/* ============================================================
   HelmetSensorTracker — Design System
   Palette: Yellow (#F59E0B) · Orange (#F97316) · Black · White
   ============================================================ */

/* ---------- CSS Variables / Theming ---------- */
:root {
    --accent: #F59E0B;
    --accent-hover: #D97706;
    --accent-rgb: 245, 158, 11;
    --orange: #F97316;
    --orange-hover: #EA580C;
    --danger: #EF4444;
    --success: #10B981;
    --info: #06B6D4;
    --warning: #FBBF24;
}

[data-theme="dark"] {
    --bg-body: #0D0F12;
    --bg-surface: #151921;
    --bg-card: #1C2130;
    --bg-card-hover: #232838;
    --bg-sidebar: #111520;
    --bg-topbar: #151921;
    --bg-input: #1C2130;
    --border-color: rgba(255,255,255,0.07);
    --text-primary: #F1F1F3;
    --text-secondary: #8B8FA3;
    --text-muted: #5C6070;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
    --shadow-md: 0 4px 14px rgba(0,0,0,.45);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.55);
}

[data-theme="light"] {
    --bg-body: #F4F5F7;
    --bg-surface: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FAFAFA;
    --bg-sidebar: #1A1A2E;
    --bg-topbar: #FFFFFF;
    --bg-input: #FFFFFF;
    --border-color: rgba(0,0,0,0.08);
    --text-primary: #1A1A2E;
    --text-secondary: #555770;
    --text-muted: #999AAD;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 14px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.10);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }
@media (min-width: 768px) { html { font-size: 15px; } }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background .3s, color .3s;
}

/* Custom scrollbar — subtle transparent orange */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb), .18);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--accent-rgb), .35);
}
/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(245,158,11,.18) transparent;
}

a { color: var(--accent); transition: color .2s; }
a:hover { color: var(--accent-hover); }

.alarm-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.alarm-pill--warning {
    background: rgba(251,191,36,.14);
    color: #FCD34D;
}

.alarm-pill--critical {
    background: rgba(239,68,68,.14);
    color: #FCA5A5;
}

.alarm-pill--sos {
    background: rgba(220,38,38,.18);
    color: #FECACA;
    box-shadow: 0 0 0 1px rgba(248,113,113,.18) inset;
}

.alarm-pill--restricted {
    background: rgba(168,85,247,.16);
    color: #D8B4FE;
    box-shadow: 0 0 0 1px rgba(192,132,252,.18) inset;
}

.alarm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
}

.alarm-status-pill--open {
    background: rgba(249,115,22,.14);
    color: #FDBA74;
}

.alarm-status-pill--acknowledged {
    background: rgba(6,182,212,.14);
    color: #67E8F9;
}

.alarm-status-pill--resolved {
    background: rgba(16,185,129,.14);
    color: #6EE7B7;
}

.alarm-record-title {
    font-weight: 600;
    color: var(--text-primary);
}

.alarm-record-meta {
    font-size: .82rem;
    color: var(--text-secondary);
}

.alarm-record-reading {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border-color);
    font-size: .8rem;
    color: var(--text-secondary);
}

.alarm-record-reading strong {
    color: var(--text-primary);
}

.alarm-live-link {
    white-space: nowrap;
}

.alarm-map-modal {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.alarm-location-map {
    width: 100%;
    height: 360px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,.18);
}

.alarm-location-coords {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: .84rem;
}

::selection { background: rgba(var(--accent-rgb), .3); }

code {
    background: rgba(var(--accent-rgb), .1);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .85em;
}

/* Override Bootstrap text-muted for theme awareness */
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    font-size: 1.6rem;
    color: var(--accent);
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), .4));
}

.brand-text {
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    letter-spacing: .5px;
}

.sidebar-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.5);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0 10px;
}

.nav-list .nav-item { margin-bottom: 2px; }

.nav-list .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 10px;
    color: rgba(255,255,255,.55);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: all .2s;
}

.nav-list .nav-link i { font-size: 1.15rem; width: 22px; text-align: center; }

.nav-list .nav-link:hover {
    background: rgba(var(--accent-rgb), .08);
    color: rgba(255,255,255,.85);
}

.nav-list .nav-link.active {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .18), rgba(var(--accent-rgb), .08));
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,.45) !important;
    text-decoration: none;
    font-size: .85rem;
    transition: color .2s;
}
.logout-link:hover { color: var(--danger) !important; }

/* Theme toggle */
.theme-toggle {
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background .2s;
    display: flex;
    align-items: center;
}
.theme-toggle:hover { background: rgba(255,255,255,.08); }

[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; color: var(--accent); font-size: 1.1rem; }
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; color: var(--accent); font-size: 1.1rem; }

/* Sidebar responsive */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-wrapper { margin-left: 0 !important; }
}

/* Kill transitions during initial page load to prevent collapse flash */
.sidebar--no-transition,
.sidebar--no-transition *,
.sidebar--no-transition ~ .main-wrapper,
body.sidebar--no-transition .main-wrapper {
    transition: none !important;
}

/* ---------- Sidebar Collapse / Expand (desktop) ---------- */
.sidebar-collapse-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.07);
    color: rgba(255,255,255,.35);
    cursor: pointer;
    transition: all .2s;
    flex-shrink: 0;
    padding: 0;
}
@media (min-width: 992px) {
    .sidebar-collapse-btn { display: flex; }
}
.sidebar-collapse-btn:hover {
    background: rgba(var(--accent-rgb), .10);
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), .2);
}

/* Expand tab — small orange arrow on the collapsed sidebar edge */
.sidebar-expand-tab {
    display: none;
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 48px;
    border: none;
    border-radius: 0 8px 8px 0;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    color: #000;
    font-size: .7rem;
    cursor: pointer;
    z-index: 1041;
    padding: 0;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 10px rgba(0,0,0,.25);
    transition: width .2s, background .2s, box-shadow .2s;
}
.sidebar-expand-tab:hover {
    width: 18px;
    box-shadow: 2px 0 14px rgba(var(--accent-rgb), .4);
}
.sidebar-expand-tab i {
    font-size: .65rem;
    line-height: 1;
}

@media (min-width: 992px) {
    /* Smooth sidebar width transition */
    .sidebar {
        transition: width .3s cubic-bezier(.4,0,.2,1), transform .3s cubic-bezier(.4,0,.2,1);
    }
    .main-wrapper {
        transition: margin-left .3s cubic-bezier(.4,0,.2,1);
    }

    /* Collapsed sidebar */
    .sidebar.sidebar--collapsed {
        width: 72px;
    }
    .sidebar.sidebar--collapsed .sidebar-collapse-btn {
        display: none;
    }
    .sidebar.sidebar--collapsed .sidebar-expand-tab {
        display: flex;
    }
    .sidebar.sidebar--collapsed .brand-text,
    .sidebar.sidebar--collapsed .nav-list .nav-link span,
    .sidebar.sidebar--collapsed .logout-link span {
        opacity: 0;
        width: 0;
        overflow: hidden;
        white-space: nowrap;
        transition: opacity .2s, width .2s;
    }
    .sidebar.sidebar--collapsed .sidebar-header {
        padding: 16px 12px;
        justify-content: center;
    }
    .sidebar.sidebar--collapsed .sidebar-brand {
        justify-content: center;
    }
    .sidebar.sidebar--collapsed .sidebar-brand-logo {
        margin: 0;
    }
    .sidebar.sidebar--collapsed .nav-list {
        padding: 0 8px;
    }
    .sidebar.sidebar--collapsed .nav-list .nav-link {
        justify-content: center;
        padding: 12px;
        gap: 0;
    }
    .sidebar.sidebar--collapsed .nav-list .nav-link i {
        font-size: 1.2rem;
        width: auto;
    }
    .sidebar.sidebar--collapsed .sidebar-footer {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        align-items: center;
    }
    .sidebar.sidebar--collapsed .sidebar-footer .logout-link {
        justify-content: center;
    }
    body.sidebar-is-collapsed .main-wrapper {
        margin-left: 72px;
    }
}

/* ---------- Main Wrapper ---------- */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .3s;
}

/* ---------- Topbar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}
@media (max-width: 991.98px) { .hamburger { display: block; } }

.topbar-title h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.admin-greeting {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: .88rem;
    font-weight: 500;
}
.admin-greeting i { font-size: 1.3rem; color: var(--accent); }

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    padding: 28px 32px 48px;
}

@media (max-width: 575.98px) {
    .main-content { padding: 18px 16px 36px; }
    .topbar { padding: 0 14px; }
}

/* ---------- Stat Cards ---------- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform .2s, box-shadow .2s;
    min-height: 90px;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card--devices .stat-card__icon  { background: rgba(var(--accent-rgb), .15); color: var(--accent); }
.stat-card--online .stat-card__icon   { background: rgba(16,185,129,.15); color: var(--success); }
.stat-card--employees .stat-card__icon { background: rgba(99,102,241,.15); color: #6366F1; }
.stat-card--alerts .stat-card__icon   { background: rgba(239,68,68,.15); color: var(--danger); }

.stat-card__label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.stat-card__value { display: block; font-size: 1.8rem; font-weight: 800; line-height: 1.15; color: var(--text-primary); }

/* ---------- Panels ---------- */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow .2s;
}

.panel__header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel__title {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}
.panel__title i { color: var(--accent); }

.panel__body { padding: 24px; }

/* ---------- Tables ---------- */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-hover-bg: var(--bg-card-hover);
    --bs-table-hover-color: var(--text-primary);
    margin: 0;
    font-size: .88rem;
}

.table thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom-width: 1px;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:last-child td { border-bottom: none; }

/* ---------- Badge overrides ---------- */
.badge { font-weight: 600; font-size: .75rem; padding: 5px 10px; border-radius: 6px; }
.badge .small { font-size: .55rem; }

/* ---------- Buttons ---------- */
.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--orange));
    color: #fff;
    border: none;
    font-weight: 600;
    border-radius: 10px;
    transition: all .25s;
    box-shadow: 0 2px 10px rgba(var(--accent-rgb), .3);
}
.btn-accent:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--orange-hover));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(var(--accent-rgb), .4);
}

.btn-outline-accent {
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: transparent;
    font-weight: 500;
    transition: all .2s;
}
.btn-outline-accent:hover {
    background: rgba(var(--accent-rgb), .12);
    color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
}
.btn-outline-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* ---------- Form Controls ---------- */
.form-control, .form-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15);
}
/* Disabled / read-only — override Bootstrap's bright grey with theme variables */
.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    background: var(--bg-input) !important;
    color: var(--text-muted) !important;
    border-color: var(--border-color) !important;
    opacity: 0.55;
    cursor: not-allowed;
}
.form-control::placeholder { color: var(--text-muted); }

.form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: .4rem;
}

.form-floating > label { color: var(--text-muted); }
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    color: var(--accent);
}
/* Remove the Bootstrap 5.3 background pill behind floating labels */
.form-floating > .form-control:focus ~ label::after,
.form-floating > .form-control:not(:placeholder-shown) ~ label::after,
.form-floating > .form-select ~ label::after,
.form-floating > .form-control:disabled ~ label::after,
.form-floating > .form-control[readonly] ~ label::after {
    background-color: transparent !important;
}
/* Floating label background matches the input when filled/focused */
.form-floating > .form-control:disabled ~ label,
.form-floating > .form-control[readonly] ~ label {
    color: var(--text-muted);
    opacity: 0.7;
}

.input-group-text {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 10px 0 0 10px;
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .2); }

/* ---------- Alert — theme-aware overrides ---------- */
.alert { border-radius: 10px; font-size: .9rem; }
.alert-success {
    background: rgba(16, 185, 129, .12);
    border: 1px solid rgba(16, 185, 129, .25);
    color: var(--text-primary);
}
.alert-success .btn-close { filter: invert(1) brightness(.7); }
.alert-warning {
    background: rgba(251, 191, 36, .1);
    border: 1px solid rgba(251, 191, 36, .25);
    color: var(--text-primary);
}
.alert-danger {
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .25);
    color: var(--text-primary);
}
.alert-info {
    background: rgba(6, 182, 212, .1);
    border: 1px solid rgba(6, 182, 212, .25);
    color: var(--text-primary);
}

/* ---------- Settings page — MFA status badge ---------- */
.settings-mfa-status {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: .85rem;
    line-height: 1.5;
    border: 1px solid;
}
.settings-mfa-status i { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.settings-mfa-status--on {
    background: rgba(16, 185, 129, .1);
    border-color: rgba(16, 185, 129, .25);
    color: var(--success);
}
.settings-mfa-status--on span { color: var(--text-primary); }
.settings-mfa-status--off {
    background: rgba(251, 191, 36, .08);
    border-color: rgba(251, 191, 36, .2);
    color: var(--warning);
}
.settings-mfa-status--off span { color: var(--text-primary); }

/* ---------- Progress ---------- */
.progress { background: var(--bg-body); border-radius: 6px; }

/* ---------- Detail Items ---------- */
.detail-item label {
    display: block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
}
.detail-item span { font-size: .9rem; color: var(--text-primary); }

/* ---------- Activity Feed ---------- */
.activity-feed {
    list-style: none;
    margin: 0;
    padding: 16px 20px;
}
.activity-feed__item {
    display: flex;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
}
.activity-feed__item:last-child { border-bottom: none; }

.activity-feed__dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    margin-top: 7px;
    flex-shrink: 0;
}

.activity-feed__content p { font-size: .88rem; }

/* ---------- Avatar ---------- */
.avatar-sm {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
    flex-shrink: 0;
}

/* ---------- Color Swatches (settings) ---------- */
.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: default;
}

/* ==========================================================
   AUTH PAGES  (Login, Landing)
   ========================================================== */
.auth-body {
    min-height: 100vh;
    background: #0D0F12;
    color: #F1F1F3;
}

