/* ============================================================
   assets/style.css — Sistema RAI CTNAV
   Línea gráfica: basada en modelo diseño (NOTAM PERÚ)
   Fuente: Inter (Google Fonts) | Dark mode premium
   ============================================================ */

/* ── 1. VARIABLES (idénticas al modelo diseño) ─────────────── */
:root {
    --bg-principal:  #0f1115;
    --card-bg:       #1a1d23;
    --header-bg:     #21262e;
    --accent-tech:   #e2e8f0;
    --text-bright:   #f8fafc;
    --text-muted:    #94a3b8;
    --border-dark:   #334155;
    --critical:      #ff3e3e;
    --warning:       #38bdf8;
    --info:          #3b82f6;
    --success:       #10b981;
    --linea:         rgba(226, 232, 240, 0.1);
    --header-height: 64px;
    --toolbar-height: 62px;
    --transition:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 2. RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-principal);
    color: var(--text-bright);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ── 3. SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── 4. HEADER (Fiel al modelo diseño) ──────────────────────── */
#main-header {
    background: var(--header-bg);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-dark);
    z-index: 1000;
}

#main-header h1 {
    font-size: 1.2rem;
    letter-spacing: 2px;
    font-weight: 800;
    color: var(--accent-tech);
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

#main-header h1 .brand-country {
    color: var(--text-muted);
    font-weight: 300;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.status-badge {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
}

#sync-time-header {
    color: var(--accent-tech);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px #10b981;
}

/* Ondas de Latido (Radar) */
.status-dot::before,
.status-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background-color: #10b981;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.5;
    animation: radar-pulse 2s infinite;
}

.status-dot::after {
    animation-delay: 1s;
}

@keyframes radar-pulse {
    0% {
        width: 8px;
        height: 8px;
        opacity: 0.8;
    }

    100% {
        width: 35px;
        height: 35px;
        opacity: 0;
    }
}

/* ── HERRAMIENTAS DERECHA DEL HEADER ── */
.header-right-tools {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* ── IDENTIFICACIÓN Y MENÚ DESPLEGABLE DE PERFIL DE USUARIO ── */
.user-profile-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.user-header-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    cursor: pointer;
    user-select: none;
    outline: none !important;
}

.user-profile-wrapper .user-header-chip:hover,
.user-profile-wrapper.open .user-header-chip {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.user-chip-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #031525;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
    border: none;
    text-transform: uppercase;
}

.user-chip-email {
    font-size: 0.74rem;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0.2px;
    white-space: nowrap;
    text-transform: lowercase;
    transition: color 0.2s ease;
}

/* Modo Discreto cuando VER PERFIL USUARIO está apagado (0) */
.user-chip-avatar.user-chip-avatar-dot {
    width: 9px !important;
    height: 9px !important;
    min-width: 9px !important;
    min-height: 9px !important;
    background: #38bdf8 !important;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.7) !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 2px 0 0 !important;
}

.user-header-chip.user-chip-anonymous .user-chip-email {
    text-transform: none !important;
    color: #94a3b8 !important;
    font-weight: 500 !important;
}

.user-header-chip.user-chip-anonymous:hover .user-chip-email,
.user-profile-wrapper.open .user-header-chip.user-chip-anonymous .user-chip-email {
    color: #f1f5f9 !important;
}

.user-profile-wrapper:hover .user-chip-email,
.user-profile-wrapper.open .user-chip-email {
    color: #f1f5f9;
}

.user-chip-chevron {
    color: #64748b;
    margin-left: 2px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.user-profile-wrapper.open .user-chip-chevron {
    color: #38bdf8;
    transform: rotate(180deg);
}

/* Menú Desplegable Flotante (Con la forma y línea gráfica del Menú Waffle) */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 270px;
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 20px rgba(0, 0, 0, 0.35);
    padding: 16px 14px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    box-sizing: border-box;
}

.user-profile-wrapper.open .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    animation: slideInWaffle 0.25s ease;
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px;
}

.user-dropdown-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #031525;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
    text-transform: uppercase;
    letter-spacing: 0;
}

.user-dropdown-meta {
    overflow: hidden;
    flex: 1;
}

.user-dropdown-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.user-dropdown-email {
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin-bottom: 4px;
}

.user-dropdown-badge {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.user-dropdown-badge.badge-user {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.user-dropdown-menu .waffle-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 14px 4px 12px 4px;
}

/* Opciones inferiores estilo Menú Waffle en formato vertical */
.user-waffle-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.user-waffle-grid .waffle-item {
    background: transparent;
    border: none;
    font-family: inherit;
    color: inherit;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    text-decoration: none;
}

.user-waffle-grid .waffle-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-waffle-grid .waffle-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.user-waffle-grid .waffle-item:hover .waffle-icon {
    transform: scale(1.12);
    background: transparent !important;
}

.user-waffle-icon-perfil svg {
    color: #38bdf8;
}

.user-waffle-icon-logout svg {
    color: #ef4444;
    stroke: #ef4444;
    transition: transform 0.2s, stroke 0.2s, color 0.2s;
}

.user-waffle-grid .waffle-item:hover .user-waffle-icon-logout svg {
    color: #f87171;
    stroke: #f87171;
}

.user-waffle-grid .waffle-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
    line-height: 1;
    transition: color 0.2s;
}

.user-waffle-grid .waffle-item:hover .waffle-label {
    color: var(--text-bright);
}

/* ── MODAL MI PERFIL (Línea gráfica RAI | ALERTAS TELEGRAM) ── */
.user-profile-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.user-profile-modal-overlay.active {
    display: flex !important;
}

.user-profile-popup-box {
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    width: 660px;
    max-width: 95vw;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.85);
    overflow: hidden;
    animation: popInAlerts 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.user-profile-popup-body {
    padding: 22px 26px;
    background: var(--bg-principal);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Tarjeta de Identidad Superior */
.user-profile-id-card {
    display: flex;
    align-items: center;
    gap: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px 20px;
}

.user-profile-modal-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #031525;
    font-size: 1.45rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
    text-transform: uppercase;
    letter-spacing: 0;
}

