/* ── Self-hosted fonts (variable, latin subset) ─────────────────────────────
   Served from our own static/ instead of fonts.googleapis.com: no third-party
   request, no fallback-font flash on cold loads. Both files are Google's own
   variable builds, so every weight the UI uses comes from one file each. */
/* ── Stacking order ──────────────────────────────────────────────────────
   One ladder for every layer that can overlap another. Local z-indexes
   inside a component (1–12: sticky cells, resizers) stay literal; anything
   that floats over the page takes a rung from here. lib/dialogs.js mirrors
   the order for Escape handling (menu < drawer < modal < sheet). */
:root {
    --z-header:     100;   /* sticky header */
    --z-modal:      200;   /* centred modals: annotate, wide (negotiation, wizard), column picker */
    --z-drawer:     500;   /* device / user drawer */
    --z-menu:       900;   /* settings menu, pulse panel */
    --z-overlay:    999;   /* sync overlay, skip link */
    --z-tooltip:   1100;   /* chart tooltips */
    --z-net-pill:  1150;   /* "connection lost" pill */
    --z-shortcuts: 1200;   /* keyboard cheat sheet */
    --z-tour:      1300;   /* first-run tour */
    --z-palette:   2000;   /* command palette */
    --z-login:     9999;   /* sign-in overlay: above everything but toasts */
    --z-toast:    10000;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/Inter-var-latin.65850a373e25.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("fonts/JetBrainsMono-var-latin.570751c5f8b4.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Dark theme (default). 2026-08 refresh: lifted from the near-black
       Night Owl palette — comfortable dark slate, teal kept as the
       brand/interactive accent, coral reserved for alarm. */
    --bg:            #141920;
    --surface:       #1b212b;
    --surface-2:     #232b37;
    --surface-3:     #2a3442;
    --border:        #303a49;
    --border-sub:    #262f3c;
    --accent:        #00d4b8;
    --accent-dim:    rgba(0,212,184,0.08);
    --accent-border: rgba(0,212,184,0.25);
    --warn:          #f2b13c;
    --warn-dim:      rgba(242,177,60,0.10);
    --error:         #e8503a;
    --error-dim:     rgba(232,80,58,0.10);
    --success:       #3dd68c;
    --success-dim:   rgba(61,214,140,0.10);
    --ghost:         #8b9aab;
    --ghost-dim:     rgba(139,154,171,0.12);
    /* Conflict = "sources disagree": its own hue, never blended into warn. */
    --conflict:      #e879f9;
    --conflict-dim:  rgba(232,121,249,0.10);
    --conflict-hatch: repeating-linear-gradient(45deg, rgba(232,121,249,0.10) 0 4px, transparent 4px 9px);
    /* Chart series (design system): canvas code reads these at draw time —
       zero hard-coded canvas colours. Order: blue, violet, green, amber,
       teal, coral. */
    --chart-1:       #60a5fa;
    --chart-2:       #a78bfa;
    --chart-3:       #34d399;
    --chart-4:       #fbbf24;
    --chart-5:       #3fc5d6;
    --chart-6:       #fb7185;
    --chart-axis:    rgba(130,160,180,0.28);
    --chart-grid:    rgba(130,160,180,0.10);
    --text:          #e2e8f0;
    --text-2:        #97a5b8;
    --text-3:        #6f7f96;
    --mono:          'JetBrains Mono', monospace;
    --sans:          'Inter', sans-serif;
    --thead-top:     52px;   /* updated by updateStickyOffsets() */
    --overlay-bg:        rgba(12,15,20,0.85);
    --login-overlay-bg:  rgba(12,15,20,0.9);
    --stripe-bg:         rgba(255,255,255,0.03);
    --btn-accent-text:   #000;
    --body-font-size:    14px;
    --body-font-weight:  500;
    --table-font-size:   14px;
    --table-font-weight: 500;
    --mono-font-weight:  500;
    /* Elevation + radius tokens — the only sanctioned values. */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --shadow-1:   0 1px 2px rgba(0,0,0,0.25);
    --shadow-2:   0 8px 24px rgba(0,0,0,0.35);
    --shadow-3:   0 24px 64px rgba(0,0,0,0.5);
    /* Type scale — every font-size in the app resolves to one of these
       (display sizes >24 excepted). Numeric names: --fs-12 is 12px. */
    --fs-10: 10px;
    --fs-11: 11px;
    --fs-12: 12px;
    --fs-13: 13px;
    --fs-14: 14px;
    --fs-16: 16px;
    --fs-20: 20px;
    --fs-24: 24px;
    --fs-30: 30px;
    /* Spacing scale (adopted where values already align; odd gaps remain
       intentional micro-fit). */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    /* Motion scale — all UI transitions/animations use these. */
    --dur-fast: 0.1s;
    --dur-med:  0.15s;
    --dur-slow: 0.2s;
    --ease:     ease;
    /* Source + platform brand colors (charts sample these at draw time). */
    --src-jc:   #60a5fa;
    --src-kj:   #a78bfa;
    --src-gw:   #34d399;
    --src-si:   #f59e0b;
    --src-tn:   #06b6d4;
    --plat-macos:    #a78bfa;
    --plat-windows:  #60a5fa;
    --plat-linux:    #fb923c;
    --plat-chromeos: #34d399;
    --amber:  #f59e0b;
    --orange: #fb923c;
}

/* ── LIGHT THEME ───────────────────────────────────────
   White cards on a soft neutral-gray canvas (modeled on an internal-tool
   internal tool): high contrast text, restrained borders. */
html[data-theme="light"] {
    --bg:            #f6f7f9;
    --surface:       #ffffff;
    --surface-2:     #f1f3f6;
    --surface-3:     #e9edf2;
    --border:        #e1e5eb;
    --border-sub:    #eaedf2;
    --accent:        #0d9488;
    --accent-dim:    rgba(13,148,136,0.08);
    --accent-border: rgba(13,148,136,0.28);
    --warn:          #b45309;
    --warn-dim:      rgba(180,83,9,0.10);
    --error:         #dc2626;
    --error-dim:     rgba(220,38,38,0.08);
    --success:       #0f8a5f;
    --success-dim:   rgba(15,138,95,0.09);
    --ghost:         #64748b;
    --ghost-dim:     rgba(100,116,139,0.12);
    --conflict:      #a21caf;
    --conflict-dim:  rgba(162,28,175,0.09);
    --conflict-hatch: repeating-linear-gradient(45deg, rgba(162,28,175,0.09) 0 4px, transparent 4px 9px);
    --chart-1:       #2563eb;
    --chart-2:       #8b5cf6;
    --chart-3:       #059669;
    --chart-4:       #d97706;
    --chart-5:       #1e8a99;
    --chart-6:       #e11d48;
    --chart-axis:    rgba(60,75,95,0.30);
    --chart-grid:    rgba(60,75,95,0.10);
    --text:          #1c2430;
    --text-2:        #4d5768;
    --text-3:        #8a94a6;
    --overlay-bg:        rgba(23,30,42,0.5);
    --login-overlay-bg:  rgba(23,30,42,0.6);
    --stripe-bg:         rgba(15,23,42,0.035);
    --shadow-1:   0 1px 2px rgba(23,30,42,0.08);
    --shadow-2:   0 8px 24px rgba(23,30,42,0.12);
    --shadow-3:   0 24px 64px rgba(23,30,42,0.2);
    --btn-accent-text:   #ffffff;
    --body-font-size:    14.5px;
    --body-font-weight:  540;
    --table-font-size:   14.5px;
    --table-font-weight: 540;
    --mono-font-weight:  540;
}

* { margin:0; padding:0; box-sizing:border-box; }

/* ── Skip links (keyboard users) ──────────────────────── */
.skip-link {
    position: fixed;
    top: -100px;
    left: 16px;
    z-index: var(--z-overlay);
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: var(--fs-13);
    font-weight: 600;
    text-decoration: none;
    transition: top var(--dur-med) ease;
}
.skip-link:focus {
    top: 8px;
    outline: none;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: var(--body-font-size);
    font-weight: var(--body-font-weight);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Global focus-visible ────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── Comfortable density mode ─────────────────────────── */
html[data-density="comfortable"] .panel-card { padding: 20px; border-radius: 14px; }
html[data-density="comfortable"] .home-grid { gap: var(--sp-4); }
html[data-density="comfortable"] .home-kpi { min-height: 120px; }
html[data-density="comfortable"] .kpi-label { font-size: var(--fs-13); }
html[data-density="comfortable"] .kpi-val { font-size: 34px; }
html[data-density="comfortable"] table td { padding: 10px 14px; font-size: var(--fs-14); }
html[data-density="comfortable"] table th { padding: 10px 14px; font-size: var(--fs-13); }
html[data-density="comfortable"] .needs-attention-card { padding: 14px 16px; }
html[data-density="comfortable"] .home-briefing { padding: 18px 22px; }
html[data-density="comfortable"] .briefing-sentence { font-size: var(--fs-16); }
html[data-density="comfortable"] .btn-sync { padding: 8px 20px; font-size: var(--fs-13); }
html[data-density="comfortable"] .btn-pulse { padding: 8px 14px; font-size: var(--fs-12); }
html[data-density="comfortable"] .drawer-field { padding: 10px 14px; }
html[data-density="comfortable"] .pinned-filter-chip { padding: 6px 14px; font-size: var(--fs-11); }

/* ── HEADER ────────────────────────────────────────── */
header {
    position: sticky; top: 0; z-index: var(--z-header);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.brand {
    font-family: var(--mono);
    font-size: var(--fs-12);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-shrink: 0;
}

.brand svg { width: 14px; height: 14px; fill: var(--accent); }
/* Armory mark (V · Crest PNG, brand gradient, never recoloured); sized for the rail. */
.brand.brand-armory img { width: 20px; height: 20px; display: block; object-fit: contain; }
body.mc.rail-collapsed .brand.brand-armory img { width: 22px; height: 22px; }

.h-sep { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }

.subtitle {
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    flex-shrink: 0;
}


.source-indicators {
    display: flex;
    gap: 14px;
    align-items: center;
}

.src-ind {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-3);
    letter-spacing: 0.04em;
}

.src-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-3);
    flex-shrink: 0;
}

.src-ind.ok    .src-dot { background: var(--success); }
.src-ind.error .src-dot { background: var(--error); }
.src-ind.ok    { color: var(--text-2); }

.last-sync {
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-3);
    white-space: nowrap;
}

.last-sync b { color: var(--text-2); font-weight: 500; }

.last-sync.stale {
    color: var(--warn);
}

.last-sync.stale b {
    color: var(--warn);
    font-weight: 600;
}

.btn-sync {
    font-family: var(--mono);
    font-size: var(--fs-12);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--btn-accent-text);
    background: var(--accent);
    border: none;
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: opacity var(--dur-med), transform var(--dur-fast), box-shadow var(--dur-med);
    flex-shrink: 0;
}

.btn-sync:hover:not(:disabled) { opacity: 0.88; box-shadow: 0 0 0 3px var(--accent-dim); }
.btn-sync:active:not(:disabled) { transform: scale(0.97); }
.btn-sync:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-sync.syncing { background: var(--accent); opacity: 1; }

.sync-progress-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-11);
    cursor: pointer;
}
.sync-progress-pill[hidden] { display: none; }

.sync-progress-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.sync-progress-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* ── SYSTEM PULSE PANEL ────────────────────────────── */
.pulse-wrap {
    position: relative;
    flex-shrink: 0;
}

.btn-pulse {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-11);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color var(--dur-med), color var(--dur-med), background var(--dur-med);
}

.btn-pulse:hover,
.btn-pulse.open {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--surface-3);
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
    transition: background 0.3s;
}

.pulse-dot.stale { background: var(--warn); }
.pulse-dot.error { background: var(--error); }

.pulse-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: min(78vh, 760px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    z-index: calc(var(--z-menu) + 10);
    box-shadow: var(--shadow-2);
}

.pulse-panel.open { display: block; animation: pop-in var(--dur-med) ease; }

.pulse-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--border-sub);
}

.pulse-panel-title {
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}

.pulse-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-3);
    font-size: var(--fs-16);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-close:hover {
    background: var(--surface-2);
    color: var(--text);
}

.pulse-section {
    padding: 12px 16px;
}

.pulse-section-title {
    font-size: var(--fs-10);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    margin-bottom: 8px;
}

.pulse-row {
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-2);
    margin-bottom: 4px;
}

.pulse-row b { color: var(--text); font-weight: 600; }

#syncStatusSection.stale .pulse-row,
#syncStatusSection.stale .pulse-row b {
    color: var(--warn);
}

.pulse-divider {
    height: 1px;
    background: var(--border-sub);
    margin: 0;
}

.pulse-sources-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.pulse-src-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border-sub);
    border-radius: 8px;
    background: var(--surface-2);
}

.pulse-src-icon {
    font-size: var(--fs-16);
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.pulse-src-details {
    flex: 1;
    min-width: 0;
}

.pulse-src-name {
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.03em;
}

.pulse-src-count {
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-2);
}

.pulse-src-time {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
}

.settings-wrap {
    position: relative;
    flex-shrink: 0;
}

.btn-settings {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-14);
    line-height: 1;
    cursor: pointer;
    transition: border-color var(--dur-med), color var(--dur-med), background var(--dur-med);
}

.btn-settings:hover,
.btn-settings.open {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--surface-3);
}

.btn-settings.has-alert::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--error);
    box-shadow: 0 0 0 2px var(--surface-2);
}

.btn-settings.has-alert.stale-alert::after {
    background: var(--warn);
}

.settings-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: min(78vh, 760px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    z-index: var(--z-menu);
    box-shadow: var(--shadow-2);
}

.settings-menu.open { display: block; animation: pop-in var(--dur-med) ease; }

.settings-section { display: grid; gap: var(--sp-2); }

.settings-title {
    font-size: var(--fs-10);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
}

.settings-row {
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-2);
}

.settings-row b { color: var(--text); font-weight: 600; }

#syncStatusSection.stale .settings-row,
#syncStatusSection.stale .settings-row b {
    color: var(--warn);
}

.settings-row-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.settings-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: var(--fs-10);
    border: 1px solid var(--warn);
    background: var(--warn-dim);
    color: var(--warn);
}

.settings-divider {
    height: 1px;
    background: var(--border-sub);
    margin: 12px 0;
}

.settings-link-btn {
    margin-top: 6px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--accent);
    font-family: var(--mono);
    font-size: var(--fs-11);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.settings-link-btn:hover { color: var(--text); }

.settings-tool-btn {
    width: 100%;
    text-align: left;
}

.stale-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 8px 16px;
    background: var(--warn-dim);
    color: var(--warn);
    border-bottom: 1px solid var(--warn);
}
.stale-banner[hidden] { display: none; }

.stale-icon {
    font-size: var(--fs-14);
    line-height: 1;
}

.stale-text {
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--warn);
}

.stale-sync-btn,
.stale-dismiss {
    border: 1px solid var(--warn);
    background: transparent;
    color: var(--warn);
    border-radius: 6px;
    font-family: var(--mono);
    font-size: var(--fs-11);
    padding: 4px 8px;
    cursor: pointer;
}

.stale-sync-btn { margin-left: auto; }

.stale-sync-btn:hover,
.stale-dismiss:hover {
    background: var(--warn);
    color: var(--bg);
}

/* ── MAIN ──────────────────────────────────────────── */
main {
    flex: 1;
    min-width: 0;
    padding: 20px 24px 40px;
}

/* ── STAT CARDS ────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    margin-bottom: 1px;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

.stat {
    background: var(--surface);
    padding: 16px 20px 14px;
    cursor: pointer;
    position: relative;
    transition: background var(--dur-fast), box-shadow var(--dur-fast);
    overflow: hidden;
}

.stat:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent-border); }

.stat::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    transform: scaleX(0);
    transition: transform var(--dur-slow);
}

.stat.active::after { transform: scaleX(1); }
.stat.s-total::after  { background: var(--accent); }
.stat.s-ok::after     { background: var(--success); }
.stat.s-disc::after   { background: var(--warn); }
.stat.s-unmanaged::after { background: var(--error); }
.stat.s-phantom::after { background: var(--ghost); }

.stat.active { background: var(--surface-2); }

.stat-label {
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 6px;
}

.stat-val {
    font-family: var(--mono);
    font-size: var(--fs-30);
    font-weight: 600;
    line-height: 1;
    margin-bottom: 4px;
}

.s-total    .stat-val { color: var(--accent); }
.s-ok       .stat-val { color: var(--success); }
.s-disc     .stat-val { color: var(--warn); }
.s-unmanaged .stat-val { color: var(--error); }
.s-phantom  .stat-val { color: var(--ghost); }

.stat-sub {
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-3);
}

/* ── SOURCE CARDS ──────────────────────────────────── */
.sources-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-top: none;
    margin-bottom: 20px;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.src-card {
    background: var(--surface);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background var(--dur-fast);
}

.src-card:hover { background: var(--surface-2); }

.src-icon {
    font-size: var(--fs-20);
    line-height: 1;
    flex-shrink: 0;
}

.src-details { flex: 1; min-width: 0; }

.src-name {
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
}

.src-count {
    font-family: var(--mono);
    font-size: var(--fs-20);
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.src-badge {
    font-family: var(--mono);
    font-size: var(--fs-11);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 100px;
    flex-shrink: 0;
}

.src-badge.ok            { color: var(--success); background: var(--success-dim); }
.src-badge.error         { color: var(--error);   background: var(--error-dim); }
.src-badge.not_configured { color: var(--text-3);  background: var(--ghost-dim); }

/* ── TOAST NOTIFICATIONS ───────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    z-index: var(--z-toast);
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    min-width: 260px;
    max-width: 380px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    box-shadow: var(--shadow-2);
    pointer-events: all;
    animation: toast-in var(--dur-slow) ease;
    font-size: var(--fs-13);
    line-height: 1.4;
}
.toast.dismissing { animation: toast-out var(--dur-slow) ease forwards; }
.toast-icon { font-size: var(--fs-16); flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; }
.toast-msg  { color: var(--text); font-weight: 500; }
.toast-detail { color: var(--text-2); font-size: var(--fs-11); margin-top: 2px; }
.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: 0;
    font-size: var(--fs-14);
    line-height: 1;
    margin-top: 1px;
}
.toast-close:hover { color: var(--text); }
.toast.success { border-color: var(--success); background: var(--success-dim); }
.toast.success .toast-msg { color: var(--success); }
.toast.error   { border-color: var(--error);   background: var(--error-dim); }
.toast.error   .toast-msg { color: var(--error); }
.toast.warning { border-color: var(--warn);    background: var(--warn-dim); }
.toast.warning .toast-msg { color: var(--warn); }
.toast.info    { border-color: var(--accent);  background: var(--accent-dim); }
.toast.info    .toast-msg { color: var(--accent); }
@keyframes toast-in  {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(16px); }
}

/* ── CONTROLS ──────────────────────────────────────── */
.controls {
    display: flex;
    gap: 6px;
    margin-bottom: 1px;
    align-items: center;
}

.s-input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--mono);
    font-size: var(--fs-13);
    padding: 8px 14px;
    outline: none;
    width: 220px;
    border-radius: 6px;
    transition: border-color var(--dur-med), box-shadow var(--dur-med);
}