/* ---------- Landing Page ---------- */
.landing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Landing Navbar ---- */
.landing-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    border-bottom: 1px solid transparent;
    transition: background .35s, backdrop-filter .35s, border-color .35s, box-shadow .35s;
}
.landing-nav--scrolled {
    background: rgba(10,12,15,.88);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border-color: rgba(255,255,255,.07);
    box-shadow: 0 4px 32px rgba(0,0,0,.55);
}
.landing-nav__container {
    max-width: 1200px;
    margin: 0 auto;
    height: 72px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 24px;
}
/* Brand */
.landing-nav__brand {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
    letter-spacing: .2px;
    transition: opacity .2s;
}
.landing-nav__brand:hover { opacity: .85; color: #fff; }
.landing-nav__brand strong { font-weight: 800; color: var(--accent); }
.landing-nav__logo {
    width: 26px; height: 26px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), .55));
}
/* Desktop links */
.landing-nav__links {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0 auto;
    padding: 0;
}
.landing-nav__link {
    display: inline-block;
    padding: 7px 13px;
    font-size: .875rem;
    font-weight: 500;
    color: rgba(255,255,255,.55);
    text-decoration: none;
    border-radius: 8px;
    transition: color .2s, background .2s;
    white-space: nowrap;
}
.landing-nav__link:hover {
    color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.06);
}
.landing-nav__link.active {
    color: var(--accent);
    background: rgba(var(--accent-rgb), .08);
}
/* Actions */
.landing-nav__actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.landing-nav__login {
    padding: 8px 20px;
    font-size: .83rem;
    font-weight: 600;
    white-space: nowrap;
}
/* Hamburger */
.landing-nav__hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px; height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
}
.landing-nav__hamburger span {
    display: block;
    width: 100%; height: 2px;
    background: rgba(255,255,255,.75);
    border-radius: 2px;
    transition: transform .3s cubic-bezier(.25,.46,.45,.94), opacity .2s;
    transform-origin: center;
}
.landing-nav__hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.landing-nav__hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.landing-nav__hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
/* Mobile dropdown */
.landing-nav__mobile {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .38s cubic-bezier(.25,.46,.45,.94), opacity .28s;
    background: rgba(10,12,17,.97);
    border-top: 1px solid transparent;
}
.landing-nav__mobile.open {
    max-height: 520px;
    opacity: 1;
    border-top-color: rgba(255,255,255,.07);
}
.landing-nav__mobile ul {
    list-style: none;
    margin: 0;
    padding: 8px 20px 0;
}
.landing-nav__mobile ul li {
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.landing-nav__mobile ul li:last-child { border-bottom: none; }
.landing-nav__mobile .landing-nav__link {
    display: block;
    width: 100%;
    padding: 14px 0;
    font-size: .92rem;
    border-radius: 0;
    color: rgba(255,255,255,.6);
}
.landing-nav__mobile .landing-nav__link:hover,
.landing-nav__mobile .landing-nav__link.active {
    background: none;
    color: var(--accent);
}
.landing-nav__mobile .landing-nav__mobile-cta {
    display: block;
    margin: 14px 20px 20px;
}
/* Responsive — collapse links on mobile */
@media (max-width: 767px) {
    .landing-nav__links,
    .landing-nav__actions { display: none; }
    .landing-nav__hamburger { display: flex; }
    .landing-nav__container { gap: 0; padding: 0 20px; }
}
@media (min-width: 768px) and (max-width: 991px) {
    .landing-nav__link { padding: 7px 9px; font-size: .82rem; }
    .landing-nav__container { padding: 0 20px; gap: 12px; }
}

/* Offset hero content below the fixed navbar */
.landing-page .landing-hero {
    padding-top: 152px;
}

/* ---- Hero ---- */
.landing-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px 100px;
    min-height: 100vh;
    overflow: hidden;
    background: linear-gradient(180deg, #0A0C0F 0%, #0D0F12 30%, #111520 60%, #151921 100%);
}

.landing-hero__mesh {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 55% at 50% -5%, rgba(var(--accent-rgb), .14) 0%, transparent 60%),
        radial-gradient(ellipse 60% 45% at 15% 85%, rgba(249,115,22,.08) 0%, transparent 55%),
        radial-gradient(ellipse 55% 50% at 88% 55%, rgba(6,182,212,.06) 0%, transparent 50%);
    animation: meshShift 14s ease-in-out infinite alternate;
}
@keyframes meshShift {
    0%   { opacity: .65; transform: scale(1) rotate(0deg); }
    100% { opacity: 1;   transform: scale(1.06) rotate(.5deg); }
}

.landing-hero__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    pointer-events: none;
}
.landing-hero__glow--left {
    width: 420px; height: 420px;
    left: -120px; top: 28%;
    background: var(--accent);
    opacity: .12;
    animation: glowFloat 9s ease-in-out infinite alternate;
}
.landing-hero__glow--right {
    width: 350px; height: 350px;
    right: -80px; bottom: 18%;
    background: var(--orange);
    opacity: .1;
    animation: glowFloat 11s ease-in-out infinite alternate-reverse;
}
@keyframes glowFloat {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(30px, -45px); }
}

.landing-particles-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto;
}

.landing-content { position: relative; z-index: 2; max-width: 1200px; width: 100%; padding: 0 32px; }

/* ---- Hero tag badge ---- */
.landing-hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 18px;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(var(--accent-rgb), .06);
    border: 1px solid rgba(var(--accent-rgb), .15);
    margin-bottom: 28px;
    backdrop-filter: blur(6px);
}
.landing-hero-tag__dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(var(--accent-rgb), .7);
    animation: heroTagPulse 2s ease-in-out infinite;
}
@keyframes heroTagPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(var(--accent-rgb), .7); }
    50%      { opacity: .35; box-shadow: 0 0 4px rgba(var(--accent-rgb), .3); }
}

/* ---- Logo Showcase ---- */
.landing-logo-showcase {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 400px;
    height: 400px;
    margin: 0 auto;
}
.landing-logo-showcase__ring {
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    border: 1px solid rgba(var(--accent-rgb), .1);
    animation: showcaseRingSpin 22s linear infinite;
}
.landing-logo-showcase__ring--outer {
    inset: -25px;
    border: 1px dashed rgba(var(--accent-rgb), .06);
    animation-duration: 38s;
    animation-direction: reverse;
}
.landing-logo-showcase__pulse {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--accent-rgb), .1) 0%, transparent 65%);
    animation: showcasePulse 4.5s ease-in-out infinite;
    pointer-events: none;
}
@keyframes showcaseRingSpin { to { transform: rotate(360deg); } }
@keyframes showcasePulse {
    0%, 100% { transform: scale(.9); opacity: .4; }
    50%      { transform: scale(1.1); opacity: 1; }
}

/* Orbiting dots */
.landing-logo-showcase__orbit {
    position: absolute;
    inset: -8px;
    animation: showcaseRingSpin 16s linear infinite;
}
.orbit-dot {
    position: absolute;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), .7), 0 0 24px rgba(var(--accent-rgb), .25);
    top: 50%; left: 0;
    transform: translate(-50%, -50%);
}
.orbit-dot--2 {
    top: 8%; left: 60%;
    background: var(--orange);
    box-shadow: 0 0 12px rgba(249,115,22,.7), 0 0 24px rgba(249,115,22,.25);
    width: 5px; height: 5px;
}
.orbit-dot--3 {
    top: 85%; left: 72%;
    background: #06B6D4;
    box-shadow: 0 0 12px rgba(6,182,212,.7), 0 0 24px rgba(6,182,212,.25);
    width: 4px; height: 4px;
}

.landing-brand-logo {
    position: relative;
    z-index: 2;
    max-width: 260px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 60px rgba(var(--accent-rgb), .45)) drop-shadow(0 0 120px rgba(var(--accent-rgb), .18));
    animation: logoFloat 6s ease-in-out infinite;
}
@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-14px); }
}

.landing-brand-tagline {
    margin-top: 32px;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.landing-brand-tagline__line {
    display: block;
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 2px;
}

/* ---- Logo Showcase responsive ---- */
@media (max-width: 991px) {
    .landing-logo-showcase { width: 320px; height: 320px; }
    .landing-brand-logo { max-width: 210px; }
}
@media (max-width: 575px) {
    .landing-logo-showcase { width: 260px; height: 260px; }
    .landing-brand-logo { max-width: 170px; }
}

/* ---- Hero mobile responsiveness ---- */
@media (max-width: 767px) {
    .landing-page .landing-hero {
        padding-top: 120px;
    }
    .landing-hero {
        padding: 60px 12px 70px;
        min-height: auto;
    }
    .landing-content {
        padding: 0 16px;
    }
    /* Reduce heavy drop-shadow so logo stays crisp on small screens */
    .landing-brand-logo {
        filter: drop-shadow(0 0 30px rgba(var(--accent-rgb), .35)) drop-shadow(0 0 50px rgba(var(--accent-rgb), .12));
    }
    /* Tone down glow orbs – they overwhelm the logo on narrow viewports */
    .landing-hero__glow {
        filter: blur(70px);
    }
    .landing-hero__glow--left {
        width: 260px; height: 260px;
        left: -80px;
        opacity: .08;
    }
    .landing-hero__glow--right {
        width: 220px; height: 220px;
        right: -60px;
        opacity: .07;
    }
    .landing-logo-showcase__pulse {
        inset: -10px;
    }
    .landing-brand-tagline {
        margin-top: 20px;
        font-size: .72rem;
        letter-spacing: 2px;
    }
    .landing-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }
    .landing-typing {
        font-size: 1.1rem;
    }
    .landing-actions {
        margin-bottom: 30px;
    }
    .landing-trust {
        gap: 16px;
    }
    .landing-hero__scroll {
        bottom: 16px;
    }
}

@media (max-width: 575px) {
    .landing-page .landing-hero {
        padding-top: 100px;
    }
    .landing-hero {
        padding: 40px 8px 50px;
    }
    .landing-content {
        padding: 0 10px;
    }
    /* Further reduce blur so the helmet logo stays sharp on small phones */
    .landing-brand-logo {
        filter: drop-shadow(0 0 18px rgba(var(--accent-rgb), .28)) drop-shadow(0 0 30px rgba(var(--accent-rgb), .08));
    }
    .landing-hero__glow {
        filter: blur(50px);
    }
    .landing-hero__glow--left {
        width: 180px; height: 180px;
        left: -60px;
        opacity: .06;
    }
    .landing-hero__glow--right {
        width: 150px; height: 150px;
        right: -50px;
        opacity: .05;
    }
    .landing-hero-tag {
        font-size: .65rem;
        padding: 5px 14px;
        margin-bottom: 20px;
    }
    .landing-subtitle {
        font-size: .92rem;
        margin-bottom: 24px;
        line-height: 1.7;
    }
    .landing-typing {
        font-size: 1rem;
    }
    .landing-actions {
        gap: 10px;
        margin-bottom: 24px;
    }
    .landing-actions .btn-lg {
        font-size: .88rem;
        padding: 10px 20px;
    }
    .landing-trust {
        gap: 12px;
    }
    .landing-trust span {
        font-size: .72rem;
    }
    .landing-logo-showcase__ring--outer {
        inset: -14px;
    }
    .landing-brand-tagline {
        margin-top: 16px;
        font-size: .66rem;
        letter-spacing: 1.5px;
    }
}

@media (max-width: 400px) {
    .landing-page .landing-hero {
        padding-top: 90px;
    }
    .landing-hero {
        padding: 30px 6px 40px;
    }
    .landing-logo-showcase { width: 220px; height: 220px; }
    .landing-brand-logo {
        max-width: 140px;
        filter: drop-shadow(0 0 12px rgba(var(--accent-rgb), .22));
    }
    .landing-hero__glow--left {
        width: 140px; height: 140px;
        opacity: .05;
    }
    .landing-hero__glow--right {
        width: 120px; height: 120px;
        opacity: .04;
    }
    .landing-title {
        font-size: 1.9rem;
    }
}

/* Badge */
.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(var(--accent-rgb), .08);
    border: 1px solid rgba(var(--accent-rgb), .18);
    margin-bottom: 30px;
    backdrop-filter: blur(4px);
}
.landing-badge i { font-size: .9rem; }

/* Logo icon */
.landing-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 104px; height: 104px;
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .18), rgba(249,115,22,.13));
    margin-bottom: 34px;
    font-size: 3.2rem;
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb), .12);
    box-shadow: 0 0 70px rgba(var(--accent-rgb), .22), inset 0 0 40px rgba(var(--accent-rgb),.04);
    animation: logoPulse 3.5s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 70px rgba(var(--accent-rgb), .2), inset 0 0 40px rgba(var(--accent-rgb),.04); transform: scale(1); }
    50%      { box-shadow: 0 0 100px rgba(var(--accent-rgb), .4), inset 0 0 40px rgba(var(--accent-rgb),.08); transform: scale(1.03); }
}

.landing-title {
    font-size: 4.8rem;
    font-weight: 800;
    margin-bottom: 18px;
    letter-spacing: -2px;
    color: #fff;
    line-height: 1.05;
    text-shadow: 0 0 80px rgba(var(--accent-rgb), .15);
}
@media (max-width: 991px) { .landing-title { font-size: 3.6rem; letter-spacing: -1px; } }
@media (max-width: 767px) { .landing-title { font-size: 2.8rem; } }
@media (max-width: 575px) { .landing-title { font-size: 2.2rem; letter-spacing: -.5px; } }

/* Typing effect */
.landing-typing {
    font-size: 1.25rem;
    color: var(--accent);
    font-weight: 600;
    min-height: 1.8em;
    margin-bottom: 10px;
}
.typing-cursor {
    display: inline-block;
    color: var(--accent);
    animation: blink .7s step-end infinite;
    font-weight: 300;
    margin-left: 1px;
}
@keyframes blink {
    50% { opacity: 0; }
}

.landing-subtitle {
    font-size: 1.12rem;
    color: rgba(255,255,255,.50);
    line-height: 1.8;
    margin-bottom: 42px;
    max-width: 520px;
}
@media (max-width: 991px) { .landing-subtitle { margin-left: auto; margin-right: auto; } }

.landing-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 44px;
}
@media (max-width: 991px) { .landing-actions { justify-content: center; } }

/* Glow button effect */
.landing-btn-glow {
    position: relative;
    overflow: hidden;
    z-index: 1;
}
.landing-btn-glow::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    opacity: 0;
    z-index: -1;
    filter: blur(16px);
    transition: opacity .35s;
}
.landing-btn-glow:hover::after { opacity: .55; }

/* Ghost button (Explore Features) */
.landing-btn-ghost {
    color: rgba(255,255,255,.85);
    border: 1px solid rgba(255,255,255,.15);
    background: rgba(255,255,255,.04);
    backdrop-filter: blur(6px);
    border-radius: 10px;
    font-weight: 600;
    transition: all .3s cubic-bezier(.25,.46,.45,.94);
}
.landing-btn-ghost:hover {
    color: #fff;
    border-color: rgba(var(--accent-rgb), .4);
    background: rgba(var(--accent-rgb), .1);
    box-shadow: 0 0 20px rgba(var(--accent-rgb), .15);
    transform: translateY(-1px);
}
.landing-btn-ghost i {
    transition: transform .3s;
}
.landing-btn-ghost:hover i {
    transform: scale(1.15);
}

