.hidden { display: none !important; }
@keyframes rexspin { to { transform: rotate(360deg); } }
.btn-spin-icon { animation: rexspin .7s linear infinite; flex-shrink: 0; display: inline-block; }

/* ===== Dropdown menu ===== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 150px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 100;
    overflow: hidden;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .55rem 1rem;
    font-size: 13px;
    color: var(--gray-800);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
}
.dropdown-item:hover { background: var(--gray-100); }
.dropdown-item--danger { color: var(--red); }
.dropdown-item--danger:hover { background: var(--red-light); }

/* ===== Settings tabs ===== */
.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: var(--gray-100);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 1.25rem;
    width: fit-content;
    max-width: 100%;
}
.settings-tab {
    padding: .32rem .95rem;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    background: transparent;
    border: none;
    text-decoration: none;
    transition: background .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
    cursor: pointer;
}
.settings-tab:hover { color: var(--blue); background: rgba(255,255,255,.65); text-decoration: none; }
.settings-tab.active {
    background: var(--white);
    color: var(--blue);
    box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.07);
}

/* ===== Backups device select ===== */
.device-select {
    appearance: none;
    -webkit-appearance: none;
    padding: .4rem .75rem;
    padding-right: 2.25rem !important;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background-color: var(--white);
    color: var(--gray-800);
    font-size: 13px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%236C757D'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
}
.device-select:focus { outline: 2px solid var(--orange); border-color: var(--orange); }