.s-input::placeholder { color: var(--text-3); }
.s-input:focus        { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.f-select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-13);
    padding: 8px 12px;
    outline: none;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color var(--dur-med), box-shadow var(--dur-med);
}

.f-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.c-spacer { flex: 1; }

.result-count {
    font-family: var(--mono);
    font-size: var(--fs-12);
    font-weight: var(--mono-font-weight);
    color: var(--text-3);
}

/* ── TABLE ─────────────────────────────────────────── */
.tbl-wrap {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto;
}

table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }

#deviceTable.hide-col-serial th.col-serial,
#deviceTable.hide-col-serial td.col-serial,
#deviceTable.hide-col-hostname th.col-hostname,
#deviceTable.hide-col-hostname td.col-hostname,
#deviceTable.hide-col-platform th.col-platform,
#deviceTable.hide-col-platform td.col-platform,
#deviceTable.hide-col-model th.col-model,
#deviceTable.hide-col-model td.col-model,
#deviceTable.hide-col-username th.col-username,
#deviceTable.hide-col-username td.col-username,
#deviceTable.hide-col-okta_status th.col-okta_status,
#deviceTable.hide-col-okta_status td.col-okta_status,
#deviceTable.hide-col-source th.col-source,
#deviceTable.hide-col-source td.col-source,
#deviceTable.hide-col-last_seen th.col-last_seen,
#deviceTable.hide-col-last_seen td.col-last_seen,
#deviceTable.hide-col-snipe_asset_tag th.col-snipe_asset_tag,
#deviceTable.hide-col-snipe_asset_tag td.col-snipe_asset_tag,
#deviceTable.hide-col-snipe_status th.col-snipe_status,
#deviceTable.hide-col-snipe_status td.col-snipe_status,
#deviceTable.hide-col-status th.col-status,
#deviceTable.hide-col-status td.col-status,
#deviceTable.hide-col-issues th.col-issues,
#deviceTable.hide-col-issues td.col-issues,
#deviceTable.hide-col-confidence th.col-confidence,
#deviceTable.hide-col-confidence td.col-confidence,
#deviceTable.hide-col-encryption_status th.col-encryption_status,
#deviceTable.hide-col-encryption_status td.col-encryption_status {
    display: none !important;
}

thead {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 10px 14px;
    text-align: left;
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border-right: 1px solid var(--border-sub);
}

th:last-child { border-right: none; cursor: default; }
th:hover { color: var(--text-2); }
th:last-child:hover { color: var(--text-3); }
th.sorted { color: var(--accent); }

/* .sort-arr spans may still carry a legacy "↕" text node (static theads) —
   collapse it and render the shared caret instead. */
.sort-arr { font-size: 0; margin-left: 3px; }
.sort-arr::after {
    content: '▾';
    display: inline-block;
    font-size: var(--fs-10);
    opacity: 0;
    transition: opacity var(--dur-fast), transform var(--dur-fast);
}
th[data-sort]:hover .sort-arr::after { opacity: 0.45; }
th.sorted .sort-arr::after { opacity: 1; color: var(--accent); }
th.sorted.asc .sort-arr::after { transform: rotate(180deg); }

tbody tr {
    border-bottom: 1px solid var(--border-sub);
    transition: background 0.08s;
}
tbody tr:nth-child(even) { background: var(--stripe-bg); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover {
    background: var(--surface-2) !important;
    box-shadow: inset 2px 0 0 var(--accent);
}

td {
    padding: 11px 14px;
    font-family: var(--sans);
    font-size: var(--table-font-size);
    font-weight: var(--table-font-weight);
    font-variant-numeric: tabular-nums;
    color: var(--text-2);
    border-right: 1px solid var(--border-sub);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

td:last-child { border-right: none; white-space: normal; }

/* Serial stays mono — it's a code */
td.c-serial {
    font-family: var(--mono);
    font-size: var(--fs-13);
    color: var(--text);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Hostname is human-readable text */
td.c-hostname {
    font-family: var(--sans);
    font-size: var(--fs-14);
    color: var(--text);
    font-weight: 600;
}

/* User field */
td.c-user {
    font-family: var(--sans);
    font-size: var(--fs-13);
    color: var(--text-2);
}

/* Model field */
td.c-model {
    font-family: var(--sans);
    font-size: var(--fs-13);
    color: var(--text-2);
}

/* Dim empty dash */
td.c-empty {
    color: var(--text-3);
    font-family: var(--mono);
    font-size: var(--fs-13);
}

.serial-link {
    padding: 0;
    border: none;
    background: transparent;
    color: var(--accent);
    font-family: var(--mono);
    font-size: var(--fs-11);
    cursor: pointer;
    text-decoration: none;
}

.serial-link:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Unified badge metrics ────────────────────────────────────────────────
   One size/shape language for every inline badge (.pill status, .s-tag
   source, .p-tag platform, .src-badge health). Colors stay per-variant. */
.pill, .s-tag, .p-tag, .src-badge {
    display: inline-flex;
    align-items: center;
    font-family: var(--sans);
    font-size: var(--fs-11);
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: 0.03em;
    padding: 2px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

/* Status pill */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 100px;
}

.pill::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pill.ok          { color: var(--success); background: var(--success-dim); }
.pill.ok::before  { background: var(--success); border-radius: 50%; }
/* discrepancy == sources disagree: conflict tone, split-circle glyph. */
.pill.discrepancy { color: var(--conflict); background: var(--conflict-dim); }
.pill.discrepancy::before { background: linear-gradient(90deg, var(--conflict) 50%, transparent 50%); border: 1px solid var(--conflict); border-radius: 50%; width: 6px; height: 6px; }
.pill.unmanaged   { color: var(--error);   background: var(--error-dim); }
.pill.unmanaged::before { background: var(--error); clip-path: polygon(50% 0%, 100% 100%, 0% 100%); border-radius: 0; width: 7px; height: 6px; }
.pill.outdated_info { color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); }
.pill.outdated_info::before { background: var(--amber); border-radius: 1px; transform: rotate(45deg); }
.pill.unused { color: var(--ghost); background: var(--ghost-dim); }
.pill.unused::before { background: var(--ghost); }
.pill.phantom     { color: var(--ghost);   background: var(--ghost-dim); }
.pill.phantom::before { background: var(--ghost); }
/* Security-gap statuses were unstyled (rendered as invisible pills). Ring
   glyph: distinct from the dot/diamond/triangle family. */
.pill.missing_agent { color: var(--error); background: var(--error-dim); }
.pill.missing_agent::before { background: transparent; border: 1.5px solid var(--error); width: 6px; height: 6px; }
.pill.missing_mdm   { color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, transparent); }
.pill.missing_mdm::before { background: transparent; border: 1.5px solid var(--orange); width: 6px; height: 6px; }

/* Okta status urgency tiers */
.pill.okta-active   { color: var(--text-3); background: transparent; border: 1px solid var(--border-sub); }
.pill.okta-active::before { display: none; }
.pill.okta-medium   { color: var(--warn);  background: rgba(245, 158, 11, 0.10); border: 1px solid var(--warn); }
.pill.okta-medium::before { background: var(--warn); }
.pill.okta-high     { color: var(--error);   background: rgba(239, 68, 68, 0.10); border: 1px solid var(--error); }
.pill.okta-high::before { background: var(--error); }
.pill.okta-critical { color: #fff; background: var(--error); border: 1px solid var(--error); font-weight: 600; }
.pill.okta-critical::before { background: #fff; }

/* Stale row */
.row-stale { opacity: 0.72; }

/* Encryption badge */
.enc-badge { font-size: var(--fs-14); cursor: default; }
.enc-on  { color: var(--success); }
.enc-off { color: var(--error); }

/* Confidence badge */
.conf-badge {
    display: inline-block;
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 28px;
    text-align: center;
}
.conf-high { color: var(--success); background: var(--success-dim); }
.conf-mid  { color: var(--warn);    background: var(--warn-dim); }
.conf-low  { color: var(--error);   background: var(--error-dim); }

/* Source badge — each source has its own color */
.s-tag {
    font-family: var(--mono);
    font-size: var(--fs-11);
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border: 1px solid;
    border-radius: 100px;
}
.s-tag.jc  { color: var(--src-jc); border-color: color-mix(in srgb, var(--src-jc) 30%, transparent); background: color-mix(in srgb, var(--src-jc) 6%, transparent); }
.s-tag.kj  { color: var(--src-kj); border-color: color-mix(in srgb, var(--src-kj) 30%, transparent); background: color-mix(in srgb, var(--src-kj) 6%, transparent); }
.s-tag.gw  { color: var(--src-gw); border-color: color-mix(in srgb, var(--src-gw) 30%, transparent); background: color-mix(in srgb, var(--src-gw) 6%, transparent); }
.s-tag.si  { color: var(--src-si); border-color: color-mix(in srgb, var(--src-si) 30%, transparent); background: color-mix(in srgb, var(--src-si) 6%, transparent); }
.s-tag.tn  { color: var(--src-tn); border-color: color-mix(in srgb, var(--src-tn) 30%, transparent); background: color-mix(in srgb, var(--src-tn) 6%, transparent); }

/* Platform badge */
.p-tag {
    font-family: var(--mono);
    font-size: var(--fs-11);
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-3);
}

.p-tag.macos    { color: var(--plat-macos); border-color: color-mix(in srgb, var(--plat-macos) 25%, transparent); background: color-mix(in srgb, var(--plat-macos) 5%, transparent); }
.p-tag.windows  { color: var(--plat-windows); border-color: color-mix(in srgb, var(--plat-windows) 25%, transparent); background: color-mix(in srgb, var(--plat-windows) 5%, transparent); }
.p-tag.linux    { color: var(--plat-linux); border-color: color-mix(in srgb, var(--plat-linux) 25%, transparent); background: color-mix(in srgb, var(--plat-linux) 5%, transparent); }
.p-tag.chromeos { color: var(--plat-chromeos); border-color: color-mix(in srgb, var(--plat-chromeos) 25%, transparent); background: color-mix(in srgb, var(--plat-chromeos) 5%, transparent); }

/* Issues — truncated with expand */
.issue-wrap { white-space: normal; max-width: 280px; }
.issue-item {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-family: var(--sans);
    font-size: var(--fs-13);
    color: var(--warn);
    line-height: 1.5;
}
.issue-item::before { content: '⚠'; font-size: var(--fs-12); flex-shrink: 0; }

/* Writeback feedback */
.wb-ok  { color: var(--success); font-size: var(--fs-12); font-family: var(--mono); }
.wb-err { color: var(--error);   font-size: var(--fs-12); font-family: var(--mono); white-space: normal; }

/* Empty */
.empty {
    padding: 56px 24px;
    text-align: center;
}

.empty-glyph {
    font-family: var(--mono);
    font-size: 36px;
    color: var(--text-3);
    margin-bottom: 12px;
    letter-spacing: -4px;
}

.empty-text {
    font-family: var(--mono);
    font-size: var(--fs-13);
    color: var(--text-3);
    letter-spacing: 0.06em;
}

.empty-hint {
    font-family: var(--sans);
    font-size: var(--fs-12);
    color: var(--text-3);
    margin-top: 8px;
    opacity: 0.7;
}

.empty .btn-toolbar,
.empty .btn-generate-report { margin-top: 14px; }

/* Compact variant for secondary tables (annotations, swaps, costs, …) —
   same voice as the big Investigate empty state, less vertical real estate. */
.empty.empty-sm { padding: 28px 20px; }
.empty.empty-sm .empty-glyph { font-size: var(--fs-24); margin-bottom: 8px; letter-spacing: -2px; }

/* ── LOADING ───────────────────────────────────────── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: var(--z-overlay);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.overlay.show { display: flex; }

.sync-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-4);
    cursor: default;
}

.sync-center {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: min(600px, calc(100vw - 32px));
    cursor: default;
}

.sync-cancel-btn {
    padding: 6px 16px;
    background: var(--surface);
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--mono);
    font-size: var(--fs-11);
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background var(--dur-med), color var(--dur-med), border-color var(--dur-med);
}

.sync-cancel-btn:hover {
    background: var(--error, #d04848);
    color: #fff;
    border-color: var(--error, #d04848);
}

.spinner {
    width: 28px; height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

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

.load-label {
    font-family: var(--mono);
    font-size: var(--fs-13);
    letter-spacing: 0.06em;
    color: var(--text-2);
}

.load-sub {
    font-family: var(--mono);
    font-size: var(--fs-12);
    letter-spacing: 0.06em;
    color: var(--text-3);
}

.sync-status-list {
    width: 100%;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    padding: 10px;
    max-height: 44vh;
    overflow: auto;
}

.sync-status-row {
    display: grid;
    grid-template-columns: 14px minmax(100px, 140px) 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 7px 8px;
    border-bottom: 1px solid var(--border-sub);
    font-family: var(--mono);
    font-size: var(--fs-12);
    letter-spacing: 0.03em;
    color: var(--text-2);
}

.sync-status-row:last-child {
    border-bottom: none;
}

.sync-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-3);
    box-shadow: 0 0 0 1px var(--border);
}

.sync-status-row.queued .sync-dot,
.sync-status-row.running .sync-dot {
    background: var(--warn);
    box-shadow: 0 0 0 1px var(--warn-dim);
}

.sync-status-row.running .sync-dot {
    animation: pulse-dot 1.1s ease-in-out infinite;
}

.sync-status-row.ok .sync-dot {
    background: var(--success);
    box-shadow: 0 0 0 1px var(--success-dim);
}

.sync-status-row.error .sync-dot {
    background: var(--error);
    box-shadow: 0 0 0 1px var(--error-dim);
}

.sync-status-row.not_configured .sync-dot {
    background: var(--text-3);
}

.sync-source-name {
    text-transform: uppercase;
    color: var(--text);
}

.sync-source-msg {
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-source-meta {
    color: var(--text-3);
    font-size: var(--fs-11);
    white-space: nowrap;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.25); opacity: 1; }
}

/* ── EXPORT BTN ────────────────────────────────────── */
.btn-export {
    font-family: var(--mono);
    font-size: var(--fs-12);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-2);
    background: transparent;
    border: 1px solid var(--border);
    padding: 7px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color var(--dur-med), color var(--dur-med), box-shadow var(--dur-med);
}

.btn-export:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.btn-export:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── PUSH BTN ──────────────────────────────────────── */
.btn-push {
    font-family: var(--mono);
    font-size: var(--fs-12);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    background: var(--error);
    border: none;
    padding: 7px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: opacity var(--dur-med), box-shadow var(--dur-med);
    flex-shrink: 0;
}

.btn-push:hover:not(:disabled) { opacity: 0.88; box-shadow: 0 0 0 3px var(--error-dim); }
.btn-push:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── EXCLUDE BTN ────────────────────────────────────── */
.btn-exclude {
    font-family: var(--mono);
    font-size: var(--fs-12);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--warn);
    background: transparent;
    border: 1px solid var(--warn-dim);
    padding: 7px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color var(--dur-med), color var(--dur-med), box-shadow var(--dur-med);
    flex-shrink: 0;
}
.btn-exclude:hover:not(:disabled) { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); }
.btn-exclude:disabled { opacity: 0.3; cursor: not-allowed; }

.excluded-bar {
    display: none;
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-3);
    align-items: center;
    gap: var(--sp-2);
}
.excluded-bar.show { display: flex; }
.excluded-bar b { color: var(--warn); font-weight: 400; }
.restore-link {
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── CHECKBOX ───────────────────────────────────────── */
.cb-col { width: 32px; text-align: center; padding: 9px 8px; }
input[type=checkbox] {
    appearance: none;
    width: 13px; height: 13px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    vertical-align: middle;
    border-radius: 3px;
    transition: border-color var(--dur-med), background var(--dur-med);
}
input[type=checkbox]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
input[type=checkbox]:checked::after {
    content: '';
    position: absolute;
    left: 2px; top: 0px;
    width: 5px; height: 8px;
    border: 1.5px solid #000;
    border-top: none; border-left: none;
    transform: rotate(40deg);
}
input[type=checkbox]:hover { border-color: var(--accent); }

/* ── LAYOUT ────────────────────────────────────────── */
.layout {
    display: flex;
    min-height: calc(100vh - 52px);
}

/* Utility: initially hidden elements shown by JS */
.js-hidden { display: none; }

/* Filter description bar */
#filterDescription {
    padding: 12px 16px;
    background: var(--surface-2);
    border-left: 3px solid var(--accent);
    font-size: var(--fs-13);
    color: var(--text-2);
    margin-bottom: 8px;
}

/* Login overlay */
#loginOverlay {
    display: none;
    position: fixed; inset: 0; z-index: var(--z-login);
    background: var(--login-overlay-bg);
    align-items: center; justify-content: center;
}
#loginOverlay.visible { display: flex; }
#loginBox {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px 40px;
    display: flex; flex-direction: column; gap: var(--sp-4);
    min-width: 320px;
}
#loginBox h2 { font-size: var(--fs-16); font-weight: 600; color: var(--text); }
#loginBox p  { font-size: var(--fs-12); color: var(--text-3); }
#loginSecretInput {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: var(--mono);
    font-size: var(--fs-13);
    padding: 8px 10px;
    width: 100%;
}
#loginSecretInput:focus { outline: 1px solid var(--accent); }
#loginError { font-size: var(--fs-12); color: var(--error); display: none; }

