/* Onyx Voice - shared design system (admin console + user portal), the Obsidian console language.
   "Cut Obsidian" console language: dark surfaces, violet accent with glow, Inter for UI, JetBrains Mono for data.
   Presets on <html data-preset="...">: obsidian (default), swiss, soc, daylight.
   Layout rule: content never scrolls inside boxes; everything wraps and the page grows. */

@font-face { font-family: "Inter"; src: url("/static/fonts/inter-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-latin-wght.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

[hidden] { display: none !important; }

:root {
    --bg-base: #090A0F;
    --bg-surface: #11131A;
    --bg-elevated: #171A24;
    --bg-input: #090A0F;
    --bg-band: rgba(0, 0, 0, 0.18);
    --bg-well: rgba(0, 0, 0, 0.25);
    --bg-hover: rgba(255, 255, 255, 0.035);
    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #64748B;
    --accent-primary: #7C5CFF;
    --accent-ink: #FFFFFF;
    --accent-glow: rgba(124, 92, 255, 0.18);
    --accent-tint: rgba(124, 92, 255, 0.15);
    --accent-line: rgba(124, 92, 255, 0.40);
    --ok: #34D399;    --ok-bg: rgba(16, 185, 129, 0.10);  --ok-line: rgba(16, 185, 129, 0.25);
    --warn: #FBBF24;  --warn-bg: rgba(245, 158, 11, 0.10); --warn-line: rgba(245, 158, 11, 0.25);
    --bad: #FB7185;   --bad-bg: rgba(244, 63, 94, 0.10);   --bad-line: rgba(244, 63, 94, 0.25);
    --info: #A5B4FC;  --info-bg: rgba(99, 102, 241, 0.10); --info-line: rgba(99, 102, 241, 0.22);
    --sky: #38BDF8; --teal: #2DD4BF; --rose: #FB7185; --amber: #FBBF24; --indigo: #818CF8; --emerald: #34D399;
    --cell-py: 0.75rem;
    --cell-px: 1rem;
    --card-pad: 1.25rem;
    --radius-ui: 0.5rem;
    --highlight: inset 0 1px 0 0 rgba(255, 255, 255, 0.04);
    --shadow-float: inset 0 1px 0 0 rgba(255, 255, 255, 0.06), 0 10px 30px -10px rgba(0, 0, 0, 0.6);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --header-h: 56px;
    color-scheme: dark;

    /* Aliases used by component styles */
    --bg-canvas: var(--bg-base);
    --border: var(--border-subtle);
    --text: var(--text-primary);
    --text-2: var(--text-secondary);
    --text-3: var(--text-muted);
    --accent: var(--accent-primary);
    --accent-soft: var(--accent-tint);
    --ok-soft: var(--ok-bg);
    --warn-soft: var(--warn-bg);
    --bad-soft: var(--bad-bg);
    --info-soft: var(--info-bg);
    --radius: var(--radius-ui);
    --radius-sm: calc(var(--radius-ui) * 0.8);
    --shadow: var(--highlight), 0 0 0 1px var(--border-subtle);
}

/* Preset 2: Swiss Precision - high-contrast architectural slate */
:root[data-preset="swiss"] {
    --bg-base: #0D1017;
    --bg-surface: #131822;
    --bg-elevated: #1A2130;
    --bg-input: #0D1017;
    --bg-hover: rgba(255, 255, 255, 0.05);
    --border-subtle: rgba(255, 255, 255, 0.13);
    --border-strong: rgba(255, 255, 255, 0.26);
    --text-primary: #FFFFFF;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --accent-primary: #6366F1;
    --accent-glow: rgba(99, 102, 241, 0.22);
    --accent-tint: rgba(99, 102, 241, 0.18);
    --accent-line: rgba(99, 102, 241, 0.45);
    --radius-ui: 0.125rem;
}

/* Preset 3: Tactical SOC - high-density operator mode */
:root[data-preset="soc"] {
    --bg-base: #05070B;
    --bg-surface: #0A0E15;
    --bg-elevated: #0F1622;
    --bg-input: #05070B;
    --bg-hover: rgba(16, 185, 129, 0.06);
    --border-subtle: rgba(148, 163, 184, 0.12);
    --border-strong: rgba(16, 185, 129, 0.32);
    --text-primary: #E2E8F0;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --accent-primary: #10B981;
    --accent-ink: #04130D;
    --accent-glow: rgba(16, 185, 129, 0.18);
    --accent-tint: rgba(16, 185, 129, 0.14);
    --accent-line: rgba(16, 185, 129, 0.40);
    --cell-py: 0.42rem;
    --cell-px: 0.75rem;
    --card-pad: 0.875rem;
    --radius-ui: 0.25rem;
}

/* Preset 4: Daylight - light surfaces for long reading sessions */
:root[data-preset="daylight"] {
    --bg-base: #F3F4F7;
    --bg-surface: #FFFFFF;
    --bg-elevated: #FAFAFC;
    --bg-input: #FFFFFF;
    --bg-band: #F6F7F9;
    --bg-well: #F6F7FA;
    --bg-hover: rgba(15, 23, 42, 0.04);
    --border-subtle: #E4E7EC;
    --border-strong: #CDD2DA;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #6B7280;
    --accent-primary: #6D4AFF;
    --accent-glow: rgba(109, 74, 255, 0.16);
    --accent-tint: rgba(109, 74, 255, 0.10);
    --accent-line: rgba(109, 74, 255, 0.35);
    --ok: #047857;   --ok-bg: rgba(16, 185, 129, 0.10);
    --warn: #B45309; --warn-bg: rgba(245, 158, 11, 0.12);
    --bad: #BE123C;  --bad-bg: rgba(244, 63, 94, 0.09);
    --info: #4338CA; --info-bg: rgba(99, 102, 241, 0.09);
    --sky: #0369A1; --teal: #0F766E; --rose: #BE123C; --amber: #B45309; --indigo: #4338CA; --emerald: #047857;
    --highlight: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-float: 0 12px 30px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px var(--border-subtle);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { scrollbar-color: #262B3C var(--bg-base); scrollbar-width: thin; }
:root[data-preset="daylight"] { scrollbar-color: #C8CDD6 var(--bg-base); }

body {
    background: var(--bg-base);
    color: var(--text-primary);
    font: 13px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
    overflow-wrap: anywhere;
}
::selection { background: var(--accent-glow); color: var(--text-primary); }

a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.95em; }
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
h1 { font-size: 18px; letter-spacing: -0.02em; }
h2 { font-size: 14px; }
h3 { font-size: 13px; }
p { margin: 0; }
.muted { color: var(--text-secondary); }
.faint { color: var(--text-muted); }
.small { font-size: 12px; }
.label, .eyebrow { font: 500 10px/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }

svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@keyframes pulse-slow { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; flex: none; }
.dot.pulse { animation: pulse-slow 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.accent { background: var(--accent-primary); }

/* ---------- app frame: full-width header, sidebar + main below ---------- */

.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
    height: var(--header-h); position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 16px; padding: 0 20px;
    background: color-mix(in srgb, var(--bg-surface) 94%, transparent); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}
.app-header .spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.emblem {
    width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; flex: none;
    background: var(--bg-elevated); box-shadow: inset 0 0 0 1px var(--border-strong), inset 0 2px 6px rgba(0, 0, 0, 0.35);
}
.emblem svg { width: 20px; height: 20px; color: var(--accent-primary); }
.brand-name { display: flex; align-items: center; gap: 8px; }
.brand-name b { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
.ver-pill { font: 500 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px;
    background: var(--bg-hover); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border-subtle); white-space: nowrap; }
.host-line { display: flex; align-items: center; gap: 8px; font: 11px var(--mono); color: var(--text-secondary); white-space: nowrap; }
.host-line .sep { color: var(--text-muted); opacity: 0.6; }
.host-line .note { color: var(--text-muted); }

.header-search { position: relative; display: flex; align-items: center; width: min(320px, 100%); }
.header-search .icon { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }
.header-search input[type] { padding: 6px 58px 6px 30px; font: 12px var(--mono); background: var(--bg-input); }
.app-header select.org-pick { width: auto; max-width: 220px; flex-shrink: 0; padding: 5px 28px 5px 10px; font-size: 12px; }
.header-search kbd { position: absolute; right: 8px; font: 10px var(--mono); color: var(--text-muted); padding: 1px 5px; border-radius: 4px;
    background: var(--bg-hover); box-shadow: inset 0 0 0 1px var(--border-subtle); pointer-events: none; }

/* Segmented control (presets, ranges) */
.seg { display: inline-flex; padding: 2px; border-radius: var(--radius-ui); background: var(--bg-input); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.seg button { border: 0; background: transparent; color: var(--text-secondary); font: 500 11px var(--font); padding: 4px 10px; border-radius: calc(var(--radius-ui) * 0.8); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text-primary); }
.seg button.active { background: var(--bg-elevated); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-strong); }
.seg.mono button { font-family: var(--mono); }

.header-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--radius-ui); font: 12px var(--mono);
    background: var(--bg-elevated); color: var(--text-secondary); box-shadow: var(--shadow-float); text-decoration: none; white-space: nowrap; }
.header-pill:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--border-strong); }
.header-pill b { color: var(--text-primary); font-weight: 600; }
.header-pill .warn { color: var(--warn); font-size: 10px; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-chip .who b { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.user-chip .who span { font: 10.5px var(--mono); color: var(--text-muted); white-space: nowrap; }

.menu-btn { display: none; }

.app-body { flex: 1; display: grid; grid-template-columns: 256px minmax(0, 1fr); align-items: start; }

.sidebar {
    position: sticky; top: var(--header-h); min-height: calc(100vh - var(--header-h));
    display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
    background: var(--bg-surface); border-right: 1px solid var(--border-subtle);
}
/* A sidebar taller than the window scrolls with the page instead of sticking (no inner scroll box). */
.sidebar.tall { position: static; }
.sidebar .side-top { padding: 12px; display: flex; flex-direction: column; gap: 22px; }
.nav { display: flex; flex-direction: column; gap: 20px; }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-caption { padding: 0 12px 6px; font: 500 10px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }
.nav a, .nav button.nav-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    padding: 9px 12px; border-radius: var(--radius-ui); border: 0; background: transparent; cursor: pointer;
    font: 500 12px var(--font); color: var(--text-secondary); text-decoration: none; text-align: left;
    border-left: 2px solid transparent; transition: background-color .12s ease, color .12s ease;
}
.nav a:hover, .nav button.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav a .lbl, .nav button.nav-item .lbl { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav a .lbl span, .nav button.nav-item .lbl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a.active { background: linear-gradient(90deg, var(--accent-glow) 0%, transparent 100%); border-left-color: var(--accent-primary);
    color: var(--text-primary); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.nav-badge { font: 500 10px var(--mono); padding: 2px 6px; border-radius: 4px; color: var(--text-secondary);
    background: var(--bg-hover); box-shadow: inset 0 0 0 1px var(--border-subtle); flex: none; }
.nav-badge.plain { background: none; box-shadow: none; color: var(--text-muted); padding: 0; }
.nav-badge.ok { color: var(--ok); background: var(--ok-bg); box-shadow: none; }
.nav-badge.warn { color: var(--warn); background: var(--warn-bg); box-shadow: none; }
.nav-badge.accent { color: var(--accent-ink); background: var(--accent-primary); box-shadow: 0 0 12px var(--accent-glow); }
/* Icon colours per nav item */
.ic-accent { color: var(--accent-primary); }
.ic-amber { color: var(--amber); }
.ic-indigo { color: var(--indigo); }
.ic-emerald { color: var(--emerald); }
.ic-sky { color: var(--sky); }
.ic-rose { color: var(--rose); }
.ic-teal { color: var(--teal); }
.ic-muted { color: var(--text-muted); }

.side-box { padding: 12px; border-radius: var(--radius-ui); background: var(--bg-elevated); box-shadow: var(--shadow-float); display: flex; flex-direction: column; gap: 9px; }
.side-box .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 10px var(--mono); color: var(--text-secondary); }
.side-box .row .k { text-transform: uppercase; letter-spacing: 0.1em; }
.side-box .val { font: 12px var(--mono); color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { padding: 12px; border-top: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 7px; font: 11px var(--mono); color: var(--text-secondary); }
.side-foot .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-foot .row b { color: var(--text-primary); font-weight: 500; }
.side-foot .row.dim { font-size: 10px; color: var(--text-muted); }
.side-foot .links { display: flex; gap: 4px; flex-wrap: wrap; }
.side-foot .preset-seg { display: none; flex-wrap: wrap; }

.bar { height: 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.4); overflow: hidden; }
:root[data-preset="daylight"] .bar { background: #E7E9EE; }
.bar.thin { height: 4px; }
.bar > i { display: block; height: 100%; background: var(--accent-primary); border-radius: inherit; }
.bar > i.ok { background: #10B981; }
.bar > i.warn { background: #F59E0B; }
.bar > i.bad { background: #EF4444; }
.meter { height: 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.4); overflow: hidden; }
:root[data-preset="daylight"] .meter { background: #E7E9EE; }
.meter > i { display: block; height: 100%; background: var(--accent-primary); border-radius: inherit; }

.main { min-width: 0; }
.content { padding: 24px; display: flex; flex-direction: column; gap: 22px; max-width: 1440px; width: 100%; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 18px; }
.page-head p { margin-top: 4px; font-size: 13px; line-height: 1.5; color: var(--text-secondary); max-width: 760px; }
.page-head h1 { font-size: 20px; }

/* ---------- surfaces ---------- */

.card { background: var(--bg-surface); border-radius: var(--radius-ui); box-shadow: var(--highlight), 0 0 0 1px var(--border-subtle);
    padding: var(--card-pad); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card.flush > .card-head { padding: var(--card-pad); border-bottom: 1px solid var(--border-subtle); }
.card.flush > .card-body { padding: var(--card-pad); display: flex; flex-direction: column; gap: 14px; }
.card.flush > .card-foot { padding: 12px var(--card-pad); border-top: 1px solid var(--border-subtle); background: var(--bg-band); display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 12px var(--mono); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head p { font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); margin-top: 2px; }
.card-head a, .link-more { font: 500 12.5px var(--font); }
.elevated { background: var(--bg-elevated); border-radius: var(--radius-ui); box-shadow: var(--shadow-float); }
.well { background: var(--bg-well); border-radius: var(--radius-ui); box-shadow: inset 0 0 0 1px var(--border-subtle); padding: 12px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.split-3 { display: grid; gap: 20px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.stack.tight { gap: 4px; }
ol.plain-list.numbered { list-style: decimal; padding-left: 22px; }
ol.plain-list.numbered li { display: list-item; }

/* Service health cards */
.svc-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(max(230px, calc((100% - 48px) / 4)), 1fr)); }
.svc { display: flex; flex-direction: column; gap: 12px; }
.svc .svc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.svc .svc-name { display: flex; align-items: center; gap: 8px; font: 600 12px var(--mono); color: var(--text-primary); }
.svc .svc-role { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.svc .svc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding-top: 10px; border-top: 1px solid var(--border-subtle); font: 11px var(--mono); }
.svc .svc-meta span { display: block; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 1px; }
.svc .svc-meta div { color: var(--text-primary); overflow-wrap: anywhere; }

/* KPI strip */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { padding: 12px; border-radius: var(--radius-ui); background: var(--bg-well); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.kpi .k { font: 10px var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }
.kpi .v { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 4px; }
.kpi .v b { font: 600 18px var(--mono); }
.kpi .v span { font: 11px var(--mono); opacity: 0.85; }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); } .t-accent { color: var(--accent-primary); } .t-info { color: var(--info); } .t-sky { color: var(--sky); }

/* Chart */
.chart { position: relative; width: 100%; user-select: none; }
.chart svg { width: 100%; height: auto; overflow: visible; display: block; }
.chart .tip { position: absolute; top: 12px; pointer-events: none; z-index: 5; padding: 8px 12px; font: 11px var(--mono); min-width: 170px;
    background: var(--bg-elevated); border-radius: var(--radius-ui); box-shadow: var(--shadow-float); display: flex; flex-direction: column; gap: 3px; }
.chart .tip .h { color: var(--text-primary); font-weight: 600; border-bottom: 1px solid var(--border-subtle); padding-bottom: 4px; margin-bottom: 2px; }
.chart .tip .r { display: flex; justify-content: space-between; gap: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font: 12px var(--mono); color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Org / count stats (compact cards with an icon) */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(max(190px, calc((100% - 42px) / 4)), 1fr)); }
.stat { display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px !important; }
a.stat { color: inherit; text-decoration: none; transition: box-shadow .12s ease; }
a.stat:hover { text-decoration: none; box-shadow: var(--highlight), 0 0 0 1px var(--accent-line); }
.stat .n { font: 600 20px/1.1 var(--mono); letter-spacing: -0.02em; color: var(--text-primary); }
.stat .l { color: var(--text-secondary); font-size: 11.5px; margin-top: 3px; }
.stat-icon { width: 36px; height: 36px; border-radius: var(--radius-ui); display: grid; place-items: center; flex: none; }
.stat-icon .icon { width: 18px; height: 18px; }
.tone-accent { background: var(--accent-tint); color: var(--accent-primary); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tone-bad { background: var(--bad-bg); color: var(--bad); }
.tone-amber { background: var(--warn-bg); color: var(--warn); }
.tone-violet { background: var(--accent-tint); color: var(--accent-primary); }
.tone-teal { background: rgba(45, 212, 191, 0.10); color: var(--teal); }
.tone-sky { background: rgba(56, 189, 248, 0.10); color: var(--sky); }
.tone-slate { background: var(--bg-hover); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.mini-stats .n { font: 600 18px var(--mono); color: var(--text-primary); }
.mini-stats .l { color: var(--text-secondary); font: 12px var(--font); }

/* Domain / item tiles */
.tiles { display: flex; flex-direction: column; gap: 12px; }
.tiles.wrap { flex-direction: row; flex-wrap: wrap; }
.tiles.wrap > .tile { flex: 1 1 240px; }
.tile { padding: 12px; border-radius: var(--radius-ui); background: var(--bg-well); box-shadow: inset 0 0 0 1px var(--border-subtle);
    display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; transition: box-shadow .12s ease; }
a.tile:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--border-strong); }
.tile .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tile .name { font: 600 12px var(--mono); color: var(--text-primary); }
.tile .sub { font: 11px var(--mono); color: var(--text-secondary); }

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.45; font-size: 12.5px; color: var(--text-secondary); }
.feed-text b, .feed-target { color: var(--text-primary); font-weight: 600; }
.feed-text .when { font: 10.5px var(--mono); color: var(--text-muted); }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.plain-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }
.plain-list li:first-child { border-top: 0; }
.plain-list li .icon { color: var(--text-muted); }

.kv { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 8px 18px; margin: 0; }
.kv > dt { color: var(--text-muted); font: 500 12.5px var(--font); padding-top: 1px; }
.kv > dd { margin: 0; min-width: 0; }

/* ---------- controls ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 6px 12px; border-radius: var(--radius-ui); border: 0; cursor: pointer;
    font: 500 12.5px/1.35 var(--font); color: var(--text-secondary); background: transparent;
    box-shadow: inset 0 0 0 1px var(--border-subtle); white-space: nowrap; text-decoration: none;
    transition: background-color .12s ease, box-shadow .12s ease, color .12s ease, filter .12s ease;
}
.btn:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn .icon { width: 14px; height: 14px; }
.btn.primary { background: var(--accent-primary); color: var(--accent-ink); font-family: var(--font); font-weight: 500;
    box-shadow: 0 0 20px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn.primary:hover { filter: brightness(1.1); background: var(--accent-primary); color: var(--accent-ink); }
.btn.ghost { box-shadow: none; }
.btn.small { padding: 4px 9px; font-size: 11px; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn.danger.armed { background: #EF4444; color: #fff; box-shadow: 0 0 16px rgba(239, 68, 68, 0.3); }
.btn.tint-ok { color: var(--ok); background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok-line); }
.btn.tint-warn { color: var(--warn); background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.btn.tint-info { color: var(--info); background: var(--info-bg); box-shadow: inset 0 0 0 1px var(--info-line); }
.btn.tint-bad { color: var(--bad); background: var(--bad-bg); box-shadow: inset 0 0 0 1px var(--bad-line); }
.btn.tint-accent { color: var(--accent-primary); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); }
.btn.tint-ok:hover, .btn.tint-warn:hover, .btn.tint-info:hover, .btn.tint-bad:hover, .btn.tint-accent:hover { filter: brightness(1.15); }
.btn.icon-btn { padding: 0; width: 32px; height: 32px; box-shadow: none; color: var(--text-secondary); }
.btn.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn.icon-btn.on { color: var(--accent-primary); background: var(--accent-tint); }
.btn.icon-btn.danger:hover { color: var(--bad); background: var(--bad-bg); }
.btn.icon-btn .icon { width: 17px; height: 17px; }
.btn-group { display: inline-flex; border-radius: var(--radius-ui); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.btn-group > .btn { box-shadow: none; border-radius: 0; }
.btn-group > .btn + .btn { box-shadow: -1px 0 0 0 var(--border-subtle); }
.btn-group > .btn:first-child { border-radius: var(--radius-ui) 0 0 var(--radius-ui); }
.btn-group > .btn:last-child { border-radius: 0 var(--radius-ui) var(--radius-ui) 0; }
.toolbar-sep { width: 1px; align-self: stretch; background: var(--border-subtle); margin: 4px 4px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row > select { width: auto; }

label.field, div.field { display: flex; flex-direction: column; gap: 6px; font: 500 12.5px var(--font); color: var(--text-secondary); }
.field .hint, .hint { font: 12px/1.45 var(--font); color: var(--text-muted); }
.field .hint b, .hint b { color: var(--text-secondary); font-weight: 500; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-primary); cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent-primary); }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=datetime-local], input[type=date], input[type=time], select, textarea {
    font: 13px/1.4 var(--font); color: var(--text-primary); background: var(--bg-input);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-ui); padding: 7px 11px; width: 100%; min-width: 0;
    transition: border-color .12s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { field-sizing: content; min-height: 90px; resize: none; overflow: hidden; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-primary); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 1px; }
.mono-input, input.mono { font-family: var(--mono) !important; font-size: 12px !important; }

.form { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.form .wide { grid-column: 1 / -1; }
.form.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; max-width: 820px; }
@media (max-width: 700px) { .form.cols-2 { grid-template-columns: 1fr; } }

.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 14px; height: 14px; }
.search input { padding-left: 30px; }

/* Filter pills */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { border: 0; cursor: pointer; background: transparent; color: var(--text-secondary); font: 500 12.5px var(--font);
    padding: 5px 12px; border-radius: var(--radius-ui); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.tabs button:hover { color: var(--text-primary); }
.tabs button.active { background: var(--accent-tint); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--accent-line); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: 4px; font: 500 10px var(--mono);
    letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
    background: var(--bg-hover); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.badge.ok { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn-line); }
.badge.bad { background: var(--bad-bg); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-line); }
.badge.info { background: var(--info-bg); color: var(--info); box-shadow: inset 0 0 0 1px var(--info-line); }
.badge.accent { background: var(--accent-tint); color: var(--accent-primary); box-shadow: inset 0 0 0 1px var(--accent-line); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: var(--radius-ui); font: 12px var(--mono);
    background: var(--bg-well); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-subtle); text-decoration: none; }
a.chip:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--border-strong); }
.chip button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }
.chip button:hover { color: var(--bad); }