.user-profile-id-info {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-profile-modal-name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.user-profile-modal-email {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sección de Detalles - Grid de 2 Columnas */
.user-profile-section-title {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #64748b;
    text-transform: uppercase;
    margin-top: 2px;
}

.user-profile-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.user-profile-card-item {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}

.user-profile-card-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #94a3b8;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.user-profile-card-label svg {
    color: #38bdf8;
    flex-shrink: 0;
}

.user-profile-card-val {
    font-size: 0.88rem;
    font-weight: 600;
    color: #f1f5f9;
}

.status-val-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #10b981;
}

.profile-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

@media (max-width: 600px) {
    .user-profile-data-grid,
    .profile-form-grid-2 {
        grid-template-columns: 1fr !important;
    }
}

/* Pie Técnico (ap-footer) */
.user-profile-popup-footer {
    padding: 11px 18px;
    border-top: 1px solid var(--border-dark);
    background: var(--header-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.ap-footer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid #334155;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-family: inherit;
    line-height: 1;
}

.ap-footer-btn:hover {
    border-color: #64748b;
    color: #f8fafc;
    background: rgba(148, 163, 184, 0.12);
}

.ap-footer-btn.close:hover {
    border-color: #94a3b8;
    color: #f8fafc;
    background: rgba(148, 163, 184, 0.15);
}

.ap-footer-btn.log:hover {
    border-color: #38bdf8;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.ap-footer-btn.edit:hover {
    border-color: #38bdf8;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.ap-footer-btn.key:hover {
    border-color: #eab308;
    color: #facc15;
    background: rgba(234, 179, 8, 0.1);
}

.ap-footer-btn.save {
    background: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
}

.ap-footer-btn.save:hover {
    background: #38bdf8;
    border-color: #38bdf8;
    color: #082f49;
}

/* Formularios de edición en Modal Perfil */
.profile-form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.profile-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    text-align: left;
}

.profile-form-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.profile-form-input {
    background: #0b0f19 !important;
    border: 1px solid var(--border-dark) !important;
    border-radius: 8px !important;
    color: #f8fafc !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    outline: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    font-family: inherit !important;
}

.profile-form-input:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2) !important;
}

.profile-form-hint {
    font-size: 0.72rem;
    color: #64748b;
    margin: 6px 0 0 0;
    line-height: 1.4;
    text-align: left;
}

/* ── BOTÓN CELESTE GRÁFICOS ANALÍTICOS (Solo usuarios regulares, nunca admin) ── */
.btn-header-graficos {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 20px;
    padding: 5px 13px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #38bdf8;
    text-decoration: none;
    cursor: pointer;
    letter-spacing: 0.4px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.btn-header-graficos:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
    transform: translateY(-1px);
}

.btn-header-graficos:active {
    transform: translateY(0);
}

.btn-header-graficos svg {
    color: #38bdf8;
    transition: transform 0.2s;
}

.btn-header-graficos:hover svg {
    color: #ffffff;
    transform: scale(1.1);
}

/* Ocultar terminantemente para el Administrador */
html.admin-logged .btn-header-graficos,
body.admin-logged .btn-header-graficos,
.admin-logged .btn-header-graficos {
    display: none !important;
}

/* Ocultar menú de perfil desplegable para el Administrador (ya tiene menú Waffle) */
html.admin-logged .user-chip-chevron,
body.admin-logged .user-chip-chevron,
.admin-logged .user-chip-chevron,
html.admin-logged .user-dropdown-menu,
body.admin-logged .user-dropdown-menu,
.admin-logged .user-dropdown-menu {
    display: none !important;
}

html.admin-logged .user-profile-wrapper .user-header-chip,
body.admin-logged .user-profile-wrapper .user-header-chip,
.admin-logged .user-profile-wrapper .user-header-chip {
    cursor: default !important;
    background: transparent !important;
    border-color: transparent !important;
}

/* ── WIDGET AUTO-REFRESCO EN VIVO ── */
.auto-refresh-widget {
    position: relative;
    display: none; /* Oculto por defecto: visible únicamente para administrador */
    align-items: center;
}

html.admin-logged .auto-refresh-widget,
body.admin-logged .auto-refresh-widget {
    display: inline-flex;
}

.auto-refresh-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 4px 11px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #cbd5e1;
    cursor: pointer;
    letter-spacing: 0.6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.auto-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(56, 189, 248, 0.45);
    color: #f8fafc;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.auto-refresh-btn.open {
    background: rgba(56, 189, 248, 0.12);
    border-color: #38bdf8;
    color: #38bdf8;
}

.auto-refresh-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.auto-refresh-dot.live {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: autoRefreshGlow 2s infinite ease-in-out;
}

.auto-refresh-dot.paused {
    background-color: #f59e0b;
    box-shadow: 0 0 7px rgba(245, 158, 11, 0.6);
    animation: none;
}

@keyframes autoRefreshGlow {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 8px #10b981;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.75;
        box-shadow: 0 0 14px rgba(16, 185, 129, 0.85);
    }
}

.auto-refresh-label {
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

.auto-refresh-arrow {
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.auto-refresh-btn.open .auto-refresh-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* Dropdown */
.auto-refresh-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75);
    padding: 6px;
    z-index: 10050;
    display: none;
    flex-direction: column;
    gap: 2px;
    backdrop-filter: blur(12px);
    animation: popInRefreshMenu 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.auto-refresh-dropdown.show {
    display: flex;
}

@keyframes popInRefreshMenu {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auto-refresh-dropdown-title {
    padding: 6px 10px 4px;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #64748b;
    text-transform: uppercase;
}

.auto-refresh-opt {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 11px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.74rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
}

.auto-refresh-opt:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
}

.auto-refresh-opt.active {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    font-weight: 700;
}

.auto-refresh-opt .opt-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #475569;
    flex-shrink: 0;
}

.auto-refresh-opt.active .opt-indicator {
    background: #38bdf8;
    border-color: #38bdf8;
    box-shadow: 0 0 6px #38bdf8;
}

.auto-refresh-opt.opt-pause.active {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.auto-refresh-opt.opt-pause.active .opt-indicator {
    background: #f59e0b;
    border-color: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
}

.auto-refresh-opt small.opt-rec {
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 500;
    margin-left: 2px;
}

.auto-refresh-opt.active small.opt-rec {
    color: #38bdf8;
    opacity: 0.8;
}

.auto-refresh-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 6px;
}