/* Armory login (Django): a full page, not a veil over the dashboard. */
#loginOverlay.login-armory { background: var(--bg); padding: 48px 16px; }
#loginOverlay.login-armory #loginBox {
    background: none; border: none; padding: 0; min-width: 0;
    width: 360px; max-width: 100%; gap: 0;
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand img { width: 44px; height: 44px; }
#loginOverlay.login-armory #loginBox h2.login-wordmark {
    margin: 0; font-family: var(--mono); font-size: var(--fs-16); font-weight: 700;
    letter-spacing: 0.22em; text-transform: uppercase; color: var(--text); text-align: center;
}
.login-sub {
    font-family: var(--mono); font-size: var(--fs-10); letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--text-3); text-align: center;
}
.login-card {
    border: 1px solid var(--border-sub); border-radius: 12px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 160%);
    padding: 32px; box-shadow: var(--shadow-1);
    display: flex; flex-direction: column; gap: 14px;
}
.login-card .login-error { margin: 0; }
.login-primary {
    display: block; width: 100%; box-sizing: border-box; text-align: center;
    background: var(--accent); color: var(--btn-accent-text); border: none;
    border-radius: 6px; padding: 10px 14px; font-size: var(--fs-13); font-weight: 600;
    text-decoration: none;
}
.login-primary:hover { opacity: 0.9; box-shadow: 0 0 0 3px var(--accent-dim); }
.login-breakglass-row { text-align: right; }
.login-breakglass {
    font-family: var(--mono); font-size: var(--fs-10); letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--text-3); text-decoration: none;
}
.login-breakglass:hover { color: var(--text-2); text-decoration: underline; }
.login-foot {
    margin-top: 22px; text-align: center; font-family: var(--mono);
    font-size: var(--fs-10); color: var(--text-3);
}
#loginSubmitBtn {
    background: var(--accent);
    color: var(--btn-accent-text);
    border: none; border-radius: 4px;
    font-weight: 600; font-size: var(--fs-13);
    padding: 8px 16px;
    cursor: pointer;
    align-self: flex-end;
}
#loginSubmitBtn:hover { opacity: 0.88; }

/* ── THEME TOGGLE (dark/light) ────────────────────────── */
.btn-theme-toggle { position: relative; }
.btn-theme-toggle .theme-ico { font-size: var(--fs-14); line-height: 1; }

/* ── SOURCES COLLAPSE ──────────────────────────────────────── */
.sources-section { position: relative; }
.sources-collapse-btn {
    display: flex; align-items: center; gap: 5px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px 6px 0 0; border-bottom: none;
    color: var(--text-3); font-family: var(--mono); font-size: var(--fs-11);
    padding: 5px 12px; cursor: pointer; letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: color var(--dur-med), border-color var(--dur-med), background var(--dur-fast);
    margin-bottom: -1px; position: relative; z-index: 1;
}
.sources-collapse-btn:hover { color: var(--accent); background: var(--surface-2); }
.sources-collapse-btn .src-chevron { font-size: var(--fs-10); transition: transform 0.18s; }
.sources-section.collapsed .src-chevron { transform: rotate(-90deg); }
.sources-section.collapsed .sources-row { display: none; }
.sources-section.collapsed .sources-collapse-btn { border-radius: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }

/* ── COLUMN RESIZER ──────────────────────────────────────── */
th { position: relative; }
.col-resizer {
    position: absolute; right: 0; top: 0; bottom: 0; width: 5px;
    cursor: col-resize; background: transparent; z-index: 2;
    transition: background var(--dur-fast);
}
.col-resizer:hover { background: var(--accent-border); }
.col-resizing .col-resizer { background: var(--accent); opacity: 0.5; }

/* ── TOP TABS + PANELS ───────────────────────────────────── */
.tabs-shell {
    padding: 12px 24px 32px;
}

/* Tabs live inside the sticky <header>, no separate strip */
header .top-tabs {
    display: flex;
    gap: var(--sp-1);
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    flex-shrink: 0;
    align-items: center;
}

header .tab-btn {
    min-width: 0;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 6px;
}

header .tab-name { font-size: var(--fs-11); letter-spacing: 0.06em; }
header .tab-sub { font-size: var(--fs-10); }

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-2);
    cursor: pointer;
    transition: border-color var(--dur-med), background var(--dur-med), color var(--dur-med);
}

.tab-btn:hover { background: var(--surface-2); color: var(--text); }
.tab-btn.active {
    background: var(--surface-2);
    border-color: var(--accent-border);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--accent-dim);
}

.tab-name {
    font-family: var(--mono);
    font-size: var(--fs-12);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tab-sub {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--warn);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tab-btn.wip {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    border-color: var(--border);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: panel-in var(--dur-med) ease; }

/* Shared entrance for panels/popovers: plays when display flips on. */
@keyframes panel-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}
@keyframes pop-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.99); }
    to   { opacity: 1; transform: none; }
}

/* ── MODE SUB-TABS (Insights / Operations) ──────────── */
.mode-subtabs {
    display: flex;
    gap: var(--sp-1);
    padding: 0 0 12px;
    border-bottom: 1px solid var(--border-sub);
    margin-bottom: 16px;
}

.mode-subtab {
    font-family: var(--mono);
    font-size: var(--fs-12);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-3);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}

.mode-subtab:hover {
    background: var(--surface-2);
    color: var(--text);
}

.mode-subtab.active {
    background: var(--surface-2);
    border-color: var(--accent-border);
    color: var(--text);
}

.mode-subpanel { display: none; }
.mode-subpanel.active { display: block; animation: panel-in var(--dur-med) ease; }

/* ── HOME TAB ─────────────────────────────────────────────── */

/* Briefing bar — the page hero: first thing anyone reads after a sync. */
.home-briefing {
    position: relative;
    margin-bottom: 14px;
    padding: 18px 22px;
    border: 1px solid var(--border-sub);
    border-radius: var(--radius-md);
    background:
        linear-gradient(120deg, var(--accent-dim), transparent 42%),
        var(--surface);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.home-briefing::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent), transparent);
}

.briefing-sentence {
    font-size: var(--fs-16);
    font-weight: 550;
    color: var(--text);
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.briefing-sentence b {
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.briefing-meta {
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-3);
    margin-top: 6px;
}

.briefing-meta:empty { display: none; }

.needs-attention {
    margin-bottom: 12px;
}

/* Software-costs strip (itam home) — added without the sibling margin, so
   it rendered glued to the at-a-glance grid below it. */
#homeCostsCard { margin-bottom: 12px; }

/* Same missing sibling margin on the Costs tab: KPI row sat glued to the
   subtab bar below it. */
#costsKpiRow { margin-bottom: 12px; }

.needs-attention-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.needs-attention-card {
    position: relative;
    min-width: 190px;
    flex: 1 1 210px;
    border: 1px solid var(--border-sub);
    background: var(--surface-2);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--dur-med), background var(--dur-med);
}

.needs-attention-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 10px 0 0 10px;
    background: var(--accent);
}

.needs-attention-card.sev-error::before { background: var(--error); }
.needs-attention-card.sev-warn::before { background: var(--warn); }
.needs-attention-card.sev-info::before { background: var(--accent); }

.needs-attention-card:hover {
    border-color: var(--accent-border);
    background: var(--surface-3);
}

.needs-attention-label {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.needs-attention-count {
    margin-top: 4px;
    font-family: var(--mono);
    font-size: var(--fs-24);
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.needs-attention-clear {
    font-size: var(--fs-12);
    color: var(--success);
    font-family: var(--mono);
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--sp-3);
}

.home-grid-glance { margin-bottom: 16px; }

.home-details-section {
    margin-bottom: 12px;
}

.home-details-toggle {
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 8px;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.home-details-toggle::-webkit-details-marker { display: none; }

.home-details-toggle::before {
    content: '▸';
    transition: transform var(--dur-med);
    display: inline-block;
}

.home-details-section[open] > .home-details-toggle::before {
    transform: rotate(90deg);
}

.panel-card {
    border: 1px solid var(--border-sub);
    /* Vertical gradient only: with the old 165deg diagonal, a card's darker
       bottom-right corner met its neighbour's lighter top-left corner, which
       read as cards sliding under each other once density tightened the gaps.
       Keeping the left/right edges a single colour makes every seam clean. */
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 160%);
    border-radius: 12px;
    padding: 14px;
    transition: border-color var(--dur-med) ease;
}
.panel-card:hover { border-color: var(--border); }

.home-kpi {
    grid-column: span 3;
    min-height: 96px;
    display: flex;
    flex-direction: column;
}

.kpi-spark-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
}

.kpi-sparkline {
    flex: 1;
    /* min-width:0 is load-bearing: without it the flex item's min size is the
       canvas's intrinsic (bitmap) width, so every redraw at devicePixelRatio>1
       doubles the layout width — bars grow past the card and across the row. */
    min-width: 0;
    height: 30px;
    display: block;
}

.kpi-spark-row { min-width: 0; }
.home-kpi, .sec-kpi, .osv-kpi, .stock-kpi { min-width: 0; }

.kpi-trend {
    font-family: var(--mono);
    font-size: var(--fs-13);
    font-weight: 700;
    flex-shrink: 0;
}

.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--error); }
.kpi-trend.flat { color: var(--text-3); }

.donut-tab-bar {
    display: flex;
    gap: var(--sp-1);
    margin-bottom: 8px;
}

.donut-tab-btn {
    font-family: var(--mono);
    font-size: var(--fs-10);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 10px;
    border: 1px solid var(--border-sub);
    border-radius: 20px;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    transition: background var(--dur-med), color var(--dur-med);
}

.donut-tab-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.issues-card {
    grid-column: span 4;
}

.issues-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 4px;
}

.issue-row {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: 10px;
}

.issue-row-btn {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.issue-row-btn:hover .issue-label {
    color: var(--accent);
}

.issue-rank {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    text-align: right;
}

.issue-body {
    min-width: 0;
}

.issue-label {
    font-size: var(--fs-12);
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.issue-bar {
    height: 3px;
    background: var(--border-sub);
    border-radius: 2px;
    margin-top: 3px;
}

.issue-bar-fill {
    height: 100%;
    background: var(--warn);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.issue-count {
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-2);
    white-space: nowrap;
}

.issue-empty {
    font-size: var(--fs-12);
    color: var(--text-3);
    padding: 8px 0;
}

.kpi-label {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.kpi-val {
    font-family: var(--mono);
    font-size: var(--fs-30);
    font-weight: 700;
    line-height: 1.15;
    margin-top: 6px;
    color: var(--text);
}

.kpi-note {
    margin-top: 4px;
    font-size: var(--fs-12);
    color: var(--text-3);
}

.home-sources {
    grid-column: span 7;
}

.home-sync {
    grid-column: span 5;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 220px;
}

.sync-ring {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    position: relative;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: conic-gradient(var(--success) 0deg, var(--surface-3) 0deg);
}

.sync-ring::after {
    content: '';
    position: absolute;
    width: 124px;
    height: 124px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
}

.sync-ring-label {
    position: relative;
    z-index: 1;
    font-family: var(--mono);
    font-size: var(--fs-24);
    font-weight: 700;
    color: var(--success);
}

.sync-meta {
    display: grid;
    gap: 7px;
    min-width: 220px;
}

.sync-meta-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-2);
}

.chart-card {
    grid-column: span 4;
    min-height: 248px;
}

.card-title {
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-3);
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.chart-canvas {
    width: 100%;
    height: 190px;
    border: 1px solid var(--border-sub);
    background: rgba(255, 255, 255, 0.01);
    border-radius: 8px;
}

.chart-canvas.is-clickable {
    cursor: pointer;
}

.home-clickable-card {
    cursor: pointer;
}

.home-clickable-card:hover,
.home-clickable-card:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.home-list-card {
    display: flex;
    flex-direction: column;
}

.home-action-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-top: 4px;
}

.home-action-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-sub);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-2);
    text-align: left;
    cursor: pointer;
}

.home-action-row:hover {
    border-color: var(--accent);
}

.home-action-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.home-action-label {
    font-size: var(--fs-12);
    color: var(--text-2);
}

.home-action-meta {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
}

.home-action-count {
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text);
    white-space: nowrap;
}

.source-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-2);
    margin-top: 10px;
}

.source-mini {
    border: 1px solid var(--border-sub);
    border-radius: 8px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.01);
}

.source-mini .name {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.source-mini .count {
    margin-top: 4px;
    font-family: var(--mono);
    font-size: var(--fs-20);
    color: var(--text);
    line-height: 1;
}

/* ── CUSTOM FILTERS TAB ──────────────────────────────────── */
.custom-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 130px);
    gap: 10px;
}

.custom-filters-area {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 10px;
    padding: 14px;
    flex-shrink: 0;
}

.custom-results-panel {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 10px;
    overflow: hidden;
}

.custom-results-panel .tbl-wrap {
    height: 100%;
    border: none;
    border-radius: 0;
}

.custom-controls {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: var(--sp-2);
    margin-bottom: 10px;
}

.custom-input,
.custom-select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--mono);
    font-size: var(--fs-12);
    border-radius: 6px;
    padding: 8px 10px;
    width: 100%;
}

.custom-input:focus,
.custom-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.advanced-wrap {
    border: 1px solid var(--border-sub);
    border-radius: 8px;
    margin-bottom: 10px;
}

.advanced-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 10px 12px;
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-11);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

.advanced-panel {
    display: none;
    padding: 0 12px 12px;
}

.advanced-wrap.open .advanced-panel { display: block; }

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: var(--sp-2);
}

.custom-action-row {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.custom-count {
    margin-left: auto;
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-3);
}

.btn-muted {
    font-family: var(--mono);
    font-size: var(--fs-11);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-2);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
}

.btn-muted:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── OS Versions tab ───────────────────────────────────────────── */
.osv-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.osv-subtabs {
    display: flex;
    gap: 6px;
}

.osv-tab {
    padding: 6px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-12);
    cursor: pointer;
    transition: background var(--dur-med), color var(--dur-med), border-color var(--dur-med);
}
.osv-tab:hover { background: var(--surface-2); color: var(--text); }
.osv-tab.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.osv-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-3);
}

.osv-kpi { min-height: 88px; }

.osv-chart-card { padding: 14px; }

.osv-chart-scroll {
    overflow-x: hidden;
    overflow-y: auto;
}

#osvChart {
    display: block;
    width: 100%;
    height: 260px;
}

.osv-heatmap-card { padding: 14px; }
.osv-heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}
.osv-heat-cell {
    position: relative;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--mono);
    font-size: var(--fs-12);
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 56px;
    overflow: hidden;
}
.osv-heat-cell .v { font-weight: 600; white-space: normal; word-break: break-word; }
.osv-heat-cell .c { font-size: var(--fs-12); opacity: 0.9; }
.osv-heat-cell .rank {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: var(--fs-10);
    color: var(--text-3);
    letter-spacing: 0.05em;
}
.osv-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: var(--fs-11);
    color: var(--text-3);
    font-family: var(--mono);
}
.osv-heatmap-legend .ramp {
    flex: 0 0 140px;
    height: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(0,212,184,0.08), rgba(0,212,184,0.95));
    border: 1px solid var(--border);
}

.osv-table-card { padding: 14px; }

.osv-table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.osv-search {
    flex: 1;
    min-width: 180px;
    max-width: 340px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--mono);
    font-size: var(--fs-12);
    outline: none;
}
.osv-search:focus { border-color: var(--accent); }

.osv-table-wrap {
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

#osvTable {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-12);
}

#osvTable thead th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    padding: 7px 10px;
    text-align: left;
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-3);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    z-index: 1;
}

#osvTable tbody tr { cursor: pointer; transition: background var(--dur-fast); }
#osvTable tbody tr:hover { background: var(--surface-2); }
#osvTable tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-sub);
    color: var(--text-2);
    white-space: nowrap;
}


@media (max-width: 1200px) {
    .osv-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── End OS Versions ──────────────────────────────────────────── */

/* ── Stock tab ────────────────────────────────────────────────── */
.stock-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.stock-subtabs {
    display: flex;
    gap: 6px;
}

.stock-view-tabs {
    display: flex;
    gap: 6px;
    margin-top: -4px;
}

.stock-tab {
    padding: 6px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-12);
    cursor: pointer;
    transition: background var(--dur-med), color var(--dur-med), border-color var(--dur-med);
}

.stock-tab:hover {
    background: var(--surface-2);
    color: var(--text);
}

.stock-tab.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.stock-view-tab {
    padding: 6px 14px;
    border-radius: 18px;
    border: 1px solid var(--border-sub);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-11);
    cursor: pointer;
    transition: background var(--dur-med), color var(--dur-med), border-color var(--dur-med);
}

.stock-view-tab:hover {
    background: var(--surface-2);
    color: var(--text);
}

.stock-view-tab.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.stock-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-3);
}

.stock-kpi {
    min-height: 88px;
}

.stock-status-card,
.stock-table-card {
    padding: 14px;
}

.stock-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.stock-status-item {
    border: 1px solid var(--border-sub);
    border-radius: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
}

button.stock-status-item {
    width: 100%;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

button.stock-status-item:hover,
button.stock-status-item:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.stock-status-name {
    font-size: var(--fs-12);
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-status-count {
    margin-top: 8px;
    font-family: var(--mono);
    font-size: var(--fs-24);
    color: var(--text);
}

.stock-model-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stock-model-breakdown {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.stock-model-pill {
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border-sub);
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-2);
}

.stock-model-pill b {
    color: var(--text);
}

.stock-table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.stock-search {
    flex: 1;
    min-width: 180px;
    max-width: 340px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--mono);
    font-size: var(--fs-12);
    outline: none;
}

.stock-search:focus {
    border-color: var(--accent);
}

.stock-table-wrap {
    overflow-x: auto;
    max-height: 460px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

#stockTable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: var(--fs-12);
}

#stockTable thead th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    padding: 7px 10px;
    text-align: left;
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-3);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    z-index: 1;
}

#stockTable tbody tr {
    cursor: pointer;
    transition: background var(--dur-fast);
}

#stockTable tbody tr:hover {
    background: var(--surface-2);
}

.offboarding-table tbody tr[data-serial] {
    cursor: pointer;
    transition: background var(--dur-fast);
}

.offboarding-table tbody tr[data-serial]:hover {
    background: var(--surface-2);
}

.okta-link-icon {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    margin-left: 8px;
    padding: 2px 8px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: var(--fs-12);
    font-weight: 700;
    line-height: 1.2;
    opacity: 1;
    text-decoration: none;
    vertical-align: middle;
    white-space: nowrap;
    transition: background-color var(--dur-med) ease, border-color var(--dur-med) ease, color var(--dur-med) ease, transform var(--dur-med) ease;
}

.okta-link-icon:hover,
.okta-link-icon:focus-visible {
    background: color-mix(in srgb, var(--accent) 16%, var(--surface));
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.okta-link-icon:focus-visible {
    outline: 2px solid var(--accent-border);
    outline-offset: 2px;
}

#stockTable tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-sub);
    color: var(--text-2);
    vertical-align: middle;
}

.stock-col-asset-tag {
    width: 13ch;
}

.stock-col-serial {
    width: 18ch;
}

.stock-col-model {
    width: 24ch;
}

.stock-col-category {
    width: 14ch;
}

.stock-col-status {
    width: 28ch;
}

.stock-col-user {
    width: 20ch;
}

.stock-col-location {
    width: 18ch;
}

.stock-col-updated {
    width: 18ch;
}

.stock-cell {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-cell.mono {
    font-family: var(--mono);
    font-size: var(--fs-12);
}

@media (max-width: 1200px) {
    .stock-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── End Stock tab ───────────────────────────────────── */

/* ── Offboarding Tracker tab ─────────────────────────────────── */
.offboarding-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.offboarding-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-3);
}

