:root {
    /* Render native widgets (select dropdowns, scrollbars, date pickers) dark so
       option text is not white-on-white in the OS-drawn popup. */
    color-scheme: dark;
    --bg: #040711;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.12);
    --accent: #38bdf8;
    --hover: rgba(56, 189, 248, 0.12);
    --active: rgba(56, 189, 248, 0.2);
    --card-bg: #1e293b;
    /* Single source of truth for the sidebar's footprint. Anything pinned to the
       sidebar edge (the ws-banner) reads this, so collapsing only has to change
       the variable — body.nav-collapsed overrides it below. */
    --nav-width: 240px;
    /* 76px, not 68: the rail keeps its own scrollbar (24 links overflow any
       laptop viewport), which eats ~16px of the content box. 68px left the
       logout label wider than the button it sits in. */
    --nav-width-collapsed: 76px;
    --success-color: #22c55e;
    --warning-color: #eab308;
    --error-color: #ef4444;
}

/* Fallback for browsers that ignore color-scheme on <option> popups. */
select option {
    background-color: #0f172a;
    color: var(--text);
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--tm-sans);
}

body {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Any class that sets `display` outranks the UA stylesheet's [hidden] rule, so
   an element toggled with `el.hidden = true` stays on screen. The codebase had
   already hit this twice and patched it one component at a time; the Cases undo
   bar hit it a third time. One rule instead, so `hidden` means hidden
   everywhere. */
[hidden] { display: none !important; }

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 100002;
    transform: translateY(-140%);
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--accent);
    color: #04263a;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.skip-link:focus,
.skip-link:focus-visible {
    transform: translateY(0);
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Sidebar */
/* Mobile nav toggle + backdrop are desktop-hidden; the ≤640px block below
   turns the sidebar into an off-canvas drawer and reveals these. */
.nav-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1002;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    cursor: pointer;
}

.nav-toggle svg {
    width: 22px;
    height: 22px;
}

.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(2, 6, 23, 0.55);
}

.nav {
    --nav-text: #e2e8f0;
    --nav-muted: #94a3b8;
    --nav-border: rgba(148, 163, 184, 0.12);
    --nav-hover: rgba(56, 189, 248, 0.12);
    --nav-active: rgba(56, 189, 248, 0.2);
    --nav-accent: #38bdf8;
    width: var(--nav-width);
    flex: 0 0 var(--nav-width);
    min-height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
    border-right: 1px solid var(--nav-border);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease, flex-basis 0.2s ease, padding 0.2s ease;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    color: var(--nav-muted);
    background: transparent;
    border: 1px solid var(--nav-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--nav-hover);
    color: var(--nav-accent);
    border-color: rgba(56, 189, 248, 0.4);
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
}

body[data-mode="Light"] .nav {
    --nav-text: #0f172a;
    --nav-muted: #475569;
    --nav-border: rgba(15, 23, 42, 0.08);
    --nav-hover: rgba(2, 6, 23, 0.06);
    --nav-active: rgba(56, 189, 248, 0.18);
    --nav-accent: #38bdf8;
}

.nav .header {
    color: var(--nav-text);
}

.nav .small {
    color: var(--nav-muted);
}

.nav .logo-placeholder {

        background-image: url("../assets/login_icon.svg");

}

.nav .link {
    color: var(--nav-text);
}

.nav .link:hover {
    background: var(--nav-hover);
    color: var(--nav-accent);
}

.nav .link:hover .icon {
    color: var(--nav-accent);
}

.nav .link.active {
    background: var(--nav-active);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: var(--nav-accent);
}

.nav .link.active .icon {
    color: var(--nav-accent);
}

.nav .icon {
    color: var(--nav-muted);
}

.nav .logout-btn {
    color: var(--nav-muted);
}

.nav .logout-btn:hover {
    background: var(--nav-hover);
    color: var(--nav-accent);
}