/* Destello en la nueva fila que ingresa en vivo */
@keyframes rowPulseHighlight {
    0% {
        background-color: rgba(56, 189, 248, 0.38) !important;
        box-shadow: inset 0 0 12px rgba(56, 189, 248, 0.4);
    }
    50% {
        background-color: rgba(56, 189, 248, 0.18) !important;
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

.row-new-highlight td {
    animation: rowPulseHighlight 3.5s ease-out forwards;
}

/* Buscador Universal en Toolbar */
.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buscador Universal (Exacto a modelo diseño) */
.search-main-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    padding: 2px 15px;
    width: 300px;
    transition: all 0.3s ease;
    position: relative;
}

.search-main-container:focus-within {
    border-color: #3b82f6;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-main-input {
    background: transparent;
    border: none;
    color: var(--text-bright);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 10px 8px 0;
    width: 100%;
    outline: none;
    text-transform: uppercase;
}

.search-main-input::placeholder {
    color: #64748b;
}

.btn-clear-search {
    background: #ef4444;
    border: 1px solid #dc2626;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.65);
    cursor: pointer;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    padding: 0;
    margin-left: 6px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.btn-clear-search:hover {
    background: #dc2626;
    border-color: #b91c1c;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.85);
    transform: scale(1.12);
}

.btn-clear-search:active {
    transform: scale(0.96);
}

.btn-clear-search.visible {
    display: flex;
}

/* === SWITCH AND/OR (Exacto a modelo diseño) === */
.search-mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-dark);
    border-radius: 20px;
    padding: 3px 4px 3px 8px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-mode-toggle:hover {
    border-color: var(--info);
    background: rgba(59, 130, 246, 0.05);
}

.search-mode-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.2s;
}

.search-mode-toggle.and-mode .search-mode-label {
    color: var(--info);
}

.toggle-pill {
    width: 30px;
    height: 16px;
    background: #334155;
    border-radius: 10px;
    position: relative;
    transition: background 0.25s ease;
}

.toggle-pill::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #64748b;
    transition: transform 0.25s ease, background 0.25s ease;
}

.search-mode-toggle.and-mode .toggle-pill {
    background: rgba(59, 130, 246, 0.25);
}

.search-mode-toggle.and-mode .toggle-pill::after {
    transform: translateX(14px);
    background: var(--info);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
}

/* ── 5. MAIN LAYOUT ─────────────────────────────────────────── */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 20px 14px;
    min-height: 0;
}

/* Botón Actualizar Tabla */
.btn-refresh-table {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: #7dd3fc;
    padding: 5px 13px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    outline: none;
}

.btn-refresh-table:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
    transform: translateY(-1px);
}

.btn-refresh-table:active {
    transform: translateY(0);
}

.btn-refresh-table svg {
    transition: transform 0.4s ease;
    color: #38bdf8;
}

.btn-refresh-table.spinning svg {
    animation: spinRefresh 0.6s linear infinite;
}

@keyframes spinRefresh {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Selectores de Límite (Exacto a modelo diseño) */
.limit-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dark);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
}

.limit-selector select {
    background: transparent;
    border: none;
    color: var(--info);
    font-weight: 800;
    outline: none;
    cursor: pointer;
    font-size: 0.75rem;
}

.limit-selector select option {
    background: var(--card-bg);
    color: white;
}

/* Badge Contador RAI (Exacto a #notam-count de modelo diseño) */
#rai-counter {
    background-color: #042f4d;
    /* Azul profundo */
    color: #7dd3fc;
    /* Texto cian brillante */
    font-weight: 800;
    font-size: 0.7rem;
    padding: 8px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 1.5px;
    border: 2px solid #075985;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(125, 211, 252, 0.6);
}

.notam-count-icon {
    font-size: 0.9rem;
    color: #ffffff;
    flex-shrink: 0;
    transform: rotate(45deg);
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.7));
    transition: transform 0.3s ease;
}

#rai-count-value {
    color: #7dd3fc;
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    font-variant-numeric: tabular-nums;
}

/* ── 7. WAFFLE MENU (Exclusivo Administrador) ─────────────────── */
.waffle-container {
    position: relative;
    display: none; /* Oculto para usuario regular */
}

.admin-logged .waffle-container {
    display: block !important; /* Visible solo para Administrador */
}

.waffle-btn {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    grid-template-columns: repeat(3, 4px);
    gap: 3px;
    transition: background 0.2s;
    align-items: center;
    justify-items: center;
}

.waffle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.waffle-dot {
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: background 0.2s;
}

.waffle-btn:hover .waffle-dot {
    background: var(--text-bright);
}

.waffle-menu {
    position: absolute;
    top: 50px;
    right: 0;
    width: 58px;
    max-height: 88vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: none;
    flex-direction: column;
    padding: 8px 6px;
    z-index: 5000;
    transition: width 0.3s cubic-bezier(0.34, 1.35, 0.64, 1), padding 0.25s ease, border-radius 0.25s ease;
    box-sizing: border-box;
}

.waffle-menu.pass-expanded {
    width: 275px;
    padding: 10px 12px;
}

.waffle-menu.admin-logged {
    width: 360px;
    padding: 18px 16px;
}

.waffle-menu.show,
.waffle-menu.open {
    display: flex;
    animation: slideInWaffle 0.3s ease;
}

@keyframes slideInWaffle {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.waffle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.waffle-item {
    background: transparent;
    border: none;
    font-family: inherit;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
}

.waffle-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.waffle-icon {
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
}

.waffle-item:hover .waffle-icon {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.08);
}

.waffle-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.25;
}

.waffle-item:hover .waffle-label {
    color: var(--text-bright);
}

.waffle-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 15px 0;
    position: relative;
}

.waffle-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #475569;
    font-weight: 800;
    margin-bottom: 15px;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.waffle-section-general {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

.waffle-general-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
}

#admin-toggle-btn,
.waffle-key-btn {
    position: static;
    width: 34px;
    height: 34px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    margin: 0 auto;
    padding: 0;
}