.offboarding-tables {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.offboarding-toolbar {
    margin-bottom: 0;
}

.offboarding-table-card {
    padding: 14px;
}

.offboarding-country-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.offboarding-country-count {
    font-family: var(--mono);
    font-size: var(--fs-12);
    font-weight: 600;
    color: var(--accent);
}

.offboarding-country-note {
    font-size: var(--fs-11);
    color: var(--text-3);
}

.offboarding-collapse-btn {
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-2);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.offboarding-collapse-btn:hover,
.offboarding-collapse-btn:focus-visible {
    color: var(--text);
    border-color: var(--accent);
}

.offboarding-collapse-btn span {
    display: inline-block;
    transition: transform var(--dur-fast);
}

.offboarding-table-card.is-collapsed .offboarding-collapse-btn span {
    transform: rotate(-90deg);
}

.offboarding-table-card.is-collapsed .stock-table-wrap {
    display: none;
}

.offboarding-table-card.is-collapsed .offboarding-country-head {
    margin-bottom: 0;
}

/* ── Security tab ─────────────────────────────────────────────── */
.sec-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.sec-subtabs {
    display: flex;
    gap: 6px;
}

.sec-tab {
    padding: 6px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-12);
    cursor: pointer;
    transition: background var(--dur-med), color var(--dur-med), border-color var(--dur-med);
}
.sec-tab:hover { background: var(--surface-2); color: var(--text); }
.sec-tab.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.sec-panel { display: none; flex-direction: column; gap: 14px; }
.sec-panel.active { display: flex; }

/* Coverage / All-Devices wrappers inside a sec-panel. This rule was simply
   missing — an unstyled block div gives its rows ZERO vertical spacing, so
   the KPI, chart and table cards rendered glued edge-to-edge. The JS toggle
   clears inline display back to '' when showing, so flex comes from here. */
.s1-view { display: flex; flex-direction: column; gap: 14px; }

.sec-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-3);
}
.sec-kpi { min-height: 88px; }
.sec-kpi-row-3 { grid-template-columns: repeat(3, 1fr); }
.sec-kpi-row-5 { grid-template-columns: repeat(5, 1fr); }
/* Source tabs: the cards are the selector — the active one is outlined. */
.sec-kpi.is-select { cursor: pointer; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.sec-kpi.is-select:hover { border-color: var(--accent-border); }
.sec-kpi.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.sec-kpi.is-active .kpi-val { color: var(--accent); }
.sec-kpi .kpi-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
#tab-source .sec-layout { height: auto; }
/* Page head: every tab opens with its name and one line on what it is,
   above whatever the tab shows. Lives in the shell, outside the panels. */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: 2px 2px 12px;
    margin: 0 0 14px;
    border-bottom: 1px solid var(--border-sub);
}
.page-head[hidden] { display: none; }
.page-title {
    margin: 0;
    font-family: var(--sans);
    font-size: var(--fs-16);
    font-weight: 650;
    letter-spacing: 0;
    color: var(--text);
}
.page-subtitle {
    margin: 4px 0 0;
    font-size: var(--fs-12);
    color: var(--text-3);
    max-width: 70ch;
}
.page-meta {
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-3);
    white-space: nowrap;
    padding-bottom: 2px;
}
.page-meta-num { color: var(--text); font-weight: 600; }

.sec-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
}
.sec-chart-card { min-height: 230px; }
.sec-chart-full { grid-column: span 1; }

.sec-xref-card { padding: 14px; }
.sec-xref-actions { display: flex; align-items: center; gap: 8px; }
.list-search { max-width: 260px; min-width: 160px; }
.list-search[hidden] { display: none; }
.list-search-bar { padding: 0 0 8px; }
.sec-xref-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.sec-xref-card-header .card-title { margin-bottom: 0; }

.sec-xref-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.sec-xref-btn {
    padding: 4px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    font-family: var(--mono);
    font-size: var(--fs-11);
    cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.sec-xref-btn:hover { background: var(--surface-2); color: var(--text); }
.sec-xref-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.sec-xref-desc {
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-3);
    margin-bottom: 8px;
    min-height: 16px;
}

.sec-table-wrap {
    overflow-x: auto;
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.sec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-12);
}

.sec-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    padding: 7px 10px;
    text-align: left;
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-3);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    z-index: 1;
}

.sec-table tbody tr { cursor: pointer; transition: background var(--dur-fast); }
.sec-table tbody tr:hover { background: var(--surface-2); }
.sec-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-sub);
    color: var(--text-2);
    white-space: nowrap;
}

/* Sortable table header styling */
.sortable-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}
.sortable-table thead th.sortable:hover {
    background: var(--surface-2);
}
.sortable-table thead th.sortable:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: -1px;
}
/* One caret language for every sortable header (matches .sort-arr below):
   invisible at rest, ghosted on hover, accent + direction when sorted. */
.sortable-table thead th.sortable .sort-arrow::after {
    content: '▾';
    display: inline-block;
    margin-left: 4px;
    font-size: var(--fs-10);
    opacity: 0;
    transition: opacity var(--dur-fast), transform var(--dur-fast);
}
.sortable-table thead th.sortable:hover .sort-arrow::after { opacity: 0.45; }
.sortable-table thead th.sortable.asc .sort-arrow::after,
.sortable-table thead th.sortable.desc .sort-arrow::after {
    opacity: 1;
    color: var(--accent);
}
.sortable-table thead th.sortable.asc .sort-arrow::after { transform: rotate(180deg); }

@media (max-width: 1200px) {
    .sec-kpi-row, .sec-kpi-row-3, .sec-kpi-row-5 { grid-template-columns: repeat(2, 1fr); }
    .sec-charts-row { grid-template-columns: 1fr; }
}
/* ── End Security ─────────────────────────────────────────────── */

@media (max-width: 1200px) {
    .home-kpi { grid-column: span 6; }
    .home-sources, .home-sync { grid-column: span 12; }
    .chart-card { grid-column: span 12; }
    .issues-card { grid-column: span 12; }
    .custom-controls { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
    .advanced-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

@media (max-width: 760px) {
    .tabs-shell { padding: 10px 10px 24px; }
    header .top-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    header .tab-btn {
        flex-shrink: 0;
        padding: 5px 8px;
    }
    header .tab-name { font-size: var(--fs-10); }
    .custom-controls,
    .advanced-grid {
        grid-template-columns: 1fr;
    }
    .source-mini-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── RESPONSIVE ──────────────────────────────────────────── */

/* Tablet (≤900px). */
@media (max-width: 900px) {
    .osv-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .sec-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .home-kpi   { grid-column: span 6; }
}

/* Small tablet / large phone (≤768px): compact header, scrollable table. */
@media (max-width: 768px) {
    header { padding: 0 10px; gap: 6px; }
    .settings-menu { width: min(360px, calc(100vw - 20px)); }
    .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 560px; }
    .home-kpi { grid-column: span 12; }
    .home-sources, .home-sync { grid-column: span 12; }
    .chart-card  { grid-column: span 12; }
}

/* Phone (≤480px): hide non-essential header elements, single-column everything. */
@media (max-width: 480px) {
    header { gap: var(--sp-1); padding: 0 8px; }
    .osv-kpi-row { grid-template-columns: 1fr; }
    .sec-kpi-row { grid-template-columns: 1fr; }
    .source-mini-grid { grid-template-columns: 1fr; }
    .tabs-shell { padding: 6px 6px 16px; }
}

/* ── DENSITY TOGGLE ──────────────────────────────────────── */
.btn-density {
    font-family: var(--mono);
    font-size: var(--fs-10);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color var(--dur-med), color var(--dur-med);
    flex-shrink: 0;
}
.btn-density:hover { border-color: var(--accent); color: var(--accent); }

.btn-report {
    font-family: var(--mono);
    font-size: var(--fs-10);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color var(--dur-med), color var(--dur-med);
    flex-shrink: 0;
}
.btn-report:hover { border-color: var(--accent); color: var(--accent); }

.btn-api-docs {
    font-family: var(--mono);
    font-size: var(--fs-10);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color var(--dur-med), color var(--dur-med);
    flex-shrink: 0;
    text-decoration: none;
}
.btn-api-docs:hover { border-color: var(--accent); color: var(--accent); }

.home-report-bar {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    padding: 16px 24px 20px;
}
.btn-generate-report {
    font-family: var(--mono);
    font-size: var(--fs-11);
    letter-spacing: 0.05em;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color var(--dur-med), color var(--dur-med), background var(--dur-med);
}
.btn-generate-report:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-3); }
.btn-md-report { margin-left: 0; }

/* ── COMPACT DENSITY MODE ────────────────────────────────────
   Dramatically shrinks the whole UI for data-heavy views:
   smaller fonts, tighter padding, compact controls, KPIs.
   ───────────────────────────────────────────────────────── */
html[data-density="compact"] body { font-size: var(--fs-12); }

/* Header — shorter bar, smaller controls */
html[data-density="compact"] header { height: 40px; padding: 0 14px; gap: 10px; }
html[data-density="compact"] .brand { font-size: var(--fs-11); letter-spacing: 0.14em; }
html[data-density="compact"] .brand svg { width: 11px; height: 11px; }
html[data-density="compact"] .subtitle { font-size: var(--fs-10); }
html[data-density="compact"] .h-sep { height: 14px; }
html[data-density="compact"] .btn-sync { font-size: var(--fs-10); padding: 5px 12px; }
html[data-density="compact"] .sync-progress-pill { font-size: var(--fs-10); padding: 4px 8px; }
html[data-density="compact"] .btn-settings { width: 30px; height: 30px; font-size: var(--fs-12); }
html[data-density="compact"] .btn-pulse { font-size: var(--fs-10); padding: 4px 8px; }
html[data-density="compact"] .btn-pulse .pulse-dot { width: 6px; height: 6px; }
html[data-density="compact"] .btn-density,
html[data-density="compact"] .btn-report,
html[data-density="compact"] .btn-api-docs { font-size: var(--fs-10); padding: 4px 8px; }

/* Header tabs inside compact mode */
html[data-density="compact"] header .tab-btn { padding: 4px 8px; }
html[data-density="compact"] header .tab-name { font-size: var(--fs-10); letter-spacing: 0.04em; }
html[data-density="compact"] header .tab-sub { font-size: 8px; }

/* Main padding */
html[data-density="compact"] main { padding: 10px 14px 20px; }
html[data-density="compact"] .tabs-shell { padding: 8px 14px 18px; }

/* Table — the star of compact mode */
html[data-density="compact"] table { font-size: var(--fs-11); }
html[data-density="compact"] td { padding: 3px 8px !important; line-height: 1.25 !important; }
html[data-density="compact"] th { padding: 4px 8px !important; font-size: var(--fs-10) !important; letter-spacing: 0.03em !important; }
html[data-density="compact"] tr { height: auto; }
html[data-density="compact"] .badge,
html[data-density="compact"] .status-pill { font-size: var(--fs-10); padding: 1px 5px; letter-spacing: 0.02em; }
html[data-density="compact"] .issue-pill { font-size: var(--fs-10); padding: 1px 4px; }

/* Hide non-essential row icons and decorations in compact */
html[data-density="compact"] td .row-icon,
html[data-density="compact"] td .source-mini-icons,
html[data-density="compact"] th .col-hint,
html[data-density="compact"] .issue-count-bubble,
html[data-density="compact"] .kpi-note,
html[data-density="compact"] .stat-sub { display: none !important; }

/* KPI / stat cards — shrink significantly */
html[data-density="compact"] .stat { padding: 8px 10px 6px; }
html[data-density="compact"] .stat-label { font-size: var(--fs-10); }
html[data-density="compact"] .stat-val { font-size: var(--fs-20); line-height: 1.05; }
html[data-density="compact"] .panel-card { padding: 8px; border-radius: 8px; }
html[data-density="compact"] .home-kpi { min-height: 60px; }
html[data-density="compact"] .home-briefing { padding: 8px 12px; margin-bottom: 8px; }
html[data-density="compact"] .briefing-sentence { font-size: var(--fs-12); }
html[data-density="compact"] .briefing-meta { font-size: var(--fs-10); }
html[data-density="compact"] .kpi-label { font-size: var(--fs-10); }
html[data-density="compact"] .kpi-val { font-size: var(--fs-20); line-height: 1.05; }
html[data-density="compact"] .kpi-spark-row { padding-top: 4px; }
html[data-density="compact"] .kpi-sparkline { height: 20px; }
html[data-density="compact"] .issues-card { display: none; }
html[data-density="compact"] .donut-tab-bar { margin-bottom: 4px; }
html[data-density="compact"] .home-grid { gap: 10px; }

/* Toolbar / filter controls */
html[data-density="compact"] .toolbar { padding: 6px 10px; gap: 6px; }
html[data-density="compact"] .toolbar input,
html[data-density="compact"] .toolbar select,
html[data-density="compact"] .toolbar button { font-size: var(--fs-11); padding: 4px 8px; }

/* Charts — shrink card padding */
html[data-density="compact"] .chart-card { padding: 8px; }
html[data-density="compact"] .chart-title { font-size: var(--fs-10); }

/* ── COLUMN PICKER ───────────────────────────────────────── */
.col-picker-wrap { position: relative; flex-shrink: 0; }
#colPickerBtn {
    font-family: var(--mono);
    font-size: var(--fs-12);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-2);
    background: transparent;
    border: 1px solid var(--border);
    padding: 7px 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color var(--dur-med), color var(--dur-med), box-shadow var(--dur-med);
}
#colPickerBtn:hover,
#colPickerBtn.open { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.col-picker-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    min-width: 160px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.col-picker-menu.open { display: block; animation: pop-in var(--dur-med) ease; }

.col-pick-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-2);
    transition: background var(--dur-fast);
}
.col-pick-item:hover { background: var(--surface-2); color: var(--text); }
.col-pick-item input[type=checkbox] { cursor: pointer; }

/* ── CONFLICT CELL (sources disagree) ─────────────────────── */
/* Both values, attributed, side by side; hatch on the cell, never on pills. */
.conflict-cell {
    display: inline-flex; flex-direction: column; gap: 2px;
    padding: 2px 6px; border-radius: var(--radius-sm, 6px);
    background: var(--conflict-hatch);
    box-shadow: inset 2px 0 0 var(--conflict);
}
.cc-val { font-family: var(--mono); font-size: var(--fs-12); color: var(--text); line-height: 1.3; }
.cc-val::before {
    content: attr(data-src);
    display: inline-block; min-width: 62px; margin-right: 6px;
    font-size: var(--fs-10); letter-spacing: .04em; text-transform: uppercase;
    color: var(--conflict);
}

/* ── DEVICE DRAWER ───────────────────────────────────────── */
#deviceDrawer {
    position: fixed; inset: 0; z-index: var(--z-drawer);
    pointer-events: none;
}
#deviceDrawer.open { pointer-events: all; }

#drawerBackdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.18);
    opacity: 0;
    transition: opacity 0.25s;
}
#deviceDrawer.open #drawerBackdrop { opacity: 1; }

#drawerPanel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 480px; max-width: 92vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex; flex-direction: column;
    overflow: hidden;
}
#deviceDrawer.open #drawerPanel { transform: translateX(0); }

#drawerHeader {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    flex-shrink: 0;
}
#drawerTitle {
    font-family: var(--mono);
    font-size: var(--fs-12);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}
#drawerClose {
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: var(--fs-20);
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: color var(--dur-fast);
}
#drawerClose:hover { color: var(--text); }

#drawerBody {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.drawer-device-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: 14px 20px 10px;
    border-bottom: 1px solid var(--border-sub);
}

.drawer-sticky-identity {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
    border-bottom: 1px solid var(--border);
}
.drawer-serial {
    font-family: var(--mono);
    font-size: var(--fs-16);
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.05em;
}
.drawer-hostname {
    font-size: var(--fs-12);
    color: var(--text-2);
    margin-top: 2px;
}
.drawer-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; margin-top: 2px; }

.drawer-section-title {
    font-family: var(--mono);
    font-size: var(--fs-10);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 14px 20px 6px;
    border-top: 1px solid var(--border-sub);
}
.drawer-section-title:first-of-type { border-top: none; }

.drawer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border-sub);
    margin: 0 0 0 0;
}
.drawer-field {
    background: var(--surface);
    padding: 10px 20px;
}
.drawer-field-label {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.drawer-field-value {
    font-size: var(--fs-13);
    color: var(--text-2);
    word-break: break-all;
}

.drawer-issues { padding: 8px 20px 20px; }
.drawer-issue {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 0;
    font-size: var(--fs-13);
    color: var(--warn);
    border-bottom: 1px solid var(--border-sub);
}
.drawer-issue:last-child { border-bottom: none; }
.drawer-issue-icon { flex-shrink: 0; font-size: var(--fs-12); }

/* ── Drawer: header actions (Copy button) ─────────────────────── */
.drawer-actions { display: flex; gap: 6px; align-items: center; }
.drawer-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-2);
    background: var(--surface-2, var(--surface));
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.drawer-copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.drawer-copy-btn.flash { color: var(--success); border-color: var(--success); }
.drawer-copy-icon { font-size: var(--fs-13); line-height: 1; }

/* ── Drawer: tabs ─────────────────────────────────────────────── */
.drawer-tabs {
    display: flex;
    gap: 2px;
    padding: 0 14px;
    background: var(--surface);
    overflow-x: auto;
    scrollbar-width: thin;
}
.drawer-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 9px 12px;
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--dur-fast), border-color var(--dur-fast);
}
.drawer-tab:hover { color: var(--text-2); }
.drawer-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.drawer-tab-panels { padding-bottom: 16px; }
.drawer-tab-panel { display: block; }
.drawer-tab-panel[hidden] { display: none; }

/* ── Drawer: per-panel "Open in [tool]" deep-link ────────────── */
.drawer-panel-header {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-sub);
    background: var(--surface);
}
.drawer-open-link {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    font-family: var(--mono);
    font-size: var(--fs-11);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--accent);
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid var(--accent);
    border-radius: 3px;
    transition: background var(--dur-fast), color var(--dur-fast);
}
.drawer-open-link:hover { background: var(--accent); color: var(--bg); }

/* ── Drawer: Snipe-IT notes block ─────────────────────────────── */
.drawer-snipe-notes {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-sub);
    background: var(--surface);
}
.drawer-snipe-notes-body {
    font-size: var(--fs-13);
    color: var(--text-2);
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 4px;
}