.empty { padding: 28px; text-align: center; color: var(--text-secondary); font: 13px/1.5 var(--font); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.notice { padding: 10px 14px; border-radius: var(--radius-ui); background: var(--info-bg); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--info-line); font-size: 12.5px; }
.notice.bad { background: var(--bad-bg); box-shadow: inset 0 0 0 1px var(--bad-line); }
.notice.warn { background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.notice.ok { background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok-line); }
.console { background: #06070B; border-radius: var(--radius-ui); box-shadow: inset 0 0 0 1px var(--border-subtle); padding: 12px 14px;
    font: 11.5px/1.65 var(--mono); color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
:root[data-preset="daylight"] .console { background: #F6F7F9; }

/* Inline panel (the design's modal, kept in page flow so nothing scrolls inside it) */
.panel { background: var(--bg-elevated); border-radius: var(--radius-ui); box-shadow: var(--shadow-float); overflow: hidden; }
.panel > .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px;
    background: var(--bg-base); border-bottom: 1px solid var(--border-subtle); }
.panel > .panel-head h2 { font-size: 13px; }
.panel > .panel-body { padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.panel > .panel-foot { padding: 12px 16px; border-top: 1px solid var(--border-subtle); background: var(--bg-base); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------- avatars ---------- */

.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
    background: var(--bg-elevated); box-shadow: inset 0 0 0 1px var(--border-strong); font: 600 11.5px var(--font); color: var(--text-secondary);
    letter-spacing: 0.02em; user-select: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.av-0 { background: rgba(124, 92, 255, 0.18); color: #B8A6FF; box-shadow: none; }
.avatar.av-1 { background: rgba(56, 189, 248, 0.16); color: #7DD3FC; box-shadow: none; }
.avatar.av-2 { background: rgba(16, 185, 129, 0.16); color: #6EE7B7; box-shadow: none; }
.avatar.av-3 { background: rgba(245, 158, 11, 0.16); color: #FCD34D; box-shadow: none; }
.avatar.av-4 { background: rgba(244, 63, 94, 0.16); color: #FDA4AF; box-shadow: none; }
.avatar.av-5 { background: rgba(45, 212, 191, 0.16); color: #5EEAD4; box-shadow: none; }
.avatar.av-6 { background: rgba(129, 140, 248, 0.18); color: #A5B4FC; box-shadow: none; }
.avatar.av-7 { background: rgba(148, 163, 184, 0.16); color: #CBD5E1; box-shadow: none; }
:root[data-preset="daylight"] .avatar.av-0 { background: #EDE9FE; color: #6D28D9; }
:root[data-preset="daylight"] .avatar.av-1 { background: #E0F2FE; color: #0369A1; }
:root[data-preset="daylight"] .avatar.av-2 { background: #D1FAE5; color: #047857; }
:root[data-preset="daylight"] .avatar.av-3 { background: #FEF3C7; color: #B45309; }
:root[data-preset="daylight"] .avatar.av-4 { background: #FFE4E6; color: #BE123C; }
:root[data-preset="daylight"] .avatar.av-5 { background: #CCFBF1; color: #0F766E; }
:root[data-preset="daylight"] .avatar.av-6 { background: #E0E7FF; color: #4338CA; }
:root[data-preset="daylight"] .avatar.av-7 { background: #E7E5E4; color: #44403C; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* ---------- tables: console style; one card per row on narrow screens ---------- */

table.data { width: 100%; border-collapse: collapse; overflow-wrap: break-word; }
table.data th { text-align: left; padding: var(--cell-py) var(--cell-px); font: 600 10.5px var(--font); letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--text-muted); background: var(--bg-band); border-bottom: 1px solid var(--border-subtle); }
table.data td { padding: var(--cell-py) var(--cell-px); border-bottom: 1px solid var(--border-subtle); vertical-align: middle;
    font: 13px var(--font); color: var(--text-secondary); overflow-wrap: break-word; transition: background-color .12s ease; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--bg-hover); }
table.data tr.link { cursor: pointer; }
table.data td.num { white-space: nowrap; }
table.data .stamp { white-space: nowrap; font-family: var(--mono); color: var(--text-secondary); }
table.data td.actions { text-align: right; }
table.data td .mono, table.data td.mono { font: 12px var(--mono); }
table.data .cell-main { color: var(--text-primary); font-weight: 600; }
table.data .cell-id { color: var(--accent-primary); font-weight: 600; }
.cell-main { font-weight: 600; color: var(--text-primary); }
.cell-sub { color: var(--text-muted); font-size: 11px; }
.card > table.data { margin: calc(var(--card-pad) * -1); width: calc(100% + var(--card-pad) * 2); margin-top: 0; margin-bottom: calc(var(--card-pad) * -1); }
.card.flush > table.data { margin: 0; width: 100%; }

@media (max-width: 760px) {
    table.data thead { display: none; }
    table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
    table.data tr { padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
    table.data tr:last-child { border-bottom: 0; }
    table.data td { border: 0; padding: 3px var(--cell-px); display: flex; gap: 10px; }
    table.data td::before { content: attr(data-label); color: var(--text-muted); font-size: 10px; text-transform: uppercase; min-width: 96px; flex: none; padding-top: 2px; }
    table.data td.actions { text-align: left; }
    table.data td:empty { display: none; }
    .card > table.data { margin: 0; width: 100%; }
}

/* ---------- guidance: help links, checklist, common tasks, success panels ---------- */

.help-link { display: inline-flex; align-items: center; gap: 6px; font: 500 12.5px var(--font); color: var(--accent-primary); text-decoration: none; white-space: nowrap; }
.help-link:hover { text-decoration: underline; }
.help-link .icon { width: 14px; height: 14px; }
.lead { font-size: 13px; line-height: 1.55; color: var(--text-secondary); margin: 0; max-width: 820px; }

.progress-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.progress-row .bar { flex: 1; min-width: 160px; }
.progress-row b { font: 600 12.5px var(--font); color: var(--text-primary); white-space: nowrap; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.checklist > li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 14px 0; border-top: 1px solid var(--border-subtle); }
.checklist > li:first-child { border-top: 0; padding-top: 4px; }
.checklist .st { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; margin-top: 1px; }
.checklist .st .icon { width: 20px; height: 20px; }
.checklist .st.done { color: var(--ok); }
.checklist .st.todo { color: var(--text-muted); }
.checklist .st.warn { color: var(--warn); }
.checklist .t { font: 600 13.5px var(--font); color: var(--text-primary); }
.checklist li.done .t { color: var(--text-secondary); }
.checklist .d { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); margin-top: 3px; }
.checklist .d code { font: 12px var(--mono); color: var(--text-primary); background: var(--bg-well); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.checklist .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.checklist .sub { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
@media (max-width: 700px) {
    .checklist > li { grid-template-columns: 26px minmax(0, 1fr); }
    .checklist .acts { grid-column: 2; justify-content: flex-start; margin-top: 8px; }
}

.task-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-ui); text-decoration: none; cursor: pointer;
    background: var(--bg-well); box-shadow: inset 0 0 0 1px var(--border-subtle); color: var(--text-primary); border: 0; text-align: left; font: inherit;
    transition: box-shadow .12s ease, background-color .12s ease; }
.task:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--accent-line); background: var(--accent-tint); }
.task .ic { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--bg-hover); }
.task .ic .icon { width: 16px; height: 16px; }
.task .t { font: 600 13px var(--font); color: var(--text-primary); }
.task .d { font: 12px/1.4 var(--font); color: var(--text-secondary); margin-top: 2px; }

.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--radius-ui); cursor: pointer; text-align: left; font: inherit;
    background: var(--bg-well); border: 0; box-shadow: inset 0 0 0 1px var(--border-subtle); color: var(--text-primary); }
.choice:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.choice.active { background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); }
.choice .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.choice .t { font: 600 13px var(--font); }
.choice .d { font: 12px/1.4 var(--font); color: var(--text-secondary); margin-top: 2px; }

.secret-box { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--radius-ui);
    background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok-line); }
.secret-box .kv > dd { font: 13px var(--mono); color: var(--text-primary); overflow-wrap: anywhere; }
.inline-input { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.inline-input > input, .inline-input > .grow { flex: 1; min-width: 180px; }
.inline-input > select { width: auto; }

.suggest-list { display: flex; flex-direction: column; gap: 2px; }
.suggest-list button { display: flex; gap: 10px; align-items: center; text-align: left; border: 0; background: transparent; color: var(--text-primary);
    padding: 6px 8px; border-radius: 6px; cursor: pointer; font: 13px var(--font); }
.suggest-list button:hover, .suggest-list button.on { background: var(--bg-hover); }
.suggest-list small { color: var(--text-muted); font: 12px var(--mono); }

.status-line { display: inline-flex; align-items: center; gap: 6px; font: 500 12.5px var(--font); }
.status-line .icon { width: 15px; height: 15px; }
.status-line.ok { color: var(--ok); }
.status-line.warn { color: var(--warn); }
.status-line.bad { color: var(--bad); }
.status-line.todo { color: var(--text-muted); }

/* ---------- public folders (admin) ---------- */

.pf-tree { display: flex; flex-direction: column; }
.pf-item { border-top: 1px solid var(--border-subtle); }
.pf-item:first-child { border-top: 0; }
.pf-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 0; }
.pf-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.pf-name b { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.pf-name .icon { width: 16px; height: 16px; }
.pf-panel { padding: 4px 0 14px; }

/* ---------- documentation articles ---------- */

.doc-layout { display: grid; gap: 20px; grid-template-columns: 240px minmax(0, 1fr); align-items: start; }
.doc-toc { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 2px; }
.doc-toc a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text-secondary); font: 13px var(--font); text-decoration: none; border-left: 2px solid transparent; }
.doc-toc a:hover { background: var(--bg-hover); color: var(--text-primary); }
.doc-toc a.active { color: var(--text-primary); background: var(--accent-tint); border-left-color: var(--accent-primary); border-radius: 0 6px 6px 0; }
.doc-toc .cap { font: 500 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); padding: 4px 10px 8px; }
@media (max-width: 1000px) {
    .doc-layout { grid-template-columns: 1fr; }
    .doc-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
    .doc-toc .cap { width: 100%; padding-bottom: 2px; }
    .doc-toc a { border-left: 0; box-shadow: inset 0 0 0 1px var(--border-subtle); border-radius: 6px; padding: 5px 10px; }
    .doc-toc a.active { border-radius: 6px; box-shadow: inset 0 0 0 1px var(--accent-line); }
}
.doc { font: 14px/1.7 var(--font); color: var(--text-secondary); max-width: 860px; overflow-wrap: break-word; }
.doc > :first-child { margin-top: 0; }
.doc h1 { font-size: 24px; margin: 0 0 8px; color: var(--text-primary); }
.doc h2 { font-size: 17px; margin: 34px 0 10px; padding-top: 18px; border-top: 1px solid var(--border-subtle); color: var(--text-primary); scroll-margin-top: calc(var(--header-h) + 16px); }
.doc h3 { font-size: 14.5px; margin: 24px 0 8px; color: var(--text-primary); scroll-margin-top: calc(var(--header-h) + 16px); }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc strong { color: var(--text-primary); font-weight: 600; }
.doc a { color: var(--accent-primary); }
.doc code { font: 12.5px var(--mono); color: var(--text-primary); background: var(--bg-well); padding: 1px 5px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--border-subtle); overflow-wrap: anywhere; }
.doc pre { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-ui); background: var(--bg-well); box-shadow: inset 0 0 0 1px var(--border-subtle);
    font: 12.5px/1.6 var(--mono); color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; position: relative; }
.doc pre code { background: none; box-shadow: none; padding: 0; font: inherit; }
.doc pre .copy { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .12s ease; background: var(--bg-elevated); }
.doc pre:hover .copy, .doc pre .copy:focus-visible { opacity: 1; }
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 13px; }
.doc th { text-align: left; font: 600 12px var(--font); color: var(--text-primary); background: var(--bg-band); padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); }
.doc td { padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.doc blockquote { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-ui); background: var(--info-bg); box-shadow: inset 0 0 0 1px var(--info-line); color: var(--text-primary); }
.doc blockquote.warn { background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.doc blockquote p:last-child { margin-bottom: 0; }
.doc .live { margin: 0 0 16px; }
.doc-pager { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border-subtle); }
.doc-pager a { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: var(--radius-ui); box-shadow: inset 0 0 0 1px var(--border-subtle); text-decoration: none; min-width: 200px; }
.doc-pager a:hover { box-shadow: inset 0 0 0 1px var(--accent-line); }
.doc-pager small { color: var(--text-muted); font: 11px var(--font); }
.doc-pager b { color: var(--text-primary); font: 600 13px var(--font); }
.doc-pager .next { text-align: right; margin-left: auto; }
.doc-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 760px) {
    .doc table, .doc tbody, .doc tr, .doc td { display: block; width: 100%; }
    .doc thead { display: none; }
    .doc tr { padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
    .doc td { border: 0; padding: 2px 0; }
    .doc td::before { content: attr(data-label); display: block; font: 600 11px var(--font); color: var(--text-muted); }
}

/* ---------- toasts ---------- */

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(400px, calc(100vw - 40px)); }
.toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: var(--radius-ui);
    font: 13px var(--font); color: var(--text-primary); background: var(--bg-elevated); box-shadow: var(--shadow-float);
    border-left: 2px solid rgba(16, 185, 129, 0.6); animation: toast-in 0.18s ease-out; }
.toast .t { display: flex; align-items: center; gap: 10px; }
.toast.bad { border-left-color: rgba(244, 63, 94, 0.7); }
.toast.warn { border-left-color: rgba(245, 158, 11, 0.7); }
.toast.accent { border-left-color: var(--accent-line); }
.toast button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; }
.toast button:hover { color: var(--text-primary); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- sign-in ---------- */

.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(600px 400px at 50% 30%, var(--accent-glow), transparent 70%), var(--bg-base); }
.signin .card { width: min(400px, 100%); padding: 28px; gap: 20px; background: var(--bg-elevated); box-shadow: var(--shadow-float); }
.signin .brand { padding: 0; }
.signin form { display: flex; flex-direction: column; gap: 14px; }
.signin .error { color: var(--bad); min-height: 1.2em; font: 12px var(--mono); }
.signin .btn.primary { padding: 9px 14px; font-size: 13px; }
/* Two-factor set-up: the enrolment gate is wider than the sign-in card; QR codes stay on white (scanners need contrast). */
.signin.wide > .stack { width: min(680px, 100%); }
.signin.wide .card { width: 100%; }
.qr-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.qr { background: #fff; border-radius: var(--radius-ui); padding: 6px; line-height: 0; flex: none; }
.qr svg { width: 196px; height: 196px; display: block; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; font-size: 13px; }
.recovery-codes span { padding: 6px 10px; border-radius: var(--radius-ui); background: var(--bg-input); box-shadow: inset 0 0 0 1px var(--border-subtle); }
a.who { text-decoration: none; color: inherit; }
a.who:hover b { text-decoration: underline; }

/* ---------- narrow screens: header wraps, sidebar becomes a collapsible panel ---------- */

@media (max-width: 1100px) {
    .app-header .preset-seg { display: none; }
    .side-foot .preset-seg { display: inline-flex; }
    .split-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .app-header { height: auto; min-height: var(--header-h); flex-wrap: wrap; padding: 8px 14px; position: static; }
    .header-search, .app-header .header-pill, .user-chip .who, .host-line { display: none; }
    .menu-btn { display: inline-flex; }
    .app-body { grid-template-columns: 1fr; }
    .sidebar { position: static; min-height: 0; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
    .sidebar:not(.open) { display: none; }
    .content { padding: 16px; }
    .grid-2 { grid-template-columns: 1fr; }
}

/* Mail flow rules and compliance */
.rule-rows { display: flex; flex-direction: column; gap: 8px; }
.rule-row { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px;
    border-radius: var(--radius-ui); background: var(--bg-well); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.rule-row .what { font: 500 12.5px/1.4 var(--font); color: var(--text-primary); padding-top: 7px; }
.rule-row .val { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rule-section-title { font: 600 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-top: 4px; }
.rule-summary { font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); margin-top: 3px; overflow-wrap: anywhere; }
.rule-try { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.slot:empty { display: none; }
.preview-text { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 var(--font); margin: 10px 0 0; padding: 12px; border-radius: var(--radius-ui);
    background: var(--bg-well); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.wrap-anywhere { overflow-wrap: anywhere; word-break: break-all; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
.add-picker { max-width: 360px; }
.chips-input { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.order-btns { display: flex; gap: 2px; align-items: center; }
.order-btns .num { min-width: 18px; }
.dlp-kinds { display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 8px; }
@media (max-width: 760px) {
    .rule-row { grid-template-columns: minmax(0, 1fr) auto; }
    .rule-row .val { grid-column: 1 / -1; }
}
/* Reports: a day chart that scales to the card, and a weekday x hour heat map. */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border-subtle); stroke-width: 1; }
.chart .axis { fill: var(--text-muted); font: 11px var(--mono); }
.chart .inbound, .legend .inbound::before { fill: var(--info); background: var(--info); }
.chart .outbound, .legend .outbound::before { fill: var(--ok); background: var(--ok); }
.chart .internal, .legend .internal::before { fill: var(--text-muted); background: var(--text-muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; }
.heat-h { font: 10px var(--mono); color: var(--text-muted); text-align: center; line-height: 16px; overflow: hidden; }
.heat-c { aspect-ratio: 1; border-radius: 2px; background: var(--accent-primary); min-height: 8px; }
