/* ── 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. */

@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;
}

/* Tokens live in static/css/tokens/ (scale, primitives, one file per theme). */

* { 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: var(--on-accent);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    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);
}

.pulse-panel {
    display: none;
    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-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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    font-weight: 500;
    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: var(--radius-xs);
    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-12);
    font-weight: 500;
    color: var(--text-3);
    margin-bottom: 8px;
}

.pulse-row {
    font-variant-numeric: tabular-nums;
    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 {
    /* G4: a fill inside the panel, not a second frame. */
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    font-weight: 600;
    color: var(--text);
}

.pulse-src-count {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    color: var(--text-2);
}

.pulse-src-time {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    color: var(--text-3);
}

.settings-menu {
    display: none;
    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-section { display: grid; gap: var(--sp-2); }
/* G4: spacing separates the sections (the divider lines are gone). */
.settings-section + .settings-section { margin-top: var(--sp-5); }

.settings-title {
    font-size: var(--fs-12);
    font-weight: 500;
    color: var(--text-3);
}

.settings-row {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-13);
    color: var(--text-2);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
}

.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: var(--radius-pill);
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    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 {
    justify-self: start;
    margin-top: 2px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: var(--fs-13);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

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

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

/* ── 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: var(--radius-md) var(--radius-md) 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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    font-weight: 500;
    color: var(--text-3);
    margin-bottom: 6px;
}

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

.s-total    .stat-val { color: var(--text); }
.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-variant-numeric: tabular-nums;
    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 var(--radius-md) var(--radius-md);
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    font-weight: 500;
    color: var(--text-3);
}

.src-count {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-20);
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.src-badge {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    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); }

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

.f-select {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-13);
    padding: 8px 12px;
    outline: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    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-variant-numeric: tabular-nums;
    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: var(--radius-sm);
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    font-weight: 500;
    color: var(--text-3);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    background: var(--surface-2);
}

/* G4: no vertical gridlines; rows separate with a hairline. */
th:last-child { 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: the icon set's chevron (G11). */
.sort-arr { font-size: 0; margin-left: 3px; }
.sort-arr::after {
    content: '';
    display: inline-block;
    width: 10px; height: 10px;
    vertical-align: -1px;
    background: var(--icon-select-chevron) center / 10px 10px no-repeat;
    opacity: 0;
    transition: opacity var(--dur-fast), transform var(--dur-fast);
}
th[data-sort]:hover .sort-arr::after { opacity: 0.6; }
th.sorted .sort-arr::after { opacity: 1; }
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(--hover) !important; }

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);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

td:last-child { 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;
}

/* Hostname is an identifier: mono (revamp G3). */
td.c-hostname {
    font-family: var(--mono);
    font-size: var(--fs-13);
    color: var(--text);
    font-weight: 500;
}

/* 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-variant-numeric: tabular-nums;
    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;
}

/* Stale row */
/* A stale row reads muted through its text colour, not opacity: opacity
   also faded its status pills below 4.5:1 (axe, revamp finish). */
.row-stale td { color: var(--text-3); }

/* 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-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    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); }

/* Issues — truncated with expand */
/* Writeback feedback */
.wb-ok  { color: var(--success); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
.wb-err { color: var(--error);   font-size: var(--fs-12); font-variant-numeric: tabular-nums; white-space: normal; }

/* ── 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: var(--radius-sm);
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    cursor: pointer;
    transition: background var(--dur-med), color var(--dur-med), border-color var(--dur-med);
}

.sync-cancel-btn:hover {
    background: var(--error);
    color: var(--surface);
    border-color: var(--error);
}

.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-variant-numeric: tabular-nums;
    font-size: var(--fs-13);
    color: var(--text-2);
}

.load-sub {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    color: var(--text-3);
}

.sync-status-list {
    width: 100%;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    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 {
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    color: var(--text-2);
    background: transparent;
    border: 1px solid var(--border);
    padding: 7px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    color: var(--surface);
    background: var(--error);
    border: none;
    padding: 7px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    color: var(--warn);
    background: transparent;
    border: 1px solid var(--warn-dim);
    padding: 7px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    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-variant-numeric: tabular-nums;
    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;
}

/* ── BUTTONS ─────────────────────────────────────────
   One base for every .btn (Assets, Costs, Settings, login), 2026-10-03.
   Before this, .btn was only styled inside the Assets tab and rendered as a
   native browser control everywhere else. Variants: .btn-primary,
   .btn-danger; size: .btn-sm. Specific classes later in this file
   (.login-primary, .costs-action-btn) still refine it. */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-size: var(--fs-13); font-weight: 500; line-height: 1.2;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-1);
    min-height: 32px; padding: 6px 12px; cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.btn:hover { background: var(--hover); color: var(--text); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--btn-accent-text); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); color: var(--btn-accent-text); border-color: var(--accent-hover); }