/* ── Drawer: issue drill-down with severity colors ────────────── */
.drawer-issue {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    color: var(--text-2);
}
.drawer-issue[data-issue-toggle] { cursor: pointer; }
.drawer-issue-head {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 9px 0;
}
.drawer-issue-text { flex: 1; font-size: var(--fs-13); }
.drawer-issue-chev {
    font-size: var(--fs-11);
    color: var(--text-3);
    font-family: var(--mono);
}
.drawer-issue-detail {
    padding: 4px 0 12px 56px;
    font-size: var(--fs-12);
    color: var(--text-2);
    line-height: 1.5;
}
.drawer-sev-pill {
    display: inline-block;
    font-family: var(--mono);
    font-size: var(--fs-10);
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 3px;
    min-width: 40px;
    text-align: center;
}
.drawer-sev-pill.sev-critical { background: rgba(220, 53, 69, 0.18); color: var(--error, #dc3545); }
.drawer-sev-pill.sev-high     { background: rgba(255, 140, 50, 0.18); color: var(--orange, #ff8c32); }
.drawer-sev-pill.sev-medium   { background: rgba(255, 193, 7, 0.18);  color: var(--warn, #ffc107); }
.drawer-sev-pill.sev-info     { background: rgba(120, 130, 145, 0.18); color: var(--text-3); }
.drawer-issue.sev-critical .drawer-issue-text { color: var(--error, #dc3545); }
.drawer-issue.sev-high     .drawer-issue-text { color: var(--orange, #ff8c32); }

/* ── HEATMAP CARD ────────────────────────────────────────── */
.heatmap-card {
    grid-column: span 12;
}

.home-insight-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: calc(var(--z-modal) - 10); /* insight modal sits under a drawer opened from it */
    padding: 68px 16px 16px;
    box-sizing: border-box;
}

.home-insight-modal.visible {
    display: flex;
}

.home-insight-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 14, 0.7);
    backdrop-filter: blur(8px);
}

.home-insight-panel {
    position: relative;
    width: min(980px, 100%);
    max-height: calc(100vh - 84px);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(165deg, var(--surface) 0%, var(--surface-2) 100%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.home-insight-header {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    align-items: flex-start;
}

.home-insight-title {
    margin: 0;
    font-size: 18px;
    color: var(--text);
}

.home-insight-subtitle {
    margin-top: 4px;
    font-size: var(--fs-12);
    color: var(--text-3);
}

.home-insight-actions {
    display: flex;
    gap: 6px;
}

.home-insight-body {
    min-height: 0;
    overflow: auto;
}

.home-insight-table-wrap {
    overflow: auto;
    border: 1px solid var(--border-sub);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.home-insight-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: var(--fs-12);
    color: var(--text-2);
}

.home-insight-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-3);
    font-family: var(--mono);
    font-size: var(--fs-10);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
}

.home-insight-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-sub);
    vertical-align: middle;
}

.home-insight-table tbody tr:last-child td {
    border-bottom: none;
}

.home-insight-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.home-insight-col-serial {
    width: 18ch;
}

.home-insight-col-hostname {
    width: 28ch;
}

.home-insight-col-user {
    width: 22ch;
}

.home-insight-col-status {
    width: 14ch;
}

.home-insight-col-source {
    width: 20ch;
}

.home-insight-cell {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-insight-cell.is-mono {
    font-family: var(--mono);
}

.home-insight-serial-link {
    display: block;
    width: 100%;
    text-align: left;
}

.home-insight-truncated {
    margin-top: 10px;
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-3);
}

@media (max-width: 720px) {
    .home-insight-modal {
        padding: 60px 10px 10px;
    }

    .home-insight-panel {
        max-height: calc(100vh - 70px);
        padding: 12px;
    }
}

/* ── HEATMAP CARD ────────────────────────────────────────── */
.heatmap-card {
    grid-column: span 12;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.heatmap-scroll { overflow-x: auto; }

/* ── SOURCE LAST-FETCH TIME ──────────────────────────────── */
.src-time {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    margin-top: 1px;
    min-height: 13px;
}

/* ── ISSUES ONLY BUTTON ACTIVE STATE ─────────────────────── */
.btn-muted.active {
    border-color: var(--warn);
    color: var(--warn);
    background: var(--warn-dim);
}

/* ── FILTERS TAB: LAYOUT ──────────────────────────────────── */
.filters-layout {
    display: flex;
    /* Shell padding + list strip above; a little air below. */
    height: calc(100vh - 84px);
    overflow: hidden;
}

/* ── List strip (Investigate / Sync state / Google Workspace / Reports) ──
   One pill per list in the family: colour dot, name, live count, and a pin
   that appears on hover. The Custom builder sits at the end under Investigate. */
.list-subtabs { flex-wrap: wrap; margin-bottom: 10px; }
.list-subtabs:empty { display: none; }
.list-subtab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--sans);
    font-size: var(--fs-12);
    font-weight: 500;
    padding: 5px 10px 5px 9px;
}
.list-subtab.active .list-subtab-label { color: var(--text); font-weight: 600; }
.list-subtab-count {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    background: var(--surface-2);
    border-radius: 4px;
    padding: 1px 5px;
    font-variant-numeric: tabular-nums;
}
.list-subtab.active .list-subtab-count { background: var(--surface-3); color: var(--text-2); }
.list-subtab-custom { margin-left: auto; color: var(--text-3); }
.list-subtab-custom svg { width: 13px; height: 13px; }
.list-subtab-custom.active { color: var(--accent); }

/* Custom filter builder — a left panel that only exists in Custom mode. */
.detail-panel {
    position: relative;
    width: 220px;
    min-width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.filters-layout.custom-mode .detail-panel { display: flex; }
.detail-panel-title {
    font-size: var(--fs-11);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    padding: 14px 14px 8px;
    flex-shrink: 0;
}

.detail-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
/* Custom mode */
.detail-custom { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.detail-custom.visible { display: flex; }
.detail-custom-scroll { flex: 1; overflow-y: auto; padding: 0 10px 12px; }
.detail-section-label {
    font-size: var(--fs-10);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-3);
    margin: 10px 0 4px;
}
.no-presets-msg {
    font-size: var(--fs-12);
    color: var(--text-3);
    padding: 8px 0;
    font-style: italic;
}
.preset-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    background: var(--surface-2);
    border: 1px solid var(--border);
    margin-bottom: 4px;
    transition: border-color var(--dur-fast);
}
.preset-item:hover { border-color: var(--accent-border); }
.preset-item.active { border-color: var(--accent); background: var(--accent-dim); }
.preset-item-name {
    flex: 1;
    font-size: var(--fs-12);
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.preset-item.active .preset-item-name { color: var(--text); }
.preset-item-del {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-12);
    flex-shrink: 0;
}
.preset-item-del:hover { background: var(--error-dim); color: var(--error); }
.cf-control {
    display: block;
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 5px;
    padding: 5px 8px;
    font-size: var(--fs-12);
    font-family: var(--sans);
    box-sizing: border-box;
    margin-bottom: 6px;
}
.cf-control:focus { outline: none; border-color: var(--accent); }
.builder-actions {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    margin-top: 8px;
}
.builder-btn {
    width: 100%;
    padding: 7px;
    border-radius: 6px;
    font-size: var(--fs-12);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    margin-top: 6px;
    transition: border-color var(--dur-fast), color var(--dur-fast);
}
.builder-btn:hover { border-color: var(--accent); color: var(--accent); }
.builder-btn.primary {
    background: var(--accent);
    color: var(--btn-accent-text);
    border-color: var(--accent);
}
.builder-btn.primary:hover { opacity: 0.88; }

/* Main Area */
.filters-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.filters-toolbar {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: nowrap;
}
.toolbar-search-wrap {
    position: relative;
    flex: 1;
    min-width: 140px;
    max-width: 300px;
}
.toolbar-search-wrap svg {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    pointer-events: none;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.toolbar-search-wrap input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 6px 10px 6px 30px;
    font-size: var(--fs-13);
    font-family: var(--sans);
    box-sizing: border-box;
}
.toolbar-search-wrap input:focus { outline: none; border-color: var(--accent); }
.cmdk-hint {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor: default;
}

.cmdk-hint kbd {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    border: 1px solid var(--border-sub);
    background: var(--surface-2);
    border-radius: 6px;
    padding: 4px 7px;
    letter-spacing: 0.04em;
    box-shadow: inset 0 -1px 0 var(--border);
    user-select: none;
}

.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.filter-pill {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 3px 8px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: 20px;
    font-size: var(--fs-12);
    color: var(--accent);
    white-space: nowrap;
}
.pill-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent);
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    font-size: var(--fs-14);
    opacity: 0.7;
}
.pill-remove:hover { opacity: 1; }
.btn-toolbar {
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: var(--fs-12);
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: border-color var(--dur-fast), color var(--dur-fast);
}
.btn-toolbar:hover { border-color: var(--accent); color: var(--accent); }
.filter-desc-bar {
    padding: 7px 16px;
    font-size: var(--fs-12);
    color: var(--text-2);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: none;
}
.filter-desc-bar.visible { display: block; }
/* override old rule that targets #filterDescription as block element */
#filterDescription {
    display: inline;
    background: none;
    padding: 0;
    border: none;
    font-size: inherit;
    color: inherit;
}
.result-count-bar {
    padding: 6px 16px;
    font-size: var(--fs-12);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-sub);
}

.result-help {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    letter-spacing: 0.04em;
    opacity: 0.8;
    white-space: nowrap;
}

tbody tr.row-focused {
    box-shadow: inset 3px 0 0 var(--accent);
}
.filters-table-wrap {
    flex: 1;
    overflow: auto;
    position: relative;
}


/* ── Command Palette Modal ───────────────────────────────────────────────────── */

.command-palette-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-palette);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

.command-palette-modal.visible {
    display: flex;
}

.palette-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    z-index: calc(var(--z-palette) - 1);
}

.palette-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    z-index: calc(var(--z-palette) + 1);
    overflow: hidden;
}

.palette-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.palette-icon {
    width: 18px;
    height: 18px;
    color: var(--text-3);
    flex-shrink: 0;
}

.palette-search {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: var(--fs-16);
    outline: none;
    font-family: inherit;
    padding: 0;
}

.palette-search::placeholder {
    color: var(--text-3);
}

.palette-close {
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: var(--fs-12);
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 150ms ease;
    flex-shrink: 0;
}

.palette-close:hover {
    background: var(--surface-2);
    color: var(--text);
}

.palette-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.palette-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 100ms ease;
    border-left: 3px solid transparent;
}

.palette-result-item:hover {
    background: var(--surface-2);
}

.palette-result-item.selected {
    background: var(--surface-2);
    border-left-color: var(--accent);
}

.palette-result-icon {
    font-size: var(--fs-14);
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.palette-result-body {
    flex: 1;
    min-width: 0;
}

.palette-result-label {
    font-size: var(--fs-13);
    font-weight: 500;
    color: var(--text);
}

.palette-result-desc {
    font-size: var(--fs-11);
    color: var(--text-3);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.palette-result-cat {
    font-size: var(--fs-10);
    color: var(--text-3);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.palette-section-label {
    font-family: var(--mono);
    font-size: var(--fs-10);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    padding: 10px 16px 4px;
}

.palette-section-label:first-child {
    padding-top: 4px;
}

.palette-empty {
    padding: 24px 16px;
    text-align: center;
    font-family: var(--mono);
    font-size: var(--fs-12);
    color: var(--text-3);
}

/* Scrollbar styling for palette results */
.palette-results::-webkit-scrollbar {
    width: 8px;
}

.palette-results::-webkit-scrollbar-track {
    background: transparent;
}

.palette-results::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.palette-results::-webkit-scrollbar-thumb:hover {
    background: var(--text-3);
}


/* ── Skeleton loading (KPI values while cost data fetches) ─────────────── */
.skeleton {
    color: transparent !important;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background: var(--surface-2);
    min-width: 90px;
    min-height: 1em;
}
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
    animation: skeleton-sweep 1.2s infinite;
}
@keyframes skeleton-sweep {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}


/* ═══ Design refresh · Mission Control (2026-07) ═══════════════════════════
   Typography: Inter carries the UI; mono is reserved for serials/code.
   Numbers go sans-bold with tabular figures. Labels keep the uppercase
   eyebrow treatment but in Inter with tuned tracking. Cards gain a clearer
   elevation step. Purely additive layer — later rules, same var names. */

.kpi-label, .card-title, .pulse-section-title, .settings-title,
.drawer-section-title, .detail-cat-label, .nav-section {
    font-family: var(--sans);
    font-weight: 650;
    letter-spacing: 0.09em;
}
.kpi-label { font-size: var(--fs-10); }
.card-title { font-size: var(--fs-12); }

.kpi-val {
    font-family: var(--sans);
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

table th, .sec-table th {
    font-family: var(--sans);
    font-weight: 650;
    letter-spacing: 0.07em;
}

.panel-card, .sec-kpi, .sec-chart-card, .home-briefing, .needs-attention {
    border-radius: 10px;
}

button, input, select, textarea { font-family: var(--sans); }

.btn-sync {
    font-family: var(--sans);
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Status pills read as state, not decoration. */
.pill { font-family: var(--sans); font-weight: 650; }


/* ═══ Mission Control layout (body.mc — itam template only) ════════════════
   The header ELEMENT becomes a fixed left rail; every child keeps its id and
   behavior (tabs, sync, pulse, settings), only geometry changes. The Flask
   template has no body.mc, so none of this applies there. */

body.mc header {
    transition: width var(--dur-med) ease;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 224px;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-1);
    padding: 16px 12px 14px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
}
body.mc .h-sep { display: none; }
body.mc .rail-toggle {
    /* Pinned at the same viewport spot in BOTH rail states (left-anchored,
       centered in the 64px collapsed rail) so repeated expand/collapse
       clicks never have to chase the button. */
    position: absolute;
    top: 14px;
    left: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
}
body.mc .rail-toggle:hover { background: var(--surface-2); color: var(--text-2); }
body.mc .rail-toggle svg { width: 15px; height: 15px; transition: transform var(--dur-med); }
body.mc.rail-collapsed .rail-toggle svg { transform: rotate(180deg); }
body.mc .brand { padding: 2px 10px 0 42px; font-size: var(--fs-13); }
body.mc .subtitle { padding: 0 10px 10px 42px; font-size: var(--fs-10); color: var(--text-3); }

body.mc .top-tabs { flex-direction: column; flex: 1; width: 100%; gap: 2px; }
body.mc .mc-group { width: 100%; }
body.mc .mc-group-items { display: flex; flex-direction: column; gap: 2px; width: 100%; }
/* Section headers are fold toggles: the chevron turns, the items disappear.
   State lives on <html> (rail-fold-<group>) so the pre-paint script can
   apply it before first paint. */
body.mc .mc-sec {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--sans);
    font-size: var(--fs-10);
    font-weight: 650;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 11px 10px 4px;
    border-radius: 6px;
}
body.mc .mc-sec:hover { color: var(--text-2); }
body.mc .mc-sec .mc-sec-chev { width: 11px; height: 11px; opacity: 0.35; transition: transform var(--dur-med), opacity var(--dur-fast); }
body.mc .mc-sec:hover .mc-sec-chev,
body.mc .mc-sec[aria-expanded="false"] .mc-sec-chev { opacity: 0.9; }
body.mc .mc-sec[aria-expanded="false"] .mc-sec-chev { transform: rotate(-90deg); }
html.rail-fold-fleet .mc-group[data-group="fleet"] .mc-group-items,
html.rail-fold-insights .mc-group[data-group="insights"] .mc-group-items,
html.rail-fold-operate .mc-group[data-group="operate"] .mc-group-items,
html.rail-fold-money .mc-group[data-group="money"] .mc-group-items,
html.rail-fold-system .mc-group[data-group="system"] .mc-group-items { display: none; }
/* Settings: alone at the foot of the list, above Sync. */
body.mc .tab-btn.rail-pinned { margin-top: auto; }
body.mc .tab-btn.rail-pinned::before {
    content: '';
    position: absolute;
    left: 10px; right: 10px; top: -7px;
    height: 1px;
    background: var(--border-sub);
}
body.mc .tab-btn.rail-pinned { margin-top: auto; }
body.mc .top-tabs { padding-bottom: 2px; }
body.mc .tab-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    width: 100%;
    padding: 7px 10px;
    border-radius: 7px;
    text-align: left;
}
body.mc .tab-btn .tab-ico {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.8;
}
body.mc .tab-btn .tab-ico svg { width: 15px; height: 15px; }
body.mc .tab-btn.active .tab-ico { opacity: 1; color: var(--accent); }
body.mc .mc-badge { margin-left: auto; }
body.mc .tab-btn.active {
    background: var(--surface-2);
    box-shadow: inset 2px 0 0 var(--accent);
}
body.mc .mc-badge {
    font-family: var(--sans);
    font-size: var(--fs-11);
    font-weight: 700;
    color: var(--error);
    font-variant-numeric: tabular-nums;
}
body.mc .mc-badge.mc-money { color: var(--text-3); font-weight: 600; }

/* Staging-only feature placeholder (Costs on production): stays in the rail
   so the layout doesn't shift between environments, but reads as inert —
   dimmed glyph + name, a WIP tag overlaid on the right, no hover state.
   Not a button: the tab click delegation only matches [data-tab]. */
body.mc .tab-btn.tab-wip {
    cursor: not-allowed;
    user-select: none;
    background: transparent;
}
body.mc .tab-btn.tab-wip:hover { background: transparent; color: var(--text-2); }
body.mc .tab-btn.tab-wip .tab-ico,
body.mc .tab-btn.tab-wip .tab-name { opacity: 0.45; }
body.mc .tab-btn.tab-wip .tab-wip-overlay {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--mono);
    font-size: var(--fs-10);
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 999px;
    color: var(--warn);
    background: var(--warn-dim);
    border: 1px solid var(--warn);
    pointer-events: none;
}
/* Collapsed rail: the tag becomes a corner dot, like the numeric badges. */
body.mc.rail-collapsed .tab-btn.tab-wip .tab-wip-overlay {
    top: 5px;
    right: 10px;
    width: 6px;
    height: 6px;
    padding: 0;
    border: none;
    transform: none;
    font-size: 0;
    background: var(--warn);
}

/* Rail foot: Sync + Pulse, then the utility rows (Search, theme, Alerts,
   Saved Views, Options) as labelled nav-style rows, not a pile of glyphs. */
