/* =====================================================================
   Platform UI: banners, notifications, account, support, consent and the
   admin console (layout, KPIs, charts, list views). Uses app.css tokens.
   ===================================================================== */

/* Chart palette (validated: single-series brand blue; second series green). */
:root { --c1: #2c59e8; --c2: #0b8f63; --c1-soft: rgba(44, 89, 232, .12); --heat: 44, 89, 232; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c1: #6488fa; --c2: #20a878; --c1-soft: rgba(100, 136, 250, .16); --heat: 100, 136, 250; } }
:root[data-theme="dark"] { --c1: #6488fa; --c2: #20a878; --c1-soft: rgba(100, 136, 250, .16); --heat: 100, 136, 250; }

.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); }
.nowrap { flex-wrap: nowrap; white-space: nowrap; }
.center { justify-content: center; }
.h3 { font-size: 1.08rem; font-weight: 600; }
.h4 { font-size: .95rem; font-weight: 600; margin: 0 0 8px; display: block; }
.pad-h { padding: 18px 20px 6px; margin: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; cursor: pointer; font-size: inherit; }
.linkish:hover { text-decoration: underline; }
.danger-text { color: var(--red) !important; }
.wrap.wide { max-width: 1400px; }
.label-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-2 > *, .grid-side > * { min-width: 0; }
.admin-grid { margin-bottom: 18px; align-items: start; }
.card + .card, .settings-body > .card + .card { margin-top: 0; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
h1[tabindex="-1"]:focus { outline: none; }

/* Skip link */
.skip-link { position: fixed; left: -999px; top: 8px; z-index: 200; background: var(--card); color: var(--ink); padding: 10px 14px; border-radius: 10px; box-shadow: var(--e3); }
.skip-link:focus { left: 12px; }

/* ---------- Global banners ---------- */
.banners:empty { display: none; }
.banners { position: relative; z-index: 5; margin-top: calc(var(--nav-h) + env(safe-area-inset-top)); }
body.on-home .banners, body.on-auth .banners { margin-top: 0; position: fixed; left: 0; right: 0; top: calc(var(--nav-h) + env(safe-area-inset-top)); }
.banners:not(:empty) + #view .page { padding-top: 24px; }
.gbanner { display: flex; align-items: center; gap: 10px; padding: 10px max(var(--gutter), 16px); font-size: .88rem; background: var(--brand-soft); color: var(--ink); border-bottom: 1px solid var(--line); }
.gbanner span { flex: 1; }
.gbanner a, .gbanner .linkish { font-weight: 600; white-space: nowrap; }
.gbanner.warn, .gbanner.warning { background: var(--amber-soft); }
.gbanner.success { background: var(--green-soft); }
.gbanner .icon-btn { width: 32px; height: 32px; }

/* ---------- Block screens (suspended, maintenance, error, 404) ---------- */
.block-screen { text-align: center; padding: 42px 26px; margin-top: 20px; }
.block-screen h1 { font-size: 1.7rem; }
.block-screen p { max-width: 520px; margin-left: auto; margin-right: auto; }
.bs-ic { width: 60px; height: 60px; border-radius: 18px; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 14px; }
.bs-ic.bad { background: var(--red-soft); color: var(--red); }
.bs-ic.ok { background: var(--green-soft); color: var(--green); }

/* ---------- Empty & error states ---------- */
.empty-state { text-align: center; padding: 38px 20px; }
.empty-state.compact { padding: 18px 10px; }
.empty-state h3 { margin: 10px 0 4px; }
.empty-state p { max-width: 420px; margin: 0 auto 14px; }
.es-ic { width: 52px; height: 52px; border-radius: 16px; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.es-ic.ok { background: var(--green-soft); color: var(--green); }
.err-state .es-ic { background: var(--red-soft); color: var(--red); }

/* ---------- Notifications bell ---------- */
.bell-wrap { position: relative; }
.bell-btn { position: relative; }
.bell-n { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--card); }
.bell-pop { position: absolute; right: -60px; top: calc(100% + 10px); width: min(380px, calc(100vw - 24px)); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e4); z-index: 60; overflow: hidden; animation: pop .18s var(--ease-out); }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: .92rem; }
.bell-head .linkish { font-size: .8rem; }
.bell-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.bell-list .sk-line { margin: 12px 10px; }
.bell-empty { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 24px 12px; margin: 0; }
.bell-foot { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-top: 1px solid var(--line-2); font-weight: 600; font-size: .86rem; }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; color: var(--ink); position: relative; }
.note + .note { border-top: 1px solid var(--line-2); }
.note:hover { background: var(--card-2); }
.note.unread { background: var(--brand-soft); }
.note-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); display: grid; place-items: center; flex: none; }
.note.unread .note-ic { background: var(--card); color: var(--brand); }
.note-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; font-size: .88rem; }
.note-t span { color: var(--ink-2); font-size: .84rem; overflow-wrap: anywhere; }
.note-t em { font-style: normal; color: var(--muted); font-size: .76rem; }
.note .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; margin-top: 6px; }
.notif-page { padding: 8px; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 700; margin-left: auto; }
.drawer-links .badge { margin-left: auto; }

