/**
 * ==============================================================================
 * MOCKUP OPERATIVO INTEGRAL - TIMT "EL INSURGENTE"
 * Estilos específicos del portal administrativo y pantalla de autenticación.
 * Basado en timt-identity.css con soporte dinámico Día / Noche.
 * ==============================================================================
 */

/* Importar diseño base institucional */
@import url('../assets/css/timt-identity.css');

/* ==============================================================================
   ESCALA TIPOGRÁFICA Y DIMENSIONES HOMOLOGADAS - TIMT
   ============================================================================== */
:root {
    --mk-fs-xs: 0.75rem;   /* Badges, footers, metadatos, leyendas secundarias */
    --mk-fs-sm: 0.85rem;   /* Textos de apoyo, botones pequeños, celdas tabla */
    --mk-fs-md: 0.95rem;   /* Texto base de párrafos, labels, selects e inputs */
    --mk-fs-lg: 1.10rem;   /* Subtítulos destacados, inputs primarios */
    --mk-fs-xl: 1.25rem;   /* Títulos de tarjetas y secciones modales */
    --mk-fs-2xl: 1.60rem;  /* Indicadores numéricos KPI y montos monetarios */
    --mk-fs-3xl: 1.85rem;  /* Títulos de página y cabeceras principales */
}

/* Homologación dimensional de logotipos e imágenes */
.mk-logo-nav {
    height: 30px;
    width: auto;
    max-height: 30px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.mk-logo-emblem {
    height: 36px;
    width: 36px;
    max-height: 36px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.mk-sentiment-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
}

.mk-qr-code {
    width: 110px;
    height: 110px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.mk-avatar-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--timt-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--mk-fs-sm);
    font-weight: 700;
}

/* ==============================================================================
   1. PANTALLA DE INICIO DE SESIÓN (LOGIN)
   ============================================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: radial-gradient(circle at 10% 20%, rgba(16, 62, 77, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(139, 43, 43, 0.08) 0%, transparent 40%),
                var(--timt-bg-cream);
    color: var(--timt-text-main);
    transition: var(--timt-transition);
    position: relative;
    overflow-x: hidden;
}

[data-theme="dark"] .login-page {
    background: radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(182, 63, 53, 0.12) 0%, transparent 40%),
                #091519;
}

/* Inversión y realce de logotipos en barra superior en modo noche */
[data-theme="dark"] .login-topbar img[src*="banobras"],
[data-theme="dark"] .login-topbar img[src*="fonadin"],
body.timt-dark .login-topbar img[src*="banobras"],
body.timt-dark .login-topbar img[src*="fonadin"] {
    filter: brightness(0) invert(1) opacity(0.9);
}

.login-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
}

@media (max-width: 768px) {
    .login-topbar {
        padding: 16px 20px;
        flex-direction: column;
        gap: 14px;
        align-items: center;
        text-align: center;
    }
    .login-topbar-logos {
        justify-content: center;
        flex-wrap: wrap;
    }
}

.login-topbar-logos {
    display: flex;
    align-items: center;
    gap: 16px;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    flex: 1;
}

.login-card {
    background: var(--timt-surface);
    border: 1px solid var(--timt-border-cream);
    border-radius: 24px;
    padding: 45px 40px 35px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--timt-shadow-elevated);
    position: relative;
    overflow: hidden;
    transition: var(--timt-transition);
}

[data-theme="dark"] .login-card {
    background: #10232a;
    border-color: #1e3a45;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--timt-primary) 0%, var(--timt-wine) 100%);
}

[data-theme="dark"] .login-card::before {
    background: linear-gradient(90deg, #38bdf8 0%, #b63f35 100%);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    height: 60px;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

[data-theme="dark"] .login-logo {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.3));
}

.login-title {
    font-family: var(--timt-font-serif);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--timt-primary-accent);
    margin-bottom: 6px;
}

.login-subtitle {
    color: var(--timt-text-muted);
    font-size: 0.92rem;
}

.login-demo-accounts {
    background: var(--timt-surface-alt);
    border: 1px dashed var(--timt-border-color);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 25px;
}