/* Trust badges */
.landing-trust {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}
@media (max-width: 991px) { .landing-trust { justify-content: center; } }
.landing-trust span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .78rem;
    color: rgba(255,255,255,.32);
    font-weight: 500;
}
.landing-trust i { color: rgba(var(--accent-rgb), .55); font-size: .85rem; }

/* Scroll indicator */
.landing-hero__scroll {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}
.landing-hero__scroll a {
    color: rgba(255,255,255,.22);
    font-size: 1.3rem;
    text-decoration: none;
    animation: scrollBounce 2.2s ease-in-out infinite;
    transition: color .2s;
}
.landing-hero__scroll a:hover { color: rgba(255,255,255,.5); }
@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(10px); }
}

/* ---- Section Headers ---- */
.landing-section-header {
    text-align: center;
    margin-bottom: 52px;
}
.landing-section-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: .73rem;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(var(--accent-rgb), .07);
    border: 1px solid rgba(var(--accent-rgb), .14);
    margin-bottom: 18px;
}
.landing-section-header h2 {
    font-size: 2.3rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 14px;
    letter-spacing: -.5px;
    line-height: 1.2;
}
.landing-section-header p {
    font-size: 1.02rem;
    color: rgba(255,255,255,.42);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ---- 5. Feature Cards ---- */
.landing-features {
    background: #111520;
    border-top: 1px solid rgba(255,255,255,.04);
    padding: 90px 0;
    position: relative;
}

.feature-card {
    text-align: center;
    padding: 34px 20px 28px;
    border-radius: 18px;
    background: rgba(255,255,255,.022);
    border: 1px solid rgba(255,255,255,.05);
    transition: transform .3s cubic-bezier(.4,0,.2,1), box-shadow .3s, border-color .3s;
    height: 100%;
    position: relative;
    overflow: hidden;
}
.feature-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--orange), transparent);
    opacity: 0;
    transition: opacity .35s;
}
.feature-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 16px 50px rgba(0,0,0,.4);
    border-color: rgba(var(--accent-rgb), .13);
}
.feature-card:hover::before { opacity: 1; }

.feature-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px; height: 58px;
    border-radius: 16px;
    margin-bottom: 20px;
    font-size: 1.5rem;
    transition: transform .3s, box-shadow .3s;
}
.feature-card:hover .feature-card__icon { transform: scale(1.1); }
.feature-card__icon--amber  { background: rgba(var(--accent-rgb), .12); color: var(--accent); }
.feature-card__icon--orange { background: rgba(249,115,22,.12); color: var(--orange); }
.feature-card__icon--cyan   { background: rgba(6,182,212,.12); color: var(--info); }
.feature-card__icon--green  { background: rgba(16,185,129,.12); color: var(--success); }
.feature-card__icon--purple { background: rgba(99,102,241,.12); color: #818CF8; }
.feature-card__icon--rose   { background: rgba(244,63,94,.12); color: #FB7185; }

.feature-card h5 { font-size: .95rem; font-weight: 700; color: #fff; margin-bottom: 10px; }
.feature-card p  { font-size: .82rem; color: rgba(255,255,255,.4); margin: 0 0 16px; line-height: 1.65; }

.feature-card__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.035);
    color: rgba(255,255,255,.22);
    font-size: .8rem;
    transition: all .25s;
}
.feature-card:hover .feature-card__arrow {
    background: rgba(var(--accent-rgb), .15);
    color: var(--accent);
    transform: translateX(4px);
}

/* Wide variant for alternating row */
.feature-card--wide {
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 30px 28px;
}
.feature-card--wide .feature-card__icon { flex-shrink: 0; margin-bottom: 0; }
.feature-card--wide .feature-card__arrow { margin-left: auto; align-self: center; }

/* ---- 3. How It Works ---- */
.landing-how {
    padding: 90px 0;
    background: #0D0F12;
    position: relative;
}
.landing-steps { position: relative; }
.landing-steps__line {
    display: none;
}
@media (min-width: 768px) {
    .landing-steps__line {
        display: block;
        position: absolute;
        top: 38px;
        left: 20%;
        right: 20%;
        height: 2px;
        background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .2), rgba(var(--accent-rgb), .2), transparent);
        z-index: 0;
    }
}

.how-step {
    text-align: center;
    padding: 40px 24px 32px;
    border-radius: 18px;
    background: rgba(255,255,255,.02);
    border: 1px solid rgba(255,255,255,.05);
    position: relative;
    z-index: 1;
    transition: transform .3s, box-shadow .3s, border-color .3s;
    height: 100%;
}
.how-step:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,.35);
    border-color: rgba(var(--accent-rgb), .12);
}
.how-step__number {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    color: #000;
    font-size: .78rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(var(--accent-rgb), .35);
}
.how-step__icon {
    font-size: 2.2rem;
    color: var(--accent);
    margin-bottom: 18px;
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),.2));
}
.how-step h5 { font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 10px; }
.how-step p  { font-size: .85rem; color: rgba(255,255,255,.4); margin: 0; line-height: 1.65; }

/* ---- 4. Metrics ---- */
.landing-metrics {
    padding: 72px 0;
    background: linear-gradient(180deg, #151921 0%, #111520 100%);
    border-top: 1px solid rgba(255,255,255,.04);
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.metric-item { padding: 20px 10px; }

/* Odometer rolling digits */
.odometer {
    display: inline-flex;
    align-items: center;
    height: 3.2rem;
    overflow: hidden;
}
.odometer__slot {
    display: inline-block;
    height: 3.2rem;
    overflow: hidden;
    position: relative;
}
.odometer__strip {
    display: flex;
    flex-direction: column;
    transition: transform 1.6s cubic-bezier(.16,1,.3,1);
    will-change: transform;
}
.odometer__num {
    display: block;
    height: 3.2rem;
    line-height: 3.2rem;
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    text-align: center;
    min-width: .55em;
}
.odometer__sep {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 3.2rem;
}

.metric-item__suffix {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: .8;
    vertical-align: top;
    line-height: 3.2rem;
}
.metric-item p {
    margin: 10px 0 0;
    font-size: .78rem;
    color: rgba(255,255,255,.38);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .7px;
}

/* ---- Comparison Table ---- */
.landing-compare {
    padding: 90px 0;
    background: #111520;
    position: relative;
}
.compare-table {
    max-width: 720px;
    margin: 0 auto;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.06);
    overflow: hidden;
    background: rgba(255,255,255,.015);
}
.compare-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    border-bottom: 1px solid rgba(255,255,255,.04);
    transition: background .25s;
}
.compare-row:last-child { border-bottom: none; }
.compare-row:not(.compare-row--header):hover {
    background: rgba(var(--accent-rgb), .04);
}
.compare-row--header {
    background: rgba(255,255,255,.03);
}
.compare-cell {
    padding: 14px 20px;
    font-size: .84rem;
    color: rgba(255,255,255,.5);
    display: flex;
    align-items: center;
    justify-content: center;
}
.compare-cell--feature {
    justify-content: flex-start;
    font-weight: 600;
    color: rgba(255,255,255,.7);
}
.compare-row--header .compare-cell {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: rgba(255,255,255,.35);
    padding: 12px 20px;
}
.compare-row--header .compare-cell--us {
    color: var(--accent);
}
.compare-yes { color: var(--accent); font-size: 1.1rem; filter: drop-shadow(0 0 4px rgba(var(--accent-rgb),.3)); }
.compare-no { color: rgba(255,255,255,.15); font-size: 1.1rem; }
.compare-partial { color: rgba(255,255,255,.25); font-size: 1.1rem; }
.compare-tag {
    font-size: .68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.compare-tag--good {
    background: rgba(var(--accent-rgb), .12);
    color: var(--accent);
}
.compare-tag--bad {
    background: rgba(239,68,68,.1);
    color: rgba(239,68,68,.6);
}
@media (max-width: 575px) {
    .compare-cell { padding: 10px 12px; font-size: .76rem; }
}

/* ---- 3D Tilt (feature cards) ---- */
[data-tilt] {
    transition: transform .2s ease-out, box-shadow .3s, border-color .3s;
    transform-style: preserve-3d;
}

/* ---- 6. CTA Banner ---- */
.landing-cta {
    padding: 90px 0;
    background: #0A0C0F;
    position: relative;
    overflow: hidden;
}
.landing-cta__glow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 550px; height: 320px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(var(--accent-rgb), .1), transparent 70%);
    filter: blur(70px);
    pointer-events: none;
    animation: ctaPulse 5s ease-in-out infinite alternate;
}
@keyframes ctaPulse {
    0%   { opacity: .5; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 1;  transform: translate(-50%, -50%) scale(1.1); }
}
.landing-cta h2 {
    font-size: 2.1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 14px;
}
.landing-cta p {
    font-size: 1.05rem;
    color: rgba(255,255,255,.42);
    margin-bottom: 30px;
    line-height: 1.7;
}

/* ---- 7. Footer ---- */
.landing-footer {
    padding: 0;
    font-size: .82rem;
    color: rgba(255,255,255,.3);
    background: #06070A;
    position: relative;
    overflow: hidden;
}

/* Glowing gradient top border */
.footer-glow-border {
    height: 2px;
    background: linear-gradient(90deg, transparent 5%, var(--accent), var(--orange), var(--accent), transparent 95%);
    opacity: .5;
}

.footer-grid { padding: 60px 0 40px; }

/* Brand */
.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,.8);
    font-size: 1.1rem;
    margin-bottom: 16px;
}
.footer-brand i {
    font-size: 1.5rem;
    color: var(--accent);
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),.35));
}
.footer-brand strong { font-weight: 700; }
.footer-brand-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), .35));
}
.sidebar-brand-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), .4));
}

.footer-desc {
    font-size: .84rem;
    color: rgba(255,255,255,.35);
    line-height: 1.7;
    margin-bottom: 20px;
    max-width: 320px;
}

/* Status pill */
.footer-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--success);
    background: rgba(16,185,129,.08);
    border: 1px solid rgba(16,185,129,.15);
}
.footer-status__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(16,185,129,.5);
    animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .4; }
}

/* Column headings */
.footer-heading {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: rgba(255,255,255,.5);
    margin-bottom: 18px;
}

/* Nav links */
.footer-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}
.footer-nav li { margin-bottom: 10px; }
.footer-nav a {
    color: rgba(255,255,255,.3);
    text-decoration: none;
    font-size: .84rem;
    transition: color .2s, padding-left .2s;
}
.footer-nav a:hover {
    color: var(--accent);
    padding-left: 4px;
}

/* Newsletter */
.footer-newsletter-desc {
    font-size: .82rem;
    color: rgba(255,255,255,.32);
    line-height: 1.65;
    margin-bottom: 14px;
}
.footer-newsletter {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.footer-newsletter__input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    padding: 0 14px;
    transition: border-color .2s;
}
.footer-newsletter__input:focus-within {
    border-color: rgba(var(--accent-rgb), .3);
}
.footer-newsletter__input i {
    color: rgba(255,255,255,.2);
    font-size: .9rem;
    flex-shrink: 0;
}
.footer-newsletter__input input {
    background: none;
    border: none;
    outline: none;
    color: rgba(255,255,255,.6);
    font-size: .82rem;
    padding: 10px 0;
    width: 100%;
}
.footer-newsletter__input input::placeholder {
    color: rgba(255,255,255,.2);
}
.footer-newsletter .btn {
    flex-shrink: 0;
    padding: 8px 18px;
}

/* Socials */
.footer-socials {
    display: flex;
    gap: 10px;
}
.footer-socials a {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    color: rgba(255,255,255,.3);
    font-size: .95rem;
    text-decoration: none;
    transition: all .25s;
}
.footer-socials a:hover {
    background: rgba(var(--accent-rgb), .12);
    border-color: rgba(var(--accent-rgb), .2);
    color: var(--accent);
    transform: translateY(-2px);
}

/* Bottom bar */
.footer-bottom {
    padding-bottom: 28px;
}
.footer-bottom__line {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
    margin-bottom: 24px;
}
.footer-copy {
    margin: 0;
    font-size: .76rem;
    color: rgba(255,255,255,.2);
}

@media (max-width: 767px) {
    .footer-grid { padding: 40px 0 24px; }
    .footer-desc { max-width: none; }
}

/* ---- Animated Gradient Text ---- */
.text-gradient-shift {
    background: linear-gradient(90deg, #FBBF24, var(--accent), var(--orange), var(--orange-hover), var(--accent));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease-in-out infinite;
}
@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---- Gradient Logo Border ---- */
.landing-logo-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 34px;
    padding: 4px;
    border-radius: 32px;
}
.landing-logo-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 32px;
    padding: 2px;
    background: linear-gradient(135deg, #FBBF24, var(--accent), var(--orange), var(--orange-hover));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: .7;
    transition: opacity .3s;
}
.landing-logo-wrap:hover::before {
    opacity: 1;
}
.landing-logo-wrap .landing-logo {
    margin-bottom: 0;
}

/* ---- Tech Marquee Strip ---- */
.tech-marquee {
    overflow: hidden;
    background: #111520;
    border-bottom: 1px solid rgba(255,255,255,.04);
    padding: 16px 0;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.tech-marquee__track {
    display: flex;
    gap: 18px;
    width: max-content;
    animation: marqueeScroll 30s linear infinite;
}
@keyframes marqueeScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.tech-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .3px;
    color: rgba(255,255,255,.35);
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    white-space: nowrap;
    flex-shrink: 0;
}
.tech-pill i { color: rgba(var(--accent-rgb), .45); font-size: .8rem; }