.waffle-menu.pass-expanded #admin-toggle-btn,
.waffle-menu.pass-expanded .waffle-key-btn {
    margin: 0;
}

#admin-toggle-btn:hover,
.waffle-key-btn:hover {
    color: var(--text-bright) !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: scale(1.15);
}

#admin-toggle-btn.active,
.waffle-key-btn.active {
    color: #38bdf8 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#admin-toggle-btn.logged,
.waffle-key-btn.logged {
    color: #10b981 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.admin-password-box {
    display: none;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.waffle-menu.pass-expanded .admin-password-box {
    display: flex;
    opacity: 1;
    transform: translateX(0);
}

#admin-password-input {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 7px 10px;
    color: var(--text-bright);
    font-size: 0.82rem;
    flex: 1;
    min-width: 0;
    width: 100%;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#admin-password-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.btn-admin-submit-pass {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-admin-submit-pass:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Sección de Administración desplegable (Acordeón) */
.admin-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    width: 100%;
    box-sizing: border-box;
}

.admin-section.visible {
    max-height: 650px;
    opacity: 1;
    pointer-events: auto;
    margin-top: 10px;
    padding-bottom: 5px;
}

/* Ocultar opciones de admin por defecto hasta autenticarse */
#admin-grid {
    display: none;
}

.admin-logged #admin-grid {
    display: grid;
}

.admin-logged .admin-password-box {
    display: none !important;
}

/* Una vez logueado: la llave y el separador desaparecen, y Administración sube arriba */
.admin-logged .waffle-section-general {
    display: none !important;
}

.admin-logged .admin-section .waffle-separator {
    display: none !important;
}

.admin-logged .admin-section.visible {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.admin-logged .admin-section .waffle-section-title {
    margin-top: 0 !important;
    margin-bottom: 15px !important;
}

/* ── 8. TABLE CARD ──────────────────────────────────────────── */
.table-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 14px;
    overflow: hidden;
    min-height: 0;
    margin-bottom: 14px;
}

.card-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-dark);
    flex-shrink: 0;
    background: var(--header-bg);
    gap: 15px;
}

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

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

/* ── 9. TABLA DE REGISTROS ───────────────────────────────────── */
.table-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0;
    cursor: grab;
}

.table-wrapper.is-dragging {
    cursor: grabbing !important;
    user-select: none;
}

.table-wrapper.is-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

/* Ocultar el scroll horizontal nativo delgado (reemplazado por control en footer) y mantener vertical */
.table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 0px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #475569;
}


/* ── 10. TABLE ──────────────────────────────────────────────── */
table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

thead tr {
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

th {
    position: sticky;
    top: 0;
    background: var(--header-bg);
    padding: 12px 14px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: #cbd5e1;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-dark);
    white-space: nowrap;
    user-select: none;
    z-index: 100;
}

th.sortable {
    cursor: pointer;
    transition: color 0.18s ease, background-color 0.18s ease;
    user-select: none;
}

th.sortable:hover {
    color: #ffffff;
    background-color: rgba(56, 189, 248, 0.06);
}

th.sort-active {
    color: #38bdf8 !important;
    background-color: rgba(56, 189, 248, 0.1) !important;
    border-bottom-color: #38bdf8 !important;
}

.sort-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    margin-left: 6px;
    color: rgba(255, 255, 255, 0.28);
    transition: color 0.2s ease, transform 0.2s ease;
    vertical-align: middle;
    width: 13px;
}

th.sortable:hover .sort-icon {
    color: rgba(56, 189, 248, 0.75);
}

.sort-icon.active {
    color: #38bdf8 !important;
    font-weight: 900;
    font-size: 0.78rem;
}

tbody tr {
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    transition: background var(--transition);
    cursor: pointer;
}

tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
tbody tr:hover { background: rgba(59,130,246,0.07); }
tbody tr:hover td { color: var(--text-bright); }

td {
    padding: 10px 14px;
    color: var(--accent-tech);
    vertical-align: top;
    transition: color var(--transition);
}

/* Column widths for all 14 columns */
.col-fecha      { width: 165px; white-space: nowrap; }
.col-asunto     { width: 215px; }
.col-hora       { width: 140px; }
.col-ruta-dest  { width: 130px; }
.col-desc       { min-width: 320px; max-width: 460px; }
.col-info       { min-width: 200px; max-width: 320px; }
.col-remitente  { min-width: 170px; max-width: 250px; font-size: 0.72rem; word-break: break-all; }
.col-op         { width: 130px; }
.col-av         { width: 85px;  }
.col-mat        { width: 90px;  }
.col-vuelo      { width: 90px;  }
.col-ruta       { width: 110px; }
.col-personal   { min-width: 150px; max-width: 220px; }
.col-arch       { min-width: 200px; white-space: nowrap; font-size: 0.78rem; }

td.col-fecha, td.col-ruta-dest, td.col-desc, td.col-info, td.col-remitente, td.col-av, td.col-ruta, td.col-personal, td.col-arch { color: #94A3B8; }
td.col-hora, td.col-op, td.col-vuelo, td.col-mat, .badge-mat { color: #7DD3FC; }

/* Full text cells (untruncated) */
.cell-fulltext {
    white-space: normal;
    word-break: break-word;
    line-height: 1.45;
}

/* Truncated text */
.truncate {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.4;
}

/* ── 11. BADGES ─────────────────────────────────────────────── */
.badge-asunto {
    display: inline-block;
    background-color: #0c3a5c;
    border: 1px solid #1e5a8a;
    color: #7dd3fc;
    border-radius: 12px;
    padding: 4px 14px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.badge-txt {
    display: inline-block;
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.2);
    color: #6ee7b7;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    cursor: default;
}

.badge-ruta {
    display: inline-block;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #7dd3fc;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.badge-av {
    display: inline-block;
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.25);
    color: #c4b5fd;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-mat {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #7DD3FC;
    letter-spacing: 1px;
}

/* Row number */
.row-num {
    font-variant-numeric: tabular-nums;
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* ── 12. EMPTY / LOADING STATES ─────────────────────────────── */
.state-row td {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    cursor: default;
}

.state-row:hover { background: transparent !important; }

.loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(59,130,246,0.2);
    border-top-color: var(--info);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    opacity: 0.7;
}

.empty-icon svg {
    width: 48px;
    height: 48px;
    stroke: #64748b;
}
.empty-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── 13. PAGINATION ─────────────────────────────────────────── */
#pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-top: 1px solid var(--border-dark);
    flex-shrink: 0;
    background: var(--header-bg);
    gap: 15px;
}

