/* ============================================================
   CBG ATM Manager — operator console redesign
   Archetype: dense dashboard (data-first operator tool)
   ============================================================ */

/* ---- 1. Token spine (primitive -> semantic) ---- */
:root {
    color-scheme: dark;

    /* Surfaces (elevation via tint, not just shadow) */
    --bg: #0b0f19;
    --surface-1: #10141f;              /* sidebar / header */
    --surface-2: #141926;              /* cards */
    --surface-3: #1a2131;              /* hover / elevated */
    --card: var(--surface-2);

    /* Borders */
    --border: #232b3d;
    --border-strong: #2f3951;

    /* Text */
    --text: #e8ecf5;
    --text-2: #b3bdce;
    --muted: #8691a8;

    /* Brand accent (single, refined blue — banking is convention) */
    --accent: #4f8cff;
    --accent-strong: #6ea0ff;
    --on-accent: #0a1428;
    --accent-weak: rgba(79, 140, 255, 0.13);

    /* Semantic status — subdued OKLCH-ish, low chroma (operator glare-free) */
    --ok: #4cc98c;
    --ok-weak: rgba(76, 201, 140, 0.14);
    --warn: #e3a94c;
    --warn-weak: rgba(227, 169, 76, 0.14);
    --bad: #ec6a76;
    --bad-weak: rgba(236, 106, 118, 0.14);
    --bad-btn: #c23b4c;              /* filled button bg: passes AA on white (4.6:1) */
    --info: #5bb2ea;
    --info-weak: rgba(91, 178, 234, 0.14);

    /* Type */
    --font-ui: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace;

    /* Spacing (4/8 grid) */
    --sp1: 4px; --sp2: 8px; --sp3: 12px; --sp4: 16px; --sp5: 24px; --sp6: 32px;

    /* Radius */
    --r-sm: 6px; --r-md: 8px; --r-lg: 12px;

    /* Shadows (layered) */
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.25);
    --shadow-2: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ---- 2. App shell (sidebar + main column) ---- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky; top: 0;
    display: flex; flex-direction: column;
    width: 232px; flex: 0 0 232px;
    height: 100vh;
    background: var(--surface-1);
    border-right: 1px solid var(--border);
    padding: var(--sp3) var(--sp2);
    gap: var(--sp4);
    overscroll-behavior: contain;
}

.brand {
    display: flex; align-items: center; gap: var(--sp2);
    padding: var(--sp1) var(--sp2);
}
.brand-mark {
    width: 34px; height: 34px;
    flex: 0 0 auto;
    border-radius: var(--r-sm);
    object-fit: contain;
    background: var(--surface-3);
    padding: 3px;
    box-shadow: var(--shadow-1);
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }

/* Sidebar nav */
.topnav { display: flex; flex-direction: column; gap: 2px; }
.topnav a {
    display: flex; align-items: center; gap: var(--sp3);
    padding: var(--sp2) var(--sp3);
    border-radius: var(--r-md);
    color: var(--muted);
    text-decoration: none;
    font-size: 13px; font-weight: 500;
    border-left: 2px solid transparent;
    transition: background-color 100ms ease, color 100ms ease, border-color 100ms ease;
}
.topnav a svg { width: 18px; height: 18px; flex: 0 0 auto; }
.topnav a:hover { background: var(--surface-3); color: var(--text-2); }
.topnav a.active {
    background: var(--accent-weak);
    color: var(--text);
    border-left-color: var(--accent);
}
.topnav a.active svg { color: var(--accent-strong); }
#topnav-admin { color: var(--warn); }
#topnav-admin.active { color: var(--warn); border-left-color: var(--warn); background: var(--warn-weak); }

.sidebar-foot {
    margin-top: auto;
    padding: var(--sp2) var(--sp3);
    font-size: 12px;
    border-top: 1px solid var(--border);
}
.conn-indicator { display: inline-flex; align-items: center; gap: var(--sp1); }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-weak); }