/* ---- SVG Wave Dividers ---- */
.wave-divider {
    line-height: 0;
    background: linear-gradient(180deg, #0D0F12, #111520);
    margin-top: -2px;
}
.wave-divider svg {
    width: 100%;
    height: 40px;
    display: block;
}
.wave-divider--flip {
    background: linear-gradient(180deg, #111520, #0D0F12);
    margin-top: 0;
    margin-bottom: -2px;
}
.wave-divider--flip svg {
    transform: scaleY(-1);
}

/* ---- Mouse-Follow Spotlight on Features ---- */
.features-spotlight {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity .4s;
}
.landing-features { position: relative; overflow: hidden; }
.landing-features:hover .features-spotlight { opacity: 1; }
.landing-features .container { position: relative; z-index: 1; }

/* ---- Dashboard Preview ---- */
.landing-preview {
    padding: 90px 0;
    background: #111520;
    position: relative;
}

.preview-frame {
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.07);
    background: rgba(255,255,255,.02);
    overflow: hidden;
    box-shadow: 0 20px 80px rgba(0,0,0,.5), 0 0 60px rgba(var(--accent-rgb),.06);
    transform: perspective(1200px) rotateX(2deg);
    transition: transform .5s cubic-bezier(.25,.46,.45,.94), box-shadow .5s;
}
.preview-frame:hover {
    transform: perspective(1200px) rotateX(0deg);
    box-shadow: 0 30px 100px rgba(0,0,0,.6), 0 0 80px rgba(var(--accent-rgb),.1);
}

.preview-frame__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255,255,255,.03);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.preview-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
}
.preview-dot--red    { background: #EF4444; }
.preview-dot--yellow { background: #FBBF24; }
.preview-dot--green  { background: #10B981; }
.preview-frame__url {
    margin-left: 12px;
    font-size: .7rem;
    color: rgba(255,255,255,.3);
    background: rgba(255,255,255,.04);
    padding: 4px 12px;
    border-radius: 6px;
    font-family: 'Segoe UI', monospace;
}

.preview-frame__body {
    padding: 20px;
}

/* Mock stat cards */
.preview-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 575px) { .preview-stats { grid-template-columns: repeat(2, 1fr); } }
.preview-stat {
    background: rgba(var(--accent-rgb), .06);
    border: 1px solid rgba(var(--accent-rgb), .1);
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
}
.preview-stat--green { background: rgba(16,185,129,.06); border-color: rgba(16,185,129,.1); }
.preview-stat--blue  { background: rgba(99,102,241,.06); border-color: rgba(99,102,241,.1); }
.preview-stat--red   { background: rgba(239,68,68,.06); border-color: rgba(239,68,68,.1); }
.preview-stat__val {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}
.preview-stat--green .preview-stat__val { color: var(--success); }
.preview-stat--blue  .preview-stat__val { color: #818CF8; }
.preview-stat--red   .preview-stat__val { color: var(--danger); }
.preview-stat__lbl {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: rgba(255,255,255,.35);
    font-weight: 600;
}

/* Mock chart + table grid */
.preview-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 12px;
}
@media (max-width: 767px) { .preview-grid { grid-template-columns: 1fr; } }

.preview-chart, .preview-table {
    background: rgba(255,255,255,.02);
    border: 1px solid rgba(255,255,255,.05);
    border-radius: 10px;
    overflow: hidden;
}
.preview-chart__header, .preview-table__header {
    padding: 10px 14px;
    font-size: .7rem;
    font-weight: 700;
    color: rgba(255,255,255,.4);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.preview-chart__header i, .preview-table__header i { color: var(--accent); }

.preview-chart__bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 16px 14px;
    height: 130px;
}
.preview-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--accent), rgba(var(--accent-rgb),.25));
    animation: barGrow 1.5s ease-out both;
    transform-origin: bottom;
}
@keyframes barGrow {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

.preview-table__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: .72rem;
    color: rgba(255,255,255,.5);
    border-bottom: 1px solid rgba(255,255,255,.03);
}
.preview-table__row:last-child { border-bottom: none; }
.preview-table__time {
    margin-left: auto;
    color: rgba(255,255,255,.25);
    font-size: .65rem;
}
.preview-dot-sm {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.preview-dot-sm--green { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,.4); }
.preview-dot-sm--amber { background: var(--accent); box-shadow: 0 0 6px rgba(var(--accent-rgb),.4); }
.preview-dot-sm--red   { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,.4); }

/* ---- Roadmap Timeline ---- */
.landing-timeline {
    padding: 90px 0;
    background: #0D0F12;
    position: relative;
}

.timeline {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 0;
}
.timeline__line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent, rgba(var(--accent-rgb),.15) 10%, rgba(var(--accent-rgb),.15) 90%, transparent);
    transform: translateX(-50%);
}

.timeline__item {
    position: relative;
    display: flex;
    justify-content: flex-end;
    padding-right: calc(50% + 30px);
    margin-bottom: 40px;
}
.timeline__item--right {
    justify-content: flex-start;
    padding-right: 0;
    padding-left: calc(50% + 30px);
}

.timeline__node {
    position: absolute;
    left: 50%;
    top: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1C2130;
    border: 2px solid rgba(var(--accent-rgb),.25);
    transform: translateX(-50%);
    transition: background .5s, border-color .5s, box-shadow .5s;
    z-index: 1;
}
.timeline--active .timeline__node {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(var(--accent-rgb),.5), 0 0 40px rgba(var(--accent-rgb),.2);
}

.timeline__content {
    background: rgba(255,255,255,.02);
    border: 1px solid rgba(255,255,255,.05);
    border-radius: 14px;
    padding: 20px 22px;
    transition: border-color .5s, box-shadow .5s;
}
.timeline--active .timeline__content {
    border-color: rgba(var(--accent-rgb),.15);
    box-shadow: 0 4px 25px rgba(0,0,0,.25);
}
.timeline__date {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--accent);
    margin-bottom: 8px;
    opacity: .7;
}
.timeline--active .timeline__date { opacity: 1; }
.timeline__content h5 {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}
.timeline__content p {
    font-size: .82rem;
    color: rgba(255,255,255,.4);
    margin: 0;
    line-height: 1.6;
}

/* Timeline responsive — stack on mobile */
@media (max-width: 767px) {
    .timeline__line { left: 16px; }
    .timeline__item,
    .timeline__item--right {
        padding-left: 46px;
        padding-right: 0;
        justify-content: flex-start;
    }
    .timeline__node {
        left: 16px;
    }
}

/* ---- Parallax layer reset (JS overrides transform) ---- */
.landing-hero__mesh,
.landing-hero__glow,
.landing-particles-canvas,
.landing-content {
    will-change: transform;
}

/* ---- Back to Top Button ---- */
.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(var(--accent-rgb), .12);
    border: 1px solid rgba(var(--accent-rgb), .2);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    text-decoration: none;
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity .35s, transform .35s, background .2s;
    z-index: 1050;
}
.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.back-to-top:hover {
    background: rgba(var(--accent-rgb), .25);
    color: var(--accent);
    transform: translateY(-2px);
}

/* ---- 8. Scroll-Reveal Animation Classes ---- */

/* Section-level: fades + slides the entire section */
.reveal-hidden {
    opacity: 0 !important;
    transform: translateY(40px) !important;
}
.reveal-section {
    transition: opacity .8s cubic-bezier(.25,.46,.45,.94), transform .8s cubic-bezier(.25,.46,.45,.94);
}
.reveal-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Child-level: individual items inside a section stagger in */
.reveal-child-hidden {
    opacity: 0 !important;
    transform: translateY(24px) !important;
}
.reveal-fade {
    transition: opacity .6s cubic-bezier(.25,.46,.45,.94), transform .6s cubic-bezier(.25,.46,.45,.94);
}
.reveal-child-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* ---------- Auth Scene ---------- */
.auth-scene {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #0A0C0F 0%, #0D0F12 40%, #111520 100%);
}

/* Background effects */
.auth-bg-mesh {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(var(--accent-rgb), .1) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 10% 80%, rgba(249,115,22,.06) 0%, transparent 50%),
        radial-gradient(ellipse 50% 40% at 90% 60%, rgba(var(--accent-rgb),.05) 0%, transparent 50%);
    animation: meshShift 14s ease-in-out infinite alternate;
}
.auth-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
}
.auth-glow--left {
    width: 350px; height: 350px;
    left: -100px; top: 20%;
    background: var(--accent);
    opacity: .08;
    animation: glowFloat 10s ease-in-out infinite alternate;
}
.auth-glow--right {
    width: 280px; height: 280px;
    right: -60px; bottom: 15%;
    background: var(--orange);
    opacity: .06;
    animation: glowFloat 12s ease-in-out infinite alternate-reverse;
}
.auth-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ---- Two-Panel Auth Card ---- */
.auth-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    min-height: 560px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(18,22,30,.85);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,.07);
    box-shadow:
        0 24px 80px rgba(0,0,0,.5),
        0 0 60px rgba(var(--accent-rgb),.05),
        inset 0 1px 0 rgba(255,255,255,.04);
}

/* ---- Forms side ---- */
.auth-forms {
    position: relative;
    padding: 44px 38px;
    display: flex;
    align-items: center;
    z-index: 1;
    transition: transform .65s cubic-bezier(.77,0,.18,1);
}
.auth-panel--register .auth-forms {
    transform: translateX(100%);
}

.auth-form-face {
    width: 100%;
    transition: opacity .4s .15s, transform .4s .15s;
}
.auth-form-face--login {
    opacity: 1;
    transform: translateX(0);
}
.auth-form-face--register {
    position: absolute;
    inset: 0;
    padding: 44px 38px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
}

/* When register is active */
.auth-panel--register .auth-form-face--login {
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}
.auth-panel--register .auth-form-face--register {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

/* ---- Sliding welcome overlay ---- */
.auth-welcome {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    z-index: 5;
    transition: transform .65s cubic-bezier(.77,0,.18,1);
    overflow: hidden;
    border-radius: 0 24px 24px 0;
}
.auth-panel--register .auth-welcome {
    transform: translateX(-100%);
    border-radius: 24px 0 0 24px;
}

.auth-welcome__bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb),.92), rgba(249,115,22,.88)),
        radial-gradient(circle at 30% 20%, rgba(255,255,255,.12), transparent 60%);
    z-index: 0;
}
.auth-welcome__bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 80% 80%, rgba(255,255,255,.08), transparent 50%),
        radial-gradient(circle at 20% 90%, rgba(0,0,0,.12), transparent 40%);
}

.auth-welcome__content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 36px;
    text-align: center;
}

/* Welcome faces — toggle visibility */
.auth-welcome__face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 36px;
    transition: opacity .35s, transform .35s;
}
.auth-welcome__face--hello {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.auth-welcome__face--join {
    opacity: 0;
    transform: translateX(30px);
    pointer-events: none;
}
.auth-panel--register .auth-welcome__face--hello {
    opacity: 0;
    transform: translateX(-30px);
    pointer-events: none;
}
.auth-panel--register .auth-welcome__face--join {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.auth-welcome__icon {
    font-size: 3rem;
    color: #fff;
    margin-bottom: 18px;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,.2));
}

.auth-welcome__content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
}
.auth-welcome__content p {
    font-size: .9rem;
    color: rgba(255,255,255,.8);
    line-height: 1.65;
    max-width: 280px;
    margin: 0 auto 20px;
}

.auth-welcome__features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 28px;
}
.auth-welcome__features span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    color: rgba(255,255,255,.75);
    font-weight: 500;
}
.auth-welcome__features i {
    color: #fff;
    font-size: .75rem;
}

.auth-welcome__btn {
    background: rgba(255,255,255,.15);
    border: 2px solid rgba(255,255,255,.35);
    border-radius: 14px;
    color: #fff;
    font-size: .84rem;
    padding: 14px 28px;
    cursor: pointer;
    transition: all .3s;
    line-height: 1.4;
    backdrop-filter: blur(4px);
}
.auth-welcome__btn strong { font-weight: 700; }
.auth-welcome__btn:hover {
    background: rgba(255,255,255,.25);
    border-color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
    color: #fff;
}

/* ---- Shared form styles ---- */
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}
.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .18), rgba(249,115,22,.12));
    margin-bottom: 14px;
    font-size: 1.8rem;
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb), .12);
    box-shadow: 0 0 30px rgba(var(--accent-rgb), .12);
}
.auth-logo--register {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .15), rgba(16,185,129,.1));
}
.auth-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}
.auth-subtitle {
    font-size: .84rem;
    color: rgba(255,255,255,.38);
    margin: 0;
}

.auth-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    padding: 0 16px;
    margin-bottom: 12px;
    transition: border-color .25s, box-shadow .25s;
}
.auth-input-group:focus-within {
    border-color: rgba(var(--accent-rgb), .4);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .08);
}
.auth-input-group i {
    color: rgba(255,255,255,.2);
    font-size: .95rem;
    flex-shrink: 0;
    transition: color .25s;
}
.auth-input-group:focus-within i { color: var(--accent); }
.auth-input-group input {
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: .88rem;
    padding: 13px 0;
    width: 100%;
}
.auth-input-group input::placeholder { color: rgba(255,255,255,.22); }

/* Password visibility toggle button */
.auth-pw-toggle {
    background: none;
    border: none;
    outline: none;
    color: rgba(255,255,255,.2);
    font-size: .95rem;
    padding: 0;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: color .2s;
}
.auth-pw-toggle:hover { color: var(--accent); }
.auth-pw-toggle:focus-visible {
    outline: 2px solid rgba(var(--accent-rgb), .5);
    border-radius: 4px;
}

.auth-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.auth-input-row .auth-input-group { margin-bottom: 12px; }

.auth-submit {
    margin-top: 4px;
    position: relative;
    overflow: hidden;
}
.auth-submit::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    opacity: 0;
    z-index: -1;
    filter: blur(14px);
    transition: opacity .35s;
}
.auth-submit:hover::after { opacity: .45; }

.auth-home-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: .78rem;
    color: rgba(255,255,255,.22);
    text-decoration: none;
    transition: color .2s;
}
.auth-home-link:hover { color: var(--accent); }

/* Alert override */
.auth-form-face .alert {
    background: rgba(239,68,68,.1);
    border-color: rgba(239,68,68,.2);
    color: #FCA5A5;
    border-radius: 12px;
    font-size: .82rem;
}
.auth-form-face .alert .btn-close {
    filter: invert(1) grayscale(1) brightness(.7);
}