/* ── Control de Desplazamiento Horizontal en Footer (Zona Central) ── */
.hscroll-controller {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 480px;
    margin: 0 auto;
    background: rgba(15, 17, 21, 0.65);
    border: 1px solid var(--border-dark);
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.hscroll-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-dark);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.hscroll-btn:hover:not([disabled]) {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--info);
    color: var(--text-bright);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.hscroll-btn[disabled] {
    opacity: 0.3;
    cursor: default;
}

.hscroll-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.hscroll-thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    min-width: 40px;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
    cursor: grab;
    transition: background 0.2s, box-shadow 0.2s;
}

.hscroll-thumb:hover,
.hscroll-thumb.is-active {
    cursor: grabbing;
    background: linear-gradient(90deg, #3b82f6, #7dd3fc);
    box-shadow: 0 0 12px rgba(125, 211, 252, 0.9);
}

.pagination-info {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-dark);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--info);
    color: var(--text-bright);
    background: rgba(59,130,246,0.08);
}

.page-btn.active {
    background: var(--info);
    border-color: var(--info);
    color: white;
    box-shadow: 0 0 12px rgba(59,130,246,0.4);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-btn-nav {
    padding: 0 10px;
    width: auto;
    gap: 4px;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

/* ── 14. MODAL DETALLE RAI ──────────────────────────────────── */
#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 900;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#modal-overlay.open { display: flex; }

#modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85);
    width: 100%;
    max-width: 960px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

#modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 20px;
    border-bottom: 1px solid var(--border-dark);
    background: var(--header-bg);
    flex-shrink: 0;
    gap: 12px;
}

#modal-title {
    font-size: 0.94rem;
    font-weight: 800;
    color: var(--text-bright);
    letter-spacing: 0.6px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--accent-tech);
}

#modal-title .modal-badge {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #7dd3fc;
    border-radius: 5px;
    padding: 2px 10px;
    font-size: 0.80rem;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-modal-print,
.btn-modal-copy {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    color: var(--text-muted);
    padding: 5px 12px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* Botón CERRAR destacado (Rojo con texto e icono blanco) */
.btn-modal-close {
    background: #dc2626;
    border: 1px solid #ef4444;
    border-radius: 6px;
    color: #ffffff;
    padding: 5px 12px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.btn-modal-close svg {
    stroke: #ffffff;
    transition: transform var(--transition);
}

.btn-modal-close:hover {
    background: #b91c1c;
    border-color: #f87171;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
}

.btn-modal-close:hover svg {
    transform: scale(1.1);
}

.btn-modal-close:active {
    background: #991b1b;
    transform: scale(0.97);
}

/* Botón Enviar Correo en Popup Detalle RAI: visible únicamente para administrador autenticado */
#btn-modal-email {
    display: none;
}

html.admin-logged #btn-modal-email,
body.admin-logged #btn-modal-email {
    display: inline-flex;
}

/* Botón Vista Previa TXT en Popup Detalle RAI */
.btn-modal-txt-preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    color: #38bdf8;
    padding: 5px 10px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: all var(--transition);
    cursor: pointer;
    outline: none;
    font-family: inherit;
    line-height: 1.2;
}

.btn-modal-txt-preview svg {
    stroke: #38bdf8;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.btn-modal-txt-preview:hover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.btn-modal-txt-preview:hover svg {
    transform: scale(1.08);
}


.btn-modal-print svg,
.btn-modal-copy svg {
    stroke: currentColor;
    transition: stroke var(--transition);
}

.btn-modal-print:hover {
    border-color: #38bdf8;
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.12);
}

.btn-modal-copy:hover {
    border-color: var(--success);
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.1);
}

#modal-body {
    overflow-y: auto;
    padding: 13px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Tarjetas y Secciones del Modal */
.modal-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 9px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #7dd3fc;
    text-transform: uppercase;
}

.modal-card-header.text-cyan {
    color: #38bdf8;
    font-weight: 600;
}

/* Grids del modal */
.modal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.modal-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px 12px;
}

.modal-row-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: #334155;
    margin: 2px 0;
}

@media (max-width: 768px) {
    .modal-grid-2, .modal-grid-3, .modal-grid-4 {
        grid-template-columns: 1fr;
    }
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.modal-field-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-field-label svg {
    color: #38bdf8;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.modal-field-value {
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
}

.modal-field-value.text-strong {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.88rem;
}

.modal-field-value.text-accent {
    color: #38bdf8;
    font-weight: 700;
    font-size: 0.88rem;
}

.modal-field-value.text-highlight {
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.85rem;
}

.modal-field-value.text-date {
    color: #cbd5e1;
    font-weight: 600;
    font-size: 0.83rem;
}

.modal-field-value.text-regular {
    color: #cbd5e1;
    font-weight: 400;
    font-size: 0.83rem;
}

.modal-field-value.text-mono {
    font-family: 'Courier New', monospace;
    font-size: 0.80rem;
    color: #94a3b8;
}

.modal-field-value.text-code {
    font-family: 'Courier New', monospace;
    font-size: 0.80rem;
    color: #7dd3fc;
    font-weight: 600;
}

.badge-mat-modal {
    display: inline-block;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #7dd3fc;
    padding: 1px 8px;
    border-radius: 5px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
}

.description-box {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 7px;
    padding: 9px 13px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #94a3b8;
    font-weight: 400;
    max-height: 115px;
    overflow-y: auto;
}

.description-box.info-box {
    background: rgba(0, 0, 0, 0.2);
    color: #94a3b8;
}

.modal-meta-footer {
    padding: 7px 14px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
}

.modal-meta-footer strong {
    color: #94a3b8;
    margin-right: 4px;
}

/* ── 15. TOAST ──────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 12px 18px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 240px;
    max-width: 360px;
    pointer-events: all;
    animation: slideInToast 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInToast {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.toast.toast-success { border-color: rgba(16,185,129,0.4); color: #6ee7b7; }
.toast.toast-error   { border-color: rgba(255,62,62,0.4); color: #fca5a5; }
.toast.toast-info    { border-color: rgba(59,130,246,0.4); color: #93c5fd; }
.toast.toast-warn    { border-color: rgba(56,189,248,0.4); color: #7dd3fc; }

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-msg  { flex: 1; line-height: 1.3; }

/* ── 16. RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .header-brand .brand-desc { display: none; }
    .header-search-wrap { max-width: 300px; }
    .modal-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    #main-header { padding: 0 14px; }
    #main-content { padding: 10px 10px 0; }
    .header-search-wrap { display: none; }
    .modal-grid-2, .modal-grid-4 { grid-template-columns: 1fr; }
    #modal-content { max-height: 95vh; }
}

/* ── 15. POPUP MODAL REMITENTES (Encima de pantalla principal) ── */
.popup-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.popup-modal-overlay.open {
    display: flex;
}

#alertas-modal-overlay.open {
    display: block !important;
    padding: 0 !important;
    background: transparent !important;
}