/* Main column */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: var(--sp4);
    padding: var(--sp2) var(--sp5);
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    height: 52px;
}
.topbar h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.topbar-meta { margin-left: auto; font-size: 12px; display: flex; align-items: center; gap: var(--sp2); }

main {
    padding: var(--sp5);
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    flex: 1;
}
/* events view requests extra width (added via main.js on main-col) */
.main-col.wide main { max-width: 1600px; }

/* ---- Bottom nav (phones/tablets) ---- */
.bottomnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    display: none;
    background: var(--surface-1);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 0 8px;
    color: var(--muted); text-decoration: none; font-size: 11px;
}
.bottomnav a svg { width: 22px; height: 22px; }
.bottomnav a.active { color: var(--accent-strong); }
.bottomnav a:active { opacity: 0.7; }

@media (min-width: 980px) {
    .bottomnav { display: none; }
}
@media (max-width: 979px) {
    .sidebar { display: none; }
    .app { display: block; }
    .topbar h1 { font-size: 14px; }
    main { padding: var(--sp3) var(--sp3) calc(96px + env(safe-area-inset-bottom)); }
    .bottomnav { display: flex; }
}

/* ---- Responsive table width helpers ---- */
@media (min-width: 1000px) {
    .main-col.wide main { max-width: 1600px; }
}

/* ---- Typography base ---- */
h2 { font-size: 16px; font-weight: 600; margin: 0 0 var(--sp2); letter-spacing: -0.01em; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); font-size: 12px; }
code {
    font-family: var(--font-mono); font-size: 0.92em;
    background: var(--surface-3); border: 1px solid var(--border);
    border-radius: 4px; padding: 0.1em 0.35em;
}
a { color: var(--accent-strong); }

/* Real SVG icons are used in nav; emoji/unicode glyphs remain only as tiny CTAs */

/* ---- Cards ---- */
.card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp3) var(--sp4);
    margin-bottom: var(--sp3);
    box-shadow: var(--shadow-1);
    overflow-x: auto;
}
.card.static { cursor: default; }
.card.clickable, .card:not(.static) { cursor: pointer; }
.card:not(.static):hover,
.card.clickable:hover { background: var(--surface-3); }
.card:not(.static):hover { border-color: var(--border-strong); }
.card.static:hover { background: var(--surface-3); }

/* ---- Layout rows ---- */
.row { display: flex; align-items: center; gap: var(--sp2); flex-wrap: wrap; }
.row .grow, .grow { flex: 1; }

/* ---- Pills (status tags) ---- */
.pill {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 500; line-height: 1;
    padding: 0.32em 0.6em;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-2);
    background: var(--surface-3);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.pill.ok  { color: var(--ok);  background: var(--ok-weak);  border-color: transparent; }
.pill.warn{ color: var(--warn); background: var(--warn-weak);border-color: transparent; }
.pill.bad { color: var(--bad); background: var(--bad-weak); border-color: transparent; }
.pill.info{ color: var(--info); background: var(--info-weak);border-color: transparent; }

/* ---- Filter chips (removable outline style) ---- */
.chip {
    font-size: 12px; font-weight: 500;
    padding: 0.3em 0.7em;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 100ms ease, color 100ms ease, border-color 100ms ease;
}
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip.off { opacity: 0.35; border-style: dashed; text-decoration: line-through; }

/* Filter chip groups: Types and Results on separate lines for clear separation */
.chip-group {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin-bottom: 6px;
}
.chip-label {
    color: var(--muted); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    min-width: 52px;
}
/* date-range filter labels (flat tables) */
.fd-label {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--muted); font-size: 12px; margin: 0;
}
.fd-label input[type="date"], .fd-label input[type="datetime-local"] { width: auto; padding: 3px 7px; }