/* ---- Responsive: stack on mobile ---- */
@media (max-width: 767px) {
    .auth-scene {
        padding: 24px 12px;
        align-items: flex-start;
    }

    .auth-panel {
        grid-template-columns: 1fr;
        max-width: 460px;
        min-height: auto;
    }

    .auth-forms {
        padding: 32px 24px;
        transform: none !important;
    }

    .auth-form-face--register {
        position: relative;
        inset: auto;
        padding: 0;
        display: none;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }
    .auth-form-face--login {
        display: block;
    }
    /* When register is active on mobile, swap visibility */
    .auth-panel--register .auth-form-face--login {
        display: none;
    }
    .auth-panel--register .auth-form-face--register {
        display: flex;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }

    /* Welcome panel sits below forms on mobile */
    .auth-welcome {
        position: relative;
        width: 100%;
        height: auto;
        border-radius: 0 0 24px 24px;
        transform: none !important;
        z-index: 1;
    }
    .auth-panel--register .auth-welcome {
        transform: none !important;
        border-radius: 0 0 24px 24px;
    }

    .auth-welcome__content {
        padding: 28px 20px;
        min-height: auto;
    }

    /* Un-absolute the welcome faces so they flow naturally */
    .auth-welcome__face {
        position: relative;
        inset: auto;
        padding: 28px 20px;
    }
    .auth-welcome__face--hello {
        display: flex;
    }
    .auth-welcome__face--join {
        display: none;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
    .auth-panel--register .auth-welcome__face--hello {
        display: none;
    }
    .auth-panel--register .auth-welcome__face--join {
        display: flex;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }

    .auth-welcome__icon {
        font-size: 2.2rem;
        margin-bottom: 12px;
    }
    .auth-welcome__content h2 {
        font-size: 1.5rem;
    }
    .auth-welcome__content p {
        font-size: .84rem;
        margin-bottom: 16px;
    }
    .auth-welcome__features {
        margin-bottom: 20px;
    }
    .auth-welcome__btn {
        padding: 12px 22px;
        font-size: .8rem;
    }

    .auth-input-row { grid-template-columns: 1fr; }

    .auth-header {
        margin-bottom: 20px;
    }
    .auth-header h2 {
        font-size: 1.3rem;
    }
    .auth-logo {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
        margin-bottom: 12px;
    }

    .auth-submit {
        font-size: .9rem;
    }
    .auth-home-link {
        margin-top: 12px;
    }
}

@media (max-width: 480px) {
    .auth-scene {
        padding: 16px 8px;
    }

    .auth-panel {
        border-radius: 18px;
    }

    .auth-forms {
        padding: 24px 18px;
    }

    .auth-input-group {
        padding: 0 12px;
        gap: 10px;
        border-radius: 10px;
        margin-bottom: 10px;
    }
    .auth-input-group input {
        font-size: .84rem;
        padding: 11px 0;
    }

    .auth-header h2 {
        font-size: 1.2rem;
    }
    .auth-subtitle {
        font-size: .78rem;
    }

    .auth-welcome__content {
        padding: 24px 16px;
    }
    .auth-welcome__face {
        padding: 24px 16px;
    }
    .auth-welcome__content h2 {
        font-size: 1.3rem;
    }
    .auth-welcome__content p {
        font-size: .8rem;
    }
    .auth-welcome__btn {
        padding: 10px 18px;
        font-size: .78rem;
        border-radius: 12px;
    }
    .auth-welcome {
        border-radius: 0 0 18px 18px;
    }

    .auth-submit {
        font-size: .85rem;
        padding: 10px 16px !important;
    }

    /* OTP modal mobile fixes */
    .otp-card {
        padding: 28px 20px;
        border-radius: 18px;
    }
    .otp-digit {
        width: 40px;
        height: 48px;
        font-size: 1.2rem;
        border-radius: 10px;
    }
    .otp-digits {
        gap: 7px;
    }
}

@media (max-width: 360px) {
    .auth-forms {
        padding: 20px 14px;
    }
    .auth-input-group {
        padding: 0 10px;
    }
    .auth-input-group input {
        font-size: .8rem;
        padding: 10px 0;
    }
    .auth-header h2 {
        font-size: 1.1rem;
    }
    .auth-welcome__content h2 {
        font-size: 1.15rem;
    }
    .auth-welcome__btn {
        padding: 9px 14px;
        font-size: .75rem;
    }
    .otp-digit {
        width: 36px;
        height: 44px;
        font-size: 1.1rem;
        border-radius: 8px;
    }
    .otp-digits {
        gap: 5px;
    }
}

/* ==========================================================
   OTP / 2FA VERIFICATION MODAL
   ========================================================== */
.otp-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: otpFadeIn 0.4s ease;
}

@keyframes otpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.otp-card {
    width: 100%;
    max-width: 430px;
    background: rgba(18, 22, 30, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 80px rgba(var(--accent-rgb), 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    padding: 44px 38px;
    text-align: center;
    animation: otpSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes otpSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.otp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.18), rgba(249, 115, 22, 0.12));
    border: 1px solid rgba(var(--accent-rgb), 0.15);
    box-shadow: 0 0 50px rgba(var(--accent-rgb), 0.15);
    margin-bottom: 22px;
    font-size: 2rem;
    color: var(--accent);
    animation: otpIconPulse 3s ease-in-out infinite;
}

@keyframes otpIconPulse {
    0%, 100% { box-shadow: 0 0 50px rgba(var(--accent-rgb), 0.15); transform: scale(1); }
    50%      { box-shadow: 0 0 70px rgba(var(--accent-rgb), 0.3);  transform: scale(1.03); }
}

.otp-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
}

.otp-subtitle {
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0 0 28px;
    line-height: 1.65;
}

.otp-email {
    color: var(--accent);
    font-weight: 600;
}

/* ---- 6 Digit Inputs ---- */
.otp-digits {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
}

.otp-digit {
    width: 50px;
    height: 58px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    outline: none;
    transition: all 0.25s cubic-bezier(.25,.46,.45,.94);
    caret-color: var(--accent);
}

.otp-digit:focus {
    border-color: rgba(var(--accent-rgb), 0.55);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1), 0 0 20px rgba(var(--accent-rgb), 0.08);
    background: rgba(var(--accent-rgb), 0.04);
}

.otp-digit.filled {
    border-color: rgba(var(--accent-rgb), 0.35);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.05);
}

/* ---- Submit button ---- */
.otp-submit {
    position: relative;
    overflow: hidden;
    margin-top: 4px;
    transition: all 0.3s;
}

.otp-submit::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    opacity: 0;
    z-index: -1;
    filter: blur(14px);
    transition: opacity 0.35s;
}

.otp-submit:not(:disabled):hover::after {
    opacity: 0.45;
}

.otp-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.otp-submit--ready {
    animation: otpBtnReady 0.4s ease;
}

@keyframes otpBtnReady {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ---- Error alert ---- */
.otp-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #FCA5A5;
    border-radius: 12px;
    font-size: 0.82rem;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    animation: otpShake 0.4s ease;
}

@keyframes otpShake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}

.otp-error i {
    font-size: 1rem;
    flex-shrink: 0;
}

/* ---- Resend ---- */
.otp-actions {
    margin-top: 12px;
}

.otp-resend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s;
    font-family: inherit;
}

.otp-resend:not(:disabled):hover {
    color: var(--accent);
}

.otp-resend:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.otp-timer {
    color: var(--accent);
    font-weight: 700;
}

/* ---- Footer note ---- */
.otp-footer-note {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.2);
    margin: 18px 0 0;
    line-height: 1.5;
}

.otp-footer-note i {
    color: rgba(var(--accent-rgb), 0.4);
}

/* ---- OTP Modal Mobile Responsive ---- */
@media (max-width: 480px) {
    .otp-card {
        padding: 32px 22px;
        border-radius: 20px;
    }
    .otp-icon {
        width: 60px;
        height: 60px;
        font-size: 1.7rem;
        border-radius: 18px;
    }
    .otp-title {
        font-size: 1.2rem;
    }
    .otp-digits {
        gap: 6px;
    }
    .otp-digit {
        width: 44px;
        height: 52px;
        font-size: 1.25rem;
        border-radius: 12px;
    }
}

@media (max-width: 360px) {
    .otp-digits {
        gap: 4px;
    }
    .otp-digit {
        width: 40px;
        height: 48px;
        font-size: 1.1rem;
        border-radius: 10px;
    }
}

/* ==========================================================
   COPY CODE PAGE  (/CopyCode)
   ========================================================== */
.copycode-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: rgba(18, 22, 30, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 80px rgba(var(--accent-rgb), 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    padding: 44px 38px;
    text-align: center;
    animation: otpSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.copycode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.18), rgba(249, 115, 22, 0.12));
    border: 1px solid rgba(var(--accent-rgb), 0.15);
    box-shadow: 0 0 50px rgba(var(--accent-rgb), 0.15);
    margin-bottom: 22px;
    font-size: 2rem;
    color: var(--accent);
    transition: all 0.4s ease;
    animation: otpIconPulse 3s ease-in-out infinite;
}

.copycode-icon--success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 50px rgba(16, 185, 129, 0.2);
    color: #10B981;
    animation: none;
}

.copycode-icon--error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08));
    border-color: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.1);
    color: #EF4444;
    animation: none;
}

.copycode-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
}

.copycode-subtitle {
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0 0 26px;
    line-height: 1.7;
}

/* Code digit row */
.copycode-digits {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
}

.copycode-digit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 58px;
    background: rgba(var(--accent-rgb), 0.06);
    border: 2px solid rgba(var(--accent-rgb), 0.25);
    border-radius: 14px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    transition: all 0.3s ease;
}

.copycode-digits--selectable .copycode-digit {
    user-select: text;
    cursor: text;
}

/* Copy button pulse when ready */
.copycode-btn {
    position: relative;
    overflow: hidden;
}

.copycode-btn::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    opacity: 0;
    z-index: -1;
    filter: blur(14px);
    transition: opacity 0.35s;
}

.copycode-btn:hover::after {
    opacity: 0.45;
}

/* Copied success state icon */
.copycode-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 3.2rem;
    color: #10B981;
    margin-bottom: 16px;
    animation: copiedBounce 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes copiedBounce {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1);   opacity: 1; }
}

/* Mobile */
@media (max-width: 480px) {
    .copycode-card {
        padding: 32px 22px;
        border-radius: 20px;
    }
    .copycode-digit {
        width: 44px;
        height: 52px;
        font-size: 1.25rem;
        border-radius: 12px;
    }
    .copycode-digits {
        gap: 6px;
    }
}

/* ---------- Responsive refinements ---------- */
@media (max-width: 767.98px) {
    .stat-card { padding: 14px; }
    .stat-card__value { font-size: 1.3rem; }
    .stat-card__icon { width: 44px; height: 44px; font-size: 1.1rem; }
    .panel__body { padding: 14px; }
    .panel__header { padding: 12px 14px; }
}

/* ==========================================================
   DEVICE LOCATIONS — Mapbox Map
   ========================================================== */

/* ── Layout ── */
.map-layout {
    position: relative;
    display: flex;
    gap: 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    height: 82vh;
    min-height: 600px;
    max-height: 900px;
    background: var(--bg-card);
}

/* ── Sidebar ── */
.map-sidebar {
    width: 340px;
    min-width: 340px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    z-index: 5;
}

.map-sidebar__header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.map-sidebar__title {
    margin: 0;
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}
.map-sidebar__title i { color: var(--accent); }

.map-sidebar__toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
}
.map-sidebar__toggle:hover { color: var(--text-primary); }

.map-sidebar__search {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.map-sidebar__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.map-sidebar__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
}
.map-sidebar__empty i { margin-bottom: 12px; opacity: .4; }
.map-sidebar__empty p { font-size: .85rem; }

/* ── Device Card ── */
.device-card {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border-radius: 10px;
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: all .2s;
    overflow: hidden;
    background: transparent;
}
.device-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
}
.device-card--active {
    background: rgba(var(--accent-rgb), .08) !important;
    border-color: rgba(var(--accent-rgb), .25) !important;
    box-shadow: inset 3px 0 0 var(--accent);
}

.device-card__indicator {
    width: 4px;
    flex-shrink: 0;
    border-radius: 4px 0 0 4px;
}
.device-card__indicator--online { background: var(--success); }
.device-card__indicator--offline { background: var(--text-muted); }

.device-card__body {
    flex: 1;
    padding: 10px 12px 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.device-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.device-card__name {
    font-weight: 600;
    font-size: .85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.device-card__name i { color: var(--accent); font-size: .8rem; }

.device-card__status { flex-shrink: 0; }
.device-card__status .badge { font-size: .6rem; padding: 2px 6px; }

.device-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: .7rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.device-card__meta code {
    font-size: .65rem;
    padding: 1px 4px;
}

/* ── Card Bottom Toolbar (3 buttons) ── */
.device-card__toolbar {
    display: flex;
    border-top: 1px solid var(--border-color);
    margin: 0 -12px;
}
.device-card__btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.device-card__btn + .device-card__btn {
    border-left: 1px solid var(--border-color);
}
.device-card__btn i { font-size: .78rem; }
.device-card__btn--locate:hover {
    background: rgba(var(--accent-rgb), .1);
    color: var(--accent);
}
.device-card__btn--track:hover {
    background: rgba(59,130,246,.1);
    color: #3B82F6;
}
.device-card__btn--alarms:hover {
    background: rgba(239,68,68,.08);
    color: #EF4444;
}
.device-card__btn--active.device-card__btn--locate {
    background: rgba(var(--accent-rgb), .15) !important;
    color: var(--accent) !important;
}
.device-card__btn--active.device-card__btn--track {
    background: rgba(59,130,246,.18) !important;
    color: #3B82F6 !important;
}
.device-card__btn--active.device-card__btn--alarms {
    background: rgba(239,68,68,.15) !important;
    color: #EF4444 !important;
}

/* ── Map Container ── */
.map-container {
    flex: 1;
    position: relative;
    min-width: 0;
}

#map {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 0;
}

/* Sidebar toggle button (mobile) */
.map-sidebar-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all .2s;
}
.map-sidebar-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}
.map-sidebar-toggle__count {
    background: var(--accent);
    color: #000;
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 50px;
}

/* ── Map Toolbar ── */
.map-toolbar {
    position: absolute;
    top: 12px;
    right: 60px;
    z-index: 10;
    display: flex;
    gap: 6px;
}

.map-toolbar__btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    box-shadow: var(--shadow-sm);
}
.map-toolbar__btn:hover {
    background: var(--bg-card-hover);
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), .3);
}
.map-toolbar__btn--active {
    background: rgba(var(--accent-rgb), .15);
    color: var(--accent);
    border-color: var(--accent);
}

/* ── Map Legend ── */
.map-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 10;
    display: flex;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}
.map-legend__item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.map-legend__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.map-legend__dot--online {
    background: var(--success);
    box-shadow: 0 0 6px rgba(16,185,129,.5);
}
.map-legend__dot--offline {
    background: var(--text-muted);
}

/* ── Custom Markers ── */
.map-marker {
    position: relative;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: transform .3s ease;
    transform-origin: center center;
}

.map-marker__dot {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    color: #fff;
    transition: transform .2s;
    z-index: 2;
}
.map-marker:hover .map-marker__dot { transform: scale(1.15); }

.map-marker--online .map-marker__dot {
    background: linear-gradient(135deg, var(--accent), var(--orange));
    box-shadow: 0 2px 10px rgba(var(--accent-rgb), .5);
}
.map-marker--offline .map-marker__dot {
    background: var(--text-muted);
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.map-marker__pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    z-index: 1;
}
.map-marker--online .map-marker__pulse {
    background: rgba(var(--accent-rgb), .25);
    animation: markerPulse 2.5s ease-out infinite;
}
.map-marker--offline .map-marker__pulse {
    background: rgba(92, 96, 112, .15);
}