#alertas-modal-overlay #alertas-iframe {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border: none !important;
    background: transparent !important;
    display: block !important;
}

.popup-modal-window {
    background: var(--bg-principal);
    border: 1px solid var(--border-dark);
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9);
    width: 88%;
    max-width: 1180px;
    height: 82vh;
    max-height: 760px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: popupModalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.popup-modal-header {
    background: var(--header-bg);
    border-bottom: 2px solid var(--border-dark);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.popup-modal-header h1 {
    font-size: 1.1rem;
    letter-spacing: 2px;
    font-weight: 800;
    color: var(--accent-tech);
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.popup-modal-header h1 .brand-country {
    color: var(--text-muted);
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.popup-modal-close {
    background: transparent;
    border: 1px solid var(--border-dark);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.popup-modal-close:hover {
    color: var(--critical);
    border-color: var(--critical);
    background: rgba(255, 62, 62, 0.1);
}

.popup-modal-iframe {
    width: 100%;
    flex: 1;
    border: none;
    background: transparent;
}

/* ── 16. POPUP MODAL CARGAR HISTORIAL RAI (Drag & Drop) ─────── */
.importar-rai-body {
    padding: 24px 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-principal);
}

.importar-rai-desc {
    color: var(--text-muted);
    font-size: 0.83rem;
    line-height: 1.5;
    margin: 0;
}

.importar-rai-desc strong {
    color: var(--text-bright);
}

.rai-drop-zone {
    border: 2px dashed #334155;
    border-radius: 12px;
    padding: 34px 20px;
    background: rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: all 0.22s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.rai-drop-zone:hover,
.rai-drop-zone.dragover {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
    transform: scale(1.01);
}

.rai-drop-icon {
    color: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.rai-drop-zone:hover .rai-drop-icon {
    transform: translateY(-3px);
}

.rai-drop-text {
    color: #94a3b8;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
}

.rai-drop-text strong {
    color: #4ade80;
}

.rai-drop-text span {
    font-size: 0.75rem;
    font-weight: 400;
    color: #64748b;
}

.importar-formatos-info {
    font-size: 0.72rem;
    color: #64748b;
    text-align: center;
}

.importar-formatos-info strong {
    color: #94a3b8;
}

.rai-progress-container {
    background: #14171d;
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 12px 16px;
}

.rai-progress-text {
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rai-progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: #1e293b;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #334155;
}

.rai-progress-bar {
    width: 0%;
    height: 100%;
    background: #22c55e;
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
}

.rai-import-feedback {
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.8rem;
    line-height: 1.45;
}

.rai-import-feedback.success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
}

.rai-import-feedback.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
}

.importar-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.btn-cancel-importar {
    background: transparent;
    border: 1px solid var(--border-dark);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel-importar:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-bright);
    border-color: #64748b;
}

/* ── Resaltado de búsqueda (Highlight) ─────────────────────── */
mark {
    background: #fde047;
    color: #000000;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 800;
}

/* ── 17. MODAL ENVIAR CORREO ───────────────────────────────── */
.enviar-correo-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.enviar-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.enviar-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.enviar-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-bright);
    outline: none;
    transition: all 0.2s;
}

.enviar-input:focus {
    border-color: #3b82f6;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.enviar-input::placeholder {
    color: #475569;
    font-weight: 500;
}

.enviar-archivo-badge {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #38bdf8;
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 0.3px;
}

.enviar-correo-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.btn-enviar-submit {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.45);
    border-radius: 6px;
    color: #60a5fa;
    padding: 9px 20px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s;
}

.btn-enviar-submit:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
    color: #93c5fd;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.btn-enviar-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ── 25. BOTONES MODAL EXPORTACIÓN (Exacto a modelo diseño) ───── */
.export-modal-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 22px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dark);
    color: var(--text-bright);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    font-size: 0.82rem;
    font-weight: 700;
}

.export-modal-btn:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.08);
}

.export-pdf-btn {
    color: var(--text-bright);
}
.export-pdf-btn svg {
    fill: #ef4444;
}
.export-pdf-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 10px 24px rgba(239, 68, 68, 0.2);
}

.export-excel-btn {
    color: var(--text-bright);
}
.export-excel-btn svg {
    fill: #10b981;
}
.export-excel-btn:hover {
    border-color: #10b981;
    color: #10b981;
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.2);
}

.export-csv-btn {
    color: var(--text-bright);
}
.export-csv-btn svg {
    stroke: #38bdf8;
}
.export-csv-btn:hover {
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 10px 24px rgba(56, 189, 248, 0.2);
}

/* ── 26. POPUP INICIALIZAR BBDD & TOGGLE SWITCHES ───────────── */
.init-db-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
}

.init-db-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.init-db-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(239, 68, 68, 0.4);
}

.init-db-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.init-db-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-bright);
    display: flex;
    align-items: center;
    gap: 8px;
}