/* ---- Event groups (collapsible) ---- */
.event-group .group-head { cursor: pointer; color: var(--text); }
.event-group .group-head:hover { color: var(--accent-strong); }
.event-group .chev { transition: transform 150ms ease; color: var(--muted); font-size: 11px; }
.event-group .group-head.collapsed .chev { transform: rotate(-90deg); }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left; vertical-align: top;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
th {
    color: var(--muted);
    font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-strong);
    padding-top: 0.4rem; padding-bottom: 0.4rem;
    white-space: nowrap;
}
tbody tr:hover { background: var(--surface-3); }
tr.active-row td { background: var(--accent-weak); }
tr.active-row td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
td .pill { white-space: nowrap; }

/* sticky table header (data surface) — activates inside a scroll container */
.table-scroll { max-height: 70vh; overflow: auto; border-radius: var(--r-md); scrollbar-gutter: stable; }
.table-scroll th { position: sticky; top: 0; background: var(--surface-2); z-index: 5; }
/* numeric + mono cell helpers */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; }

/* status dot (connectivity, one per row — no pill flood) */
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.dot.ok   { background: var(--ok);   box-shadow: 0 0 0 2px var(--ok-weak); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 2px var(--warn-weak); }
.dot.bad  { background: var(--bad);  box-shadow: 0 0 0 2px var(--bad-weak); }
.dot.info { background: var(--info); box-shadow: 0 0 0 2px var(--info-weak); }

/* plain semantic event-type label (severity shown once, on the result pill) */
.event-type { font-weight: 600; font-size: 12px; }
.event-type.ok   { color: var(--ok); }
.event-type.warn { color: var(--warn); }
.event-type.bad  { color: var(--bad); }
.event-type.info { color: var(--info); }

/* events table */
.events-table td { vertical-align: top; }
.ev-details { min-width: 240px; }
.ev-details > div:first-child { margin-bottom: 4px; }
.ev-details .ev-line { font-size: 12px; color: var(--muted); line-height: 1.4; margin-bottom: 2px; max-width: 340px; }
.events-table td.result-cell { max-width: 150px; }
.events-table td.result-cell .pill {
    white-space: nowrap; display: inline-block; max-width: 140px;
    overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
td .pill { white-space: normal; }

/* ---- ATM grid ---- */
.atm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--sp3);
}
.atm-card {
    position: relative;
    margin: 0;
    padding: var(--sp2) var(--sp3) var(--sp3);
    border-left: 3px solid var(--border);
    overflow: hidden;
}
/* ATM cards are real links (a11y floor): de-inline the anchor, keep colour/text inherited */
a.card.atm-card, a.card {
    display: block; text-decoration: none; color: inherit;
}
a.card.atm-card:hover { border-color: var(--border-strong); border-left-color: var(--border); transform: none; }
a.card.atm-card:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.atm-card .dot { width: 8px; height: 8px; }
.atm-card:hover { border-color: var(--border-strong); border-left-color: var(--border); transform: none; }
/* status signature: offline / error cards get a coloured leading bar */
.atm-card:has(.pill.bad)   { border-left-color: var(--bad); }
.atm-card:has(.pill.warn)  { border-left-color: var(--warn); }
.atm-card .tid { font-family: var(--font-mono); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.atm-card .loc { font-size: 12px; color: var(--muted); margin-top: 1px; }
.atm-card .meta { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.atm-card .pill { font-size: 10px; padding: 0.28em 0.5em; }

/* ---- Fleet summary strip (Home) ---- */
.fleet-summary {
    display: flex; flex-wrap: wrap; gap: var(--sp4);
    align-items: center;
    padding: var(--sp3) var(--sp4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-1);
    margin-bottom: var(--sp4);
    font-size: 13px;
}
.fleet-summary .fs-stat { display: inline-flex; align-items: center; gap: var(--sp2); }
.fleet-summary .fs-stat b { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-weight: 600; }
.fleet-summary .fs-total b { font-size: 15px; }
.fleet-summary .fs-sep { color: var(--border-strong); }
.fleet-summary .fs-label { color: var(--muted); }

/* ---- Key/value grid (ATM detail header) ---- */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: var(--sp3) var(--sp5);
    margin-top: var(--sp4); padding-top: var(--sp4);
    border-top: 1px solid var(--border);
}
.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv .k {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--muted); white-space: nowrap;
}
.kv .v { font-size: 13px; word-break: break-word; font-variant-numeric: tabular-nums; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--accent); color: var(--on-accent);
    border: 1px solid transparent; border-radius: var(--r-sm);
    padding: 0.42rem 0.95rem;
    font-size: 13px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: background-color 100ms ease, border-color 100ms ease, opacity 100ms ease;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.secondary { background: transparent; color: var(--text-2); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-3); color: var(--text); }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text-2); }