body.mc .sync-progress-pill { width: 100%; justify-content: center; margin-bottom: 6px; }
body.mc .btn-sync { width: 100%; justify-content: center; margin-top: 8px; }
body.mc .pulse-wrap, body.mc .settings-wrap { width: 100%; }
body.mc .btn-pulse {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
}
body.mc .rail-utils {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-sub);
}
body.mc .btn-settings.rail-util {
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-2);
    font-family: var(--sans);
    font-size: var(--fs-12);
    font-weight: 500;
    text-align: left;
}
body.mc .btn-settings.rail-util:hover,
body.mc .btn-settings.rail-util.open { background: var(--surface-2); color: var(--text); }
body.mc .rail-util .util-ico,
body.mc .rail-util .theme-ico { display: flex; align-items: center; flex-shrink: 0; opacity: 0.8; }
body.mc .rail-util svg { width: 15px; height: 15px; vertical-align: 0; }
body.mc .rail-util .util-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.mc .rail-util .util-kbd {
    font-family: var(--mono);
    font-size: var(--fs-10);
    color: var(--text-3);
    border: 1px solid var(--border-sub);
    border-radius: 4px;
    padding: 1px 5px;
    line-height: 1.3;
}
/* Unread-alert count sits at the row's end like the nav badges. */
body.mc .rail-util .notif-badge {
    position: static;
    min-width: 0;
    height: auto;
    padding: 0;
    background: none;
    color: var(--error);
    font-family: var(--sans);
    font-size: var(--fs-11);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
body.mc .btn-settings.rail-util.has-alert::after { display: none; }
body.mc .btn-settings.rail-util.has-alert .util-label::after {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--error);
    vertical-align: middle;
}
body.mc .btn-settings.rail-util.has-alert.stale-alert .util-label::after { background: var(--warn); }

/* Flyout panels open to the RIGHT of the rail as true popups. position:
   fixed (viewport-anchored) — the rail scrolls its own overflow, and any
   absolutely-positioned child would be CLIPPED by it (the menu was only
   reachable by horizontally scrolling the rail). Fixed elements ignore
   ancestor overflow, so the popup always lands beside the rail. */
body.mc .pulse-panel,
body.mc .settings-menu,
body.mc .header-panel {
    position: fixed;
    top: auto;
    bottom: 12px;
    right: auto;
    left: 232px;
    z-index: 140;
}

/* Rail nav entries read as product navigation, not terminal tabs. */
body.mc .tab-btn { border: none; box-shadow: none; }
body.mc .tab-btn .tab-name {
    font-family: var(--sans);
    font-size: var(--fs-13);
    letter-spacing: 0;
    text-transform: none;
    font-weight: 500;
}
body.mc .tab-btn.active {
    background: var(--surface-2);
    box-shadow: inset 2px 0 0 var(--accent);
    border: none;
}
body.mc .tab-btn.active .tab-name { font-weight: 650; color: var(--text); }
html[data-density="compact"] body.mc header { padding: 10px 10px 8px; gap: 2px; }
html[data-density="compact"] body.mc .tab-btn { padding: 4px 10px; }
html[data-density="compact"] body.mc .mc-sec { padding: 7px 10px 2px; }
html[data-density="compact"] body.mc .subtitle { padding-bottom: 4px; }
html[data-density="compact"] body.mc .btn-settings.rail-util { padding: 3px 10px; }
html[data-density="compact"] body.mc .btn-sync { margin-top: 6px; padding: 6px 0; }
html[data-density="compact"] body.mc .btn-pulse { padding: 5px 8px; }

/* Content column clears the rail. */
body.mc .tabs-shell { margin-left: 224px; padding: 14px 8px 0 8px; transition: margin-left var(--dur-med) ease; }
body.mc .stale-banner,
body.mc .degraded-banner { margin-left: 224px; }

/* ── Collapsed main rail: 64px icon strip, Claude-style ─────────────────── */
body.mc.rail-collapsed header { width: 64px; padding: 16px 8px 14px; overflow-x: hidden; }
body.mc.rail-collapsed .tabs-shell,
body.mc.rail-collapsed .stale-banner,
body.mc.rail-collapsed .degraded-banner { margin-left: 64px; }
body.mc.rail-collapsed .pulse-panel,
body.mc.rail-collapsed .settings-menu,
body.mc.rail-collapsed .header-panel { left: 72px; }

body.mc.rail-collapsed .brand { font-size: 0; padding: 40px 0 0; justify-content: center; }
body.mc.rail-collapsed .brand svg { width: 16px; height: 16px; }
body.mc.rail-collapsed .subtitle,
body.mc.rail-collapsed .mc-sec,
body.mc.rail-collapsed .tab-btn .tab-name { display: none; }
/* Section labels vanish; keep a faint divider so groups still read. */
/* Group headers collapse to 1px hairlines. The compact-density selector
   outranks this one, so it is repeated here — otherwise its padding turns
   every hairline into a 10px grey bar. */
body.mc.rail-collapsed .mc-sec,
html[data-density="compact"] body.mc.rail-collapsed .mc-sec { display: block; width: auto; font-size: 0; line-height: 0; height: 1px; min-height: 0; overflow: hidden; background: var(--border-sub); margin: 8px 10px 6px; padding: 0; border-radius: 0; }
/* Collapsed: the toggle keeps its absolute top-left position (same viewport
   spot as expanded); the brand icon drops below it instead. */

body.mc.rail-collapsed .tab-btn { justify-content: center; padding: 9px 0; gap: 0; }
/* Numeric badges become a corner dot (the number returns on expand). */
body.mc.rail-collapsed .mc-badge:not([hidden]) {
    position: absolute;
    top: 5px;
    right: 10px;
    width: 6px;
    height: 6px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: var(--error);
    font-size: 0;
}
body.mc.rail-collapsed .mc-badge.mc-money:not([hidden]) { background: var(--text-3); }

/* Bottom cluster shrinks to glyphs (the inline SVG carries the icon). */
body.mc.rail-collapsed .btn-sync { font-size: 0; padding: 8px 0; }
body.mc.rail-collapsed .btn-sync svg { margin-right: 0; }
body.mc.rail-collapsed .pulse-label { display: none; }
/* Collapsed rail: the pill is spinner-only — the per-source readout would
   wrap six names into a tall column at 64px (it lives in the title tooltip). */
body.mc.rail-collapsed #syncProgressPillText,
body.mc.rail-collapsed .sync-progress-list { display: none; }
body.mc.rail-collapsed .sync-progress-pill { align-items: center; padding: 8px 0; }
body.mc.rail-collapsed .rail-util .util-label,
body.mc.rail-collapsed .rail-util .util-kbd { display: none; }
body.mc.rail-collapsed .btn-settings.rail-util { justify-content: center; padding: 8px 0; gap: 0; }
body.mc.rail-collapsed .rail-util .notif-badge {
    position: absolute;
    top: 4px; right: 12px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--error);
    font-size: 0;
}
/* Fold toggles have no label to click in the icon strip. */
body.mc.rail-collapsed .mc-sec { pointer-events: none; }
body.mc.rail-collapsed .mc-sec .mc-sec-chev { display: none; }
body.mc.rail-collapsed .mc-group-items { display: flex !important; }
body.mc.rail-collapsed .tab-btn.rail-pinned::before { left: 10px; right: 10px; }
body.mc { --thead-top: 0px; }

/* The Insights / Operate in-panel strips duplicate the rail's entries (and
   since MDMs and Google Workspace became rail tabs of their own they no
   longer even match it): the rail is the navigation, so hide them. They stay
   in the DOM for deep links and tests. Second-level strips that are NOT in
   the rail (Compliance views, Costs) keep showing. */
body.mc .mode-subtabs .mode-subtab { font-size: var(--fs-12); }
body.mc #insightsSubtabs,
body.mc #operationsSubtabs { display: none; }


/* Clickable cost rows (people, waste, savings, departments) */
#tab-costs tr[data-cost-user],
#tab-costs tr[data-cost-dept] { cursor: pointer; }


/* ── Degraded-sources banner (persistent, non-dismissible) ───────────────── */
.degraded-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    font-size: var(--fs-12);
    color: var(--text);
    background: color-mix(in srgb, var(--error) 12%, var(--surface));
    border-bottom: 1px solid color-mix(in srgb, var(--error) 40%, transparent);
}
.degraded-banner .stale-icon { color: var(--error); }
.degraded-banner[hidden] { display: none; }

/* Auth-failure reason inside the login overlay (both templates). */
.login-error { color: var(--error); font-size: var(--fs-13); margin: 6px 0 10px; }

/* ── Device annotations (tags / exclusions / snoozes / notes) ─────────────── */
.ann-chips { display: inline-flex; gap: var(--sp-1); flex-wrap: wrap; vertical-align: middle; margin-left: 6px; }
/* Quieter than a full pill: lowercase, subdued, no shouting next to the
   serial. The Annotations tab is where the full detail lives. */
.ann-chip {
    display: inline-block; font-size: var(--fs-10); font-weight: 600; line-height: 1.5;
    padding: 0 5px; border-radius: 3px; letter-spacing: 0.04em; white-space: nowrap;
    text-transform: lowercase; opacity: 0.85;
}
.ann-tag { background: var(--accent-dim); color: var(--accent); cursor: pointer; }
.ann-tag:hover { filter: brightness(1.15); }
.ann-excluded { background: color-mix(in srgb, var(--text-3) 22%, transparent); color: var(--text-2); }
.ann-snoozed { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.ann-note { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text-2); }

.tag-filter-chip {
    display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12);
    background: var(--accent-dim); color: var(--accent); border-radius: 14px;
    padding: 3px 10px; flex-shrink: 0;
}
.tag-filter-chip[hidden] { display: none; }
.tag-filter-chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: var(--fs-14); line-height: 1; padding: 0; }

.ann-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.ann-row { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-12); }
.ann-row-content { flex: 1; color: var(--text); }
.ann-row-meta { color: var(--text-3); font-size: var(--fs-11); }
.ann-del { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: var(--fs-16); line-height: 1; }
.ann-del:hover { color: var(--error); }

.annotate-modal {
    position: fixed; inset: 0; z-index: var(--z-modal); display: flex;
    align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.55);
}
.annotate-modal[hidden] { display: none; }
.annotate-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 22px 24px; width: 380px; max-width: 92vw;
    box-shadow: var(--shadow-3);
    animation: pop-in var(--dur-med) ease;
}
.annotate-box h3 { margin: 0 0 14px; font-size: var(--fs-16); }
.annotate-field { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: 12px; font-size: var(--fs-12); color: var(--text-2); }
.annotate-field[hidden] { display: none; }
.annotate-field select, .annotate-field input {
    background: var(--surface-2); border: 1px solid var(--border-sub); border-radius: 6px;
    padding: 7px 9px; color: var(--text); font-size: var(--fs-13); font-family: var(--sans);
}
.annotate-hint { font-size: var(--fs-12); color: var(--text-3); margin: 0 0 10px; }
.annotate-error { font-size: var(--fs-12); color: var(--error); margin: 0 0 10px; }
.annotate-error[hidden] { display: none; }
.annotate-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }

/* ── Offboarding checklist (persistent, audited) ─────────────────────────── */
.checklist-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.checklist-bar {
    flex: 1; height: 6px; border-radius: 3px;
    background: color-mix(in srgb, var(--text-3) 25%, transparent); overflow: hidden;
}
.checklist-bar span { display: block; height: 100%; background: var(--success); transition: width var(--dur-slow) ease; }
.checklist-count { font-size: var(--fs-12); color: var(--text-3); font-variant-numeric: tabular-nums; }
.checklist-group { margin-bottom: 12px; }
.checklist-group-title {
    font-size: var(--fs-10); text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-3); margin-bottom: 5px;
}
/* One row per item: as inline labels they wrapped into each other and the
   list read as a paragraph. */
.checklist-item {
    display: flex; align-items: baseline; gap: var(--sp-2); width: 100%;
    padding: 4px 0; font-size: var(--fs-12); cursor: pointer;
}
.checklist-item input { flex-shrink: 0; margin: 0; }
.checklist-item.is-done .checklist-label { text-decoration: line-through; color: var(--text-3); }
.checklist-label { flex-shrink: 0; }
.checklist-detail { color: var(--text-3); font-size: var(--fs-11); }
.checklist-by { margin-left: auto; color: var(--text-3); font-size: var(--fs-10); white-space: nowrap; }

/* ── Device history timeline (item 13) ───────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; position: relative; }
.timeline::before {
    content: ''; position: absolute; left: 3px; top: 6px; bottom: 6px;
    width: 1px; background: var(--border);
}
.timeline-item {
    position: relative; display: flex; gap: 10px; align-items: baseline;
    padding: 5px 0; font-size: var(--fs-12);
}
.timeline-item::before {
    content: ''; position: absolute; left: -14px; top: 10px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-3); border: 2px solid var(--surface);
}
.timeline-item.is-first::before { background: var(--accent); }
.timeline-date {
    font-family: var(--mono); font-size: var(--fs-11); color: var(--text-3);
    flex-shrink: 0; min-width: 74px;
}
.timeline-text { color: var(--text-2); }
.timeline-repeat {
    margin-left: 6px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text-3);
    white-space: nowrap;
}

/* ── Department compliance bars (item 19) ────────────────────────────────── */
.compliance-cell { display: flex; align-items: center; gap: var(--sp-2); }
.compliance-bar {
    flex: 1; min-width: 60px; height: 6px; border-radius: 3px;
    background: color-mix(in srgb, var(--text-3) 22%, transparent); overflow: hidden;
}
.compliance-bar span { display: block; height: 100%; }
.compliance-pct {
    font-family: var(--mono); font-size: var(--fs-12); color: var(--text-2);
    min-width: 42px; text-align: right; font-variant-numeric: tabular-nums;
}

/* ── Wide modals (negotiation pack, vendor wizard) ───────────────────────── */
.wide-modal {
    position: fixed; inset: 0; z-index: var(--z-modal); display: flex;
    align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.55); padding: 24px;
}
.wide-modal[hidden] { display: none; }
.wide-modal-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    width: 760px; max-width: 100%; max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-3);
    animation: pop-in var(--dur-med) ease;
}
.wide-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-3); padding: 16px 20px; border-bottom: 1px solid var(--border-sub);
}
.wide-modal-header h3 { margin: 0; font-size: var(--fs-16); }
.wide-modal-body { padding: 16px 20px 22px; overflow-y: auto; }

.negotiation-head { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: 14px; }
.neg-chip {
    font-size: var(--fs-11); padding: 3px 10px; border-radius: 12px;
    background: var(--accent-dim); color: var(--accent);
}
.negotiation-stats {
    /* 150px floor: "US$1,008.00/yr" overflowed a 110px track and ran into
       the next stat. Numbers here are the whole point — never clip them. */
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--sp-4) 20px; margin-bottom: 10px;
}
.negotiation-stats > div { min-width: 0; }
.negotiation-stats .kpi-label { margin-bottom: 2px; }
.negotiation-points { margin: 4px 0 14px; padding-left: 18px; font-size: var(--fs-12); color: var(--text-2); }
.negotiation-points li { margin-bottom: 5px; }

.wizard-handoff { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: 12px; }
.wizard-handoff div { display: flex; align-items: baseline; gap: 10px; font-size: var(--fs-12); }
.wizard-handoff span { color: var(--text-3); min-width: 78px; }
.wizard-handoff code {
    font-family: var(--mono); font-size: var(--fs-12); background: var(--surface-2);
    padding: 3px 8px; border-radius: 5px; color: var(--text); word-break: break-all;
}

/* ── Header panels: notifications bell, saved views (items 30, 32) ───────── */
.notif-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 15px; height: 15px; border-radius: 8px; padding: 0 4px;
    background: var(--error); color: #fff;
    font-size: var(--fs-10); font-weight: 700; line-height: 15px; text-align: center;
}
.header-panel {
    position: absolute; top: 46px; right: 12px; z-index: 150;
    width: 340px; max-height: 60vh; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-2);
    animation: pop-in var(--dur-med) ease;
}
.header-panel-title {
    padding: 12px 14px 8px; font-size: var(--fs-11); font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3);
}
.header-panel-body { padding: 0 8px 10px; }
.notif-empty { padding: 16px 10px; font-size: var(--fs-12); color: var(--text-3); text-align: center; }
.notif-item { display: flex; gap: 9px; padding: 8px 8px; border-radius: 7px; align-items: flex-start; }
.notif-item.is-new { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; background: var(--text-3); flex-shrink: 0; }
.notif-item.sev-warning .notif-dot { background: var(--warn); }
.notif-item.sev-critical .notif-dot { background: var(--error); }
.notif-text { font-size: var(--fs-12); color: var(--text); }
.notif-meta { font-size: var(--fs-10); color: var(--text-3); margin-top: 2px; }

.saved-view-row { display: flex; align-items: stretch; gap: var(--sp-1); padding: 2px 0; }
.saved-view-row.is-revoked { opacity: 0.55; }
.saved-view-apply {
    flex: 1; display: flex; flex-direction: column; align-items: flex-start;
    gap: 1px; text-align: left; background: none; border: none; cursor: pointer;
    padding: 7px 8px; border-radius: 7px; color: var(--text);
}
.saved-view-apply:hover { background: var(--surface-2); }
.saved-view-name { font-size: var(--fs-12); font-weight: 600; }
.saved-view-desc { font-size: var(--fs-10); color: var(--text-3); font-family: var(--mono); }
.saved-view-delete { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: var(--fs-11); padding: 0 8px; border-radius: 6px; }
.saved-view-delete:hover { color: var(--error); background: var(--surface-2); }

/* ── Overview customizer (item 31) ───────────────────────────────────────── */
#overviewCustomizer { width: 240px; padding: 12px 14px; }
.overview-toggle { display: flex; align-items: center; gap: var(--sp-2); padding: 5px 0; font-size: var(--fs-12); cursor: pointer; }
.overview-toggle input { margin: 0; }

/* ── API token reveal (item 33) ──────────────────────────────────────────── */
.token-reveal { margin-top: 8px; padding: 9px 10px; border-radius: 7px;
    background: color-mix(in srgb, var(--warn) 10%, transparent);
    display: flex; flex-direction: column; gap: 6px; }
.token-reveal[hidden] { display: none; } /* display:flex above would beat the hidden attribute */
.login-primary[hidden] { display: none; }
/* Ops → Okta directory feed card */
.ops-status-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-12); color: var(--text-2); padding: 3px 0; }
.ops-status-row b { color: var(--text); }
.ops-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.ops-dot.ok { background: var(--success); }
.ops-dot.error { background: var(--error); }
.ops-dot.running { background: var(--accent); animation: pulse-dot 1s ease-in-out infinite; }
#opsDirectoryRunBtn:disabled { opacity: 0.5; cursor: wait; } /* same trap: the no-role sign-out button must stay out of the card until needed */
.token-reveal-note { font-size: var(--fs-11); color: var(--warn); font-weight: 600; }
.token-reveal-value { font-family: var(--mono); font-size: var(--fs-10); word-break: break-all;
    background: var(--surface-2); padding: 6px 8px; border-radius: 5px; }

/* ═══ 2026-08 polish pass ══════════════════════════════════════════════════ */