.login-demo-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--timt-primary-accent);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.login-demo-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.login-demo-pill {
    background: var(--timt-surface);
    border: 1px solid var(--timt-border-color);
    color: var(--timt-text-main);
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.login-demo-pill:hover {
    background: var(--timt-primary-tint);
    border-color: var(--timt-primary-accent);
    color: var(--timt-primary-accent);
    transform: translateY(-1px);
}

.password-input-wrapper {
    position: relative;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--timt-text-subtle);
    cursor: pointer;
    font-size: 1.05rem;
    padding: 4px;
}

.login-options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0 25px;
    font-size: 0.86rem;
}

.login-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--timt-text-muted);
}

.login-forgot-link {
    color: var(--timt-primary-accent);
    text-decoration: none;
    font-weight: 600;
}

.login-forgot-link:hover {
    text-decoration: underline;
}

.login-footer-bar {
    text-align: center;
    padding: 20px;
    font-size: 0.85rem;
    color: var(--timt-text-subtle);
    border-top: 1px solid var(--timt-border-color);
}

/* ==============================================================================
   2. ESTRUCTURA DEL PORTAL OPERATIVO (LAYOUT PRINCIPAL)
   ============================================================================== */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--timt-bg-cream);
    color: var(--timt-text-main);
    transition: var(--timt-transition);
    width: 100%;
    position: relative;
}

/* Contenedor central que une menú lateral y contenido principal */
.app-body {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
    position: relative;
}

/* ==============================================================================
   3. MENÚ LATERAL (SIDEBAR)
   ============================================================================== */
.app-sidebar {
    width: 270px;
    background: var(--timt-surface);
    border-right: 1px solid var(--timt-border-cream);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    z-index: 900;
    flex-shrink: 0;
}

[data-theme="dark"] .app-sidebar {
    background: #0d1e24;
    border-right-color: #1a3945;
}

.app-sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 22px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--timt-border-color);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand img {
    height: 38px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-family: var(--timt-font-sans);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--timt-primary-accent);
    line-height: 1.2;
}

.sidebar-brand-text small {
    display: block;
    font-size: 0.72rem;
    color: var(--timt-text-muted);
    font-weight: 500;
}

.app-sidebar.collapsed .sidebar-brand-text,
.app-sidebar.collapsed .sidebar-section-title,
.app-sidebar.collapsed .nav-item-text,
.app-sidebar.collapsed .sidebar-badge,
.app-sidebar.collapsed .sidebar-user-info {
    display: none !important;
}

.app-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 8px;
}

.app-sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

.app-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 12px 6px;
}

.app-sidebar.collapsed .sidebar-link-content {
    justify-content: center;
    gap: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--timt-text-subtle);
    padding: 14px 12px 6px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--timt-text-main);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.sidebar-link-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: var(--timt-primary-tint);
    color: var(--timt-primary-accent);
    transform: translateX(3px);
}

.app-sidebar.collapsed .sidebar-link:hover {
    transform: none;
}

.sidebar-link.active {
    background: var(--timt-primary);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 62, 77, 0.25);
}

[data-theme="dark"] .sidebar-link.active {
    background: #1a627a;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(34, 211, 238, 0.25);
}

.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid var(--timt-border-color);
    background: var(--timt-surface-alt);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

[data-theme="dark"] .sidebar-footer {
    background: #091519;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #103e4d;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    border: 2px solid var(--timt-border-color);
}

.sidebar-user-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--timt-text-main);
    line-height: 1.2;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--timt-text-muted);
}

.sidebar-logout-btn {
    background: transparent;
    border: none;
    color: var(--timt-danger);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.sidebar-logout-btn:hover {
    background: var(--timt-danger-light);
    transform: scale(1.1);
}

/* ==============================================================================
   4. HEADER SUPERIOR (TOP NAVBAR)
   ============================================================================== */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

.app-header {
    background: var(--timt-surface);
    border-bottom: 1px solid var(--timt-border-cream);
    padding: 0 28px;
    height: 64px;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
    transition: var(--timt-transition);
}

[data-theme="dark"] .app-header {
    background: rgba(16, 35, 42, 0.95);
    border-bottom-color: #1e3a45;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.sidebar-toggle-btn {
    background: var(--timt-surface-alt);
    border: 1px solid var(--timt-border-color);
    color: var(--timt-text-main);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: var(--timt-primary-tint);
    color: var(--timt-primary-accent);
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    padding: 8px 14px 8px 36px;
    border-radius: 20px;
    font-size: 0.88rem;
    border: 1.5px solid var(--timt-border-color);
    background: var(--timt-surface-alt);
    color: var(--timt-text-main);
    outline: none;
    transition: var(--timt-transition);
}

.header-search input:focus {
    border-color: var(--timt-primary-accent);
    background: var(--timt-surface);
    box-shadow: 0 0 0 4px var(--timt-primary-tint);
}

.header-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: var(--timt-text-subtle);
    pointer-events: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Indicador de Estado del Sistema CCO */
.cco-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--timt-success-light);
    border: 1px solid var(--timt-success-border);
    color: var(--timt-success-text);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--timt-success);
    animation: timtPulse 1.8s infinite;
}