.btn.danger { background: var(--bad-btn); color: #fff; }
.btn.danger:hover { background: #b23545; }
.btn.small { padding: 0.3rem 0.6rem; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- Forms ---- */
input, select {
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: var(--r-sm);
    padding: 0.45rem 0.7rem;
    font-size: 13px;
    font-family: var(--font-ui);
}
input:focus, select:focus, .btn:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
input::placeholder { color: var(--muted); }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1); opacity: 0.8; cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
label { display: block; font-size: 12px; color: var(--muted); margin: var(--sp4) 0 5px; font-weight: 500; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp3) var(--sp4); }

/* check list */
.checks { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; }
.checks label {
    display: flex; align-items: center; gap: var(--sp2);
    color: var(--text-2); font-size: 13px; margin: 0;
    padding: 5px var(--sp2);
    border-radius: var(--r-sm);
    cursor: pointer;
}
.checks label:hover { background: var(--surface-3); }
.checks input { width: auto; }

/* ---- Toast ---- */
.toast {
    position: fixed; bottom: var(--sp5); left: 50%;
    transform: translateX(-50%);
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-2);
    color: var(--text);
    padding: 0.6rem 1.1rem;
    border-radius: var(--r-md);
    z-index: 50;
    max-width: 90vw;
    font-size: 13px;
}

/* ---- Journal lines ---- */
.journal-line {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--border);
    white-space: pre-wrap;
}
.journal-date { color: var(--muted); }

/* ---- Pagination ---- */
.pager { margin-top: var(--sp4); justify-content: center; }
.pager .muted { margin: 0 var(--sp2); }

/* ---- Pill links (ATM tid links) ---- */
.pill-link { text-decoration: none; }
.pill-link .pill { color: var(--text); font-size: 12px; }
.pill-link:hover .pill { border-color: var(--text); }

/* ---- Banners ---- */
.banner {
    padding: 0.55rem 0.9rem;
    border-radius: var(--r-md);
    margin-bottom: var(--sp4);
    font-size: 13px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}
.banner.error { background: var(--bad-weak); border-color: rgba(236, 106, 118, 0.35); }
.banner.info  { background: var(--info-weak); border-color: rgba(91, 178, 234, 0.3); }

.spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.7s linear infinite;
    vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(5, 8, 14, 0.7);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    padding: var(--sp4);
}
.modal {
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    width: 100%; max-width: 880px; max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-2);
}
.modal-header {
    display: flex; align-items: center; gap: var(--sp2);
    padding: var(--sp2) var(--sp4);
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 14px; word-break: break-all; }
.modal-header [data-close] { margin-left: auto; }
.modal-body { padding: var(--sp3) var(--sp4); overflow-y: auto; }

/* collapsible filter form */
details.filter-details summary {
    cursor: pointer; font-weight: 600; font-size: 13px; color: var(--accent-strong);
    user-select: none; margin-bottom: var(--sp1);
}
details.filter-details[open] summary { margin-bottom: var(--sp3); }