/* ---------- Feedback button & consent ---------- */
.feedback-fab { position: fixed; right: 18px; bottom: 18px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: var(--r-pill); padding: 10px 16px; background: var(--card); color: var(--ink); box-shadow: var(--e3), inset 0 0 0 1px var(--line); cursor: pointer; font-size: .86rem; font-weight: 600; }
.feedback-fab:hover { color: var(--brand); }
body.on-auth .feedback-fab, body.intro-on .feedback-fab { display: none; }
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 90; display: flex; justify-content: center; pointer-events: none; }
.consent-in { pointer-events: auto; max-width: 860px; width: 100%; display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e4); padding: 14px 16px; animation: fadeUp .3s var(--ease-out); }
.consent-in p { margin: 0; font-size: .86rem; color: var(--ink-2); flex: 1; }
.consent-ic { color: var(--brand); flex: none; }
.consent-btns { display: flex; gap: 8px; flex: none; }

/* ---------- Auth additions ---------- */
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.google-btn { gap: 10px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--ink-2); cursor: pointer; line-height: 1.45; }
label.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
label.check.invalid { color: var(--red); }
.auth .err, form .err { color: var(--red); font-size: .8rem; }
.err:empty { display: none; }
.pw-meter { height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; margin-top: 2px; }
.pw-meter i { display: block; height: 100%; width: 0; background: var(--red); transition: width .25s var(--ease), background .25s; }
.pw-meter[data-s="1"] i { width: 25%; } .pw-meter[data-s="2"] i { width: 50%; background: var(--amber); }
.pw-meter[data-s="3"] i { width: 75%; background: var(--green); } .pw-meter[data-s="4"] i { width: 100%; background: var(--green); }
.code-input { letter-spacing: .3em; font-size: 1.2rem !important; text-align: center; font-variant-numeric: tabular-nums; }
.auth-simple { min-height: 100vh; display: grid; place-items: center; padding: calc(var(--nav-h) + 20px) var(--gutter) 40px; }
.auth-simple .auth-main { width: 100%; display: flex; justify-content: center; }
.auth-simple .auth-card { text-align: left; }
.auth-simple .auth-mobile-logo.show { display: block; margin-bottom: 18px; }
.auth-card .notice { margin-bottom: 14px; }
.auth-card .btn.block + .btn.block { margin-top: 10px; }
.center-block { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0; }
.spinner.lg { width: 34px; height: 34px; border-width: 3px; }

/* ---------- Account & settings ---------- */
.settings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--nav-h) + 20px); display: flex; flex-direction: column; gap: 2px; }
.settings-nav a, .admin-nav a, .content-pages a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2); font-size: .9rem; font-weight: 500; min-height: 42px; }
.settings-nav a:hover, .admin-nav a:hover, .content-pages a:hover { background: var(--card); color: var(--ink); }
.settings-nav a.on, .admin-nav a.on, .content-pages a.on { background: var(--card); color: var(--brand); box-shadow: var(--e2); font-weight: 600; }
.settings-body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.switch-row.disabled { opacity: .6; cursor: default; }
.switch-row .switch { border: 0; padding: 0; min-height: 0; background: none; }
.stack > .switch-row + .switch-row { margin-top: 0; }
.sessions { list-style: none; padding: 0; margin: 0; }
.sessions li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.sessions li > div { flex: 1; min-width: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.copy-row { display: flex; gap: 8px; margin: 14px 0; }
.copy-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--input); border-radius: var(--r-sm); padding: 10px 12px; }
.secret-key { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .08em; background: var(--line-2); padding: 10px 12px; border-radius: 10px; margin: 8px 0; word-break: break-all; }
.steps-list { padding-left: 1.2em; } .steps-list li { margin-bottom: 12px; }
.backup-codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.backup-codes code { display: block; text-align: center; padding: 8px; font-size: .95rem; }
.timeline li b { display: block; }
.timeline li { flex-direction: column; gap: 2px; padding-left: 22px; }
.timeline li::after { content: ''; position: absolute; left: 3px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 2px var(--brand); }