/* Campana de Notificaciones */
.header-notif-btn {
    position: relative;
    background: var(--timt-surface-alt);
    border: 1px solid var(--timt-border-color);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    color: var(--timt-text-main);
    transition: all 0.2s;
}

.header-notif-btn:hover {
    background: var(--timt-primary-tint);
    color: var(--timt-primary-accent);
}

.notif-badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--timt-danger);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--timt-surface);
}

/* Dropdown de notificaciones */
.notif-dropdown {
    position: absolute;
    top: 60px;
    right: 80px;
    width: 320px;
    background: var(--timt-surface);
    border: 1px solid var(--timt-border-color);
    border-radius: 16px;
    box-shadow: var(--timt-shadow-elevated);
    z-index: 120;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: timtFadeIn 0.2s ease;
}

.notif-dropdown.show {
    display: flex;
}

.notif-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--timt-border-color);
    font-weight: 700;
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--timt-surface-alt);
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--timt-border-color);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.2s;
}

.notif-item:hover {
    background: var(--timt-primary-tint);
}

.notif-item-title {
    font-weight: 700;
    color: var(--timt-primary-accent);
    margin-bottom: 3px;
}

.notif-item-time {
    font-size: 0.72rem;
    color: var(--timt-text-subtle);
}

/* ==============================================================================
   4.1 PERFIL DE USUARIO Y MENÚ DE PREFERENCIAS (HEADER)
   ============================================================================== */
.header-user-wrapper {
    position: relative;
}

.header-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 6px;
    background: var(--timt-surface-alt);
    border: 1px solid var(--timt-border-color);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.header-user-pill:hover {
    border-color: var(--timt-primary-accent);
    background: var(--timt-primary-tint);
}

.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--timt-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    border: 1.5px solid var(--timt-border-color);
}

[data-theme="dark"] .header-avatar {
    background: #1a627a;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.15;
}

.header-user-name {
    font-weight: 700;
    font-size: 0.84rem;
    color: var(--timt-text-main);
    white-space: nowrap;
}

.header-user-role {
    font-size: 0.7rem;
    color: var(--timt-text-muted);
    white-space: nowrap;
}

.header-user-chevron {
    font-size: 0.72rem;
    color: var(--timt-text-subtle);
    margin-left: 2px;
    transition: transform 0.2s;
}

.header-user-wrapper.active .header-user-chevron {
    transform: rotate(180deg);
}

/* Dropdown del Menú de Usuario */
.user-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 290px;
    background: var(--timt-surface);
    border: 1px solid var(--timt-border-color);
    border-radius: 18px;
    box-shadow: var(--timt-shadow-elevated);
    z-index: 125;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: timtFadeIn 0.2s ease;
}

.user-dropdown.show {
    display: flex;
}

.user-dropdown-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--timt-surface-alt);
    border-bottom: 1px solid var(--timt-border-color);
}

.user-dropdown-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--timt-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.05rem;
    flex-shrink: 0;
    border: 2px solid var(--timt-border-color);
}

.user-dropdown-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--timt-text-main);
    line-height: 1.2;
}

.user-dropdown-email {
    font-size: 0.75rem;
    color: var(--timt-text-muted);
    word-break: break-all;
}

.user-dropdown-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--timt-border-color);
}

.user-dropdown-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--timt-text-subtle);
    margin-bottom: 10px;
}

.user-dropdown-menu {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.84rem;
    color: var(--timt-text-main);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.user-dropdown-item:hover {
    background: var(--timt-primary-tint);
    color: var(--timt-primary-accent);
}

.user-dropdown-footer {
    padding: 12px 14px;
    background: var(--timt-surface-alt);
    border-top: 1px solid var(--timt-border-color);
}

.sidebar-system-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 4px;
    overflow: hidden;
}