/* ---- Notifications list (dense rows: chip + state delta + time) ---- */
.notif-list { display: flex; flex-direction: column; gap: var(--sp1); }
.notif-item {
    display: flex; align-items: center; gap: var(--sp3);
    flex-wrap: wrap;
    padding: 6px var(--sp3);
    margin: 0; min-height: 36px;
}
.notif-item .notif-state {
    display: inline-flex; align-items: center; gap: var(--sp2);
    flex: 1; min-width: 180px;
    font-size: 13px;
}
.notif-item .meta { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- Off-screen report (PDF/image export — stays light, unaffected) ---- */
.tx-report {
    position: fixed; left: -10000px; top: 0; z-index: -1;
    width: 760px; background: #ffffff; color: #1e293b;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    padding: 28px 32px;
}
.tx-report h2 { margin: 0 0 4px; font-size: 20px; color: #1e293b; }
.tx-report h3 { margin: 20px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: #475569; }
.tx-report .r-sub { color: #64748b; font-size: 12px; margin-bottom: 8px; }
.tx-report .r-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tx-report .r-table th, .tx-report .r-table td {
    border: 1px solid #cbd5e1; padding: 5px 9px; text-align: left; color: #1e293b;
}
.tx-report .r-table th { width: 150px; background: #f1f5f9; font-weight: 600; }
.tx-report .r-journal { font-family: var(--font-mono); font-size: 11px; }
.tx-report .r-line { padding: 3px 6px; border-bottom: 1px solid #e2e8f0; white-space: pre-wrap; word-break: break-word; }
.tx-report .r-date { color: #64748b; }

/* ---- Scrollbars (thin, unobtrusive) ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c3550; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4566; }

/* ---- Keyboard layer (⌘K palette, J/K row nav, inline hints) ---- */
kbd {
    font-family: var(--font-mono); font-size: 10px; line-height: 1;
    background: var(--surface-3); border: 1px solid var(--border-strong); border-bottom-width: 2px;
    border-radius: 4px; padding: 2px 5px; color: var(--text-2);
}
.kbd-hint {
    display: inline-flex; align-items: center; gap: 5px;
    background: transparent; border: 1px solid var(--border); border-radius: var(--r-sm);
    padding: 4px 8px; font-size: 11px; color: var(--muted);
    cursor: pointer; font-family: var(--font-ui);
}
.kbd-hint:hover { background: var(--surface-3); color: var(--text-2); }
.kbd-hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 979px) { .kbd-hint { display: none; } }

tr.kbd-focus td { background: var(--accent-weak); }
tr.kbd-focus td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.notif-item.kbd-focus { background: var(--surface-3); border-color: var(--border-strong); }
.atm-card.kbd-focus { border-color: var(--accent); background: var(--surface-3); }

/* command palette */
.palette-overlay {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(5, 8, 14, 0.6); backdrop-filter: blur(2px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 12vh 16px 16px;
}
.palette {
    width: 100%; max-width: 560px;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden;
}
.palette input {
    width: 100%; border: 0; border-bottom: 1px solid var(--border);
    border-radius: 0; padding: 13px 15px; font-size: 15px;
    background: var(--surface-2); color: var(--text);
}
.palette input:focus { outline: none; }
.palette-list { max-height: 48vh; overflow: auto; padding: 6px; }
.palette-item {
    display: flex; align-items: center; gap: var(--sp3);
    padding: 8px 10px; border-radius: var(--r-sm);
    cursor: pointer; font-size: 13px;
}
.palette-item.sel { background: var(--accent-weak); box-shadow: inset 2px 0 0 var(--accent); }
.palette-item .pi-sub {
    color: var(--muted); font-size: 12px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px;
}
.palette-item .pi-kind {
    margin-left: auto; font-size: 10px; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--muted);
}
.palette-empty { padding: 12px 10px; }
.palette-foot {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-top: 1px solid var(--border); font-size: 11px;
}
.palette-foot .pf-sep { margin-right: var(--sp2); }

/* ---- Motion: micro only; honour reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}