.header {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.02em;
    margin: 2px 6px 10px;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-placeholder {
    width: 36px;
    height: 36px;
    background-image: url("../assets/login_icon.svg");
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    /* background: linear-gradient(135deg, var(--accent), #0ea5e9); */
    flex: 0 0 36px;
}

.group {
    margin-top: 4px;
    padding-top: 4px;
}

.small {
    font-size: 11px;
    color: var(--muted);
    margin: 0 6px 4px;
}

.link {
    display: flex;
    align-items: center;
    gap: 10px;
    /* 6px rather than 8px: with 24 links across six groups the nav ran 1352px
       against a 720px viewport, so Lookup, Reports and Report Builder — the
       things you reach for under time pressure — sat below the fold. */
    padding: 6px 10px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    border: 1px solid transparent;
}

.link:hover {
    background: var(--hover);
    color: var(--accent);
}

.link:hover .icon {
    color: var(--accent);
}

.link.active {
    background: var(--active);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: var(--accent);
}

.link.active .icon {
    color: var(--accent);
}

.icon {
    width: 18px;
    height: 18px;
    display: flex;
    color: var(--muted);
}

.footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logout-btn {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.logout-btn:hover {
    background: var(--hover);
    color: var(--accent);
    border-color: rgba(56, 189, 248, 0.4);
}

/* Shared User Menu (aligned with seals page design) */
.user-menu-wrap {
    position: relative;
}

.user-menu-wrap-right {
    margin-left: auto;
}

.user-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.user-btn:hover {
    filter: brightness(1.08);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 180px;
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 50;
    flex-direction: column;
    overflow: hidden;
}

.user-menu-header {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 8px 12px;
    color: #cbd5e1;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.user-menu-item-danger {
    color: #ef4444;
}

.user-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Shared tab system */
.main-content .tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    flex-wrap: wrap;
}

.main-content .tabs .tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: 0;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.main-content .tabs .tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.02);
}

.main-content .tabs .tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: transparent;
}

.main-content .tabs .tab:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.55);
}

.main-content .tabs .tab-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    stroke: currentColor;
    fill: none;
    opacity: 0.75;
}

.main-content .tabs .tab.active .tab-icon {
    opacity: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    width: 100%;
}


#page-container {
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: 100%;
}

/* Force injected page roots to use full available width */
#page-container .wrap,
#page-container .layout,
#page-container .dashboard-layout,
#page-container .dashboard-container,
#page-container .inspector-container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    /* Page roots carry their own padding; without border-box, 100% plus that
       padding overflowed the main column and put a horizontal scrollbar on
       Traffic, Settings and every other padded page. */
    box-sizing: border-box !important;
}

/* Page header sizing standard (dashboard-aligned) */
#page-container .page-header {
    padding: 24px 32px !important;
    align-items: center !important;
    gap: 16px !important;
}

#page-container .page-title {
    font-size: 2rem !important;
    font-weight: 700 !important;
    line-height: 1.1;
}

#page-container .page-subtitle {
    font-size: 1rem !important;
    line-height: 1.3;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.25em;
    font-weight: 600;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 2em;
}

.stat-content {
    flex: 1;
}

.stat-title {
    color: var(--muted);
    font-size: 0.9em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 600;
}

.stat-change {
    font-size: 0.85em;
    margin-top: 4px;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--error-color);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

.tm-table-pagination {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.tm-table-pagination button {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.tm-table-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tm-table-pagination-info {
    color: var(--muted);
    font-size: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
}

tr:hover {
    background-color: var(--hover);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    background-color: #0ea5e9;
}

.btn-secondary {
    background-color: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--hover);
}

/* Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.loader {
    border: 4px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Messages */
.error-message,
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--muted);
}

.error-message {
    color: var(--error-color);
}

.error-icon,
.empty-icon {
    font-size: 3em;
    margin-bottom: 12px;
    display: block;
}

/* Login Page Specific */
.tm-login-shell {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background:
        radial-gradient(900px 480px at 18% 12%, rgba(56, 189, 248, 0.14), transparent 58%),
        radial-gradient(800px 420px at 85% 88%, rgba(14, 165, 233, 0.12), transparent 60%),
        #040711;
}

.tm-login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 36px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    backdrop-filter: blur(6px) saturate(120%);
    box-shadow: 0 8px 30px rgba(6, 24, 40, 0.6);
    box-sizing: border-box;
}