.btn-danger { color: var(--error); background: var(--error-dim); border-color: color-mix(in srgb, var(--error) 40%, transparent); }
.btn-danger:hover { color: var(--error); border-color: var(--error); background: var(--error-dim); }
.btn-sm { font-size: var(--fs-12); min-height: 28px; padding: 3px 10px; }

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

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

/* Filter description bar */

/* 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: var(--radius-sm);
    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); }
#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-variant-numeric: tabular-nums; font-size: var(--fs-16); font-weight: 500;
color: var(--text); text-align: center;
}
.login-sub {
    font-variant-numeric: tabular-nums; font-size: var(--fs-12);color: var(--text-3); text-align: center;
}
.login-card {
    border: 1px solid var(--border-sub); border-radius: var(--radius-md);
    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: var(--radius-sm); 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-variant-numeric: tabular-nums; font-size: var(--fs-12);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-variant-numeric: tabular-nums;
    font-size: var(--fs-11); color: var(--text-3);
}
#loginSubmitBtn {
    background: var(--accent);
    color: var(--btn-accent-text);
    border: none; border-radius: var(--radius-xs);
    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: var(--radius-sm) var(--radius-sm) 0 0; border-bottom: none;
    color: var(--text-3); font-variant-numeric: tabular-nums; font-size: var(--fs-12);
    padding: 5px 12px; cursor: pointer;    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-11); 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: var(--radius-sm); 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; }

/* ── PANELS (the shell's padding lives in css/components/shell.css) ── */

.tab-panel { display: none; }
/* DESIGN.md §8: no entrance animation on data; a page simply appears. */
.tab-panel.active { display: block; }

/* P1: popovers and menus scale from their origin (transform + opacity). */
@keyframes panel-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}
@keyframes pop-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: none; }
}

/* ── MODE SUB-TABS (Insights / Operations) ──────────── */
.mode-subpanel { display: none; }
.mode-subpanel.active { display: block; }

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

/* Briefing bar — the page hero: first thing anyone reads after a sync. */


/* 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; }


/* X4/G6: a shape per severity next to the label, not a coloured slab:
   dash = broken (red), diamond = needs action (orange), ring = info. */


.panel-card {
    /* G4/G5: one surface, one hairline, the first elevation step. */
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
    padding: var(--sp-4);
}


/* Breakdown toggle: the shared segmented control (tabs.css). */
.donut-tab-bar { margin-bottom: var(--sp-2); }

.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-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    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;
}
/* The share of affected laptops: the shared progress bar, thinner here. */
.issue-body .kpi-bar { height: 3px; margin-top: 3px; }

.issue-count {
    font-variant-numeric: tabular-nums;
    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-size: var(--fs-13);
    font-weight: 500;
    color: var(--text-2);
}

/* G1: a KPI number never outshouts the page title. */
.kpi-val {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-kpi);
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin-top: 4px;
    color: var(--text);
}

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


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

.card-title {
    font-size: var(--fs-14);
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--sp-3);
}

.chart-canvas {
    /* G4: no frame inside the card frame. */
    width: 100%;
    height: 190px;
}

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


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


/* ── 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: var(--radius-md);
    padding: 14px;
    flex-shrink: 0;
}

.custom-results-panel {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-md);
    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;
}

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

.advanced-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 10px 12px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    color: var(--text-3);
}

.btn-muted {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    color: var(--text-2);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    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: components/insights.css ────────────────── */

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


.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: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    font-variant-numeric: tabular-nums;
    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: var(--radius-sm);
}