/* ==============================================================================
   5. CONTENEDOR DE CONTENIDO (MAIN CONTENT PANES)
   ============================================================================== */
.app-content {
    flex: 1;
    padding: 28px 32px 50px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.tab-view-pane {
    display: none;
    animation: timtFadeIn 0.25s ease forwards;
}

.tab-view-pane.active {
    display: block;
}

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-title {
    font-family: var(--timt-font-serif);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--timt-primary-accent);
    line-height: 1.2;
}

.page-desc {
    color: var(--timt-text-muted);
    font-size: 0.92rem;
    margin-top: 4px;
}

/* ==============================================================================
   6. STAT CARDS / KPIS DEL DASHBOARD
   ============================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--timt-surface);
    border: 1px solid var(--timt-border-color);
    border-radius: 16px;
    padding: 22px 24px;
    box-shadow: var(--timt-shadow-sm);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--timt-transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--timt-shadow-md);
    border-color: var(--timt-primary-accent);
}

.kpi-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.kpi-petroleo {
    background: rgba(16, 62, 77, 0.12);
    color: var(--timt-primary);
}

[data-theme="dark"] .kpi-petroleo {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
}

.kpi-vino {
    background: rgba(139, 43, 43, 0.12);
    color: var(--timt-wine);
}

[data-theme="dark"] .kpi-vino {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.kpi-verde {
    background: var(--timt-success-light);
    color: var(--timt-success);
}

.kpi-ambar {
    background: var(--timt-warning-light);
    color: var(--timt-warning);
}

.kpi-info {
    flex: 1;
}

.kpi-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--timt-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--timt-text-main);
    line-height: 1.1;
    font-family: var(--timt-font-sans);
}

.kpi-trend {
    font-size: 0.76rem;
    font-weight: 700;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend.positive { color: var(--timt-success); }
.kpi-trend.neutral { color: var(--timt-warning); }
.kpi-trend.negative { color: var(--timt-danger); }

/* ==============================================================================
   7. MAPA ESQUEMÁTICO DE LA LÍNEA DEL TREN INTERURBANO
   ============================================================================== */
.line-map-card {
    background: var(--timt-surface);
    border: 1px solid var(--timt-border-color);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--timt-shadow-sm);
}

.line-track {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    margin: 40px 20px 25px;
}

.line-track::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #103e4d 0%, #8b2b2b 50%, #103e4d 100%);
    border-radius: 3px;
    z-index: 1;
    transform: translateY(-50%);
}

[data-theme="dark"] .line-track::before {
    background: linear-gradient(90deg, #38bdf8 0%, #f87171 50%, #38bdf8 100%);
}

.station-node {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.station-node:hover {
    transform: translateY(-3px);
}

.station-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--timt-surface);
    border: 4px solid var(--timt-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
}

[data-theme="dark"] .station-dot {
    background: #091519;
    border-color: #38bdf8;
}

.station-node.active .station-dot {
    background: var(--timt-wine);
    border-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(182, 63, 53, 0.35);
}

.station-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--timt-text-main);
    margin-top: 8px;
    text-align: center;
    white-space: nowrap;
}

.station-convoy-badge {
    position: absolute;
    top: -28px;
    background: #103e4d;
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    animation: timtPulse 2s infinite;
}

[data-theme="dark"] .station-convoy-badge {
    background: #38bdf8;
    color: #091519;
}

/* ==============================================================================
   8. TABLAS DE DATOS OFICIALES (DATA TABLE)
   ============================================================================== */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--timt-border-color);
}

.timt-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
    background: var(--timt-surface);
}

.timt-data-table th {
    background: var(--timt-surface-alt);
    color: var(--timt-primary-accent);
    font-weight: 700;
    padding: 14px 18px;
    border-bottom: 2px solid var(--timt-border-color);
    white-space: nowrap;
}

.timt-data-table td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--timt-border-color);
    color: var(--timt-text-main);
    vertical-align: middle;
}

.timt-data-table tr:hover td {
    background: var(--timt-primary-tint);
}

.timt-data-table tr:last-child td {
    border-bottom: none;
}

/* ==============================================================================
   8B. CREDENCIALES Y GAFETES OFICIALES (DARK THEME SUPPORT)
   ============================================================================== */