.tm-login-logo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.tm-login-logo {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 56px;
}

.tm-login-brand {
    min-width: 0;
}

.tm-login-title {
    font-size: 20px;
    margin: 0 0 4px 0;
    color: #e6eef8;
}

.tm-login-subtitle {
    margin: 0 0 10px 0;
    color: #94a3b8;
    font-size: 14px;
}

.tm-login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tm-login-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #123;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
}

.tm-login-input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.tm-login-input:disabled {
    opacity: 0.75;
}

.tm-login-otp {
    display: none;
    text-align: center;
    letter-spacing: 4px;
    font-weight: 700;
}

.tm-login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
    font-size: 13px;
    user-select: none;
}

.tm-login-remember-check {
    width: 14px;
    height: 14px;
    accent-color: #38bdf8;
}

.tm-login-message {
    min-height: 20px;
    margin-top: 2px;
    font-size: 13px;
    color: transparent;
}

.tm-login-message.is-error {
    color: #ffb4b4;
}

.tm-login-message.is-info {
    color: #38bdf8;
}

.tm-login-message.is-success {
    color: #10b981;
}

.tm-login-actions {
    display: flex;
    gap: 8px;
}

.tm-login-resend-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.tm-login-link {
    border: none;
    background: transparent;
    color: #38bdf8;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px 0;
}

.tm-login-link:disabled {
    color: #64748b;
    cursor: not-allowed;
}

.tm-login-btn {
    border: none;
    border-radius: 8px;
    min-height: 40px;
    padding: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter 0.2s ease;
}

.tm-login-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.tm-login-btn-primary {
    flex: 1;
    background: #38bdf8;
    color: #04263a;
}

.tm-login-btn-secondary {
    width: 108px;
    background: #334155;
    color: #e6eef8;
}

.tm-login-btn:hover:not(:disabled) {
    filter: brightness(1.04);
}

.tm-login-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(10, 20, 40, 0.3);
    border-top-color: #04263a;
    animation: tm-login-spin 0.8s linear infinite;
}

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

@media (max-width: 540px) {
    .tm-login-shell {
        padding: 16px;
    }

    .tm-login-card {
        padding: 22px;
    }

    .tm-login-actions {
        flex-direction: column;
    }

    .tm-login-btn-secondary {
        width: 100%;
    }
}

/* Badges - See line 1171 for primary badge system (severity/tactic badges) */
/* Legacy .badge-* classes deprecated in favor of .badge.high|medium|low|critical */
.badge-success {
    background-color: rgba(34, 197, 94, 0.2);
    color: var(--success-color);
}

.badge-warning {
    background-color: rgba(234, 179, 8, 0.2);
    color: var(--warning-color);
}

.badge-error {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
}

.badge-info {
    background-color: rgba(56, 189, 248, 0.2);
    color: var(--accent);
}

/*  ==================================
    DASHBOARD-SPECIFIC STYLES
    ================================== */

.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Hero Section - Security Score */
.hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.score-card {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 24px 26px;
    backdrop-filter: blur(6px) saturate(120%);
    box-shadow: 0 8px 30px rgba(6, 24, 40, 0.6);
}

.score-badge {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    background: linear-gradient(135deg, #facc15, #f97316);
    box-shadow: 0 0 22px rgba(250, 204, 21, 0.45);
    margin-bottom: 18px;
}

.score-meta .eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 12px;
    color: var(--muted);
}

.score-meta .score-value {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 42px;
    font-weight: 800;
    margin: 8px 0 10px 0;
}