.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: var(--radius-pill);
    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;
}


/* ── End Stock tab (layout: components/operate.css) ──────────── */


/* ── Security tab (layout: components/insights.css) ───────────── */
/* Source tabs: the cards are the selector — the active one is outlined. */
.page-meta-num { color: var(--text); font-weight: 600; }


.list-search { max-width: 260px; min-width: 160px; }
.list-search[hidden] { display: none; }


.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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    color: var(--text-3);
    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;
    width: 10px;
    height: 10px;
    vertical-align: -1px;
    margin-left: 4px;
    background: var(--icon-select-chevron) center / 10px 10px no-repeat;
    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); }

/* ── End Security ─────────────────────────────────────────────── */

@media (max-width: 1200px) {
    .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) {
    .custom-controls,
    .advanced-grid {
        grid-template-columns: 1fr;
    }
}

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

/* Tablet (≤900px). */

/* Small tablet / large phone (≤768px): compact header, scrollable table. */
@media (max-width: 768px) {
    .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 560px; }
    .chart-card  { grid-column: span 12; }
}

/* Phone (≤480px): hide non-essential header elements, single-column everything. */
@media (max-width: 480px) {
    /* M1: the sync ring and its numbers stack instead of pushing the page
       past the viewport (431px at 390 before). */
}

/* ── DENSITY TOGGLE ──────────────────────────────────────── */

.btn-report {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    color: var(--text-3);
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 10px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    color: var(--text-3);
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 10px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    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); }

.btn-generate-report {
    /* Same look as the shared .btn (one button style, 2026-10-03). */
    font-size: var(--fs-13);
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-1);
    min-height: 32px;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--dur-med);
}
.btn-generate-report:hover { background: var(--hover); }
.btn-md-report { margin-left: 0; }

/* ── COLUMN PICKER ───────────────────────────────────────── */
.col-picker-wrap { position: relative; flex-shrink: 0; }

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

.col-pick-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 6px 8px;
    cursor: pointer;
    border-radius: var(--radius-xs);
    font-variant-numeric: tabular-nums;
    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) ─────────────────────── */
/* ── 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: var(--scrim);
    opacity: 0;
    transition: opacity var(--dur-enter) var(--ease-out);
}
#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 var(--dur-enter) var(--ease-out);
    display: flex; flex-direction: column;
    overflow: hidden;
}
/* The shadow only when open: off screen it bled a grey band into every page's right edge. */
#deviceDrawer.open #drawerPanel { transform: translateX(0); box-shadow: var(--shadow-3); }

#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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    font-weight: 500;
    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(--text);
}
.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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    font-weight: 500;
    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: header actions (Copy button) ─────────────────────── */
.drawer-actions { display: flex; gap: 6px; align-items: center; }
/* ── 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: var(--overlay-bg);
    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: var(--radius-lg);
    background: linear-gradient(165deg, var(--surface) 0%, var(--surface-2) 100%);
    box-shadow: var(--shadow-3);
}

.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: var(--radius-md);
    background: var(--surface-2);
}

.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-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    font-weight: 500;
    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: var(--surface-2);
}

.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-variant-numeric: tabular-nums;
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    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. */

/* 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-12);
    font-weight: 500;
    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-12);
    font-weight: 500;
    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: var(--radius-sm);
    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 {
    /* A button (keyboard-operable, DESIGN.md §7) that reads as the row's text. */
    flex: 1;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
    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: var(--radius-xs);
    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-strong);
    color: var(--text);
    border-radius: var(--radius-xs);
    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: var(--radius-sm);
    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;
}
.btn-toolbar:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-toolbar:disabled:hover { border-color: var(--border); color: var(--text-2); }