@keyframes markerPulse {
    0%   { transform: scale(1); opacity: .6; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* ── Mapbox Popup Overrides ── */
.map-popup .mapboxgl-popup-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    min-width: 240px;
}

.map-popup .mapboxgl-popup-tip {
    border-top-color: var(--bg-card);
}

.map-popup .mapboxgl-popup-close-btn {
    color: var(--text-muted);
    font-size: 1.1rem;
    right: 8px;
    top: 8px;
}
.map-popup .mapboxgl-popup-close-btn:hover {
    color: var(--accent);
    background: transparent;
}

/* ── GeoFence Popup (reuses theme vars for light/dark) ── */
.geofence-popup .mapboxgl-popup-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    min-width: 250px;
}
.geofence-popup .mapboxgl-popup-tip {
    border-top-color: var(--bg-card);
}
.geofence-popup .mapboxgl-popup-close-btn {
    color: var(--text-muted);
    font-size: 1.1rem;
    right: 6px;
    top: 6px;
}
.geofence-popup .mapboxgl-popup-close-btn:hover {
    color: var(--accent);
    background: transparent;
}

/* Modal backdrop fix for dark theme */
[data-theme="dark"] .modal-backdrop {
    background-color: #000;
}
[data-theme="dark"] .modal-content .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.map-popup__content {
    padding: 14px 16px;
}

.map-popup__header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .88rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.map-popup__header i { color: var(--accent); }

.map-popup__status {
    margin-left: auto;
    font-size: .68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.map-popup__status--online {
    background: rgba(16,185,129,.15);
    color: var(--success);
}
.map-popup__status--offline {
    background: rgba(92,96,112,.15);
    color: var(--text-muted);
}

.map-popup__details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: .78rem;
    color: var(--text-secondary);
}
.map-popup__details i {
    color: var(--accent);
    width: 16px;
    text-align: center;
    font-size: .72rem;
}
.map-popup__details code {
    font-size: .7rem;
}

/* ── Mapbox Controls Override ── */
.mapboxgl-ctrl-group {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow-sm) !important;
    overflow: hidden;
}

.mapboxgl-ctrl-group button {
    background-color: transparent !important;
    border-color: var(--border-color) !important;
}

.mapboxgl-ctrl-group button + button {
    border-top: 1px solid var(--border-color) !important;
}

.mapboxgl-ctrl-group button .mapboxgl-ctrl-icon {
    filter: invert(1) brightness(0.7);
}

[data-theme="light"] .mapboxgl-ctrl-group button .mapboxgl-ctrl-icon {
    filter: none;
}

.mapboxgl-ctrl-scale {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
    font-size: .7rem !important;
    border-radius: 4px !important;
}

/* ── Backdrop overlay for mobile sidebar ── */
.map-sidebar-backdrop {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 12;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
    border-radius: 14px;
}
.map-sidebar-backdrop--visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Responsive ── */
@media (max-width: 1199.98px) {
    .map-layout { height: 72vh; min-height: 500px; max-height: 750px; }
    .map-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(.4,0,.2,1);
        box-shadow: var(--shadow-lg);
        z-index: 15;
    }
    .map-sidebar--open { transform: translateX(0); }
    .map-sidebar-backdrop { display: block; }
}

@media (max-width: 767.98px) {
    .map-layout {
        height: 60vh;
        min-height: 400px;
        max-height: 600px;
        border-radius: 12px;
    }
    .map-sidebar {
        width: 300px;
        min-width: 300px;
    }
    .map-toolbar { right: 12px; top: 12px; }
    .map-legend { font-size: .68rem; padding: 6px 12px; gap: 10px; }

    .device-card__meta {
        gap: 3px 8px;
        font-size: .68rem;
    }
    .device-card__meta code {
        font-size: .62rem;
    }
    .device-card__btn {
        font-size: .64rem;
        padding: 6px 3px;
    }
    .device-card__btn i {
        font-size: .72rem;
    }
}

@media (max-width: 575.98px) {
    .map-layout {
        height: 55vh;
        min-height: 360px;
        max-height: 550px;
        border-radius: 10px;
    }
    /* Full-width sidebar on small phones */
    .map-sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-radius: 10px;
    }
    .map-sidebar__header {
        padding: 14px 16px;
    }
    .map-sidebar__title {
        font-size: .85rem;
    }
    .map-sidebar__toggle {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: rgba(255,255,255,.05);
        font-size: 1.2rem;
    }
    .map-sidebar__search {
        padding: 10px 16px;
    }
    .map-sidebar__list {
        padding: 6px;
    }

    .device-card {
        border-radius: 8px;
        margin-bottom: 5px;
    }
    .device-card__body {
        padding: 8px 10px 0;
    }
    .device-card__name {
        font-size: .82rem;
    }
    .device-card__status .badge {
        font-size: .58rem;
        padding: 2px 5px;
    }
    .device-card__toolbar {
        margin: 0 -10px;
    }
    .device-card__btn span {
        display: none;
    }
    .device-card__btn {
        padding: 8px 4px;
    }
    .device-card__btn i {
        font-size: .85rem;
    }

    .map-sidebar-toggle {
        padding: 7px 12px;
        font-size: .8rem;
        border-radius: 8px;
    }
    .map-sidebar-toggle__count {
        font-size: .65rem;
        padding: 2px 6px;
    }

    .map-toolbar {
        right: 10px;
        top: 12px;
        gap: 4px;
    }
    .map-toolbar__btn {
        width: 32px;
        height: 32px;
        font-size: .9rem;
        border-radius: 6px;
    }

    .map-legend {
        font-size: .62rem;
        padding: 5px 10px;
        gap: 8px;
        border-radius: 6px;
    }
    .map-legend__dot {
        width: 6px;
        height: 6px;
    }
}

@media (max-width: 400px) {
    .map-layout {
        height: 50vh;
        min-height: 320px;
    }
    .map-sidebar__header {
        padding: 12px 14px;
    }
    .map-sidebar__search {
        padding: 8px 14px;
    }
    .device-card__name {
        font-size: .78rem;
    }
    .device-card__meta {
        font-size: .64rem;
    }
}

/* ── Device Card Actions Column (focus + track buttons) ── */
/* (replaced by .device-card__toolbar above) */

/* ── Table Action Buttons ── */
.table-action-group {
    display: inline-flex;
    gap: 4px;
}
.table-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: .78rem;
    cursor: pointer;
    transition: all .2s;
}
.table-action-btn--locate:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), .4);
    background: rgba(var(--accent-rgb), .08);
}
.table-action-btn--track:hover {
    color: #3B82F6;
    border-color: rgba(59,130,246,.4);
    background: rgba(59,130,246,.08);
}
.table-action-btn--alarms:hover {
    color: #EF4444;
    border-color: rgba(239,68,68,.3);
    background: rgba(239,68,68,.06);
}
.table-action-btn--active.table-action-btn--locate {
    color: #fff !important;
    background: var(--accent) !important;
    border-color: var(--accent) !important;
}
.table-action-btn--active.table-action-btn--track {
    color: #fff !important;
    background: #3B82F6 !important;
    border-color: #3B82F6 !important;
}
.table-action-btn--active.table-action-btn--alarms {
    color: #fff !important;
    background: #EF4444 !important;
    border-color: #EF4444 !important;
}

/* ── Tracking Mode Banner ── */
.track-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 18px;
    margin-top: 16px;
    border-radius: 10px;
    background: rgba(59,130,246,.1);
    border: 1px solid rgba(59,130,246,.3);
    color: #93C5FD;
    font-size: .85rem;
}
.track-banner__info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.track-banner__info i { color: #3B82F6; }
.track-banner__close {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border: 1px solid rgba(239,68,68,.3);
    border-radius: 6px;
    background: rgba(239,68,68,.1);
    color: #FCA5A5;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.track-banner__close:hover {
    background: rgba(239,68,68,.2);
    border-color: rgba(239,68,68,.5);
    color: #EF4444;
}

/* ── Map Toolbar Exit Button ── */
.map-toolbar__btn--exit {
    color: #EF4444 !important;
    border-color: rgba(239,68,68,.3) !important;
}
.map-toolbar__btn--exit:hover {
    background: rgba(239,68,68,.15) !important;
    border-color: #EF4444 !important;
}

/* ── Track SOS & Start Markers ── */
.track-sos-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(245,158,11,.9);
    border: 2px solid #F59E0B;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .7rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(245,158,11,.4);
    transition: transform .2s;
}
.track-sos-marker:hover { transform: scale(1.2); }
.track-sos-marker--sos {
    background: rgba(239,68,68,.9);
    border-color: #EF4444;
    box-shadow: 0 2px 10px rgba(239,68,68,.5);
    animation: sosPulse 1.5s ease-out infinite;
}

@keyframes sosPulse {
    0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
    70%  { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

/* ── Alarm Cluster Marker ── */
.alarm-cluster-marker {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(239,68,68,.85);
    border: 3px solid #EF4444;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(239,68,68,.5);
    transition: transform .2s;
    position: relative;
}
.alarm-cluster-marker:hover { transform: scale(1.15); }
.alarm-cluster-marker__pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(239,68,68,.6);
    animation: alarmClusterPulse 2s ease-out infinite;
}
.alarm-cluster-marker__count {
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
    line-height: 1;
    z-index: 1;
}
.alarm-cluster-marker--sos {
    background: rgba(239,68,68,.95);
    box-shadow: 0 2px 16px rgba(239,68,68,.6);
}
@keyframes alarmClusterPulse {
    0%   { transform: scale(1); opacity: 1; }
    70%  { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ── Alarm Cluster Popup ── */
.alarm-cluster-map-popup .mapboxgl-popup-content {
    padding: 0 !important;
    max-height: 340px;
    overflow: hidden;
    border-radius: 10px;
}
.alarm-cluster-popup {
    display: flex;
    flex-direction: column;
    max-height: 340px;
}
.alarm-cluster-popup__header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.alarm-cluster-popup__list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    max-height: 270px;
}
.alarm-cluster-popup__item {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-bottom: 4px;
    transition: background .15s;
}
.alarm-cluster-popup__item:last-child { margin-bottom: 0; }
.alarm-cluster-popup__item:hover { background: var(--bg-card-hover); }
.alarm-cluster-popup__item--sos { border-left: 3px solid #EF4444; }
.alarm-cluster-popup__item-icon {
    flex-shrink: 0;
    font-size: .75rem;
    padding-top: 2px;
    color: #F59E0B;
}
.alarm-cluster-popup__item--sos .alarm-cluster-popup__item-icon { color: #EF4444; }
.alarm-cluster-popup__item-body { flex: 1; min-width: 0; }
.alarm-cluster-popup__item-title {
    font-weight: 600;
    font-size: .72rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.alarm-cluster-popup__item-msg {
    font-size: .65rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.alarm-cluster-popup__item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .6rem;
    color: var(--text-muted);
    margin-top: 3px;
}
.alarm-cluster-popup__status {
    padding: 1px 5px;
    border-radius: 50px;
    font-weight: 600;
    font-size: .55rem;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.alarm-cluster-popup__status--active { background: rgba(239,68,68,.15); color: #EF4444; }
.alarm-cluster-popup__status--acked { background: rgba(245,158,11,.15); color: #F59E0B; }
.alarm-cluster-popup__status--resolved { background: rgba(16,185,129,.15); color: #10B981; }

.track-start-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(16,185,129,.9);
    border: 2px solid #10B981;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .65rem;
    box-shadow: 0 2px 6px rgba(16,185,129,.4);
}

/* ── Alarm Panel (overlaid on map right side) ── */
.alarm-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    z-index: 12;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}
.alarm-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}
.alarm-panel__header i { color: #EF4444; }
.alarm-panel__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
}
.alarm-panel__close:hover { color: var(--text-primary); }
.alarm-panel__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.alarm-panel__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: .82rem;
}
.alarm-panel__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
    gap: 8px;
}
.alarm-panel__empty i { opacity: .4; color: var(--success); }
.alarm-panel__empty p { font-size: .82rem; margin: 0; }

/* ── Alarm Card (inside panel) ── */
.alarm-card {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all .2s;
    background: transparent;
}
.alarm-card:hover {
    border-color: rgba(var(--accent-rgb), .3);
    background: var(--bg-card-hover);
}
.alarm-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    flex-shrink: 0;
    font-size: .85rem;
}
.alarm-card--sos .alarm-card__icon { background: rgba(239,68,68,.12); color: #EF4444; }
.alarm-card--warning .alarm-card__icon { background: rgba(245,158,11,.12); color: #F59E0B; }
.alarm-card__body {
    flex: 1;
    padding: 8px 10px;
    min-width: 0;
}
.alarm-card__title {
    font-weight: 600;
    font-size: .78rem;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.alarm-card__msg {
    font-size: .7rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.alarm-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .65rem;
    color: var(--text-muted);
}
.alarm-card__status {
    padding: 1px 6px;
    border-radius: 50px;
    font-weight: 600;
    font-size: .6rem;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.alarm-card__status--active { background: rgba(239,68,68,.15); color: #EF4444; }
.alarm-card__status--acked { background: rgba(245,158,11,.15); color: #F59E0B; }
.alarm-card__status--resolved { background: rgba(16,185,129,.15); color: #10B981; }
.alarm-card__locate {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: .82rem;
    transition: all .2s;
}
.alarm-card:hover .alarm-card__locate { color: var(--accent); background: rgba(var(--accent-rgb), .06); }

/* Spinner util */
.spin { animation: spinAnim .8s linear infinite; }
@keyframes spinAnim { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 575.98px) {
    .track-banner {
        flex-direction: column;
        align-items: flex-start;
        font-size: .78rem;
        padding: 8px 14px;
    }
    .device-card__btn span { display: none; }
    .device-card__btn { padding: 6px 4px; }
    .device-card__btn i { font-size: .85rem; }
    .table-action-btn { width: 26px; height: 26px; font-size: .7rem; }
    .alarm-panel { width: 260px; }
    .alarm-card__title { font-size: .72rem; }
}

@media (max-width: 767.98px) {
    .alarm-panel { width: 280px; }
}

/* ============================================================
   Telemetry Page — Chart Panels & Legends
   ============================================================ */

.telemetry-panel .panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

.telemetry-panel__status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.telemetry-panel__status--online {
    background: var(--success);
    box-shadow: 0 0 6px rgba(16,185,129,.6);
}
.telemetry-panel__status--offline {
    background: var(--text-muted);
}

.telemetry-panel .panel__body canvas {
    width: 100% !important;
    max-height: 220px;
}

.telemetry-panel__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 8px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 0 0 12px 12px;
}

.telemetry-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .72rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: opacity .2s, background .2s;
    user-select: none;
}
.telemetry-legend-item:hover {
    background: rgba(var(--accent-rgb), .08);
}
.telemetry-legend-item--hidden {
    opacity: .35;
    text-decoration: line-through;
}

.telemetry-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Expand / Collapse toggle ── */
.btn-expand-toggle {
    padding: 3px 7px;
    font-size: .75rem;
    line-height: 1;
}

/* ── Expanded panel ── */
.telemetry-panel--expanded .panel__body {
    padding: 12px;
}

/* ── Individual sensor chart card (inside expanded view) ── */
.sensor-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow .2s;
}
.sensor-chart-card:hover {
    box-shadow: var(--shadow-sm);
}
.sensor-chart-card__header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}
.sensor-chart-card__title {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary);
}
.sensor-chart-card__unit {
    font-size: .72rem;
    color: var(--text-muted);
}
.sensor-chart-card__body {
    padding: 8px;
}
.sensor-chart-card__body canvas {
    width: 100% !important;
    max-height: 180px;
}

/* ==========================================================
   ADMIN DASHBOARD — extensions
   ========================================================== */

/* Header layout */
.dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}
.dash-header h2 { font-size: 1.6rem; font-weight: 800; }
.dash-header__sub {
    margin: 0;
    color: var(--text-secondary);
    font-size: .88rem;
}
.dash-header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.dash-header__actions .form-control-sm { max-width: 150px; }
@media (max-width: 575.98px) {
    .dash-header { flex-direction: column; padding-bottom: 18px; margin-bottom: 24px; }
    .dash-header__actions { width: 100%; }
    .dash-header__actions .form-control-sm { max-width: 100%; flex: 1; }
}

/* Section rhythm — generous vertical spacing between dashboard zones */
.dash-section {
    margin-bottom: 36px;
}
.dash-section--last {
    margin-bottom: 0;
}
@media (min-width: 992px) {
    .dash-section { margin-bottom: 44px; }
}

/* Section dividers — subtle line + label for visual hierarchy */
.dash-divider {
    border-top: 1px solid var(--border-color);
    margin: 8px 0 20px;
}
.dash-section-label {
    margin: 0 0 20px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}
.dash-section-label i {
    font-size: .85rem;
    color: var(--accent);
}

/* Taller panel variant for chart areas */
.panel--tall .panel__body {
    padding: 24px;
}

/* Empty state shared pattern */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 2.4rem;
    margin-bottom: 12px;
    opacity: .5;
}
.empty-state p {
    margin: 0;
    font-size: .9rem;
}

/* Skeleton shimmer */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}
@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Additional stat-card variants */
.stat-card--readings .stat-card__icon  { background: rgba(249,115,22,.15); color: var(--orange); }
.stat-card--sensors .stat-card__icon   { background: rgba(6,182,212,.15); color: var(--info); }

/* KPI delta indicator */
.stat-card__delta {
    font-size: .73rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
}
.stat-card__delta--up      { color: var(--success); }
.stat-card__delta--down    { color: var(--danger); }
.stat-card__delta--neutral { color: var(--text-muted); }

/* Sparkline mini canvas */
.stat-card__sparkline {
    width: 64px;
    height: 26px;
    flex-shrink: 0;
    align-self: flex-end;
}

/* Health dot */
.health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.health-dot--healthy  { background: var(--success); box-shadow: 0 0 8px rgba(16,185,129,.5); }
.health-dot--degraded { background: var(--warning); box-shadow: 0 0 8px rgba(251,191,36,.5); }
.health-dot--critical { background: var(--danger);  box-shadow: 0 0 8px rgba(239,68,68,.5); }

/* Alert severity chips */
.alert-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: .85rem;
    flex-shrink: 0;
}
.alert-chip--critical { background: rgba(239,68,68,.15); color: var(--danger); }
.alert-chip--warning  { background: rgba(251,191,36,.15); color: var(--warning); }
.alert-chip--info     { background: rgba(6,182,212,.15); color: var(--info); }

/* Error banner — hidden by default, shown via JS .show */
.dash-error { display: none; align-items: center; }
.dash-error.show { display: flex; }

/* Filter row */
.filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-row .form-control { max-width: 170px; }
@media (max-width: 575.98px) {
    .filter-row .form-control { max-width: 100%; flex: 1; }
}

/* Table pagination */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
}
.table-pagination__info { font-size: .82rem; color: var(--text-muted); }
.table-pagination__btns { display: flex; gap: 6px; }