.score-meta .score-value span.muted {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

.score-visual {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 24px 24px 36px;
    backdrop-filter: blur(6px) saturate(120%);
    box-shadow: 0 8px 30px rgba(6, 24, 40, 0.6);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.score-controls {
    display: flex;
    gap: 10px;
}

.chip {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.6), rgba(9, 14, 27, 0.9));
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.chip:hover {
    color: var(--text);
    border-color: rgba(56, 189, 248, 0.55);
}

.chip.active {
    color: #0f172a;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.9), rgba(129, 140, 248, 0.9));
    border-color: transparent;
    box-shadow: 0 0 22px rgba(56, 189, 248, 0.4);
}

/* Host Meta */
.host-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

/* Stat Grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.stat-grid .stat-card {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(6px) saturate(120%);
    box-shadow: 0 8px 30px rgba(6, 24, 40, 0.6);
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1), border-color 0.22s ease;
}

.stat-grid .stat-card:hover {
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-3px);
}

.stat-grid .stat-card h4 {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-grid .stat-card .stat-value {
    font-size: 30px;
    font-weight: 700;
}

/* Panels */
.panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.panel {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    backdrop-filter: blur(6px) saturate(120%);
    box-shadow: 0 8px 30px rgba(6, 24, 40, 0.6);
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.panel-subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

/* Scenario List */
.scenario-list,
.asset-list,
.choke-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scenario-item,
.asset-item,
.choke-item {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(10, 16, 28, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.12);
    transition: border-color 0.4s ease, transform 0.3s ease;
}

.scenario-item:hover,
.asset-item:hover,
.choke-item:hover {
    border-color: rgba(56, 189, 248, 0.5);
    transform: translateY(-2px);
}

.scenario-grade {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.08), 0 0 18px rgba(250, 204, 21, 0.25);
    color: #0f172a;
}

.grade-f {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.94), rgba(239, 68, 68, 0.94));
}

.grade-e {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.9), rgba(249, 115, 22, 0.9));
}

.grade-d {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.92), rgba(250, 204, 21, 0.92));
}

.grade-c {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.82), rgba(253, 224, 71, 0.92));
}

.grade-b {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.88), rgba(16, 185, 129, 0.92));
}

.grade-a {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.85), rgba(37, 99, 235, 0.92));
}

.scenario-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.scenario-body strong {
    font-size: 15px;
}

.sparkline {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.04em;
}

.scenario-metric {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 90px;
}

.scenario-metric span:first-child {
    font-weight: 700;
    font-size: 18px;
}

/* Asset Badges */
.asset-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(100, 116, 139, 0.18);
    color: var(--muted);
}

.badge.high {
    background: rgba(251, 113, 133, 0.18);
    color: #fda4af;
}

.badge.medium {
    background: rgba(250, 204, 21, 0.18);
    color: #facc15;
}

.badge.low {
    background: rgba(52, 211, 153, 0.18);
    color: #5eead4;
}

.badge.critical {
    background: rgba(251, 113, 133, 0.28);
    color: #fb7185;
}

.badge.trend-up {
    color: #34d399;
    background: rgba(52, 211, 153, 0.18);
}

.badge.trend-down {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.18);
}

.badge.trend-flat {
    color: var(--muted);
    background: rgba(148, 163, 184, 0.12);
}

/* Critical Assets Radial Gauge */
.critical-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
}

.radial {
    --fill: 0.25;
    width: 160px;
    aspect-ratio: 1/1;
    position: relative;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--fill) * 360deg), rgba(30, 41, 59, 0.5) 0deg);
    box-shadow: 0 0 26px rgba(56, 189, 248, 0.35), inset 0 0 14px rgba(4, 7, 17, 0.65);
    transition: background 0.8s ease;
}

.radial::after {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.9), rgba(2, 6, 15, 0.95));
    box-shadow: inset 0 0 20px rgba(148, 163, 184, 0.32);
}

.radial-core {
    position: absolute;
    inset: 32px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
    font-weight: 700;
    z-index: 1;
}

.radial-core span {
    font-size: 30px;
}

.radial-core small {
    font-size: 12px;
    color: var(--muted);
}

.critical-meta {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.critical-meta strong {
    font-size: 18px;
}

.critical-meta p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--muted);
}

/* Charts Section */
.charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