.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: var(--radius-pill);
    font-size: var(--fs-12);
    color: var(--accent-text);
    white-space: nowrap;
}
.pill-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent-text);
    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 {
    /* The shared button at toolbar size. */
    flex-shrink: 0;
    min-height: 30px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-13);
    font-weight: 500;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background var(--dur-fast);
}
.btn-toolbar:hover { background: var(--hover); }
.btn-toolbar:disabled { opacity: 0.45; cursor: not-allowed; }
/* override old rule that targets #filterDescription as block element */


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;
}
/* P1: the palette fades in and scales from 98%. */
.command-palette-modal.visible .palette-container { animation: dialog-in var(--dur-enter) var(--ease-out); }
.command-palette-modal.visible .palette-backdrop { animation: fade-in var(--dur-enter) var(--ease-out); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

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

.palette-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-3);
    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: var(--radius-xs);
    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-12);
    color: var(--text-3);
    font-weight: 500;
    flex-shrink: 0;
}

.palette-section-label {
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-12);
    font-weight: 500;
    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-variant-numeric: tabular-nums;
    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: var(--radius-xs);
}

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


/* ═══ Design refresh · Mission Control (2026-07) ═══════════════════════════
   Typography: Inter carries the UI; mono is reserved for serials/code.
   Numbers go sans with tabular figures. Labels are sentence case
   (revamp G2, 2026-10-06). */

/* 2026-10-06 (revamp G1/G2): sentence-case sans labels, weight 500. */
.pulse-section-title, .settings-title, .drawer-section-title, .detail-cat-label, .nav-section {
    font-family: var(--sans);
    font-weight: 500;
}
table th, .sec-table th {
    font-family: var(--sans);
    font-weight: 500;
}


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


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 #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; }


/* 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-11); font-weight: 500; line-height: 1.5;
    padding: 0 5px; border-radius: var(--radius-xs); white-space: nowrap;
}
.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: var(--warn-dim); 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: var(--radius-lg);
    padding: 3px 10px; flex-shrink: 0;
}
.tag-filter-chip[hidden] { display: none; }
.tag-filter-chip button { display: inline-grid; place-items: center; background: none; border: none; color: inherit; cursor: pointer; line-height: 1; padding: 0; }

/* ── Offboarding checklist (persistent, audited) ─────────────────────────── */
.checklist-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.checklist-progress .kpi-bar { flex: 1; margin-top: 0; }
.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-12);    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-11); 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);
}
/* ── Department compliance bars (item 19) ────────────────────────────────── */
.compliance-pct {
 font-size: var(--fs-12); color: var(--text-2);
    min-width: 42px; text-align: right; font-variant-numeric: tabular-nums;
}

.negotiation-head { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: 14px; }
.neg-chip {
    font-size: var(--fs-12); padding: 3px 10px; border-radius: var(--radius-pill);
    background: var(--sunken); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border);
}
.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: var(--radius-xs); color: var(--text); word-break: break-all;
}

/* ── Header panels: notifications bell, saved views (items 30, 32) ───────── */
.header-panel {
    position: absolute; top: 46px; right: 12px; z-index: var(--z-menu);
    width: 340px; max-height: 60vh; overflow-y: auto;
    background: var(--surface); border: 0;
    border-radius: var(--radius-md); box-shadow: var(--shadow-2), inset 0 0 0 1px var(--border);
    animation: menu-in var(--dur-enter) var(--ease-out);
}
.header-panel-title {
    padding: 12px 14px 8px; font-size: var(--fs-12); font-weight: 500;
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: var(--radius-sm); 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-11); 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: var(--radius-sm); color: var(--text);
}
.saved-view-apply:hover { background: var(--surface-2); }
/* A token row reads like a saved view but is not a button. */
.saved-view-apply.is-static { cursor: default; }
.saved-view-apply.is-static:hover { background: transparent; }
.saved-view-name { font-size: var(--fs-12); font-weight: 600; }
.saved-view-desc { font-size: var(--fs-11); color: var(--text-3); font-variant-numeric: tabular-nums; }
.saved-view-delete { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: var(--fs-11); padding: 0 8px; border-radius: var(--radius-sm); }
.saved-view-delete:hover { color: var(--error); background: var(--surface-2); }

/* ── API token reveal (item 33) ──────────────────────────────────────────── */
.token-reveal { margin-top: 8px; padding: 9px 10px; border-radius: var(--radius-sm);
    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; }
.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-11); word-break: break-all;
    background: var(--surface-2); padding: 6px 8px; border-radius: var(--radius-xs); }