[data-theme="dark"] .timt-id-badge {
    background: #10232a;
    border-color: #1e3a45;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .timt-badge-header {
    background: #ffffff !important;
    border-bottom-color: #1e3a45;
}

[data-theme="dark"] .timt-badge-avatar {
    background: #ffffff !important;
    border-color: #38bdf8;
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.25);
}

[data-theme="dark"] .timt-badge-qr-box {
    background: #ffffff !important;
    border-color: #cbd5e1;
}

[data-theme="dark"] .timt-badge-meta-grid {
    background: #091519;
    border-color: #1e3a45;
}

[data-theme="dark"] .timt-badge-meta-val {
    color: #edf6f9;
}

[data-theme="dark"] .timt-badge-name {
    color: #38bdf8;
}

[data-theme="dark"] .timt-badge-role {
    color: #f87171;
}

[data-theme="dark"] .timt-badge-qr {
    background: #091519;
    border-top-color: #1e3a45;
}

[data-theme="dark"] .timt-badge-qr-title {
    color: #38bdf8;
}

[data-theme="dark"] .timt-badge-top-slot {
    background: #0b1a20;
    border-bottom-color: #1e3a45;
}

[data-theme="dark"] .timt-badge-lanyard-hole {
    background: #061014;
    border-color: #1e3a45;
}

/* ==============================================================================
   9. FOOTER INSTITUCIONAL DEL PORTAL
   ============================================================================== */
.app-footer {
    background: #0d3b43;
    color: #e0e0e0;
    padding: 22px 32px;
    border-top: 3px solid #b63f35;
    margin-top: auto;
    width: 100%;
    box-sizing: border-box;
    z-index: 800;
    position: relative;
}

[data-theme="dark"] .app-footer {
    background: #07171d;
    border-top-color: #38bdf8;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.85rem;
}