.init-db-name code {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    padding: 2px 7px;
    border-radius: 6px;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.init-db-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.init-db-switch-wrap {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.init-db-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.init-db-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    border-radius: 26px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.init-db-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #cbd5e1;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.init-db-checkbox:checked + .init-db-slider {
    background-color: #ef4444;
    border-color: #ef4444;
}

.init-db-checkbox:checked + .init-db-slider::before {
    transform: translateX(22px);
    background-color: #ffffff;
}

/* Estado deshabilitado cuando una tabla está vacía (0 registros) */
.init-db-item.disabled {
    opacity: 0.42;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.015);
    border-color: rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.init-db-item.disabled:hover {
    background: rgba(255, 255, 255, 0.015);
    border-color: rgba(255, 255, 255, 0.05);
}

.init-db-checkbox:disabled + .init-db-slider {
    background-color: #1e2430;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.05);
}

.init-db-checkbox:disabled + .init-db-slider::before {
    background-color: #475569;
    box-shadow: none;
}

.init-db-empty-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 7px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
    margin-left: 6px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.init-db-all-empty-notice {
    background: rgba(148, 163, 184, 0.07);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #94a3b8;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
}

/* Danger Submit Button */
.btn-danger-submit {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #ef4444;
    color: #ffffff;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-danger-submit:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-danger-submit:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── 27. MODAL CONFIRMACIÓN (Exacto a modelo diseño) ─────────── */
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.custom-modal {
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    width: 380px;
    max-width: 90%;
    padding: 30px;
    text-align: center;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.9);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-modal.show {
    transform: scale(1);
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    line-height: 1;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-bright);
}

.modal-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-modal {
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-cancel {
    background: #334155;
    color: white;
}

.btn-cancel:hover {
    background: #475569;
}

.btn-confirm-delete {
    background: #ff3e3e;
    color: white;
}

.btn-confirm-delete:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-confirm-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.confirm-tables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    margin-top: 12px;
}

.confirm-table-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.confirm-table-badge code {
    font-family: 'Consolas', monospace;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 5px;
    border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════════
   CHIPS DE FILTROS POR COLUMNA MÚLTIPLES (COMBINACIÓN PRO)
   ══════════════════════════════════════════════════════════════ */
.active-col-filters-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 100%;
}

.col-filter-chips-list {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.active-col-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid #0284c7;
    color: #e0f2fe;
    padding: 3px 8px 3px 10px;
    border-radius: 16px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    animation: fadeInChip 0.18s ease-out;
}

@keyframes fadeInChip {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.active-col-filter-chip .chip-label {
    color: #7dd3fc;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
}

.active-col-filter-chip .chip-text {
    color: #ffffff;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
}

.active-col-filter-chip .btn-clear-col-filter {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #cbd5e1;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    margin-left: 2px;
}

.active-col-filter-chip .btn-clear-col-filter svg {
    color: #cbd5e1;
}

.active-col-filter-chip .btn-clear-col-filter:hover {
    background: #ef4444;
}

.active-col-filter-chip .btn-clear-col-filter:hover svg {
    color: #ffffff;
}

.btn-clear-all-col-filters {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ef4444;
    border: 1px solid #ef4444;
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3);
}

.btn-clear-all-col-filters svg {
    color: #ffffff;
    stroke: #ffffff;
}

.btn-clear-all-col-filters:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.btn-clear-all-col-filters:active {
    transform: translateY(0);
}

/* Indicador de filtro activo en cabecera TH */
.col-filter-indicator {
    display: none;
    margin-left: 4px;
    vertical-align: middle;
    color: #38bdf8;
}

th.has-filter {
    border-bottom: 2px solid #38bdf8 !important;
    background-color: rgba(56, 189, 248, 0.08) !important;
}

th.has-filter .col-filter-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

th.has-filter .col-filter-indicator svg {
    color: #38bdf8;
    filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.6));
}

/* ══════════════════════════════════════════════════════════════
   MENÚ CONTEXTUAL PARA BÚSQUEDA POR COLUMNA
   ══════════════════════════════════════════════════════════════ */
.col-context-menu {
    position: fixed;
    z-index: 1200;
    background: linear-gradient(165deg, #1e293b 0%, #111827 100%);
    border: 1px solid rgba(56, 189, 248, 0.45);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.1) inset, 0 4px 20px rgba(14, 165, 233, 0.25);
    min-width: 220px;
    user-select: none;
    animation: contextFadeIn 0.14s ease-out;
}

@keyframes contextFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(-3px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.col-context-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    color: #f8fafc;
    font-size: 0.79rem;
    font-weight: 600;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.16s ease;
}

.col-context-item svg {
    color: #38bdf8;
    flex-shrink: 0;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.col-context-item:hover {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.22) 0%, rgba(56, 189, 248, 0.08) 100%);
    color: #ffffff;
    padding-left: 16px;
}

.col-context-item:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.6));
}

.col-context-item-delete {
    color: #fca5a5;
}

.col-context-item-delete svg {
    color: #ef4444;
}

.col-context-item-delete:hover {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.22) 0%, rgba(239, 68, 68, 0.08) 100%);
    color: #ffffff;
    padding-left: 16px;
}

.col-context-item-delete:hover svg {
    transform: scale(1.15);
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.65));
}

/* Borrar RAI en menú contextual: visible solo para administrador */
#col-context-delete-item {
    display: none;
}
html.admin-logged #col-context-delete-item,
body.admin-logged #col-context-delete-item {
    display: flex;
}

.col-context-separator {
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.14) 25%, rgba(255, 255, 255, 0.14) 75%, rgba(255, 255, 255, 0.03) 100%);
    margin: 5px 4px;
}

.col-context-item-cancel {
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 500;
}

.col-context-item-cancel svg {
    color: #94a3b8;
    transition: transform 0.15s ease;
}

.col-context-item-cancel:hover {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.18) 0%, rgba(239, 68, 68, 0.06) 100%);
    color: #fca5a5;
    padding-left: 16px;
}

.col-context-item-cancel:hover svg {
    color: #ef4444;
    transform: scale(1.1);
    filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.5));
}

/* ══════════════════════════════════════════════════════════════
   POPUP MODAL DE BÚSQUEDA POR COLUMNA
   ══════════════════════════════════════════════════════════════ */