/* ═══ 2026-08 polish pass ══════════════════════════════════════════════════ */
.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-12); color: var(--text-3); text-align: right; }
#apiTokensSection { margin-top: 4px; }

/* ── Sync overlay: make "keep browsing" discoverable ─────────────────────── */
.sync-bg-btn {
    padding: 6px 16px;
    /* It sits on the scrim, not on the card: a transparent background with
       muted text vanished on the light theme's grey scrim (QA 2026-10-07). */
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    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;
}

@media (max-width: 900px) {
    .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); }
/* G7: Customize is a page action: it sits on the page header's row
   (right-aligned) instead of floating on a row of its own. */
@media (min-width: 901px) {
    .tabs-shell { position: relative; }
}

/* ── 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-enter) var(--ease-out);
}
.shortcuts-title {
    font-size: var(--fs-12);
    font-weight: 500;
    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-variant-numeric: tabular-nums;
    font-size: var(--fs-11);
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: var(--radius-xs);
    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-enter) var(--ease-out);
    transition: left 0.25s ease, top 0.25s ease;
}
.tour-title {
    font-size: var(--fs-12);
    font-weight: 500;
    color: var(--text-3);
    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-variant-numeric: tabular-nums; 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) ─────────────────────────────── */

/* ── Search-match highlight ──────────────────────────────────────────────── */
mark.cell-hl {
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: var(--radius-xs);
    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; }

/* ── OS end-of-life pill ─────────────────────────────────────────────────── */

/* ── Department compliance trend ─────────────────────────────────────────── */
.dept-trend {
    font-size: var(--fs-11);
    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-arrow { color: var(--text-3); }
.drift-quiet { color: var(--text-3); }
.drift-new {
    font-size: var(--fs-11);
    color: var(--text-3);
    border: 1px dashed var(--border);
    border-radius: var(--radius-pill);
    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: var(--radius-pill);
    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; }

/* ── 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: var(--radius-sm);
    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"] #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"] {
    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; }

.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-11);
    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,
body.mc .mc-sec: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: var(--radius-xs);
    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: var(--radius-xs);
    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: var(--radius-xs);
    background: linear-gradient(90deg,
        transparent 20%,
        color-mix(in srgb, var(--surface) 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); }
/* ── D8: clickable KPI affordance ────────────────────────────────────────── */
.home-clickable-card:hover {
    box-shadow: var(--shadow-2);   /* DESIGN.md §8: no hover lift */
}
.home-clickable-card::after {
    content: 'View';
    position: absolute;
    right: 12px;
    bottom: 8px;
    font-size: var(--fs-11);
    font-weight: 650;
    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: var(--shadow-2);
}
/* 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;
}

/* ── D18: 13" laptop tier (1024–1280px) ──────────────────────────────────── */
@media (min-width: 901px) and (max-width: 1280px) {
        /* 2×2 instead of 4-up */
}

/* ── 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;
}
/* 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;
}


.unpriced-chip { display: inline-block; margin: 4px 4px 0 0; font-size: var(--fs-11); padding: 2px 8px;
    border-radius: var(--radius-sm); border: 1px dashed color-mix(in srgb, var(--warn) 60%, transparent); color: var(--warn);
    background: transparent; cursor: pointer; }
.unpriced-chip:hover { border-style: solid; }
.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-variant-numeric: tabular-nums; font-size: var(--fs-11);font-weight: 600;
    padding: 3px 10px; border-radius: var(--radius-pill); color: var(--warn); border: 1px dashed var(--warn);
}

/* ── Inline SVG icons (emoji purge, design system) ───────────────────────── */
.palette-result-icon svg { width: 18px; height: 18px; display: block; }
/* ── Print (design system: the dashboard prints as a paper report) ───────── */
@media print {
    body { background: var(--bg) !important; color: var(--text); }
    .rail, .topbar, .rail-backdrop, .notice, .pulse-panel, .settings-menu,
    .bulk-bar, .toast-container, .header-panel, .shortcuts-modal,
    #deviceDrawer, #deviceDrawerHost, .list-subtabs, .detail-panel, .filters-toolbar, .cb-col,
    .tab-btn, .cmdk-hint { display: none !important; }
    .main-col, .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;
    }
}