/* Contenedor de logotipos inferiores en color original con fondo de contraste */
.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    background: #ffffff !important;
    padding: 7px 18px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.footer-brand img {
    height: 30px;
    width: auto;
    object-fit: contain;
    filter: none !important;
    opacity: 1 !important;
    display: inline-block;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.footer-brand img:hover {
    transform: scale(1.05);
}

.footer-links {
    display: flex;
    gap: 18px;
}

.footer-links a {
    color: #9bb7c2;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* ==============================================================================
   10. MODAL FLOTANTE DE CÓDIGO FUENTE (DOCUMENTACIÓN PARA PARTICIPANTES)
   ============================================================================== */
.code-modal-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 150;
    background: var(--timt-wine);
    color: #ffffff;
    border: none;
    border-radius: 30px;
    padding: 11px 20px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(182, 63, 53, 0.45);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.code-modal-trigger:hover {
    transform: translateY(-2px) scale(1.03);
    background: var(--timt-red-accent);
}

.code-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.code-modal-overlay.show {
    display: flex;
    animation: timtFadeIn 0.2s ease;
}

.code-modal-window {
    background: var(--timt-surface);
    border: 1px solid var(--timt-border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--timt-shadow-elevated);
    overflow: hidden;
}

.code-modal-header {
    padding: 16px 24px;
    background: var(--timt-surface-alt);
    border-bottom: 1px solid var(--timt-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.code-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Responsividad en móviles */
@media (max-width: 960px) {
    .app-sidebar {
        position: fixed;
        top: 64px;
        height: calc(100vh - 64px);
        left: -270px;
        box-shadow: var(--timt-shadow-elevated);
        z-index: 999;
    }

    .app-sidebar.mobile-open {
        left: 0;
    }

    .header-search {
        display: none;
    }

    .header-brand-title {
        display: none !important;
    }

    .app-content {
        padding: 20px 16px;
    }

    .line-track {
        overflow-x: auto;
        padding-bottom: 20px;
    }
}

/* ==============================================================================
   11. COMPONENTES REFINADOS: TICKER CCO, GRÁFICAS Y TELEMETRÍA AVANZADA
   ============================================================================== */

/* Ticker Operativo en Vivo debajo del Header */
.cco-ticker-strip {
    background: #091519;
    border-bottom: 1px solid #1a3945;
    color: #9bb7c2;
    padding: 7px 28px;
    font-size: 0.78rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
    gap: 20px;
    font-family: var(--timt-font-sans);
}

.cco-ticker-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cco-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cco-ticker-clock {
    font-family: monospace;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

/* Contenedor de Gráfica de Afluencia por Hora */
.chart-container-card {
    background: var(--timt-surface);
    border: 1px solid var(--timt-border-color);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--timt-shadow-sm);
    transition: var(--timt-transition);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-title-group h3 {
    font-size: 1.15rem;
    color: var(--timt-primary-accent);
    margin-bottom: 3px;
}

.chart-title-group p {
    font-size: 0.82rem;
    color: var(--timt-text-muted);
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--timt-text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.legend-zin { background-color: var(--timt-primary); }
[data-theme="dark"] .legend-zin { background-color: #38bdf8; }
.legend-obs { background-color: var(--timt-wine); }
[data-theme="dark"] .legend-obs { background-color: #f87171; }

/* Barras visuales interactivas */
.hourly-bars-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 180px;
    padding-top: 25px;
    border-bottom: 1px solid var(--timt-border-color);
}

.hourly-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
    cursor: pointer;
}

.hourly-bar {
    width: 100%;
    max-width: 38px;
    background: linear-gradient(180deg, var(--timt-primary) 0%, rgba(16, 62, 77, 0.6) 100%);
    border-radius: 6px 6px 0 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

[data-theme="dark"] .hourly-bar {
    background: linear-gradient(180deg, #38bdf8 0%, rgba(56, 189, 248, 0.3) 100%);
}

.hourly-bar.peak {
    background: linear-gradient(180deg, var(--timt-wine) 0%, rgba(139, 43, 43, 0.6) 100%);
}

[data-theme="dark"] .hourly-bar.peak {
    background: linear-gradient(180deg, #f87171 0%, rgba(248, 113, 113, 0.3) 100%);
}

.hourly-bar-col:hover .hourly-bar {
    transform: scaleY(1.05);
    filter: brightness(1.2);
}

.hourly-tooltip {
    position: absolute;
    top: -24px;
    background: #0f172a;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

.hourly-bar-col:hover .hourly-tooltip {
    opacity: 1;
}

.hourly-label {
    font-size: 0.72rem;
    color: var(--timt-text-subtle);
    margin-top: 8px;
    font-weight: 600;
}

/* Modal de Atajos de Teclado */
.shortcuts-badge {
    background: var(--timt-surface-alt);
    border: 1px solid var(--timt-border-color);
    padding: 4px 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.78rem;
    color: var(--timt-text-muted);
}

/* Badge de Convoy en Mapa Esquemático Interactivo */
.station-convoy-badge {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
    user-select: none;
}

.station-convoy-badge:hover {
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 4px 12px rgba(139, 43, 43, 0.35);
}

[data-theme="dark"] .station-convoy-badge:hover {
    box-shadow: 0 4px 12px rgba(248, 113, 113, 0.45);
}

/* Tarjeta de Métricas de Telemetría Ferroviaria */
.telemetry-card {
    background: var(--timt-surface);
    border: 1px solid var(--timt-border-color);
    border-radius: 14px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: var(--timt-transition);
}

.telemetry-card:hover {
    border-color: var(--timt-primary-accent);
    transform: translateY(-2px);
    box-shadow: var(--timt-shadow-sm);
}

/* Tabla de Atajos de Teclado */
.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 10px;
}

.shortcuts-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--timt-border-color);
}

.shortcuts-table tr:last-child td {
    border-bottom: none;
}

.kbd-key {
    display: inline-block;
    padding: 3px 8px;
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--timt-primary-accent);
    background: var(--timt-surface-alt);
    border: 1.5px solid var(--timt-border-color);
    border-radius: 6px;
    box-shadow: 0 2px 0 var(--timt-border-color);
}

/* Desglose de Sentimiento IA */
.sentiment-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 15px 0;
}

.sentiment-metric-box {
    background: var(--timt-surface-alt);
    border: 1px solid var(--timt-border-color);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.sentiment-metric-num {
    font-size: 1.35rem;
    font-weight: 800;
    margin-top: 4px;
}

.ticket-print-tear {
    border-top: 2px dashed var(--timt-border-color);
    margin: 15px 0;
    position: relative;
}

.ticket-print-tear::before,
.ticket-print-tear::after {
    content: '';
    position: absolute;
    top: -9px;
    width: 16px;
    height: 16px;
    background: var(--timt-surface);
    border-radius: 50%;
}
.ticket-print-tear::before { left: -22px; }
.ticket-print-tear::after { right: -22px; }