/* ── Costs toolbar (subtabs left, actions right — declutters the strip) ──── */
.costs-subtab-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}
.costs-subtab-row .costs-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-left: auto;
    flex-wrap: wrap;
}
.costs-status-note { font-size: var(--fs-11); color: var(--text-3); }
.costs-action-btn { font-size: var(--fs-11); padding: 4px 10px; }
.costs-help-link {
    font-size: var(--fs-11);
    color: var(--text-3);
    text-decoration: none;
    border: 1px solid var(--border-sub);
    border-radius: 10px;
    padding: 2px 8px;
    transition: border-color var(--dur-fast), color var(--dur-fast);
}
.costs-help-link:hover { border-color: var(--accent); color: var(--accent); }
.feed-status-wrap { position: relative; }
.feed-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-3); display: inline-block;
}
.feed-status-menu {
    display: none;
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
    min-width: 340px; max-height: 420px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 8px;
    box-shadow: var(--shadow-2);
}
.feed-status-menu.open { display: block; animation: pop-in var(--dur-med) ease; }

/* Costs waste filter row */
.costs-filter-row { display: flex; gap: var(--sp-2); align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.costs-filter-row input[type="text"] { flex: 1; min-width: 180px; max-width: 320px; }
.costs-filter-control {
    padding: 6px 10px; font-size: var(--fs-12);
    background: var(--surface); border: 1px solid var(--border-sub);
    border-radius: var(--radius-sm); color: var(--text);
}

/* S1 coverage/all-devices view toggle (was inline-styled) */
.s1-view-bar {
    display: flex; gap: var(--sp-2); margin-bottom: 16px;
    border-bottom: 1px solid var(--border-sub); padding-bottom: 12px;
}
.s1-view-toggle {
    padding: 6px 12px; background: transparent;
    border: 1px solid var(--border-sub); border-radius: var(--radius-sm);
    cursor: pointer; font-size: var(--fs-13); color: var(--text-2);
    transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
.s1-view-toggle:hover { border-color: var(--accent-border); color: var(--text); }
.s1-view-toggle.active {
    border-color: var(--accent-border);
    background: var(--accent-dim);
    color: var(--accent);
}

/* Home costs summary card grid (was inline-styled) */
.home-costs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* API token create row (was inline-styled) */
.api-token-create-row { display: flex; gap: 6px; margin-top: 8px; }
.api-token-hint { font-size: var(--fs-10); color: var(--text-3); margin-top: 6px; }
/* Remaining lifetime in the token list: amber inside the last 30 days. */
.token-expiry.is-expiring { color: var(--warn); font-weight: 600; }
.token-expiry.is-expired { color: var(--error); }
.token-reveal-expiry { font-size: var(--fs-11); color: var(--text-2); }
.api-token-create-row input {
    flex: 1; background: var(--surface-2);
    border: 1px solid var(--border-sub); border-radius: var(--radius-sm);
    padding: 5px 8px; color: var(--text); font-size: var(--fs-12);
}
.settings-docs-link {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    text-decoration: none;
}
.settings-docs-link svg { width: 13px; height: 13px; flex-shrink: 0; }
.settings-hint { font-size: var(--fs-10); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
#apiTokensSection { margin-top: 4px; }

/* ── Header/rail icon buttons: consistent SVG glyphs ─────────────────────── */
.btn-settings svg, .btn-density svg, .btn-report svg, .btn-generate-report svg {
    width: 14px; height: 14px; vertical-align: -2px;
}
.btn-sync svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 6px; }
.theme-ico { display: inline-flex; }
.theme-ico svg { width: 14px; height: 14px; }
.btn-generate-report { display: inline-flex; align-items: center; gap: 7px; }
.pulse-src-icon svg { width: 16px; height: 16px; color: var(--text-2); }
.pulse-src-icon { display: flex; align-items: center; justify-content: center; }

/* ── Collapsed-rail tooltips (floating element positioned by JS) ─────────── */
.rail-tooltip {
    position: fixed;
    z-index: 400;
    padding: 5px 10px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-2);
    color: var(--text);
    font-size: var(--fs-12);
    font-weight: 550;
    white-space: nowrap;
    pointer-events: none;
    animation: pop-in var(--dur-fast) ease;
}

/* Rail badge count change → quick pop so the eye catches it. */
@keyframes badge-pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.45); }
    100% { transform: scale(1); }
}
.mc-badge.bump { display: inline-block; animation: badge-pop 0.35s ease; }

/* ── Sync overlay: make "keep browsing" discoverable ─────────────────────── */
.sync-bg-btn {
    padding: 6px 16px;
    background: transparent;
    color: var(--text-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: var(--fs-11);
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: color var(--dur-med), border-color var(--dur-med);
}
.sync-bg-btn:hover { color: var(--accent); border-color: var(--accent); }
.sync-modal-actions { display: flex; gap: var(--sp-2); }

/* ── Numbers behave: no jitter as live values update ─────────────────────── */
.stat-val, .src-count, .pulse-src-count, .needs-attention-count,
.result-count-bar, .checklist-count, .notif-badge, .mc-badge,
#countdown, #syncTs {
    font-variant-numeric: tabular-nums;
}

/* ── Mobile (≤900px): the mission-control rail becomes a slide-over ──────── */
.mobile-nav-btn { display: none; }
.rail-backdrop { display: none; }

@media (max-width: 900px) {
    body.mc header {
        transform: translateX(-100%);
        transition: transform var(--dur-slow) ease;
        width: 246px;
        z-index: 300;
        box-shadow: none;
    }
    body.mc.rail-open header {
        transform: none;
        box-shadow: var(--shadow-3);
    }
    /* Collapsed-state geometry makes no sense off-canvas — neutralize it. */
    body.mc.rail-collapsed header { width: 246px; }
    body.mc .tabs-shell,
    body.mc.rail-collapsed .tabs-shell,
    body.mc .stale-banner,
    body.mc.rail-collapsed .stale-banner,
    body.mc .degraded-banner,
    body.mc.rail-collapsed .degraded-banner { margin-left: 0; }
    body.mc .tabs-shell { padding-top: 54px; }
    body.mc .rail-toggle { display: none; }
    body.mc.rail-collapsed .subtitle,
    body.mc.rail-collapsed .mc-sec,
    body.mc.rail-collapsed .tab-btn .tab-name { display: revert; }
    body.mc.rail-collapsed .mc-sec,
    html[data-density="compact"] body.mc.rail-collapsed .mc-sec { display: flex; width: 100%; font-size: var(--fs-10); line-height: normal; height: auto; min-height: 0; overflow: visible; background: none; margin: 0; padding: 14px 10px 5px; pointer-events: auto; }
    html[data-density="compact"] body.mc.rail-collapsed .mc-sec { padding: 7px 10px 2px; }
    body.mc.rail-collapsed .mc-sec .mc-sec-chev { display: block; }
    body.mc.rail-collapsed .mc-group-items { display: flex; }
    html.rail-fold-fleet body.mc.rail-collapsed .mc-group[data-group="fleet"] .mc-group-items,
    html.rail-fold-insights body.mc.rail-collapsed .mc-group[data-group="insights"] .mc-group-items,
    html.rail-fold-operate body.mc.rail-collapsed .mc-group[data-group="operate"] .mc-group-items,
    html.rail-fold-money body.mc.rail-collapsed .mc-group[data-group="money"] .mc-group-items,
    html.rail-fold-system body.mc.rail-collapsed .mc-group[data-group="system"] .mc-group-items { display: none; }
    body.mc.rail-collapsed .rail-util .util-label,
    body.mc.rail-collapsed .rail-util .util-kbd { display: revert; }
    body.mc.rail-collapsed .btn-settings.rail-util { justify-content: flex-start; padding: 6px 10px; gap: 9px; }
    body.mc.rail-collapsed .rail-util .notif-badge { position: static; width: auto; height: auto; border-radius: 0; background: none; font-size: var(--fs-11); }
    body.mc.rail-collapsed .brand { font-size: var(--fs-13); padding: 2px 10px 0 42px; justify-content: flex-start; }
    body.mc.rail-collapsed .tab-btn { justify-content: flex-start; padding: 8px 10px; gap: 9px; }
    body.mc.rail-collapsed .btn-sync { font-size: var(--fs-12); padding: 8px 20px; }
    body.mc.rail-collapsed .btn-sync svg { margin-right: 6px; }
    body.mc.rail-collapsed .pulse-label { display: inline; }
    body.mc.rail-collapsed #syncProgressPillText { display: inline; }
    body.mc.rail-collapsed .sync-progress-list { display: block; }
    body.mc.rail-collapsed .sync-progress-pill { align-items: stretch; padding: 6px 10px; }
    /* Numeric badges return in the slide-over (corner dots are a
       collapsed-strip affordance, meaningless at full label width). */
    body.mc.rail-collapsed .mc-badge:not([hidden]),
    body.mc.rail-collapsed .mc-badge.mc-money:not([hidden]) {
        position: static;
        width: auto;
        height: auto;
        margin: 0 0 0 auto;
        border-radius: 0;
        background: none;
        font-size: var(--fs-11);
    }
    /* The WIP tag returns to its pill form in the slide-over too. */
    body.mc.rail-collapsed .tab-btn.tab-wip .tab-wip-overlay {
        top: 50%;
        right: 10px;
        width: auto;
        height: auto;
        padding: 3px 6px;
        border: 1px solid var(--warn);
        transform: translateY(-50%);
        font-size: var(--fs-10);
        background: var(--warn-dim);
    }

    body.mc .mobile-nav-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 10px; left: 10px;
        z-index: 290;
        width: 36px; height: 36px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--surface);
        color: var(--text-2);
        cursor: pointer;
        box-shadow: var(--shadow-1);
    }
    body.mc .mobile-nav-btn svg { width: 17px; height: 17px; }
    body.mc.rail-open .rail-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 295;
        background: var(--overlay-bg);
    }
    /* Flyout panels anchor to the viewport, not the (off-canvas) rail. */
    body.mc .pulse-panel,
    body.mc .settings-menu,
    body.mc .header-panel {
        left: 12px;
        right: 12px;
        width: auto;
        bottom: 12px;
    }
    .filters-toolbar { flex-wrap: wrap; }
    .toolbar-search-wrap { min-width: 100%; }
    .filters-layout { height: calc(100vh - 140px); }
}

/* ── Reduced motion: honor the OS setting everywhere ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Companion rules for de-inlined template markup */
.account-email { font-weight: 600; }
.account-role { color: var(--text-3); font-size: var(--fs-12); }
.kpi-val.kpi-warn { color: var(--warn); }
.kpi-val.kpi-success { color: var(--success); }
.home-costs-card { cursor: pointer; }
.overview-customize-row { display: flex; justify-content: flex-end; position: relative; }
.overview-customize-row .btn-toolbar { font-size: var(--fs-11); }
#overviewCustomizer { top: 34px; right: 0; left: auto; }

/* Toast: inline action (e.g. Undo) + auto-dismiss progress bar */
.toast { position: relative; overflow: hidden; }
.toast-action {
    flex-shrink: 0;
    align-self: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: var(--fs-11);
    font-weight: 650;
    padding: 3px 10px;
    cursor: pointer;
    transition: border-color var(--dur-fast), background var(--dur-fast);
}
.toast-action:hover { border-color: var(--accent); background: var(--accent-dim); }
.toast-progress {
    position: absolute;
    left: 0; bottom: 0;
    height: 2px;
    width: 100%;
    background: currentColor;
    opacity: 0.35;
    transform-origin: left;
    animation-name: toast-progress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
@keyframes toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ── Sticky serial + checkbox columns (Investigate) ──────────────────────────
   The identity columns stay pinned while the wide table scrolls sideways.
   ≥769px only: on phones/small tablets the pinned pair would eat too much of
   the viewport, so there they scroll with the rest. */
@media (min-width: 769px) {
    #deviceTable th.cb-col,
    #deviceTable td.cb-col {
        position: sticky;
        left: 0;
        z-index: 5;
        background: var(--surface);
        /* Exactly 32px so the serial column's left offset lines up gap-free. */
        min-width: 32px;
        max-width: 32px;
    }
    #deviceTable th.col-serial,
    #deviceTable td.col-serial {
        position: sticky;
        left: 32px; /* .cb-col width (border-box) */
        z-index: 5;
        background: var(--surface);
        box-shadow: 1px 0 0 var(--border-sub);
    }
    /* Corner cells sit above both sticky axes. */
    #deviceTable thead th.cb-col,
    #deviceTable thead th.col-serial { z-index: 12; }
    /* Zebra + hover states must stay opaque on the pinned cells. */
    #deviceTable tbody tr:nth-child(even) td.cb-col,
    #deviceTable tbody tr:nth-child(even) td.col-serial {
        background: color-mix(in srgb, var(--text) 3%, var(--surface));
    }
    #deviceTable tbody tr:hover td.cb-col,
    #deviceTable tbody tr:hover td.col-serial {
        background: var(--surface-2);
    }
    #deviceTable tbody tr:hover td.cb-col {
        box-shadow: inset 2px 0 0 var(--accent);
    }
}

/* ── Keyboard-shortcuts cheat sheet (?) ──────────────────────────────────── */
.shortcuts-modal { position: fixed; inset: 0; z-index: var(--z-shortcuts); }
.shortcuts-modal[hidden] { display: none; }
.shortcuts-backdrop { position: absolute; inset: 0; background: var(--overlay-bg); }
.shortcuts-box {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-3);
    padding: 20px 22px;
    animation: pop-in var(--dur-med) ease;
}
.shortcuts-title {
    font-size: var(--fs-12);
    font-weight: 650;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 14px;
}
.shortcut-row {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 6px 0;
    font-size: var(--fs-13);
    color: var(--text-2);
}
.shortcut-keys { flex-shrink: 0; min-width: 96px; display: inline-flex; align-items: center; gap: var(--sp-1); }
.shortcut-keys i { font-style: normal; color: var(--text-3); }
.shortcut-keys kbd {
    font-family: var(--mono);
    font-size: var(--fs-11);
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 2px 7px;
}
.shortcut-desc { flex: 1; }

/* ── Chart hover tooltip ─────────────────────────────────────────────────── */
.chart-tooltip {
    position: fixed;
    z-index: var(--z-tooltip);
    padding: 5px 10px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-2);
    color: var(--text);
    font-size: var(--fs-12);
    font-weight: 550;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}

/* ── First-run tour ──────────────────────────────────────────────────────── */
.tour-overlay { position: fixed; inset: 0; z-index: var(--z-tour); background: var(--overlay-bg); }
.tour-ring {
    position: fixed;
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 4px var(--accent-dim), 0 0 24px var(--accent-dim);
    transition: left 0.25s ease, top 0.25s ease, width 0.25s ease, height 0.25s ease;
    pointer-events: none;
}
.tour-card {
    position: fixed;
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-3);
    padding: 16px 18px;
    animation: pop-in var(--dur-slow) ease;
    transition: left 0.25s ease, top 0.25s ease;
}
.tour-title {
    font-size: var(--fs-11);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
}
.tour-text { font-size: var(--fs-13); color: var(--text-2); line-height: 1.55; }
.tour-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
}
.tour-dots { font-family: var(--mono); font-size: var(--fs-11); color: var(--text-3); }
.tour-actions { display: flex; gap: var(--sp-2); }
.tour-skip {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: var(--fs-12);
    cursor: pointer;
    padding: 5px 8px;
}
.tour-skip:hover { color: var(--text); }
.tour-next {
    background: var(--accent);
    color: var(--btn-accent-text);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--fs-12);
    font-weight: 650;
    padding: 5px 14px;
    cursor: pointer;
}
.tour-next:hover { opacity: 0.88; }

/* ── Bulk-action bar (Investigate selection) ─────────────────────────────── */
.bulk-bar {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 180;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 8px 10px 8px 16px;
    background: var(--surface);
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    box-shadow: var(--shadow-3);
    animation: panel-in var(--dur-med) ease;
}
.bulk-bar[hidden] { display: none; }
.bulk-count {
    font-size: var(--fs-12);
    font-weight: 650;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    margin-right: 4px;
}
.bulk-clear {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: var(--fs-12);
    cursor: pointer;
    padding: 5px 8px;
}
.bulk-clear:hover { color: var(--text); }
body.mc .bulk-bar { left: calc(50% + 112px); }
body.mc.rail-collapsed .bulk-bar { left: calc(50% + 32px); }

/* ── Search-match highlight ──────────────────────────────────────────────── */
mark.cell-hl {
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 3px;
    padding: 0 1px;
}

/* ── Column-picker presets ───────────────────────────────────────────────── */
.col-preset-row {
    display: flex;
    gap: var(--sp-1);
    padding: 4px 6px 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-sub);
}
.col-preset-row button {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border-sub);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: var(--fs-11);
    padding: 4px 6px;
    cursor: pointer;
    transition: border-color var(--dur-fast), color var(--dur-fast);
}
.col-preset-row button:hover { border-color: var(--accent-border); color: var(--accent); }

/* ── Relative dates + trend arrows ───────────────────────────────────────── */
.rel-date { cursor: default; }
.kpi-trend { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── OS end-of-life pill ─────────────────────────────────────────────────── */
.eol-pill {
    display: inline-block;
    font-family: var(--sans);
    font-size: var(--fs-10);
    font-weight: 750;
    letter-spacing: 0.06em;
    color: var(--error);
    background: var(--error-dim);
    border: 1px solid color-mix(in srgb, var(--error) 40%, transparent);
    border-radius: 4px;
    padding: 0 5px;
    vertical-align: 1px;
    cursor: default;
}

/* ── Department compliance trend ─────────────────────────────────────────── */
.dept-trend {
    font-size: var(--fs-10);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: default;
    flex-shrink: 0;
}
.dept-trend.up { color: var(--success); }
.dept-trend.down { color: var(--error); }

/* ── "What changed" modal bits ───────────────────────────────────────────── */
.drift-all-btn { margin-left: 10px; font-size: var(--fs-10); vertical-align: 1px; }
.drift-arrow { color: var(--text-3); }
.drift-quiet { color: var(--text-3); }
.drift-new {
    font-size: var(--fs-10);
    color: var(--text-3);
    border: 1px dashed var(--border);
    border-radius: 999px;
    padding: 1px 7px;
}
.drift-row { cursor: pointer; }

/* ── Connection-lost pill ────────────────────────────────────────────────── */
.net-lost-pill {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-net-pill);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 7px 14px;
    background: var(--surface);
    border: 1px solid var(--warn);
    border-radius: 999px;
    box-shadow: var(--shadow-2);
    color: var(--warn);
    font-size: var(--fs-12);
    font-weight: 600;
    animation: panel-in var(--dur-med) ease;
}
.net-lost-pill[hidden] { display: none; }

/* ── Skeleton text lines (drawer sections while async data loads) ────────── */
.skeleton-line {
    height: 10px;
    border-radius: 5px;
    background: var(--surface-2);
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
}
.skeleton-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent);
    animation: skeleton-sweep 1.2s infinite;
}
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w60 { width: 60%; }