.chart-controls {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.chart-panel {
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.chart-panel canvas {
    height: 220px !important;
    max-height: 220px !important;
    width: 100% !important;
    border-radius: 12px;
    background: rgba(8, 13, 24, 0.6);
}

.toggle {
    display: inline-flex;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(8, 13, 24, 0.65);
}

.toggle button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    padding: 6px 14px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.toggle button.active {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
}

/* Heatmap */
.heatmap {
    display: grid;
    grid-template-columns: 80px repeat(24, 1fr);
    gap: 6px;
}

.heatmap .label {
    font-size: 12px;
    color: var(--muted);
    align-self: center;
}

.heatmap .cell {
    height: 20px;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.06);
    transition: transform 0.2s ease, border-color 0.3s ease;
}

.heatmap .cell:hover {
    transform: scale(1.08);
    border-color: rgba(56, 189, 248, 0.45);
}

.hrow {
    display: contents;
}

.hrow.header .cell {
    height: auto;
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: 10px;
    text-align: center;
}

.heatmap-legend {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.heatmap-legend .bar {
    flex: 1;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(56, 189, 248, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.heatmap-legend small {
    color: var(--muted);
}

/* Choke Points */
.choke-metric {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

/* Tech Grid */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.tech-card {
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(10, 16, 28, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.12);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 140px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.tech-card:hover {
    transform: translateY(-3px);
    border-color: rgba(129, 140, 248, 0.5);
}

.tech-card strong {
    font-size: 15px;
}

.tech-card p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
}

.tech-footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 820px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .charts {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   SEALS PAGE STYLES
   =================================== */

.seals-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    background: linear-gradient(145deg, rgba(11, 18, 32, 0.9), rgba(6, 11, 22, 0.85));
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 14px 36px -26px rgba(56, 189, 248, 0.28);
}

.page-main-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.page-subtitle {
    color: var(--muted);
    font-size: 13px;
    margin: 4px 0 0 0;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.agent-count-badge {
    padding: 8px 16px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text);
}

.agent-count-badge strong {
    color: var(--accent);
    font-size: 16px;
    margin-right: 4px;
}

/* Tabs */
.seal-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.seal-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    bottom: -1px;
}

.seal-tab:hover {
    color: var(--text);
}

.seal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Tab Content */
.seal-tab-content {
    display: none;
}

.seal-tab-content.active {
    display: block;
}

.seal-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 20px;
    backdrop-filter: blur(6px) saturate(120%);
    box-shadow: 0 8px 30px rgba(6, 24, 40, 0.6);
}

.card-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-header-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Search */
.search-wrap {
    display: flex;
    gap: 8px;
}

.search-input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    min-width: 220px;
    font-size: 13px;
}

.search-input::placeholder {
    color: var(--muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Stats Mini */
.process-stats-mini,
.app-stats-mini,
.account-stats-mini,
.auth-stats-mini,
.vuln-stats-mini {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 13px;
}

.process-stats-mini strong,
.app-stats-mini strong,
.account-stats-mini strong {
    color: var(--accent);
    font-size: 15px;
    margin-right: 4px;
}

.success-badge,
.failed-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.success-badge {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981;
}

.success-badge strong {
    color: #10b981;
}

.failed-badge {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.failed-badge strong {
    color: #ef4444;
}

.vuln-critical,
.vuln-high,
.vuln-medium,
.vuln-low {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.vuln-critical {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.vuln-high {
    background: rgba(251, 113, 133, 0.18);
    color: #fb7185;
}

.vuln-medium {
    background: rgba(250, 204, 21, 0.18);
    color: #facc15;
}

.vuln-low {
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
}

/* Status & Privilege Badges */
.status-badge,
.privilege-badge,
.severity-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-success {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981;
}

.status-failed {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.status-enabled {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981;
}

.status-disabled {
    background: rgba(100, 116, 139, 0.18);
    color: var(--muted);
}

.privilege-administrator {
    background: rgba(139, 92, 246, 0.18);
    color: #a78bfa;
}

.privilege-user {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
}

.privilege-guest {
    background: rgba(100, 116, 139, 0.18);
    color: var(--muted);
}

.severity-critical {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.severity-high {
    background: rgba(251, 113, 133, 0.18);
    color: #fb7185;
}

.severity-medium {
    background: rgba(250, 204, 21, 0.18);
    color: #facc15;
}

.severity-low {
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
}

.badge::before,
.severity-badge::before {
    font-size: 0.75em;
    font-weight: 900;
    margin-right: 4px;
}

.badge.critical::before,
.severity-critical::before {
    content: "!";
}

.badge.high::before,
.severity-high::before {
    content: "H";
}

.badge.medium::before,
.severity-medium::before {
    content: "M";
}

.badge.low::before,
.severity-low::before {
    content: "L";
}

/* Mono text */
.mono-text {
    font-family: var(--tm-mono);
    font-size: 12px;
    color: var(--muted);
}

.mono-text-small {
    font-family: var(--tm-mono);
    font-size: 11px;
    color: var(--muted);
}

/* ── Focus Visible (WCAG 2.4.7) ── */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Toast Notification System ── */
#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 420px;
    width: 100%;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text);
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-exit {
    opacity: 0;
    transform: translateX(30px);
}

.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.toast-msg {
    flex: 1;
    word-break: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text);
}

.toast-success { border-left: 3px solid var(--success-color); }
.toast-success .toast-icon { color: var(--success-color); }

.toast-error { border-left: 3px solid var(--error-color); }
.toast-error .toast-icon { color: var(--error-color); }

.toast-warning { border-left: 3px solid var(--warning-color); }
.toast-warning .toast-icon { color: var(--warning-color); }

.toast-info { border-left: 3px solid var(--accent); }
.toast-info .toast-icon { color: var(--accent); }

/* ── Confirm Dialog ── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.confirm-visible {
    opacity: 1;
}

.confirm-dialog {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.confirm-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.confirm-msg {
    margin: 0 0 20px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    /* Confirmations for multi-step actions have to list the steps; the text is
       escaped into a single <p>, so honour the newlines the caller wrote. */
    white-space: pre-line;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-danger {
    background-color: var(--error-color);
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* ── WebSocket Connection Banner ── */
.ws-banner {
    position: fixed;
    top: 0;
    left: var(--nav-width);
    right: 0;
    z-index: 99999;
    padding: 6px 16px;
    font-size: 12px;
    text-align: center;
    color: var(--warning-color);
    background: rgba(234, 179, 8, 0.12);
    border-bottom: 1px solid rgba(234, 179, 8, 0.25);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.ws-banner.ws-banner-visible {
    transform: translateY(0);
}

/* ── Dark/Light Theme Toggle ── */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    width: calc(100% - 24px);
    box-sizing: border-box;
}

.theme-toggle:hover {
    background: var(--hover);
    color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}

/* ── Collapsed sidebar (icon rail) ──────────────────────────────────────────
   Collapsing must not cost the analyst any destination: every link in the
   expanded nav is still present here, just reduced to its icon. Only the text
   that cannot fit is hidden — link labels, the brand word and the group
   headings — and the group headings are replaced by a rule so the sections stay
   visually separated. Link labels survive as title tooltips, applied by
   setupSidebarCollapse().

   Gated to ≥641px on purpose: below that the sidebar is already an off-canvas
   drawer with its own hamburger, so a persisted collapsed state must not turn
   that drawer into a 68px sliver. */
@media (min-width: 641px) {
    body.nav-collapsed {
        --nav-width: var(--nav-width-collapsed);
    }

    body.nav-collapsed .nav {
        padding-left: 8px;
        padding-right: 8px;
        align-items: stretch;
    }

    /* Logo above the toggle — side by side does not fit in 68px. */
    body.nav-collapsed .nav .header {
        margin-left: 0;
        margin-right: 0;
    }

    body.nav-collapsed .nav .header-inner {
        flex-direction: column;
        gap: 8px;
        justify-content: center;
    }

    body.nav-collapsed .nav .brand {
        justify-content: center;
        gap: 0;
    }

    body.nav-collapsed .nav .brand-name {
        display: none;
    }

    /* Group headings ("Security Operations", "GRC", …) have no room to render,
       so the grouping they convey is carried by a divider instead. */
    body.nav-collapsed .nav .small {
        display: none;
    }

    body.nav-collapsed .nav .group {
        border-top: 1px solid var(--nav-border);
        margin-top: 6px;
        padding-top: 8px;
    }

    /* No divider directly under the brand — the header already reads as one.
       Sibling-based, not :first-of-type, because .header is the first div in
       .nav and would otherwise claim that pseudo-class. */
    body.nav-collapsed .nav .header + .group {
        border-top: 0;
    }

    body.nav-collapsed .nav .link {
        justify-content: center;
        gap: 0;
        padding: 9px 0;
    }

    /* The unread badge is not a label — it stays, pinned to the icon corner. */
    body.nav-collapsed .nav .link > span:not(.nav-badge) {
        display: none;
    }

    body.nav-collapsed .nav .nav-badge {
        position: absolute;
        top: 1px;
        right: 4px;
        margin-left: 0;
        min-width: 14px;
        padding: 0 4px;
        font-size: 9px;
        line-height: 13px;
    }

    body.nav-collapsed .nav .footer {
        border-top: 1px solid var(--nav-border);
        padding-top: 8px;
    }

    body.nav-collapsed .nav .logout-btn {
        padding: 8px 1px;
        font-size: 9px;
        letter-spacing: 0;
        overflow: hidden;
    }
}

/* ── Mobile navigation (≤640px): off-canvas drawer ──────────────────────────
   The 240px sidebar is 64% of a 375px screen, so below 640px it becomes a
   hidden off-canvas drawer opened by the hamburger (#navToggle). The open-state
   rule uses the #appNav id so it outranks reports.css's `.nav { display:none
   !important }` (an id !important beats a class !important regardless of load
   order), keeping navigation reachable even on the full-screen Reports view. */
@media (max-width: 640px) {
    .nav-toggle {
        display: flex;
    }

    #appNav {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1001;
        width: 264px;
        max-width: 82vw;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 2px 0 18px rgba(2, 6, 23, 0.45);
    }

    body.nav-open #appNav {
        transform: none !important;
        display: flex !important;
    }

    body.nav-open .nav-backdrop {
        display: block;
    }

    /* Clear the hamburger so page headers don't sit under it. */
    .main-content {
        padding-top: 60px;
    }
}


/* The nav scrolls (24 links do not fit a laptop viewport even at this density)
   and nothing said so, which is how Lookup, Reports and Report Builder went
   unfound. The classic two-layer scroll shadow: the `local` cover layer scrolls
   with the content and wipes the `scroll`-anchored shadow once the rail is at
   the bottom, so the cue appears only while there is more to see. No extra
   element, nothing to keep in sync in JS. */
.nav {
    background-image:
        linear-gradient(to top, var(--bg), rgba(4, 7, 17, 0)),
        linear-gradient(to top, rgba(56, 189, 248, 0.22), rgba(4, 7, 17, 0));
    background-position: bottom center, bottom center;
    background-size: 100% 26px, 100% 26px;
    background-repeat: no-repeat;
    background-attachment: local, scroll;
    scrollbar-width: thin;
}

/* ── Focus visibility, app-wide baseline ────────────────────────────────── */
/* Six page stylesheets (soar, inspector, inventory, users, vulnerabilities,
   compliance) carried no :focus-visible rule at all, so on those pages a
   keyboard user could not see where they were. Page rules still win; this is
   only the floor. Buttons and links were the gap — inputs already replace their
   outline with a ring. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent, #38bdf8);
    outline-offset: 2px;
    border-radius: 6px;
}



/* ── Collapsible nav sections ───────────────────────────────────────────── */
/* The section label is the fold control (see setupNavGroups). It carries a
   caret so it reads as one, and keeps a focus ring because it is reachable from
   the keyboard. */
.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    padding: 2px 6px;
    margin-left: 0;
    margin-right: 0;
}

.nav-group-toggle:hover {
    color: var(--accent);
    background: var(--hover);
}

.nav-group-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.nav-group-toggle::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.6;
    transition: transform 0.15s ease;
}

.nav-group-toggle[data-collapsed="true"]::after {
    transform: rotate(-90deg);
}

/* Collapsed to the icon rail there is no room for a label, so the fold control
   would be an unlabelled sliver. Hide it and show every link instead. */
body.nav-collapsed .nav-group-toggle { display: none; }
body.nav-collapsed .nav a.link[hidden] { display: flex !important; }