.col-search-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1300;
    animation: fadeInModal 0.18s ease-out;
}

.col-search-modal {
    background: linear-gradient(165deg, #1e293b 0%, #111827 100%);
    border: 1px solid rgba(56, 189, 248, 0.45);
    border-radius: 12px;
    width: 440px;
    max-width: 92vw;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 8px 30px rgba(14, 165, 233, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.col-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.col-search-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.3px;
}

.col-search-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.col-search-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.col-search-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.col-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.col-search-input-wrap input {
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #ffffff;
    padding: 10px 36px 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    text-transform: uppercase;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.col-search-input-wrap input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.col-search-clear-input {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px;
}

.col-search-clear-input:hover {
    color: #ffffff;
}

.col-search-hint {
    font-size: 0.7rem;
    color: #64748b;
    line-height: 1.4;
}

.col-search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-col-search-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-col-search-cancel:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.05);
}

.btn-col-search-reset {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 7px 13px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-col-search-reset:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: #ef4444;
    color: #ffffff;
}

.btn-col-search-submit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0284c7;
    border: 1px solid #38bdf8;
    color: #ffffff;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
    transition: all 0.18s ease;
}

.btn-col-search-submit:hover {
    background: #0369a1;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
    transform: translateY(-1px);
}

.btn-col-search-submit:active {
    transform: translateY(0);
}

/* ── MODAL CAMBIAR CONTRASEÑA ADMIN (Idéntico a modelo diseño) ─ */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
}

.admin-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 15px;
    padding: 30px;
    width: 350px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.admin-modal-content h3 {
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--accent-tech);
    font-weight: 700;
}

.admin-modal-content input {
    width: 100%;
    background: #0f1115;
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 12px;
    color: white;
    margin-bottom: 20px;
    outline: none;
    box-sizing: border-box;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.admin-modal-content input:focus {
    border-color: var(--info);
}

.admin-modal-content button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
}

.btn-save-pass {
    background: var(--info);
    color: white;
    margin-bottom: 10px;
}

.btn-save-pass:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-cancel-pass {
    background: transparent;
    color: var(--text-muted);
}

.btn-cancel-pass:hover {
    color: var(--text-bright);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ══════════════════════════════════════════════════════════════
   VISOR TXT - ESTILO BLOC DE NOTAS (NOTEPAD BLANCO)
   ══════════════════════════════════════════════════════════════ */
#txt-viewer-modal .txt-notepad-window {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    color: #000000 !important;
    width: 840px !important;
    max-width: 95% !important;
    height: 86vh !important;
    max-height: 86vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

#txt-viewer-modal .txt-notepad-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 10px 18px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

#txt-viewer-modal .txt-notepad-header h1 {
    color: #1e293b !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.3px !important;
    font-weight: 700 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
}

#txt-viewer-modal .txt-notepad-header h1 svg {
    stroke: #2563eb !important;
}

#txt-viewer-modal .txt-notepad-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    padding: 5px 12px !important;
    border-radius: 6px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    transition: all 0.15s ease !important;
}

#txt-viewer-modal .txt-notepad-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

#txt-viewer-modal .txt-notepad-btn-download {
    background: #f0fdf4 !important;
    border-color: #86efac !important;
    color: #15803d !important;
}

#txt-viewer-modal .txt-notepad-btn-download:hover {
    background: #dcfce7 !important;
    border-color: #4ade80 !important;
    color: #166534 !important;
}

#txt-viewer-modal .txt-notepad-close {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: #64748b !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

#txt-viewer-modal .txt-notepad-close:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
}

#txt-viewer-modal .txt-notepad-statusbar {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 6px 18px !important;
    display: flex !important;
    justify-content: space-between !important;
    font-size: 11.5px !important;
    color: #64748b !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    flex-shrink: 0 !important;
}

#txt-viewer-modal .txt-notepad-body {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 20px 24px !important;
    background: #ffffff !important;
    border-bottom-left-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
}

#txt-viewer-modal pre#txt-viewer-content {
    margin: 0 !important;
    font-family: 'Consolas', 'Lucida Console', 'Courier New', monospace !important;
    font-size: 13.5px !important;
    line-height: 1.55 !important;
    color: #000000 !important;
    background: #ffffff !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    tab-size: 4 !important;
}

/* Scrollbar claro para visor bloc de notas */
#txt-viewer-modal .txt-notepad-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
#txt-viewer-modal .txt-notepad-body::-webkit-scrollbar-track {
    background: #f8fafc;
}
#txt-viewer-modal .txt-notepad-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}
#txt-viewer-modal .txt-notepad-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ══════════════════════════════════════════════════════════
   POPUP LOGIN DE SEGURIDAD (CLON EXACTO DE MAIN-DGAC)
   ══════════════════════════════════════════════════════════ */
.modal-rai-auth {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-rai-auth.active {
    display: flex;
    opacity: 1;
}

.modal-body-rai {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3rem 2.5rem;
    border-radius: 28px;
    width: 100%;
    max-width: 440px;
    box-sizing: border-box;
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 35px rgba(56, 189, 248, 0.08);
}

.modal-rai-auth.active .modal-body-rai {
    transform: scale(1);
}

.modal-body-rai input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 1.25rem;
    border-radius: 14px;
    color: #fff;
    margin-bottom: 1.15rem;
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.modal-body-rai input:focus {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.06);
    outline: none;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.modal-body-rai input::placeholder {
    color: #64748b;
}

.btn-modern-rai {
    width: 100%;
    padding: 1rem;
    border-radius: 14px;
    border: none;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    box-sizing: border-box;
    display: block;
}

.btn-primary-rai {
    background: #38bdf8;
    color: #0f172a;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
}

.btn-primary-rai:hover {
    background: #ffffff;
    color: #0f172a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.35);
}

.btn-cancel-rai {
    background: transparent;
    color: #94a3b8;
    margin-top: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.btn-cancel-rai:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.05);
}

.error-msg-rai {
    color: #f87171;
    font-size: 0.85rem;
    margin-bottom: 1.1rem;
    display: none;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
}

@keyframes raiShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-9px); }
    40% { transform: translateX(9px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}