/* Support */
.support-grid { align-items: start; }
.ticket { padding: 0; margin-bottom: 12px; }
.ticket summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; list-style: none; }
.ticket summary::-webkit-details-marker { display: none; }
.ticket[open] summary { border-bottom: 1px solid var(--line-2); }
.thread { list-style: none; padding: 0 18px; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.card > .thread { padding: 0; }
.thread li { max-width: 88%; padding: 10px 14px; border-radius: 14px; background: var(--line-2); }
.thread li p { margin: 4px 0 0; font-size: .9rem; overflow-wrap: anywhere; }
.thread li.staff { background: var(--brand-soft); align-self: flex-start; }
.thread li.me { align-self: flex-end; }
.reply { display: flex; gap: 8px; padding: 0 18px 16px; align-items: flex-end; }
.reply textarea, .note-form textarea { flex: 1; border: 1px solid var(--line); background: var(--input); border-radius: var(--r-sm); padding: 10px 12px; resize: vertical; min-height: 44px; }
.stars { color: var(--amber); letter-spacing: 1px; }

/* ---------- Admin console layout ---------- */
.admin-page { padding-top: calc(var(--nav-h) + 26px); }
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.admin-nav { position: sticky; top: calc(var(--nav-h) + 20px); max-height: calc(100vh - var(--nav-h) - 40px); overflow-y: auto; scrollbar-width: thin; }
.admin-who { display: flex; align-items: center; gap: 8px; padding: 0 12px 12px; }
.an-group + .an-group { margin-top: 14px; }
.an-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; padding: 0 12px 6px; }
.admin-main { min-width: 0; }
.admin-main > .card, .admin-main > section { margin-bottom: 18px; }
.admin-head { align-items: flex-end; margin-bottom: 20px; }
.admin-head h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 4px; }
.admin-head .muted { max-width: 720px; }
.head-actions { align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 500; margin-bottom: 10px; }
.role-owner { background: var(--purple-soft); color: var(--purple); }
.role-admin { background: var(--brand-soft); color: var(--brand); }
.role-support { background: var(--sky-soft); color: var(--sky); }
.menu-wrap { position: relative; }
.menu-pop.right { right: 0; left: auto; top: calc(100% + 6px); z-index: 30; }
.admin-tabs { margin-bottom: 16px; }
.tab-panel { overflow: hidden; }
.tab-panel > .tbl-wrap, .tab-panel > p { margin: 0; }
.tab-panel > p.muted { padding: 18px 20px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: var(--r-pill); padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; min-height: 34px; border-radius: var(--r-pill); font-size: .82rem; color: var(--muted); cursor: pointer; font-weight: 500; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--e1); }
.health-strip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r); font-size: .85rem; margin-bottom: 18px; background: var(--green-soft); color: var(--ink-2); }
.health-strip.bad { background: var(--red-soft); }
.health-strip > .ic { color: var(--green); } .health-strip.bad > .ic { color: var(--red); }
.health-strip span { flex: 1; }
.health-strip a { font-weight: 600; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.sm { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 14px 0 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; position: relative; min-width: 0; }
.kpi-ic { position: absolute; top: 14px; right: 14px; color: var(--muted); opacity: .7; }
.kpi-l { color: var(--muted); font-size: .8rem; font-weight: 500; padding-right: 26px; }
.kpi-v { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
.kpi-h { color: var(--muted); font-size: .76rem; }
.kpi-d { display: inline-flex; align-items: center; gap: 2px; font-size: .78rem; font-weight: 600; }
.kpi-d.up { color: var(--green); } .kpi-d.down { color: var(--red); } .kpi-d.flat { color: var(--muted); font-weight: 500; }

/* Charts */
.chart-card .card-head { margin-bottom: 8px; }
.chart { margin: 0; outline: none; }
.chart:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; border-radius: 8px; }
.ch-plot { position: relative; margin-left: 46px; margin-top: 12px; }
.ch-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ch-grid { position: absolute; inset: 0; pointer-events: none; }
.ch-grid span { position: absolute; left: -46px; width: calc(100% + 46px); transform: translateY(-50%); font-size: .7rem; color: var(--muted); display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.ch-grid span::after { content: ''; flex: 1; border-top: 1px dashed var(--line); margin-left: 46px; position: absolute; left: 0; right: 0; }
.ch-grid span { padding-right: 0; }
.ch-area { fill: var(--c1-soft); }
.ch-line { fill: none; stroke: var(--c1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .5; pointer-events: none; }
.ch-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--c1); box-shadow: 0 0 0 2px var(--card); transform: translate(-50%, -50%); pointer-events: none; }
.ch-tip { position: absolute; transform: translate(-50%, calc(-100% - 10px)); background: var(--ink); color: var(--card); font-size: .76rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; z-index: 3; display: flex; flex-direction: column; box-shadow: var(--e3); }
.ch-tip b { font-weight: 600; }
.ch-x { position: relative; height: 22px; margin-left: 46px; margin-top: 6px; }
.ch-x span { position: absolute; transform: translateX(-50%); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.ch-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.ch-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; min-width: 0; }
.ch-bar i { display: block; width: 100%; background: var(--c1); border-radius: 4px 4px 0 0; min-height: 0; transition: opacity .15s; }
.ch-bars:hover .ch-bar i { opacity: .55; }
.ch-bars .ch-bar.on i, .ch-bars:hover .ch-bar:hover i { opacity: 1; }
.ch-table { margin-top: 10px; font-size: .82rem; }
.ch-table summary { cursor: pointer; color: var(--brand); font-weight: 500; }
.ch-table .tbl-wrap { max-height: 260px; overflow: auto; margin-top: 8px; }
.hbars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.hb-l { display: flex; justify-content: space-between; gap: 12px; font-size: .86rem; margin-bottom: 5px; }
.hb-l b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-t { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.hb-t i { display: block; height: 100%; background: var(--c1); border-radius: 0 4px 4px 0; }
.kv-inline { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: .84rem; color: var(--ink-2); margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.cohort td.heat { background: rgba(var(--heat), calc(var(--h) / 100 * .85 + .04)); color: var(--ink); font-weight: 600; }
.cohort td.heat[style*="--h:6"], .cohort td.heat[style*="--h:7"], .cohort td.heat[style*="--h:8"], .cohort td.heat[style*="--h:9"], .cohort td.heat[style*="--h:100"] { color: #fff; }
.cohort th[scope=row] { white-space: nowrap; font-weight: 500; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: .84rem; }

/* Attention & feed */
.attention { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.attention a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); color: var(--ink); }
.attention a:hover { border-color: var(--brand); }
.attention b { font-size: 1.2rem; min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.attention a > span { flex: 1; display: flex; flex-direction: column; }
.attention .tone-bad b { color: var(--red); } .attention .tone-warn b { color: var(--amber); } .attention .tone-info b { color: var(--brand); }
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: .86rem; }
.feed li:first-child { border-top: 0; }
.feed .note-ic { width: 28px; height: 28px; border-radius: 8px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.kv-grid.one { grid-template-columns: 1fr; }
.kv-grid dt { color: var(--muted); font-size: .78rem; }
.kv-grid dd { margin: 2px 0 0; font-size: .9rem; overflow-wrap: anywhere; }

/* List views */
.lv-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.lv-search { position: relative; flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; }
.lv-search .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.lv-search input { width: 100%; border: 1px solid var(--line); background: var(--input); border-radius: var(--r-pill); padding: 9px 14px 9px 38px; min-height: 42px; }
.lv-filter select, select.sm { border: 1px solid var(--line); background: var(--input); border-radius: var(--r-pill); padding: 8px 12px; min-height: 42px; font-size: .86rem; }
.lv-spacer { flex: 1; }
.lv-summary { margin-bottom: 10px; min-height: 22px; }
.count-chips { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sum-row { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline; font-size: .92rem; }
.lv-body { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.lv-body > .empty-state, .lv-body > .err-state { background: var(--card); }
.lv-loading { opacity: .55; transition: opacity .2s; pointer-events: none; }
.tbl-wrap { overflow-x: auto; }
.lv-table td, .lv-table th { padding-left: 14px; padding-right: 14px; }
.lv-row { cursor: pointer; }
.lv-row a { color: inherit; }
.lv-row td:first-child a { color: var(--ink); }
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.th-sort .ic { opacity: .35; }
.th-sort.on { color: var(--ink); }
.th-sort.on .ic { opacity: 1; }
table.tbl th.num { text-align: right; }
.lv-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 14px; }
.lv-pager:empty { display: none; }
.who-cell { display: flex; gap: 10px; align-items: center; }
.who-cell > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: .74rem; box-shadow: none; cursor: default; }
code.act { background: none; padding: 0; color: var(--ink); font-weight: 600; }
.card.pad-0 .tbl-wrap table.tbl th:first-child, .card.pad-0 .tbl-wrap table.tbl td:first-child { padding-left: 20px; }
.card.pad-0 > p.muted.small { padding: 16px 20px; margin: 0; }

/* Detail pages */
.notes { list-style: none; padding: 0; margin: 12px 0 0; }
.notes li { padding: 10px 12px; background: var(--amber-soft); border-radius: 12px; margin-bottom: 8px; }
.notes p { margin: 0 0 4px; font-size: .88rem; }
.note-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.note-form textarea { width: 100%; }
.brief { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; margin: 0; }
.brief dt { color: var(--muted); font-size: .76rem; text-transform: capitalize; }
.brief dd { margin: 2px 0 0; font-size: .88rem; white-space: pre-line; overflow-wrap: anywhere; max-height: 160px; overflow: auto; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-2); }
.files li a:first-of-type { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.icon-btn.sm { width: 32px; height: 32px; }
.err-groups { list-style: none; padding: 0; margin: 0; }
.err-groups li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line-2); }
.err-groups li b { font-weight: 500; font-size: .88rem; overflow-wrap: anywhere; }
.run-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 3px; background: var(--green); }
.run-dot.bad { background: var(--red); }
.staff-list { list-style: none; padding: 0 20px 10px; margin: 0; }
.staff-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line-2); }
.staff-list li > div { flex: 1; min-width: 180px; }
.perm-matrix th[scope=row] { text-transform: none; letter-spacing: 0; font-size: .86rem; color: var(--ink); font-weight: 500; white-space: normal; }
.perm-matrix thead th { vertical-align: bottom; white-space: normal; min-width: 120px; }
.perm-matrix .yes { color: var(--green); } .perm-matrix .no { color: var(--muted); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; cursor: pointer; padding: 16px; font: inherit; color: var(--ink); }
.card.tpl:hover { border-color: var(--brand); }
.card.tpl .ic { color: var(--brand); }
.mail-frame { width: 100%; height: min(70vh, 640px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.modal.wide { max-width: 760px; }
.card.soft { background: var(--card-2); box-shadow: none; }
.content-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.content-pages { display: flex; flex-direction: column; gap: 2px; }
.content-pages a > span { display: flex; flex-direction: column; }
.cl-item { margin-bottom: 12px; }
.keys-group { border: 0; padding: 0; margin: 0; }
.keys-group legend { font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.sticky-save { position: sticky; bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px 10px 18px; box-shadow: var(--e3); z-index: 5; }
details summary { cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .admin-layout, .settings, .content-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .admin-nav, .settings-nav, .content-pages { position: static; max-height: none; flex-direction: row; overflow-x: auto; display: flex; gap: 4px; padding-bottom: 4px; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); }
  .admin-nav::-webkit-scrollbar, .settings-nav::-webkit-scrollbar { display: none; }
  .an-group { display: flex; gap: 4px; }
  .an-group + .an-group { margin-top: 0; }
  .an-label, .admin-who { display: none; }
  .admin-nav a, .settings-nav a, .content-pages a { white-space: nowrap; flex: none; }
  .content-pages a > span .tiny { display: none; }
  .grid-2, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .bell-pop { position: fixed; left: 12px; right: 12px; top: calc(var(--nav-h) + 6px + env(safe-area-inset-top)); width: auto; }
}
@media (max-width: 760px) {
  .feedback-fab { bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; padding: 10px; }
  .feedback-fab span { display: none; }
  .consent { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body:not(.authed) .consent { bottom: 12px; }
  .consent-in { flex-direction: column; align-items: stretch; }
  .consent-ic { display: none; }
  .consent-btns .btn { flex: 1; }
  .admin-head { align-items: flex-start; }
  .head-actions { width: 100%; }
  .kpi-v { font-size: 1.3rem; }
  .ch-plot, .ch-x { margin-left: 38px; }
  .ch-grid span { left: -38px; }
  .lv-search { max-width: none; }
  .lv-spacer { display: none; }
  .kv-grid { grid-template-columns: minmax(0, 1fr); }
  .lv-body { border: 0; background: none; border-radius: 0; overflow: visible; }
  .lv-body > .tbl-wrap { overflow: visible; }
  .thread li { max-width: 100%; }
  .reply, .note-form, .copy-row { flex-direction: column; align-items: stretch; }
  .sticky-save { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .perm-matrix thead th .tiny { display: none; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-ic { display: none; }
  .kpi-l { padding-right: 0; }
  .backup-codes { grid-template-columns: 1fr; }
  .gbanner { font-size: .82rem; }
}
@media (forced-colors: active) {
  .ch-line { stroke: CanvasText; } .ch-bar i, .hb-t i { background: CanvasText; } .bell-n { outline: 1px solid; }
}
@media print {
  .topbar, .mobile-nav, .feedback-fab, .consent, .banners, .admin-nav { display: none !important; }
}
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: inherit; }