/* ===== Dark mode — dropdown / tabs / select ===== */
[data-theme="dark"] .dropdown-menu {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .dropdown-item { color: #cbd5e1; }
[data-theme="dark"] .dropdown-item:hover { background: #0f172a; }
[data-theme="dark"] .settings-tabs { background: #0f172a; }
[data-theme="dark"] .settings-tab { color: #64748b; background: transparent; }
[data-theme="dark"] .settings-tab:hover { color: #94a3b8; background: rgba(255,255,255,.05); }
[data-theme="dark"] .settings-tab.active { background: #1e293b; color: #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
[data-theme="dark"] .device-select {
    background-color: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

/* ===== Variables RexBackup ===== */
:root {
    /* Acento de marca Rextel — se mantiene */
    --orange:      #E88120;
    --orange-dark: #C96E10;
    --orange-light:#FFF3E0;

    /* Identidad propia RexBackup — slate + emerald */
    --blue:        #0F172A;   /* slate-900: cabeceras, títulos */
    --blue-light:  #1E293B;   /* slate-800 */
    --teal:        #0D9488;   /* teal-600: acento "backup seguro" */
    --teal-light:  #CCFBF1;   /* teal-100 */

    --yellow:      #F59E0B;
    --white:       #FFFFFF;
    --gray-50:     #F8FAFC;
    --gray-100:    #F1F5F9;
    --gray-200:    #E2E8F0;
    --gray-300:    #CBD5E1;
    --gray-400:    #94A3B8;
    --gray-500:    #64748B;
    --gray-600:    #475569;
    --gray-800:    #0F172A;
    --green:       #059669;   /* emerald */
    --green-light: #D1FAE5;
    --red:         #DC2626;
    --red-light:   #FEE2E2;
    --shadow-sm:   0 1px 3px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
    --shadow:      0 4px 16px rgba(15,23,42,.09), 0 2px 4px rgba(15,23,42,.05);
    --shadow-md:   0 8px 32px rgba(15,23,42,.13), 0 4px 8px rgba(15,23,42,.06);
    --radius:           10px;
    --radius-sm:        6px;
    --font:             'Inter', system-ui, -apple-system, sans-serif;
    --navbar-h:         60px;
    --heatmap-none-bg:  #e2e8f0;
    --heatmap-none-bd:  #cbd5e1;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--gray-800);
    background-color: #F8FAFC;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(15,23,42,.045) 1px, transparent 0);
    background-size: 28px 28px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    background: var(--gray-100);
    padding: .1rem .35rem;
    border-radius: 3px;
}

/* ===== Navbar ===== */
.navbar {
    background: #0F172A;
    border-bottom: 2px solid var(--orange);
    color: var(--white);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    height: var(--navbar-h);
    gap: 1rem;
    box-shadow: 0 1px 0 rgba(232,129,32,.5), 0 4px 16px rgba(0,0,0,.3);
    position: sticky;
    top: 0;
    z-index: 200;
}

/* Logo + texto brand */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-shrink: 0;
    text-decoration: none;
}
.navbar-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
}
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: .5px;
}
.brand-name .accent { color: var(--yellow); }
.brand-sub {
    font-size: 9px;
    color: var(--gray-400);
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Hamburger button — visible solo en mobile */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    margin-left: auto;
    padding: 4px;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menú de navegación */
.navbar-menu {
    display: flex;
    list-style: none;
    gap: .15rem;
    flex: 1;
    align-items: center;
}
.navbar-menu li a {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: rgba(255,255,255,.75);
    padding: .4rem .75rem;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.navbar-menu li a svg { width: 15px; height: 15px; flex-shrink: 0; }
.navbar-menu li a:hover,
.navbar-menu li a.active {
    background: rgba(255,255,255,.12);
    color: var(--white);
    text-decoration: none;
}
.navbar-menu li a.active { background: var(--orange); }

/* Item usuario dentro del menú mobile (oculto en desktop) */
.nav-user-mobile { display: none; }

/* Usuario desktop */
.navbar-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}
.user-name { font-size: 13px; color: rgba(255,255,255,.8); }
.btn-logout {
    font-size: 12px;
    color: rgba(255,255,255,.7);
    border: 1px solid rgba(255,255,255,.3);
    padding: .3rem .65rem;
    border-radius: var(--radius-sm);
    transition: all .15s;
    white-space: nowrap;
}
.btn-logout:hover {
    background: rgba(255,255,255,.1);
    color: var(--white);
    text-decoration: none;
}

/* ⚡ Super chip */
.nav-super-chip {
    font-size: 11px;
    font-weight: 700;
    padding: .25rem .6rem;
    border-radius: 20px;
    background: rgba(232,129,32,.15);
    color: var(--orange);
    border: 1px solid rgba(232,129,32,.35);
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: .02em;
}
.nav-super-chip:hover { background: var(--orange); color: #fff; text-decoration: none; }

/* User menu button */
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 24px;
    padding: .22rem .55rem .22rem .22rem;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    color: rgba(255,255,255,.85);
    font-family: var(--font);
}
.user-menu-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }
.user-menu-btn.open  { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }

.user-initials {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.user-menu-name {
    font-size: 13px;
    font-weight: 500;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-chevron {
    width: 14px;
    height: 14px;
    opacity: .55;
    transition: transform .2s;
    flex-shrink: 0;
}
.user-menu-btn.open .user-menu-chevron { transform: rotate(180deg); }

/* User dropdown panel */
.user-dropdown {
    min-width: 210px;
    padding: .35rem 0;
}
.user-dropdown-trial {
    padding: .55rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--gray-500);
    background: var(--gray-100);
    border-radius: 4px;
    margin: .2rem .5rem;
}
.user-dropdown-trial strong { color: var(--orange); font-weight: 600; }
.dropdown-divider { height: 1px; background: var(--gray-200); margin: .3rem 0; }

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 1.5rem 1.25rem;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}
.main-content.full-height {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
    min-height: calc(100vh - 40px);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: .65rem 1rem;
    font-size: 11px;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.page-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--blue);
    padding-left: .6rem;
    border-left: 3px solid var(--orange);
}
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .9rem;
    font-size: 13px;
    font-weight: 500;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    text-decoration: none;
    font-family: var(--font);
    line-height: 1;
}
.btn:hover { text-decoration: none; filter: brightness(.92); }
.btn-primary  { background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%); color: var(--white); border-color: var(--orange-dark); }
.btn-outline  { background: transparent;        color: var(--teal);  border-color: var(--teal); }
.btn-outline:hover { background: var(--teal); color: var(--white); }
.btn-danger   { background: var(--red);         color: var(--white); border-color: var(--red); }
.btn-warning  { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.btn-warning:hover { background: #d97706; border-color: #d97706; }
.btn-sm       { padding: .28rem .6rem; font-size: 12px; }
.btn-block    { width: 100%; justify-content: center; padding: .65rem; font-size: 14px; }

/* ===== Cards ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.card:hover {
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: .5rem;
}
.card-header h3 { font-size: 14px; font-weight: 600; color: var(--blue); letter-spacing: -.1px; }

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .9rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 1.1rem 1rem;
    display: flex;
    align-items: center;
    gap: .85rem;
    box-shadow: var(--shadow-sm);
    transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card:has(.icon-blue)   { background: #EFF9FF; border-color: #BAE6FD; }
.stat-card:has(.icon-orange) { background: #FFF8F0; border-color: #FDDCAA; }
.stat-card:has(.icon-green)  { background: #F0FDF4; border-color: #BBF7D0; }
.stat-card:has(.icon-red)    { background: #FFF5F5; border-color: #FECACA; }
.stat-card--alert { border-color: #fecaca; background: #fff5f5; }
.stat-icon {
    width: 46px; height: 46px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.icon-blue   { background: linear-gradient(135deg, #E0F2FE 0%, #bae6fd 100%); color: #0369a1; }
.icon-green  { background: linear-gradient(135deg, #CCFBF1 0%, #99f6e4 100%); color: var(--green); }
.icon-orange { background: linear-gradient(135deg, #FFF3E0 0%, #fed7aa 100%); color: var(--orange); }
.icon-red    { background: linear-gradient(135deg, #FEE2E2 0%, #fecaca 100%); color: var(--red); }
.stat-value  { font-size: 28px; font-weight: 800; color: var(--blue); line-height: 1; letter-spacing: -.5px; }
.stat-label  { font-size: 11px; color: var(--gray-500); margin-top: .25rem; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 480px; }
.table th, .table td {
    padding: .65rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.table th {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--gray-600); background: var(--gray-50);
    white-space: nowrap;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:nth-child(even) td { background: var(--gray-50); }
.table tr:hover td { background: var(--gray-100) !important; }
.row-disabled td { opacity: .5; }
.actions-cell { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.filename { font-size: 11px; color: var(--gray-600); word-break: break-all; }

/* ===== Badges ===== */
.badge {
    display: inline-block; padding: .2rem .5rem;
    font-size: 10px; font-weight: 600;
    border-radius: 20px; text-transform: uppercase; letter-spacing: .4px;
    white-space: nowrap;
}
.badge-success { background: var(--green-light); color: #155724; }
.badge-danger  { background: var(--red-light);   color: #721C24; }
.badge-muted   { background: var(--gray-200);    color: var(--gray-600); }
.badge-outline  { border: 1px solid var(--gray-400); color: var(--gray-600); }
.badge-warning  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ===== Alerts ===== */
.alerts-container { margin-bottom: 1rem; }
.alert {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: .75rem 1rem; border-radius: var(--radius-sm);
    margin-bottom: .5rem; font-size: 13px; border: 1px solid transparent;
    gap: .5rem;
}
.alert button { background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1; color: inherit; opacity: .6; flex-shrink: 0; }
.alert-success { background: var(--green-light); border-color: #C3E6CB; color: #155724; }
.alert-danger  { background: var(--red-light);   border-color: #F5C6CB; color: #721C24; }
.alert-warning { background: #FFF3CD; border-color: #FFEEBA; color: #856404; }
.alert-info    { background: #D1ECF1; border-color: #BEE5EB; color: #0C5460; }

/* ===== Forms ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1.1rem;
}
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group--full { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 600; color: #495057; }
.form-group input,
.form-group select,
.form-group textarea {
    padding: .5rem .75rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color .15s;
    background: var(--white);
    width: 100%;
    -webkit-appearance: none;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(232,129,32,.15);
}
.form-hint { font-size: 11px; color: var(--gray-600); }
.required { color: var(--red); }
.checkbox-label {
    display: flex; align-items: center; gap: .5rem;
    cursor: pointer; font-size: 13px; font-weight: 400 !important;
}

/* Toggle switch */
.toggle-label {
    display: inline-flex; align-items: center; gap: .7rem;
    cursor: pointer; user-select: none;
    padding: .5rem .8rem;
    border-radius: 8px;
    border: 2px solid var(--gray-300);
    background: var(--gray-100);
    transition: border-color .2s, background .2s;
}
.toggle-label:has(.toggle-input:checked) {
    border-color: #22c55e;
    background: #f0fdf4;
}
.toggle-input { display: none; }
.toggle-switch {
    position: relative;
    width: 40px; height: 22px;
    background: #d1d5db;
    border-radius: 22px;
    transition: background .2s;
    flex-shrink: 0;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.toggle-input:checked + .toggle-switch { background: #22c55e; }
.toggle-input:checked + .toggle-switch::after { transform: translateX(18px); }
.toggle-text {
    font-size: 13px; font-weight: 500;
    color: var(--gray-500);
    transition: color .2s;
}
.toggle-label:has(.toggle-input:checked) .toggle-text {
    color: #16a34a;
}
/* Vendor badges en lista de dispositivos */
.badge-vendor { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.badge-vendor--mikrotik  { background: #fff0e0; color: #b45309; }
.badge-vendor--cisco_ios { background: #e0f0ff; color: #1d4ed8; }
.badge-vendor--cisco_ios_telnet { background: #e0f0ff; color: #1d4ed8; }
.badge-vendor--huawei_vrp { background: #e0ffe8; color: #15803d; }

/* Vendor selector */
.vendor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .5rem;
}
.vendor-option input[type="radio"] { display: none; }
.vendor-card {
    display: block;
    padding: .55rem .9rem;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--gray-100);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s, color .15s;
}
.vendor-option input[type="radio"]:checked + .vendor-card {
    border-color: var(--primary);
    background: #fff4e6;
    color: var(--primary);
}
.vendor-card:hover { border-color: var(--primary-light); }

.form-actions {
    padding: .9rem 1.1rem;
    border-top: 1px solid var(--gray-200);
    display: flex; gap: .5rem; flex-wrap: wrap;
}

/* ===== Filter bar ===== */
.filter-bar {
    display: flex; align-items: center; gap: .4rem;
    flex-wrap: wrap; margin-bottom: 1rem;
}
.filter-label { font-size: 12px; font-weight: 600; color: var(--gray-600); white-space: nowrap; }
.filter-chip {
    padding: .28rem .7rem; border-radius: 20px; font-size: 12px;
    border: 1.5px solid var(--gray-200); color: var(--gray-600);
    transition: all .15s; white-space: nowrap;
}
.filter-chip:hover { border-color: var(--orange); color: var(--orange); text-decoration: none; }
.filter-chip.active { background: var(--orange); border-color: var(--orange); color: var(--white); }

/* ===== Login ===== */
.login-wrapper {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 1.5rem;
    min-height: calc(100vh - var(--navbar-h));
}
.login-split {
    display: flex;
    width: 100%;
    max-width: 880px;
    min-height: 520px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.12);
}
.login-left {
    width: 42%;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 55%, #0d4a44 100%);
    padding: 2.5rem 2rem;
    display: flex; flex-direction: column; gap: 1rem;
    position: relative; overflow: hidden;
}
.login-left::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 90% 15%, rgba(13,148,136,.25) 0%, transparent 55%);
    pointer-events: none;
}
.login-status-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(13,148,136,.2);
    border: 1px solid rgba(13,148,136,.4);
    border-radius: 20px; padding: .28rem .75rem;
    font-size: 11px; font-weight: 500; color: #5eead4;
    width: fit-content; position: relative;
}
.login-status-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #0D9488; flex-shrink: 0;
    animation: loginPulse 2s ease-in-out infinite;
}
@keyframes loginPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .35; }
}
.login-brand {
    display: flex; align-items: center; gap: .65rem;
    position: relative;
}
.login-brand-icon {
    width: 38px; height: 38px;
    background: var(--orange);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(232,129,32,.35);
}
.login-brand-icon svg { width: 20px; height: 20px; fill: white; }
.login-brand-name {
    font-size: 1.35rem; font-weight: 700; color: white;
    letter-spacing: -.01em;
}
.login-left-tagline {
    font-size: 13px; color: #94a3b8;
    line-height: 1.65; position: relative;
}
.login-features {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: .55rem;
    position: relative;
}
.login-features li {
    font-size: 12.5px; color: #64748b;
    padding-left: 1.1rem; position: relative; line-height: 1.4;
}
.login-features li::before {
    content: '';
    position: absolute; left: 0; top: .45em;
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--teal);
}
.login-left-footer {
    margin-top: auto; font-size: 11px; color: #334155;
    position: relative;
}
.login-right {
    flex: 1; background: var(--white);
    display: flex; align-items: center; justify-content: center;
    padding: 2.5rem 2rem;
}
.login-right-inner {
    width: 100%; max-width: 320px;
    display: flex; flex-direction: column; gap: 1.5rem;
}
.login-right-title {
    font-size: 1.65rem; font-weight: 700; color: var(--blue);
    letter-spacing: -.025em; margin-bottom: .3rem;
}
.login-right-sub { font-size: 13px; color: var(--gray-500); }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.btn-teal { background: var(--teal); border-color: var(--teal); color: white; }
.btn-teal:hover { background: #0a7a70; border-color: #0a7a70; filter: none; }
@media (max-width: 680px) {
    .login-split { flex-direction: column; min-height: auto; }
    .login-left { width: 100%; padding: 1.5rem; gap: .65rem; }
    .login-features, .login-left-tagline { display: none; }
    .login-right { padding: 1.75rem 1.25rem; }
    .login-left-footer { display: none; }
}
[data-theme="dark"] .login-right { background: #1e293b; }
[data-theme="dark"] .login-right-title { color: #e2e8f0; }
[data-theme="dark"] .login-right-sub { color: #64748b; }

/* ===== Modal ===== */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 300; padding: 1rem;
}
.modal.hidden { display: none; }
.modal-box {
    background: var(--white); border-radius: var(--radius);
    padding: 1.5rem; max-width: 440px; width: 100%;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 1rem;
}
.modal-box h3 { color: var(--blue); font-size: 16px; }

/* ===== Settings page ===== */
.schedule-display {
    display: flex; align-items: center; gap: 1rem;
    background: var(--orange-light); border: 1px solid var(--orange);
    border-radius: var(--radius); padding: 1rem;
}
.schedule-icon { color: var(--orange); flex-shrink: 0; }
.schedule-time { font-size: 30px; font-weight: 800; color: var(--blue); line-height: 1; }
.schedule-label { font-size: 11px; color: var(--gray-600); text-transform: uppercase; letter-spacing: .5px; margin-top: .2rem; }
.schedule-next { font-size: 12px; color: var(--gray-600); margin-top: .25rem; }

.retention-display {
    display: flex; align-items: baseline; gap: .5rem;
    background: #EEF2FF; border: 1px solid var(--blue-light);
    border-radius: var(--radius); padding: 1rem;
}
.retention-number { font-size: 44px; font-weight: 800; color: var(--blue); line-height: 1; }
.retention-unit { font-size: 16px; color: var(--blue-light); font-weight: 600; }

.quick-times {
    display: inline-flex; flex-wrap: wrap; gap: 2px;
    background: var(--gray-100); border-radius: 10px; padding: 3px;
}
.quick-time-btn {
    padding: .28rem .75rem; font-size: 12px; font-weight: 500;
    border: none; border-radius: 7px;
    background: transparent; color: var(--gray-500);
    cursor: pointer; transition: background .15s, color .15s, box-shadow .15s;
    font-family: var(--font); white-space: nowrap;
}
.quick-time-btn:hover { color: var(--blue); background: rgba(255,255,255,.65); }
.quick-time-btn.active {
    background: var(--white); color: var(--blue);
    box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.07);
}

.info-item {
    display: flex; flex-direction: column; gap: .25rem;
    padding: .75rem; background: var(--gray-50);
    border-radius: var(--radius-sm); border: 1px solid var(--gray-200);
}
.info-label { font-size: 10px; color: var(--gray-600); text-transform: uppercase; letter-spacing: .5px; }
.info-value { font-size: 13px; font-weight: 600; color: var(--blue); }

/* ===== Backup viewer ===== */
.rsc-viewer {
    background: #0d1117; color: #c9d1d9;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 12px; line-height: 1.6;
    padding: 1.1rem; overflow-x: auto;
    max-height: 65vh; overflow-y: auto;
    white-space: pre; tab-size: 4;
    border-radius: 0 0 var(--radius) var(--radius);
    -webkit-overflow-scrolling: touch;
}

/* ===== Utilities ===== */
.text-center  { text-align: center; }
.text-muted   { color: var(--gray-400); }
.text-danger  { color: var(--red); }
.text-sm      { font-size: 12px; }

/* =============================================
   MOBILE — max-width: 768px
   ============================================= */
@media (max-width: 768px) {

    /* Navbar mobile */
    .nav-toggle { display: flex; }
    .navbar-user { display: none; } /* se muestra dentro del menú */

    .navbar-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        position: absolute;
        top: var(--navbar-h);
        left: 0; right: 0;
        background: var(--blue);
        padding: .5rem 0 1rem;
        box-shadow: 0 8px 16px rgba(0,0,0,.3);
        z-index: 199;
    }
    .navbar-menu.open { display: flex; }

    .navbar-menu li a {
        padding: .75rem 1.25rem;
        border-radius: 0;
        font-size: 15px;
    }
    .navbar-menu li a svg { width: 18px; height: 18px; }

    .nav-user-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .75rem 1.25rem;
        border-top: 1px solid rgba(255,255,255,.1);
        margin-top: .25rem;
    }
    .user-name-mobile { font-size: 13px; color: rgba(255,255,255,.7); }

    /* Content */
    .main-content { padding: 1rem .75rem; }

    /* Page header */
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; justify-content: center; }

    /* Stats — 2 columnas en móvil */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
    .stat-value { font-size: 22px; }
    .stat-card { padding: .75rem; gap: .65rem; }
    .stat-icon { width: 38px; height: 38px; }
    .stat-icon svg { width: 18px; height: 18px; }

    /* Tables — scroll horizontal */
    .table-wrapper { margin: 0 -.75rem; border-radius: 0; }
    .table th, .table td { padding: .55rem .75rem; font-size: 12px; }
    .actions-cell { gap: .25rem; }
    .btn-sm { padding: .25rem .5rem; font-size: 11px; }

    /* Forms — 1 columna */
    .form-grid { grid-template-columns: 1fr; padding: .9rem; }
    .form-group--full { grid-column: 1; }
    .form-group input, .form-group select { font-size: 16px; } /* evita zoom en iOS */

    /* Settings grid — 1 columna */
    .settings-grid { grid-template-columns: 1fr !important; }

    /* Login */
    .login-card { padding: 1.5rem 1.25rem 1.25rem; }
    .login-logo-img { width: 150px; }

    /* Backup viewer */
    .rsc-viewer { font-size: 11px; max-height: 55vh; }

    /* Filter bar */
    .filter-bar { gap: .3rem; }
    .filter-chip { font-size: 11px; padding: .25rem .55rem; }

    /* Card header */
    .card-header { padding: .75rem .9rem; }

    /* Form actions */
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }
}

/* =============================================
   SMALL MOBILE — max-width: 400px
   ============================================= */
@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }
    .brand-sub { display: none; }
    .navbar-logo { height: 30px; }
}

/* =============================================
   DARK MODE
   ============================================= */
[data-theme="dark"] {
    --gray-50:          #0f172a;
    --gray-100:         #1e293b;
    --gray-200:         #334155;
    --gray-400:         #94a3b8;
    --gray-600:         #cbd5e1;
    --gray-800:         #f1f5f9;
    /* --white se deja en blanco para no romper texto de botones */
    --shadow-sm:        0 1px 3px rgba(0,0,0,.4);
    --shadow:           0 4px 16px rgba(0,0,0,.5);
    --green-light:      #14532d;
    --red-light:        #7f1d1d;
    --orange-light:     #7c2d12;
    --heatmap-none-bg:  #1e293b;
    --heatmap-none-bd:  #334155;
}

/* Base */
[data-theme="dark"] body {
    background-color: #080d1a;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.025) 1px, transparent 0);
    background-size: 28px 28px;
    color: #e2e8f0;
}
[data-theme="dark"] a                { color: #818cf8; }

/* Brand — Rex blanco, Backup naranja igual que modo claro */
[data-theme="dark"] .brand-name      { color: #fff; }
[data-theme="dark"] .brand-name .accent { color: var(--orange); }
[data-theme="dark"] .brand-sub       { color: rgba(255,255,255,.55); }

/* Card / page header h3 y h2 */
[data-theme="dark"] .card-header h3  { color: #e2e8f0; }
[data-theme="dark"] .page-header h2  { color: #e2e8f0; }

/* Badges success/danger — texto hardcodeado */
[data-theme="dark"] .badge-success   { background: #14532d; color: #86efac; }
[data-theme="dark"] .badge-danger    { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-warning   { background: #422006; color: #fdba74; border-color: #92400e; }

/* Badges vendor — fondos más claros para legibilidad */
[data-theme="dark"] .badge-vendor--mikrotik         { background: #92400e; color: #fef3c7; }
[data-theme="dark"] .badge-vendor--cisco_ios        { background: #1d4ed8; color: #dbeafe; }
[data-theme="dark"] .badge-vendor--cisco_ios_telnet { background: #1d4ed8; color: #dbeafe; }
[data-theme="dark"] .badge-vendor--huawei_vrp       { background: #166534; color: #dcfce7; }

/* filename (.cfg, .rsc) */
[data-theme="dark"] .filename        { color: #94a3b8; }

/* Botones outline — fuerza texto legible */
[data-theme="dark"] .btn-outline        { color: #cbd5e1; border-color: #475569; background: transparent; }
[data-theme="dark"] .btn-outline:hover  { background: #334155; color: #f1f5f9; border-color: #64748b; }
[data-theme="dark"] .btn-sm.btn-outline { color: #cbd5e1; border-color: #475569; }
[data-theme="dark"] .btn-sm.btn-outline:hover { background: #334155; color: #f1f5f9; }

/* btn-primary texto siempre blanco */
[data-theme="dark"] .btn-primary        { color: #ffffff; }
[data-theme="dark"] .btn-sm.btn-primary { color: #ffffff; }

/* Configuración — schedule y retention */
[data-theme="dark"] .schedule-label  { color: #94a3b8; }
[data-theme="dark"] .schedule-next   { color: #cbd5e1; }
[data-theme="dark"] .retention-unit  { color: #cbd5e1; }

/* Labels de formularios — más visibles en dark */
[data-theme="dark"] .form-group label  { color: #cbd5e1; }
[data-theme="dark"] .form-group small,
[data-theme="dark"] .form-hint         { color: #94a3b8; }
[data-theme="dark"] .required          { color: #f87171; }

/* Cards y panels */
[data-theme="dark"] .card           { background: #131c35; border-color: #1e2d4a; }
[data-theme="dark"] .card:hover     { box-shadow: 0 6px 20px rgba(0,0,0,.35); }
[data-theme="dark"] .card-header    { background: #0e1628; border-color: #1e2d4a; }
[data-theme="dark"] .modal-box      { background: #1e293b; }
[data-theme="dark"] .login-card     { background: #1e293b; }
[data-theme="dark"] .footer         { background: #1e293b; border-color: #334155; color: #94a3b8; }

/* Navbar sigue en azul oscuro — sin cambios */

/* Tablas */
[data-theme="dark"] .table th       { background: #0f172a; color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .table td       { border-color: #1e293b; color: #e2e8f0; }
[data-theme="dark"] .table tbody tr:nth-child(even) td { background: #0f172a; }
[data-theme="dark"] .table tr:hover td { background: #334155 !important; }
[data-theme="dark"] .table-wrapper  { border-color: #334155; }

/* Formularios */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select  { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus { border-color: #4c6ef5; }
[data-theme="dark"] .form-hint      { color: #94a3b8; }
[data-theme="dark"] .search-input   { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .vendor-card    { background: #0f172a; border-color: #64748b; color: #cbd5e1; }
[data-theme="dark"] .vendor-card:hover { border-color: #f97316; color: #f1f5f9; background: #1e293b; }
[data-theme="dark"] .vendor-option input[type="radio"]:checked + .vendor-card {
    border-color: #f97316; background: #431407; color: #fb923c; font-weight: 700;
}
[data-theme="dark"] .search-input::placeholder { color: #64748b; }

/* Botones */
[data-theme="dark"] .btn-outline    { color: #94a3b8; border-color: #475569; }
[data-theme="dark"] .btn-outline:hover { background: #334155; color: #e2e8f0; }
[data-theme="dark"] .btn-logout     { color: #94a3b8; border-color: #475569; }
[data-theme="dark"] .btn-logout:hover { background: #334155; color: #e2e8f0; }

/* Stat cards */
[data-theme="dark"] .stat-card      { background: #131c35; border-color: #1e2d4a; border-left-width: 4px; }
[data-theme="dark"] .stat-card:hover { box-shadow: 0 8px 28px rgba(0,0,0,.4); }
[data-theme="dark"] .stat-value     { color: #f1f5f9; }
[data-theme="dark"] .stat-label     { color: #64748b; }
[data-theme="dark"] .stat-total     { color: #475569; }
[data-theme="dark"] .icon-blue      { background: linear-gradient(135deg, #1e3a5f, #1e4080); color: #93c5fd; }
[data-theme="dark"] .icon-green     { background: linear-gradient(135deg, #14532d, #166534); color: #86efac; }
[data-theme="dark"] .icon-orange    { background: linear-gradient(135deg, #7c2d12, #9a3412); color: #fdba74; }
[data-theme="dark"] .icon-red       { background: linear-gradient(135deg, #7f1d1d, #991b1b); color: #fca5a5; }
[data-theme="dark"] .stat-card--alert { background: #1f0808; border-left-color: var(--red); border-color: #3b0a0a; }

/* Filtros y chips */
[data-theme="dark"] .filter-bar     { border-color: #334155; }
[data-theme="dark"] .filter-label   { color: #94a3b8; }
[data-theme="dark"] .filter-chip    { background: #1e293b; color: #cbd5e1; border-color: #475569; }
[data-theme="dark"] .filter-chip.active { background: var(--orange); color: #fff; border-color: var(--orange); }

/* Notificaciones */
[data-theme="dark"] .notif-panel    { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .notif-panel-header { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .notif-item     { border-color: #334155; }
[data-theme="dark"] .notif-item-msg { color: #e2e8f0; }
[data-theme="dark"] .notif-empty    { color: #64748b; }
[data-theme="dark"] .notif-clear    { color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .notif-clear:hover { background: #334155; }

/* Código e info */
[data-theme="dark"] code            { background: #334155; color: #e2e8f0; }
[data-theme="dark"] .info-item      { border-color: #334155; }
[data-theme="dark"] .info-label     { color: #94a3b8; }
[data-theme="dark"] .info-value     { color: #e2e8f0; }
[data-theme="dark"] .text-muted     { color: #64748b !important; }

/* Badges */
[data-theme="dark"] .badge-outline  { border-color: #475569; color: #cbd5e1; }
[data-theme="dark"] .badge-muted    { background: #334155; color: #94a3b8; }
[data-theme="dark"] .badge-group    { background: #1e3a5f; color: #93c5fd; }

/* Alertas */
[data-theme="dark"] .alert-danger   { background: #3b0a0a; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .alert-warning  { background: #422006; border-color: #92400e; color: #fdba74; }

/* Diff y viewer */
[data-theme="dark"] .rsc-viewer,
[data-theme="dark"] .diff-viewer    { background: #0f172a; color: #cbd5e1; }
[data-theme="dark"] .diff-add       { background: #14532d; color: #86efac; }
[data-theme="dark"] .diff-remove    { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .diff-hunk      { background: #1e3a5f; color: #93c5fd; }

/* Settings */
[data-theme="dark"] .schedule-display { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .schedule-time  { color: var(--orange); }
[data-theme="dark"] .quick-times { background: #0f172a; }
[data-theme="dark"] .quick-time-btn { background: transparent; color: #64748b; }
[data-theme="dark"] .quick-time-btn:hover { color: #94a3b8; background: rgba(255,255,255,.05); }
[data-theme="dark"] .quick-time-btn.active { background: #1e293b; color: #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
[data-theme="dark"] .retention-display { background: #0f172a; }
[data-theme="dark"] .retention-number { color: var(--orange); }

/* Row disabled */
[data-theme="dark"] .row-disabled td { color: #475569; }

/* Botón tema */
.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.75);
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}
.theme-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
/* Iconos de tema: auto=monitor, light=sol, dark=luna */
.theme-btn .icon-auto { display: block; }
.theme-btn .icon-sun  { display: none; }
.theme-btn .icon-moon { display: none; }
[data-theme-mode="light"] .theme-btn .icon-auto { display: none; }
[data-theme-mode="light"] .theme-btn .icon-sun  { display: block; }
[data-theme-mode="light"] .theme-btn .icon-moon { display: none; }
[data-theme-mode="dark"]  .theme-btn .icon-auto { display: none; }
[data-theme-mode="dark"]  .theme-btn .icon-sun  { display: none; }
[data-theme-mode="dark"]  .theme-btn .icon-moon { display: block; }

/* =============================================
   STAT TOTAL (e.g. "5/8")
   ============================================= */
.stat-total {
    font-size: .55em;
    font-weight: 500;
    color: var(--gray-400);
    margin-left: 1px;
}
.stat-card--alert {
    border: 1.5px solid var(--red-light);
    background: #fff8f8;
}

/* =============================================
   BELL BUTTON & NOTIFICATION PANEL
   ============================================= */
.bell-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.75);
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}
.bell-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.bell-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}
.bell-badge.hidden { display: none; }

.notif-panel {
    position: fixed;
    top: calc(var(--navbar-h) + 6px);
    right: 12px;
    width: 320px;
    max-height: 400px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,.18);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}
.notif-panel.hidden { display: none; }
.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem 1rem;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}
.notif-clear {
    font-size: 11px;
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px 8px;
    color: var(--gray-600);
}
.notif-clear:hover { background: var(--gray-100); }
.notif-panel-body { overflow-y: auto; flex: 1; }
.notif-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .55rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 12px;
}
.notif-item:last-child { border-bottom: none; }
.notif-item--success { border-left: 3px solid var(--green); }
.notif-item--danger  { border-left: 3px solid var(--red); }
.notif-item--warning { border-left: 3px solid var(--yellow); }
.notif-item--info    { border-left: 3px solid var(--blue-light); }
.notif-item-msg { flex: 1; color: var(--gray-800); line-height: 1.4; }
.notif-item-time { color: var(--gray-400); white-space: nowrap; font-size: 11px; margin-top: 1px; }

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-h) + 10px);
    left: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    font-size: 13px;
    font-weight: 500;
    min-width: 240px;
    max-width: 340px;
    pointer-events: all;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity .3s ease, transform .3s ease;
    border-left: 4px solid transparent;
}
.toast--show { opacity: 1; transform: translateX(0); }
.toast--success { background: #f0fdf4; border-color: var(--green); color: #166534; }
.toast--danger  { background: #fef2f2; border-color: var(--red);   color: #991b1b; }
.toast--warning { background: #fffbeb; border-color: var(--yellow); color: #92400e; }
.toast--info    { background: #eff6ff; border-color: var(--blue-light); color: #1e40af; }
.toast-icon { flex-shrink: 0; }
.toast-msg  { flex: 1; line-height: 1.4; }
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    color: inherit;
    opacity: .6;
    flex-shrink: 0;
}
.toast-close:hover { opacity: 1; }

/* =============================================
   DIFF VIEWER
   ============================================= */
.diff-viewer {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    padding: .75rem 0;
    margin: 0;
    background: #fff;
    border-radius: 0 0 var(--radius) var(--radius);
}
.diff-line {
    display: block;
    padding: 1px 1.25rem;
}
.diff-add    { background: #f0fdf4; color: #166534; }
.diff-remove { background: #fef2f2; color: #991b1b; }
.diff-hunk   { background: #eff6ff; color: #1e40af; font-weight: 600; }
.diff-legend {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}
.diff-legend--add    { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.diff-legend--remove { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.diff-legend--hunk   { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Diff table */
.diff-table-wrap { overflow-x: auto; }
.diff-table {
    width: 100%; border-collapse: collapse;
    font-family: 'JetBrains Mono','Fira Code',monospace;
    font-size: 12px; line-height: 1.6;
}
.diff-table tr { border: none; }
.diff-gutter {
    width: 20px; min-width: 20px; padding: 0 6px;
    text-align: center; user-select: none;
    border-right: 2px solid transparent;
    white-space: nowrap;
}
.diff-sign { font-weight: 700; font-size: 13px; }
.diff-code { padding: 1px 1rem 1px .5rem; white-space: pre; width: 100%; }
.diff-row--add    .diff-gutter--add    { background: #dcfce7; border-right-color: #4ade80; color: #166534; }
.diff-row--add    .diff-code--add      { background: #f0fdf4; color: #166534; }
.diff-row--remove .diff-gutter--remove { background: #fee2e2; border-right-color: #f87171; color: #991b1b; }
.diff-row--remove .diff-code--remove   { background: #fef2f2; color: #991b1b; }
.diff-row--hunk   .diff-gutter         { background: #dbeafe; }
.diff-row--hunk   .diff-code--hunk     { background: #eff6ff; color: #1e40af; font-weight: 600; }
.diff-row--context .diff-code          { background: #fff; color: #374151; }

[data-theme="dark"] .diff-row--add    .diff-gutter--add    { background: #14532d; border-right-color: #22c55e; color: #86efac; }
[data-theme="dark"] .diff-row--add    .diff-code--add      { background: #052e16; color: #86efac; }
[data-theme="dark"] .diff-row--remove .diff-gutter--remove { background: #7f1d1d; border-right-color: #ef4444; color: #fca5a5; }
[data-theme="dark"] .diff-row--remove .diff-code--remove   { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .diff-row--hunk   .diff-gutter         { background: #1e3a5f; }
[data-theme="dark"] .diff-row--hunk   .diff-code--hunk     { background: #0f2847; color: #93c5fd; }
[data-theme="dark"] .diff-row--context .diff-code          { background: #0f172a; color: #cbd5e1; }

/* =============================================
   BADGE GROUP
   ============================================= */
.badge-group {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}

/* =============================================
   SEARCH INPUT
   ============================================= */
.search-input {
    height: 32px;
    padding: 0 .75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--white);
    width: 100%;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
    border-color: var(--blue-light);
    box-shadow: 0 0 0 3px rgba(45,66,153,.12);
}
.search-input::placeholder { color: var(--gray-400); }

/* =============================================
   ALERT WARNING (if missing)
   ============================================= */
.alert-warning {
    background: #fffbeb;
    border-color: var(--yellow);
    color: #78350f;
}

/* ── Grupo Backup/Restaurar Sistema ─────────────────── */
.sistema-backup-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sistema-backup-label {
    padding: 0 .85rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    border-right: 1px solid var(--gray-200);
    height: 100%;
    display: flex;
    align-items: center;
    background: var(--white);
}
.sistema-backup-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .9rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
    line-height: 1;
}
.sistema-backup-btn:hover {
    background: var(--gray-100);
    color: var(--orange);
    text-decoration: none;
}
.sistema-backup-divider {
    width: 1px;
    height: 28px;
    background: var(--gray-200);
    flex-shrink: 0;
}
[data-theme="dark"] .sistema-backup-group {
    background: #1e293b;
    border-color: #f97316;
}
[data-theme="dark"] .sistema-backup-label {
    background: #1e293b;
    border-color: #f97316;
    color: #fb923c;
    letter-spacing: .06em;
}
[data-theme="dark"] .sistema-backup-btn {
    color: #cbd5e1;
}
[data-theme="dark"] .sistema-backup-btn:hover {
    background: #334155;
    color: #f97316;
}
[data-theme="dark"] .sistema-backup-divider {
    background: #475569;
}

/* ── Paginación ─────────────────────────────────────── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
    padding: .5rem 0;
}
.pagination-info {
    font-size: 13px;
    color: var(--gray-400);
}
.pagination-links {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}
.pagination-ellipsis {
    padding: 0 .25rem;
    color: var(--gray-400);
    font-size: 13px;
}
[data-theme="dark"] .pagination-info { color: var(--gray-400); }

/* ── Búsqueda global ─────────────────────────────────── */
.global-search-wrap {
    position: relative;
}
.global-search-input {
    width: 180px;
    padding: .35rem .75rem;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    background: rgba(255,255,255,.18);
    color: #fff;
    transition: width .2s, box-shadow .15s, background .15s;
    outline: none;
    box-shadow: 0 0 0 1px rgba(255,255,255,.28);
    -webkit-appearance: none;
    appearance: none;
}
.global-search-input::placeholder { color: rgba(255,255,255,.55); }
.global-search-input:focus {
    width: 240px;
    box-shadow: 0 0 0 2px var(--orange);
    background: rgba(255,255,255,.22);
    color: #fff;
}
.global-search-input:focus::placeholder { color: rgba(255,255,255,.4); }
.global-search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 320px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    z-index: 500;
    overflow: hidden;
    font-size: 13px;
    color: #1e293b;
}
.search-section-title {
    padding: .4rem .75rem;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .75rem;
    text-decoration: none;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
    min-width: 0;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--gray-50); color: var(--orange); }
.search-result-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 1px;
}
.search-result-name {
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-sub {
    font-size: 11px;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-ext {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--gray-100);
    color: var(--gray-500);
    flex-shrink: 0;
    font-family: monospace;
}
.search-no-results  { padding: .75rem; color: var(--gray-400); text-align: center; }

[data-theme="dark"] .global-search-input {
    background: rgba(255,255,255,.1); box-shadow: 0 0 0 1px rgba(255,255,255,.2); color: #fff;
}
[data-theme="dark"] .global-search-input::placeholder { color: rgba(255,255,255,.4); }
[data-theme="dark"] .global-search-input:focus {
    background: rgba(255,255,255,.15); box-shadow: 0 0 0 2px var(--orange); color: #fff;
}
[data-theme="dark"] .global-search-results {
    background: #1e293b; border-color: #334155;
}
[data-theme="dark"] .search-section-title {
    background: #0f172a; border-color: #334155; color: #64748b;
}
[data-theme="dark"] .search-result-item {
    color: #cbd5e1; border-color: #334155;
}
[data-theme="dark"] .search-result-item:hover { background: #334155; color: var(--orange); }
[data-theme="dark"] .search-result-sub { color: #64748b; }

/* ===== Backup filters bar ===== */
.backup-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .75rem;
    align-items: center;
    padding: .75rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.backup-filter-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.filter-pills {
    display: inline-flex;
    background: var(--gray-100);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.filter-pill {
    padding: .28rem .85rem;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--gray-500);
    transition: background .15s, color .15s, box-shadow .15s;
    line-height: 1.4;
    white-space: nowrap;
}
.filter-pill:hover {
    color: var(--blue);
    background: rgba(255,255,255,.65);
}
.filter-pill.active {
    background: var(--white);
    color: var(--blue);
    box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.07);
}
.filter-pill--success.active { color: var(--green); }
.filter-pill--error.active   { color: var(--red); }

/* Dark mode — filters */
[data-theme="dark"] .backup-filters {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .filter-label { color: #64748b; }
[data-theme="dark"] .filter-pills { background: #0f172a; }
[data-theme="dark"] .filter-pill  { color: #64748b; background: transparent; }
[data-theme="dark"] .filter-pill:hover { color: #94a3b8; background: rgba(255,255,255,.05); }
[data-theme="dark"] .filter-pill.active { background: #1e293b; color: #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
[data-theme="dark"] .filter-pill--success.active { color: #4ade80; }
[data-theme="dark"] .filter-pill--error.active   { color: #f87171; }

/* ===== Device cards grid ===== */
.device-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .75rem;
    padding: .75rem 1rem;
}
.device-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    background: var(--white);
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: box-shadow .15s;
}
.device-card:hover { box-shadow: var(--shadow-sm); }
.device-card--success { border-left: 3px solid var(--green); }
.device-card--error   { border-left: 3px solid var(--red); }
.device-card--never   { border-left: 3px solid var(--gray-400); }
.device-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
}
.device-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}
.device-card-location {
    display: block;
    font-size: 11px;
    color: var(--gray-600);
    margin-top: 2px;
}
.device-card-meta {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}
.device-card-backup {
    font-size: 11px;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: .3rem;
}
.device-card-backup svg { flex-shrink: 0; color: var(--gray-400); }
.device-card-actions {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    margin-top: .25rem;
}

/* Dark mode — device cards */
[data-theme="dark"] .device-card {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .device-card--success { border-left-color: #22c55e; }
[data-theme="dark"] .device-card--error   { border-left-color: #ef4444; }
[data-theme="dark"] .device-card--never   { border-left-color: #475569; }
[data-theme="dark"] .device-card-name     { color: #e2e8f0; }
[data-theme="dark"] .device-card-location { color: #64748b; }
[data-theme="dark"] .device-card-backup   { color: #64748b; }

/* ===== Responsive mobile ===== */
@media (max-width: 640px) {
    /* Navbar ajustado */
    .navbar { padding: 0 .75rem; gap: .5rem; }
    .brand-name { font-size: 14px; }

    /* Page header stack */
    .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .page-actions { flex-wrap: wrap; gap: .4rem; }

    /* Stats grid 2 col en mobile */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .stat-card { padding: .75rem; }
    .stat-value { font-size: 22px; }

    /* Cards full width */
    .device-cards-grid { grid-template-columns: 1fr; padding: .5rem .75rem; }

    /* Backup filters stack vertical */
    .backup-filters { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .backup-filter-row { width: 100%; }
    .device-select { width: 100%; max-width: 100% !important; }
    .filter-pills { overflow-x: auto; max-width: 100%; }

    /* Tabla: scroll horizontal + text pequeño */
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { font-size: 12px; }
    .table th, .table td { padding: .4rem .5rem; white-space: nowrap; }

    /* Settings tabs: scroll horizontal en mobile */
    .settings-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; width: 100%; max-width: 100%; }
    .settings-tabs::-webkit-scrollbar { display: none; }
    .settings-tab { flex-shrink: 0; }

    /* Heatmap: zoom out font */
    #heatmap-table { font-size: 11px; }

    /* Cards de paginación */
    .pagination-bar { flex-direction: column; gap: .5rem; align-items: center; }
    .pagination-links { flex-wrap: wrap; justify-content: center; }

    /* Acciones inline → wrap */
    .actions-cell { white-space: normal; }
    .actions-cell .btn { margin: 1px 0; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .navbar-menu .nav-link { font-size: 14px; padding: .65rem 1rem; }
}
[data-theme="dark"] .search-result-ext { background: #334155; color: #94a3b8; }

/* ── Group dropdown filter ──────────────────────────────────────────────── */
.grp-dd { position: relative; display: inline-block; }
.grp-dd-btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .35rem .85rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 20px;
    background: var(--white);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--navy);
    white-space: nowrap;
    transition: border-color .15s, color .15s;
    max-width: 260px;
}
.grp-dd-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-dd-btn:hover { border-color: var(--orange); color: var(--orange); }
.grp-dd-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    min-width: 230px;
    max-width: 340px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.13);
    z-index: 200;
    overflow: hidden;
}
.grp-dd-search { padding: .5rem .6rem; border-bottom: 1px solid var(--gray-200); }
.grp-dd-search input { width: 100%; font-size: 13px; }
.grp-dd-list { max-height: 260px; overflow-y: auto; padding: .3rem 0; }
.grp-dd-item {
    display: flex; align-items: center; gap: .4rem;
    padding: .42rem .85rem;
    font-size: 13px;
    cursor: pointer;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.grp-dd-item:hover { background: var(--gray-100); }
.grp-dd-item.active { color: var(--orange); font-weight: 600; }
.grp-dd-check { flex-shrink: 0; color: var(--orange); }
.grp-dd-count {
    display: inline-block;
    background: var(--gray-200);
    color: var(--gray-600);
    border-radius: 10px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    margin-left: .2rem;
}
[data-theme="dark"] .grp-dd-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .grp-dd-btn:hover { border-color: var(--orange); color: var(--orange); }
[data-theme="dark"] .grp-dd-menu { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .grp-dd-search { border-color: #334155; }
[data-theme="dark"] .grp-dd-search input {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}
[data-theme="dark"] .grp-dd-search input::placeholder { color: #64748b; }
[data-theme="dark"] .grp-dd-item { color: #cbd5e1; }
[data-theme="dark"] .grp-dd-item:hover { background: #334155; }
[data-theme="dark"] .grp-dd-count { background: #334155; color: #94a3b8; }