/* Quick action links */
.quick-action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: background .2s;
}
.quick-action:last-child { border-bottom: none; }
.quick-action:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.quick-action__icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

/* Refresh spin */
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ==========================================================
   GLOBAL MODAL & TOAST SYSTEM
   ========================================================== */

/* Backdrop */
.hst-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.hst-modal-backdrop--open { opacity: 1; pointer-events: auto; }

/* Modal */
.hst-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(.92);
    z-index: 1210;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 32px 28px 24px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}
.hst-modal--open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.hst-modal--wide { max-width: 540px; text-align: left; }

/* Icon area */
.hst-modal__icon {
    font-size: 2.6rem;
    margin-bottom: 12px;
    line-height: 1;
}
.hst-modal__icon--confirm { color: var(--accent); }
.hst-modal__icon--success { color: var(--success); }
.hst-modal__icon--error   { color: var(--danger); }
.hst-modal__icon--warning { color: var(--warning); }
.hst-modal__icon--form    { color: var(--accent); }

/* Spinner */
.hst-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 4px;
}

/* Title */
.hst-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
}

/* Body */
.hst-modal__body {
    font-size: .9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.hst-modal__body p:last-child { margin-bottom: 0; }

/* Footer */
.hst-modal__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.hst-modal--wide .hst-modal__footer { justify-content: flex-end; }

/* Form fields inside modals */
.hst-modal__body .form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.hst-modal__body .form-text {
    font-size: .76rem;
    color: var(--text-muted);
}
.hst-modal__body .form-control,
.hst-modal__body .form-select {
    font-size: .88rem;
}

/* Toast container */
.hst-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* Toast */
.hst-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toastSlideIn .3s ease;
    min-width: 260px;
    max-width: 400px;
}
.hst-toast--success { background: var(--success); }
.hst-toast--error   { background: var(--danger); }
.hst-toast--info    { background: var(--info); }

.hst-toast__close {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}
.hst-toast__close:hover { color: #fff; }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ==========================================================
   SHARED PAGE COMPONENTS — reusable across Device, Register, etc.
   ========================================================== */

/* Page header — replaces ad-hoc d-flex headers */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}
.page-header__title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 4px;
}
.page-header__sub {
    margin: 0;
    font-size: .88rem;
    color: var(--text-secondary);
}
.page-header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.page-header__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 10px;
    transition: color .2s;
}
.page-header__back:hover { color: var(--accent); }
@media (max-width: 575.98px) {
    .page-header { flex-direction: column; padding-bottom: 18px; margin-bottom: 24px; }
    .page-header__actions { width: 100%; }
}

/* Offline stat card */
.stat-card--offline .stat-card__icon {
    background: rgba(107,114,128,.15);
    color: var(--text-muted);
}

/* Device name link with status dot */
.device-name-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: color .2s;
}
.device-name-link:hover { color: var(--accent-hover); }
.device-name-link__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.device-name-link__dot--online  { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,.5); }
.device-name-link__dot--offline { background: var(--text-muted); }

/* Device UUID code */
.device-uuid {
    font-size: .8rem;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Status pill */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}
.status-pill i { font-size: .5rem; }
.status-pill--online  { background: rgba(16,185,129,.12); color: var(--success); }
.status-pill--offline { background: rgba(107,114,128,.1); color: var(--text-muted); }

/* Inline action buttons */
.action-btns {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: .88rem;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}
.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb),.06);
}
.action-btn--view:hover {
    border-color: var(--info);
    color: var(--info);
    background: rgba(6,182,212,.06);
}
.action-btn--success:hover {
    border-color: var(--success);
    color: var(--success);
    background: rgba(16,185,129,.06);
}
.action-btn--danger:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239,68,68,.06);
}

/* Table footer */
.table-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
}

/* Device search */
.device-search {
    position: relative;
    max-width: 260px;
}
.device-search__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: .85rem;
    pointer-events: none;
}
.device-search .form-control {
    padding-left: 36px;
}

/* Empty state block (non-flex, for pages) */
.empty-state-block {
    text-align: center;
    padding: 56px 24px;
}
.empty-state-block__icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb),.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--accent);
    margin-bottom: 16px;
}
.empty-state-block__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.empty-state-block__text {
    font-size: .88rem;
    color: var(--text-muted);
    margin-bottom: 0;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

/* Step cards (register page) */
.step-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 28px 24px 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform .2s, box-shadow .2s;
    height: 100%;
}
.step-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.step-card__number {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    color: #fff;
    font-size: .78rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb),.35);
}
.step-card__icon {
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 12px;
}
.step-card__title {
    font-size: .92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.step-card__text {
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.55;
}

/* Register card (mobile card view) */
.register-card {
    background: var(--bg-card);
    border-color: var(--border-color) !important;
    transition: box-shadow .2s;
}
.register-card:hover {
    box-shadow: var(--shadow-sm);
}

/* ── Themed nav-tabs (Register page tabs) ── */
#registerTabs {
    border-bottom: 1px solid var(--border-color);
}
#registerTabs .nav-link {
    color: var(--text-muted);
    border: 1px solid transparent;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    background: transparent;
    padding: .6rem 1.2rem;
    font-weight: 600;
    font-size: .88rem;
    transition: color .2s, background .2s, border-color .2s;
}
#registerTabs .nav-link:hover {
    color: var(--accent);
    background: rgba(var(--accent-rgb), .06);
    border-color: transparent transparent var(--border-color);
}
#registerTabs .nav-link.active {
    color: var(--accent);
    background: var(--bg-card);
    border-color: var(--border-color) var(--border-color) var(--bg-card);
}
#registerTabs .nav-link .badge {
    font-size: .68rem;
    padding: 2px 6px;
    vertical-align: middle;
}

/* ── Device pages mobile responsive ── */
@media (max-width: 767.98px) {
    /* Step cards */
    .step-card { padding: 20px 16px 18px; }
    .step-card__icon { font-size: 1.3rem; margin-bottom: 8px; }
    .step-card__title { font-size: .84rem; }
    .step-card__text { font-size: .78rem; }

    /* Device uuid truncation */
    .device-uuid {
        font-size: .7rem;
        word-break: break-all;
        max-width: 180px;
        display: inline-block;
    }

    /* Register page tabs */
    #registerTabs .nav-link { font-size: .82rem; padding: .5rem .75rem; }

    /* Action buttons stack */
    .action-btns { flex-wrap: wrap; }
    .action-btn { width: 28px; height: 28px; font-size: .78rem; }

    /* Page header stacking */
    .page-header { flex-direction: column; align-items: flex-start !important; gap: 12px; }
    .page-header__actions { width: 100%; }
    .page-header__actions .btn { width: 100%; }

    /* Table improvements */
    .table th, .table td { font-size: .8rem; padding: .5rem .4rem; white-space: nowrap; }

    /* Index device table mobile cards */
    #devicesTable th:nth-child(3),
    #devicesTable td:nth-child(3),
    #devicesTable th:nth-child(5),
    #devicesTable td:nth-child(5) { display: none; }

    /* Stat cards */
    .stat-card { padding: 12px; }
    .stat-card__value { font-size: 1.2rem; }
    .stat-card__icon { width: 38px; height: 38px; font-size: 1rem; }
    .stat-card__label { font-size: .68rem; }

    /* Modal full-width on mobile */
    .modal-dialog { margin: .5rem; max-width: calc(100% - 1rem); }
    .modal-dialog.modal-lg { max-width: calc(100% - 1rem); }

    /* Device search full width */
    .device-search { max-width: 100%; width: 100%; }
}

/* Poll indicator (live dot) */
.poll-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--success);
}
.poll-indicator__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pollPulse 2s ease-in-out infinite;
}
@keyframes pollPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
    50%      { opacity: .5; box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

/* ==========================================================
   EMPLOYEE PAGES
   ========================================================== */

/* Avatar with initials */
.emp-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .18), rgba(99,102,241,.12));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(var(--accent-rgb), .1);
}
.emp-avatar__initials {
    font-size: .78rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Shift type badges */
.shift-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
}
.shift-badge--day {
    background: rgba(251,191,36,.12);
    color: var(--warning);
}
.shift-badge--night {
    background: rgba(99,102,241,.12);
    color: #818CF8;
}
.shift-badge--rotational {
    background: rgba(6,182,212,.12);
    color: var(--info);
}

/* Invalid field highlight */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239,68,68,.15) !important;
}

/* ==========================================================
   IMAGE GALLERY — Photo Record
   ========================================================== */

/* ── Layout ── */
.gallery-layout {
    display: flex;
    gap: 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    height: 82vh;
    min-height: 600px;
    max-height: 920px;
    background: var(--bg-card);
}

/* ── Sidebar ── */
.gallery-sidebar {
    width: 300px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    z-index: 5;
}

.gallery-sidebar__header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.gallery-sidebar__title {
    margin: 0;
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}
.gallery-sidebar__title i { color: var(--accent); }

.gallery-sidebar__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
}
.gallery-sidebar__close:hover { color: var(--text-primary); }

.gallery-sidebar__search {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.gallery-sidebar__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.gallery-sidebar__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
}
.gallery-sidebar__empty i { margin-bottom: 12px; opacity: .4; }
.gallery-sidebar__empty p { font-size: .85rem; }

/* ── Device card in sidebar ── */
.gallery-device-card {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border-radius: 10px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    transition: all .2s;
    overflow: hidden;
    background: transparent;
    cursor: pointer;
}
.gallery-device-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
}
.gallery-device-card--active {
    background: rgba(var(--accent-rgb), .08) !important;
    border-color: rgba(var(--accent-rgb), .25) !important;
    box-shadow: inset 3px 0 0 var(--accent);
}

.gallery-device-card__indicator {
    width: 4px;
    flex-shrink: 0;
    border-radius: 4px 0 0 4px;
}
.gallery-device-card__indicator--online { background: var(--success); }
.gallery-device-card__indicator--offline { background: var(--text-muted); }

.gallery-device-card__body {
    flex: 1;
    padding: 10px 12px;
    min-width: 0;
}