/* ── Unified thin scrollbars ─────────────────────────────────────────────── */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background-color: var(--surface-3);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--border); }
::-webkit-scrollbar-corner { background: transparent; }

/* ── Role-aware UI ────────────────────────────────────────────────────────────
   body[data-role] is stamped from check-auth (Django only; Flask has no
   roles). `management` is read-only: hide every mutating control. Server-side
   403s are the actual enforcement — this is ergonomics. */
body[data-role="management"] #annotateBtn,
body[data-role="management"] #excludeBtn,
body[data-role="management"] #bulkAnnotate,
body[data-role="management"] #bulkHide,
body[data-role="management"] #addVendorBtn,
body[data-role="management"] #apiTokensSection,
body[data-role="management"] #syncBtn,
body[data-role="management"] .sync-cancel-btn,
body[data-role="management"] #staleSyncBtn,
body[data-role="management"] [data-empty-action="sync"],
body[data-role="management"] [data-empty-action="add-vendor"] {
    display: none !important;
}
/* Admin-only surfaces stay hidden until the role says otherwise. The gate
   must not override display for admins: `display: revert` re-resolved to the
   UA default (inline-block for buttons), which broke the rail entries' flex
   layout — icon and label stacked. A :not() guard leaves admin elements with
   their normal author styles. */
body:not([data-role="administration"]) .admin-only { display: none !important; }

/* ── Ops tab (administration) ─────────────────────────────────────────────── */
.ops-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
}
@media (max-width: 1000px) { .ops-grid { grid-template-columns: 1fr; } }
.ops-controls { display: flex; flex-direction: column; gap: 10px; }
.ops-field { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-12); color: var(--text-2); }
.ops-field input[type="number"] {
    width: 140px;
    background: var(--surface-2);
    border: 1px solid var(--border-sub);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
    color: var(--text);
    font-size: var(--fs-13);
}
.ops-field-row { flex-direction: row; align-items: center; gap: var(--sp-2); }
.ops-field-row input { width: auto; }
.ops-actions { display: flex; gap: var(--sp-2); }
.ops-status-body .pulse-row { font-family: var(--mono); }
.ops-hygiene-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.ops-hygiene-card {
    border: 1px solid var(--border-sub);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    padding: 10px 12px;
}
.ops-hygiene-card.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.ops-hygiene-card.warn .kpi-val { color: var(--warn); }
.my-sessions-list .sec-table td { padding: 4px 6px; }
.pulse-src-retry {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--warn);
    color: var(--warn);
    border-radius: var(--radius-sm);
    font-size: var(--fs-10);
    padding: 2px 8px;
    cursor: pointer;
}
.pulse-src-retry:hover { background: var(--warn); color: var(--bg); }
.pulse-src-retry[hidden] { display: none; }


/* ── Numeric cells (D4): money and counts right-align, tabular ───────────── */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Focus rings inside scrolling containers (D11) ────────────────────────────
   The global outline draws OUTSIDE the element and gets clipped by the
   rail's / subtab strips' overflow — inset rings stay visible. */
body.mc .tab-btn:focus-visible,
.mode-subtab:focus-visible,
body.mc .mc-sec:focus-visible,
.osv-tab:focus-visible,
.sec-tab:focus-visible,
.stock-tab:focus-visible,
.stock-view-tab:focus-visible,
.donut-tab-btn:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--accent);
}

/* ═══ Batch 4 / C2: design features ════════════════════════════════════════ */

/* ── D15: sync overlay per-source progress bars ──────────────────────────── */
.sync-status-row {
    grid-template-columns: 14px minmax(100px, 140px) 1fr minmax(90px, auto);
}
.sync-src-bar {
    display: block;
    height: 6px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--text-3) 18%, transparent);
    overflow: hidden;
    position: relative;
}
.sync-src-bar-fill {
    display: block;
    position: relative;
    overflow: hidden;
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: var(--text-3);
    /* Width is driven by JS (time-based progress model) so it survives the
       poll re-renders; the transition smooths each step. */
    transition: width 0.6s cubic-bezier(0.25, 0.8, 0.4, 1), background var(--dur-slow) var(--ease);
}
.sync-status-row.queued .sync-src-bar-fill { width: 6%; }
.sync-status-row.running .sync-src-bar-fill { background: var(--accent); }
/* Shimmer sweep on the running fill: a gradient highlight that fades at both
   edges, so the loop has no visible jump (the old 40% block slid off one end
   and popped back in at the other). */
.sync-status-row.running .sync-src-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 3px;
    background: linear-gradient(90deg,
        transparent 20%,
        color-mix(in srgb, #fff 30%, transparent) 50%,
        transparent 80%);
    transform: translateX(-100%);
    animation: sync-bar-shimmer 1.1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.sync-status-row.ok .sync-src-bar-fill { width: 100%; background: var(--success); }
.sync-status-row.ok.carried .sync-src-bar-fill { background: var(--warn); }
.sync-status-row.error .sync-src-bar-fill { width: 100%; background: var(--error); }
.sync-status-row.not_configured .sync-src-bar-fill { width: 100%; background: color-mix(in srgb, var(--text-3) 35%, transparent); }
@keyframes sync-bar-shimmer {
    to { transform: translateX(100%); }
}
.sync-status-row.error .sync-source-meta { color: var(--error); }

/* ── D19: toast overflow chip ────────────────────────────────────────────── */
.toast-more-chip {
    align-self: flex-end;
    pointer-events: all;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-2);
    font-size: var(--fs-11);
    font-weight: 650;
    padding: 4px 12px;
    cursor: pointer;
    box-shadow: var(--shadow-1);
}
.toast-more-chip:hover { border-color: var(--accent); color: var(--accent); }
.toast[hidden] { display: none; }

/* ── D14: drawer jump-nav ────────────────────────────────────────────────── */
.drawer-jump-nav {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    gap: var(--sp-1);
    flex-wrap: wrap;
    padding: 8px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-sub);
}
.drawer-jump-nav button {
    background: transparent;
    border: 1px solid var(--border-sub);
    border-radius: 999px;
    color: var(--text-3);
    font-size: var(--fs-10);
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 9px;
    cursor: pointer;
    transition: color var(--dur-fast), border-color var(--dur-fast);
}
.drawer-jump-nav button:hover { color: var(--accent); border-color: var(--accent-border); }

/* ── D8: clickable KPI affordance ────────────────────────────────────────── */
.home-clickable-card {
    position: relative;
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast);
}
.home-clickable-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
}
.home-clickable-card::after {
    content: 'view →';
    position: absolute;
    right: 12px;
    bottom: 8px;
    font-size: var(--fs-10);
    font-weight: 650;
    letter-spacing: 0.05em;
    color: var(--accent);
    opacity: 0;
    transition: opacity var(--dur-fast);
}
.home-clickable-card:hover::after,
.home-clickable-card:focus-visible::after { opacity: 1; }

/* ── D7: scroll shadows ──────────────────────────────────────────────────── */
.tbl-wrap, .stock-table-wrap, .sec-table-wrap, .osv-table-wrap { position: relative; }
.tbl-wrap.is-scrolled-y thead,
.stock-table-wrap.is-scrolled-y thead,
.sec-table-wrap.is-scrolled-y thead,
.osv-table-wrap.is-scrolled-y thead {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
/* Horizontal "more columns" fades (scroll with the content). */
.tbl-wrap {
    background:
        linear-gradient(90deg, var(--surface) 30%, transparent) left / 24px 100%,
        linear-gradient(270deg, var(--surface) 30%, transparent) right / 24px 100%;
    background-repeat: no-repeat;
    background-attachment: local, local;
}

/* ── D13: comfortable density earns its keep ─────────────────────────────── */
html[data-density="comfortable"] body { font-size: 15px; }
html[data-density="comfortable"] .tabs-shell { padding-left: var(--sp-5); padding-right: var(--sp-5); }
html[data-density="comfortable"] .home-grid { gap: var(--sp-4); }
html[data-density="comfortable"] .panel-card { padding: 22px 24px; }
html[data-density="comfortable"] .sec-kpi-row { gap: var(--sp-4); }
html[data-density="comfortable"] .mode-subtab { font-size: var(--fs-13); padding: 8px 18px; }
html[data-density="comfortable"] .briefing-sentence { font-size: 18px; }

/* ── D18: 13" laptop tier (1024–1280px) ──────────────────────────────────── */
@media (min-width: 901px) and (max-width: 1280px) {
    .home-kpi { grid-column: span 6; }        /* 2×2 instead of 4-up */
    .home-sync { grid-column: span 12; }
    .sec-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .costs-subtab-row .costs-actions { flex-basis: 100%; justify-content: flex-end; }
    body.mc header { width: 200px; }
    body.mc .tabs-shell,
    body.mc .stale-banner,
    body.mc .degraded-banner { margin-left: 200px; }
}

/* ── D12: empty-state illustration (layered diamonds) ────────────────────── */
.empty-illustration {
    width: 72px;
    height: 56px;
    margin: 0 auto 12px;
    display: block;
    color: var(--text-3);
}
.empty-illustration .accent { color: var(--accent); }

/* ── As-of historical viewer (batch 4 / D) ───────────────────────────────── */
.asof-input {
    background: var(--surface-2);
    border: 1px solid var(--border-sub);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: var(--fs-12);
    padding: 2px 6px;
    margin-left: 4px;
}
.asof-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 8px 16px;
    background: var(--warn-dim);
    color: var(--warn);
    border-bottom: 1px solid var(--warn);
    font-size: var(--fs-12);
}
.asof-banner[hidden] { display: none; }
.asof-banner b { font-variant-numeric: tabular-nums; }
.asof-banner .stale-sync-btn { margin-left: auto; }
body.mc .asof-banner { margin-left: 224px; }
body.mc.rail-collapsed .asof-banner { margin-left: 64px; }
/* Historical view is read-only: hide every mutating control. */
body.asof-mode #annotateBtn,
body.asof-mode #excludeBtn,
body.asof-mode #bulkAnnotate,
body.asof-mode #bulkHide,
body.asof-mode #syncBtn,
body.asof-mode .pulse-src-retry,
body.asof-mode [data-empty-action="sync"] {
    display: none !important;
}

/* ── Drawer raw-record view (administration) ─────────────────────────────── */
.drawer-raw { margin: 10px 20px 16px; }
.drawer-raw summary {
    cursor: pointer;
    font-size: var(--fs-11);
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
}
.drawer-raw summary:hover { color: var(--accent); }
.drawer-raw pre {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-sub);
    border-radius: var(--radius-md);
    font-family: var(--mono);
    font-size: var(--fs-10);
    line-height: 1.5;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Per-tool audit cards + Admin rail entry (2026-08-31) ──────────────────── */
.tool-cards-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0 0; }
.tool-cards-row:empty { display: none; }
.tool-card { cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 8px; min-width: 240px; padding: 14px 16px; }
.tool-card:hover { border-color: var(--accent); }
.tool-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tool-card-name { font-size: 14px; font-weight: 600; color: var(--text); }
.tool-card-seats { font-size: 12px; color: var(--text-2); }
.tool-card-seats::after { content: ' seats'; color: var(--text-3); }
.tool-card-states { display: flex; flex-wrap: wrap; gap: 5px; }
.state-chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid transparent; }
.chip-active   { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.chip-dormant  { color: var(--warn);    border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.chip-orphaned { color: var(--error);   border-color: color-mix(in srgb, var(--error) 45%, transparent); }
.chip-pending  { color: var(--warn);    border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.chip-unknown  { color: var(--text-2); border-color: var(--border, rgba(128,128,128,.35)); }
.tier-chip { font-size: 10px; padding: 1px 7px; border-radius: 9px; border: 1px solid var(--border, rgba(128,128,128,.35)); color: var(--text-2); margin-right: 4px; }
.tool-card-tiers { display: flex; flex-wrap: wrap; gap: 4px; }
.tool-card-money { font-size: 12px; }
.tool-card-waste { color: var(--warn); font-weight: 600; }
.tool-card-spend { color: var(--text-3); }
.tool-card-flag { color: var(--warn); font-weight: 600; }

/* Save feedback: row dims under an overlay message (2026-08-31) */
#adminToolsTable tr { position: relative; }
tr.row-saved > td, tr.row-save-failed > td { opacity: .25; transition: opacity .2s; }
tr.row-saved::after, tr.row-save-failed::after {
    content: 'Settings saved ✓';
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; color: var(--success); pointer-events: none;
}
tr.row-save-failed::after { content: attr(data-save-msg); color: var(--error); }
#adminToolsTable td { vertical-align: middle; }

.compliance-row { cursor: pointer; }
.compliance-row { cursor: pointer; }
.compliance-row .compliance-chev { display: inline-block; width: 12px; color: var(--text-3); margin-right: 6px; transition: transform var(--dur-fast); }
.compliance-row.is-open .compliance-chev { transform: rotate(90deg); color: var(--accent); }
.compliance-row.is-open td { background: var(--surface-2); }
.compliance-detail-row td { padding: 0 !important; background: var(--surface-2); }
.compliance-detail-inner { padding: 8px 12px 12px 30px; border-bottom: 1px solid var(--border-sub); }
.compliance-detail-inner .stock-table-wrap { max-height: 320px; }
.compliance-teams-wrap { max-height: 220px; margin-bottom: 10px; }
.compliance-team-row { cursor: pointer; }
.compliance-team-row.is-active td { background: var(--accent-dim); color: var(--text); }
.compliance-detail-title { font-size: var(--fs-12); color: var(--text-2); margin: 4px 0 8px; }
.compliance-table-wrap { max-height: none; overflow: visible; }
.compliance-row:hover td { background: rgba(128,128,128,.07); }

.unpriced-chip { display: inline-block; margin: 4px 4px 0 0; font-size: 10px; padding: 2px 8px;
    border-radius: 9px; border: 1px dashed color-mix(in srgb, var(--warn) 60%, transparent); color: var(--warn);
    background: transparent; cursor: pointer; }
.unpriced-chip:hover { border-style: solid; }

/* ── Conflict resolution (Armory) ─────────────────────────── */
.drawer-conflicts { padding: 12px 20px 4px; border-bottom: 1px solid var(--border-sub); }
.drawer-conflict-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; }
.cc-field { font-size: var(--fs-10); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.conflict-resolve-btn { white-space: nowrap; color: var(--conflict); border-color: var(--conflict); }
.conflict-box { width: 520px; position: relative; overflow: hidden; }
.conflict-options { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 14px; }
.conflict-option {
    display: grid; grid-template-columns: 18px 90px 1fr; align-items: center; gap: 10px;
    padding: 8px 10px; border: 1px solid var(--border-sub); border-radius: var(--radius-md, 10px);
    background: var(--surface-2); cursor: not-allowed;
}
.conflict-option-src { font-family: var(--mono); font-size: var(--fs-10); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.conflict-option-val { font-family: var(--mono); font-size: var(--fs-13); color: var(--text); }
.wip-overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 24px; text-align: center;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    backdrop-filter: blur(3px);
}
.wip-overlay p { margin: 0; max-width: 360px; font-size: var(--fs-13); color: var(--text-2); }
.wip-badge {
    font-family: var(--mono); font-size: var(--fs-11); letter-spacing: .12em; font-weight: 600;
    padding: 3px 10px; border-radius: 999px; color: var(--warn); border: 1px dashed var(--warn);
}

/* ── Info banner (one-time notices, e.g. the Armory rename) ── */
.info-banner {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; font-size: var(--fs-13);
    background: var(--accent-dim); border-bottom: 1px solid var(--accent-border);
    color: var(--text);
}
.info-banner .stale-icon { color: var(--accent); }
.info-banner[hidden] { display: none; }
body.mc .info-banner { margin-left: 224px; }
body.mc.rail-collapsed .info-banner { margin-left: 64px; }

/* Inline per-source sync feedback in the rail pill */
.sync-progress-pill { flex-direction: column; align-items: stretch; border-radius: 10px; gap: 4px; }
.sync-progress-src { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-10); color: var(--text-3); }
.sync-progress-src[data-st="ok"] { color: var(--success); }
.sync-progress-src[data-st="error"] { color: var(--error); }
.sync-progress-src[data-st="running"] { color: var(--text-2); }
.pulse-label.pulse-failing { color: var(--error); }

/* Rail link (System → Status): a plain anchor styled as a tab; no data-tab,
   so the tab click handler ignores it and the browser just follows it. */
header .rail-link { text-decoration: none; }

/* ── Inline SVG icons (emoji purge, design system) ───────────────────────── */
.palette-result-icon svg { width: 18px; height: 18px; display: block; }
.drawer-copy-icon svg { width: 13px; height: 13px; vertical-align: -2px; }

/* ── Print (design system: the dashboard prints as a paper report) ───────── */
@media print {
    html:root {
        --bg: #ffffff; --surface: #ffffff; --surface-2: #f4f6f8;
        --text: #111827; --text-2: #374151; --text-3: #6b7280;
        --border: #d1d5db; --border-sub: #e5e7eb; --stripe-bg: rgba(0,0,0,0.03);
        --chart-axis: rgba(0,0,0,0.35); --chart-grid: rgba(0,0,0,0.10);
    }
    body { background: #fff !important; color: var(--text); }
    header, .rail-backdrop, .stale-banner, .degraded-banner, .info-banner,
    .bulk-bar, .toast-container, .header-panel, .shortcuts-modal,
    #deviceDrawer, .list-subtabs, .detail-panel, .filters-toolbar, .cb-col,
    .drawer-copy-btn, .tab-btn, .conflict-modal, .cmdk-hint { display: none !important; }
    .tabs-shell, .filters-layout, .filters-main {
        margin: 0 !important; padding: 0 !important; max-width: none !important; display: block !important;
    }
    /* Scroll containers become plain flow; sticky cells go static so the
       page breaks naturally instead of clipping the hostname column. */
    .tbl-wrap, .filters-table-wrap, .stock-table-wrap, .sec-table-wrap, .osv-table-wrap {
        overflow: visible !important; max-height: none !important; height: auto !important;
    }
    th, td { position: static !important; }
    table { font-size: 10px; border-collapse: collapse; width: 100%; }
    th, td { padding: 3px 6px !important; border-bottom: 1px solid var(--border-sub); }
    thead { display: table-header-group; }
    tr, .kpi-card, .panel { break-inside: avoid; }
    a { color: inherit; text-decoration: none; }
    canvas { max-width: 100% !important; }
    body::after {
        content: "Armory · printed " attr(data-print-date);
        display: block; margin-top: 16px; padding-top: 6px;
        border-top: 1px solid var(--border); font-size: 9px; color: var(--text-3);
        font-family: 'JetBrains Mono', ui-monospace, monospace;
    }
}