.gallery-device-card__name {
    font-weight: 600;
    font-size: .82rem;
    color: var(--text-primary);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gallery-device-card__name i { color: var(--accent); font-size: .78rem; }

.gallery-device-card__meta {
    font-size: .72rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-device-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

/* ── Gallery content area ── */
.gallery-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.gallery-sidebar-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: all .2s;
}
.gallery-sidebar-toggle:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-md);
}
.gallery-sidebar-toggle__count {
    font-size: .72rem;
    font-weight: 700;
    background: var(--accent);
    color: #000;
    padding: 2px 7px;
    border-radius: 10px;
}

/* ── Toolbar ── */
.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 10px;
}

.gallery-toolbar__info {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.gallery-toolbar__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Loading / Empty states ── */
.gallery-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gallery-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

/* ── Grid wrapper ── */
.gallery-grid-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

/* ── Date header ── */
.gallery-date-header {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 10px 4px 8px;
    margin-top: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}
.gallery-date-header:first-child { margin-top: 0; }
.gallery-date-header i { color: var(--accent); }

/* ── Image grid ── */
.gallery-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 12px 0 16px;
}

/* ── Image card ── */
.gallery-image-card {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    transition: transform .2s, box-shadow .2s;
}
.gallery-image-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.gallery-image-card__thumb {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-body);
}

.gallery-image-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.gallery-image-card:hover .gallery-image-card__thumb img {
    transform: scale(1.05);
}

.gallery-image-card__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity .25s;
}
.gallery-image-card:hover .gallery-image-card__overlay {
    opacity: 1;
}

.gallery-image-card__view,
.gallery-image-card__dl {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}
.gallery-image-card__view {
    background: rgba(var(--accent-rgb), .85);
    color: #000;
}
.gallery-image-card__view:hover {
    background: var(--accent);
    transform: scale(1.1);
}
.gallery-image-card__dl {
    background: rgba(255,255,255,.15);
    color: #fff;
}
.gallery-image-card__dl:hover {
    background: rgba(255,255,255,.3);
    color: #fff;
    transform: scale(1.1);
}

.gallery-image-card__info {
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.gallery-image-card__time {
    font-size: .7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.gallery-image-card__name {
    font-size: .68rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

/* ── Lightbox ── */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
.gallery-lightbox.open {
    display: flex;
}

.gallery-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.88);
    backdrop-filter: blur(8px);
}

.gallery-lightbox__content {
    position: relative;
    z-index: 1;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-lightbox__stage {
    width: 90vw;
    height: 78vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    user-select: none;
    cursor: grab;
    touch-action: none;
}

.gallery-lightbox__stage.is-panning {
    cursor: grabbing;
}

.gallery-lightbox__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

.gallery-lightbox__close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px;
    opacity: .7;
    transition: opacity .2s;
}
.gallery-lightbox__close:hover { opacity: 1; }

.gallery-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(var(--accent-rgb), .2);
    border: 1px solid rgba(var(--accent-rgb), .3);
    color: #fff;
    font-size: 1.4rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
}
.gallery-lightbox__nav:hover {
    background: rgba(var(--accent-rgb), .5);
}
.gallery-lightbox__nav--prev { left: -60px; }
.gallery-lightbox__nav--next { right: -60px; }

.gallery-lightbox__info {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: rgba(255,255,255,.7);
    font-size: .85rem;
}

/* ── Gallery responsive ── */
@media (max-width: 1199.98px) {
    .gallery-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(.4,0,.2,1);
        box-shadow: var(--shadow-lg);
    }
    .gallery-sidebar.open {
        transform: translateX(0);
    }
    .gallery-layout {
        height: auto;
        min-height: 75vh;
        max-height: none;
    }
}

@media (max-width: 767.98px) {
    .gallery-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    .gallery-grid-wrapper {
        padding: 12px;
    }
    .gallery-lightbox__nav--prev { left: 8px; }
    .gallery-lightbox__nav--next { right: 8px; }
    .gallery-lightbox__nav {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    .gallery-lightbox__stage {
        width: 96vw;
        height: 70vh;
    }
}

@media (max-width: 575.98px) {
    .gallery-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
    }
    .gallery-image-card__info {
        padding: 6px 8px;
    }
    .gallery-toolbar {
        flex-wrap: wrap;
        padding: 10px 12px;
    }
}

/* ==========================================================
   VIDEO GALLERY — Video Record
   ========================================================== */

/* ── Video grid ── */
.vid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 14px 0 20px;
}

/* ── Video card ── */
.vid-card {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    transition: transform .2s, box-shadow .2s;
}
.vid-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ── Preview / thumbnail ── */
.vid-card__preview {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
}

.vid-card__preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.vid-card__play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.35);
    cursor: pointer;
    transition: background .25s;
}
.vid-card:hover .vid-card__play-overlay {
    background: rgba(0,0,0,.5);
}

.vid-card__play-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), .85);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: all .25s;
    box-shadow: 0 4px 20px rgba(var(--accent-rgb), .35);
}
.vid-card:hover .vid-card__play-btn {
    transform: scale(1.1);
    background: var(--accent);
    box-shadow: 0 6px 28px rgba(var(--accent-rgb), .5);
}

.vid-card__duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,.75);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: .3px;
    pointer-events: none;
}

/* ── Card info ── */
.vid-card__info {
    padding: 12px 14px;
}

.vid-card__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.vid-card__time {
    font-size: .72rem;
    color: var(--text-muted);
}

.vid-card__size {
    font-size: .68rem;
    color: var(--text-secondary);
    background: var(--bg-body);
    padding: 2px 7px;
    border-radius: 4px;
}

.vid-card__name {
    font-size: .75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.vid-card__actions {
    display: flex;
    gap: 8px;
}

/* ── Video Player Modal ── */
.vid-player-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.82);
    backdrop-filter: blur(8px);
    z-index: 2000;
}
.vid-player-backdrop.open { display: block; }

.vid-player-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2001;
    width: 92vw;
    max-width: 960px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    flex-direction: column;
}
.vid-player-modal.open { display: flex; }

.vid-player-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.vid-player-modal__title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.vid-player-modal__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.vid-player-modal__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    transition: color .2s;
}
.vid-player-modal__close:hover { color: var(--text-primary); }

.vid-player-modal__body {
    background: #000;
    position: relative;
}

.vid-player-modal__stage {
    width: 100%;
    height: 60vh;
    max-height: 60vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    cursor: default;
    touch-action: none;
}

.vid-player-modal__stage video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transform-origin: center center;
}

/* ── Custom video controls bar (never rotated) ── */
.vid-custom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #111;
    padding: 7px 12px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.vid-ctrl-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.05rem;
    padding: 3px 6px;
    cursor: pointer;
    flex-shrink: 0;
    opacity: .8;
    transition: opacity .15s;
    line-height: 1;
}
.vid-ctrl-btn:hover { opacity: 1; color: var(--accent); }

.vid-ctrl-time {
    font-size: .72rem;
    color: rgba(255,255,255,.65);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    min-width: 32px;
}

.vid-ctrl-seek {
    flex: 1;
    min-width: 0;
    height: 4px;
    cursor: pointer;
    accent-color: var(--accent);
}

.vid-ctrl-vol {
    width: 72px;
    height: 4px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .vid-ctrl-vol { display: none; }
    .vid-custom-controls { gap: 6px; padding: 6px 10px; }
}

.vid-player-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
}

.vid-player-modal__nav {
    display: flex;
    gap: 8px;
}

/* ── Video gallery responsive ── */
@media (max-width: 767.98px) {
    .vid-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .vid-player-modal {
        width: 98vw;
        border-radius: 12px;
    }
    .vid-player-modal__stage {
        height: 44vh;
        max-height: 44vh;
    }
    .vid-card__play-btn {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .vid-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 575.98px) {
    .vid-player-modal__header {
        padding: 10px 14px;
    }
    .vid-player-modal__footer {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 14px;
    }
    .vid-card__info {
        padding: 10px 12px;
    }
}

/* ============================================================
   Live Stream Page — Responsive Grid & Cards
   ============================================================ */

/* ── Grid container ── */
.livestream-grid {
    display: grid;
    gap: 16px;
    min-height: 400px;
    transition: all .3s ease;
}

.livestream-grid--empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 1 stream — full width, tall */
.livestream-grid--1 {
    grid-template-columns: 1fr;
}
.livestream-grid--1 .livestream-card__video-container {
    min-height: 520px;
}

/* 2 streams — side by side */
.livestream-grid--2 {
    grid-template-columns: 1fr 1fr;
}
.livestream-grid--2 .livestream-card__video-container {
    min-height: 400px;
}

/* 3 streams — 2 top, 1 centered bottom */
.livestream-grid--3 {
    grid-template-columns: 1fr 1fr;
}
.livestream-grid--3 .livestream-card:nth-child(3) {
    grid-column: 1 / -1;
    max-width: 50%;
    justify-self: center;
}
.livestream-grid--3 .livestream-card__video-container {
    min-height: 340px;
}

/* 4 streams — 2x2 grid */
.livestream-grid--4 {
    grid-template-columns: 1fr 1fr;
}
.livestream-grid--4 .livestream-card__video-container {
    min-height: 300px;
}

/* 5-6 streams — 3 per row */
.livestream-grid--6 {
    grid-template-columns: repeat(3, 1fr);
}
.livestream-grid--6 .livestream-card__video-container {
    min-height: 240px;
}

/* 7+ streams — 3 per row, compact */
.livestream-grid--many {
    grid-template-columns: repeat(3, 1fr);
}
.livestream-grid--many .livestream-card__video-container {
    min-height: 200px;
}

/* ── Focus layout — 1 large + sidebar of small ── */
.livestream-grid--focus {
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto;
}
.livestream-card--focus-main {
    grid-column: 1;
    grid-row: 1 / -1;
}
.livestream-card--focus-main .livestream-card__video-container {
    min-height: 500px;
}
.livestream-card--focus-side .livestream-card__video-container {
    min-height: 140px;
}

/* ── Stream card ── */
.livestream-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, transform .25s, opacity .25s;
    display: flex;
    flex-direction: column;
}
.livestream-card:hover {
    box-shadow: var(--shadow-md);
}
.livestream-card--removing {
    opacity: 0;
    transform: scale(.95);
    pointer-events: none;
}

/* Card header */
.livestream-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
    flex-wrap: wrap;
}
.livestream-card__status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.livestream-card__status--online {
    background: var(--success);
    box-shadow: 0 0 6px rgba(16,185,129,.6);
}
.livestream-card__status--offline {
    background: var(--text-muted);
}
.livestream-card__name {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.livestream-card__btn {
    padding: 3px 7px;
    font-size: .75rem;
    line-height: 1;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    transition: all .2s;
}
.livestream-card__btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .08);
}
.livestream-card__btn--close:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(239,68,68,.08);
}

/* Card body / video area */
.livestream-card__body {
    flex: 1;
    display: flex;
}
.livestream-card__video-container {
    position: relative;
    width: 100%;
    background: #0a0c10;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.livestream-card__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.livestream-card__video-container:fullscreen {
    background: #000;
}
.livestream-card__video-container:fullscreen .livestream-card__video {
    object-fit: contain;
}

/* Overlay (shown while waiting for stream) */
.livestream-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10,12,16,.85);
    z-index: 2;
}
.livestream-card__placeholder {
    text-align: center;
    color: var(--text-muted);
}
.livestream-card__placeholder i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
    opacity: .5;
}
.livestream-card__placeholder span {
    font-size: .82rem;
    display: block;
    margin-bottom: 14px;
}

/* Loading spinner */
.livestream-card__loader {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(var(--accent-rgb), .15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: livestream-spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes livestream-spin {
    to { transform: rotate(360deg); }
}

/* Badge bar (bottom-left overlay badges) */
.livestream-card__badge-bar {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    z-index: 3;
}
.livestream-card__live-badge {
    display: inline-flex;
    align-items: center;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(239,68,68,.85);
    color: #fff;
    animation: livestream-pulse 2s ease-in-out infinite;
}
@keyframes livestream-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}
.livestream-card__device-badge {
    display: inline-flex;
    align-items: center;
    font-size: .65rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(0,0,0,.6);
    color: rgba(255,255,255,.8);
    backdrop-filter: blur(4px);
}

/* ── Empty state ── */
.livestream-empty {
    text-align: center;
    padding: 60px 20px;
}
.livestream-empty__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), .1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.livestream-empty__icon i {
    font-size: 2rem;
    color: var(--accent);
}
.livestream-empty__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.livestream-empty__text {
    font-size: .88rem;
    color: var(--text-muted);
    max-width: 360px;
    margin: 0 auto 20px;
}

/* ── Layout toggle buttons ── */
.livestream-layout-btn {
    padding: 5px 10px;
    font-size: .82rem;
}
.livestream-layout-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

/* ── Responsive adjustments ── */
@media (max-width: 991.98px) {
    .livestream-grid--2,
    .livestream-grid--3,
    .livestream-grid--4 {
        grid-template-columns: 1fr;
    }
    .livestream-grid--3 .livestream-card:nth-child(3) {
        max-width: 100%;
    }
    .livestream-grid--6,
    .livestream-grid--many {
        grid-template-columns: 1fr 1fr;
    }
    .livestream-grid--focus {
        grid-template-columns: 1fr;
    }
    .livestream-card--focus-main {
        grid-row: auto;
    }
    .livestream-card--focus-main .livestream-card__video-container {
        min-height: 300px;
    }
}

@media (max-width: 575.98px) {
    .livestream-grid--6,
    .livestream-grid--many {
        grid-template-columns: 1fr;
    }
    .livestream-card__video-container {
        min-height: 200px !important;
    }
    .livestream-grid--1 .livestream-card__video-container {
        min-height: 300px !important;
    }
}

/* Alarm row highlight (navigate from SOS modal dismiss) */
@keyframes alarmRowPulse {
    0%,100% { background: transparent; }
    15%     { background: rgba(239,68,68,.22); box-shadow: inset 3px 0 0 #ef4444; }
    50%     { background: rgba(239,68,68,.10); box-shadow: inset 3px 0 0 #ef4444; }
    85%     { background: rgba(239,68,68,.18); box-shadow: inset 3px 0 0 #ef4444; }
}
.alarm-row-highlight {
    animation: alarmRowPulse 2.2s ease-in-out 7;
    position: relative;
}


/* Dashboard silent-refresh animations */
@keyframes kpiValFlash {
  0%   { color: var(--accent); }
  100% { color: inherit; }
}
.kpi-val-flash { animation: kpiValFlash .6s ease-out; }

@keyframes tsPulse {
  0%   { opacity: .4; }
  50%  { opacity: 1; }
  100% { opacity: .7; }
}
.ts-pulse { animation: tsPulse .8s ease-out; }


/* Prevent Chart.js responsive grow loop on dashboard charts */
#activityChart,
#categoryBarChart {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
}

