/* Frontier AI admin UI. Tokens mirror the Pulse (nicte) dashboard: HeroUI v3 surfaces, teal brand. */
@font-face { font-family: "Work Sans"; src: url("fonts/work-sans-vf.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("fonts/plus-jakarta-sans-vf.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #c7d0dd; --surface: #ffffff; --surface-2: #eef1f7; --content2: #e9eef5; --th: #e6ecf4;
  --border: #cdd5e0; --border-strong: #b0bbca; --text: #11181c; --muted: #5f6773; --muted-2: #7f8791;
  --primary: #00abab; --primary-50: #e6f7f7; --primary-100: #ccefef; --primary-600: #009999; --primary-700: #007f7f;
  --navy: #003566; --success: #17c964; --warning: #f5a524; --danger: #f31260;
  --success-soft: #e8f9ef; --warning-soft: #fef3e0; --danger-soft: #fee3ea; --primary-soft: #e6f7f7;
  --grid: #eeeeee; --axis: #e4e4e7; --label: #71717a; --value: #18181b; --avg: #f97316;
  --tip-bg: rgba(255,255,255,.98); --tip-border: #f4f4f5;
  --s1: #00abab; --s2: #f97316; --s3: #8b5cf6; --s4: #eda100; --s5: #2a78d6; --s6: #e87ba4;
  --shadow: 0 0 5px rgb(0 0 0/.05), 0 2px 10px rgb(0 0 0/.13), 0 0 1px rgb(0 0 0/.3);
  --sidebar-w: 272px; --sidebar-collapsed: 76px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #08080a; --surface: #1b1b26; --surface-2: #282833; --content2: #30303c; --th: #23232f;
    --border: #3b3b48; --border-strong: #40404f; --text: #ecedee; --muted: #9797a2; --muted-2: #7c7c88;
    --primary-50: #0f2a2a; --primary-100: #123a3a; --success-soft: #0f2e1c; --warning-soft: #33250c; --danger-soft: #3a0f1c; --primary-soft: #0f2a2a;
    --grid: rgba(255,255,255,.05); --axis: #27272a; --label: #a1a1aa; --value: #e4e4e7;
    --tip-bg: rgba(24,24,27,.95); --tip-border: #27272a;
    --s1: #009999; --s2: #d95926; --s3: #9085e9; --s4: #c98500; --s5: #3987e5; --s6: #d55181;
    --shadow: 0 0 5px rgb(0 0 0/.3), 0 2px 10px rgb(0 0 0/.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08080a; --surface: #1b1b26; --surface-2: #282833; --content2: #30303c; --th: #23232f;
  --border: #3b3b48; --border-strong: #40404f; --text: #ecedee; --muted: #9797a2; --muted-2: #7c7c88;
  --primary-50: #0f2a2a; --primary-100: #123a3a; --success-soft: #0f2e1c; --warning-soft: #33250c; --danger-soft: #3a0f1c; --primary-soft: #0f2a2a;
  --grid: rgba(255,255,255,.05); --axis: #27272a; --label: #a1a1aa; --value: #e4e4e7;
  --tip-bg: rgba(24,24,27,.95); --tip-border: #27272a;
  --s1: #009999; --s2: #d95926; --s3: #9085e9; --s4: #c98500; --s5: #3987e5; --s6: #d55181;
  --shadow: 0 0 5px rgb(0 0 0/.3), 0 2px 10px rgb(0 0 0/.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: "Work Sans", system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, button, label, .brand, .kpi-value, .tip, .sidebar { font-family: "Plus Jakarta Sans", "Work Sans", sans-serif; }
a { color: var(--primary-700); }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- shell ---------------------------------------------------------- */
.shell { display: flex; height: 100dvh; gap: 8px; }
#menu, .nav-backdrop { display: none; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--surface-2); border-right: 1px solid var(--border); padding: 16px; display: flex; flex-direction: column; gap: 8px; transition: width .18s ease; overflow: hidden; }
.shell.collapsed .sidebar { width: var(--sidebar-collapsed); }
.shell.collapsed .sidebar .lbl, .shell.collapsed .sidebar .brand, .shell.collapsed .nav-sec span, .shell.collapsed .sidebar-foot { display: none; }
.sidebar-top { display: flex; align-items: center; gap: 10px; height: 40px; margin-bottom: 8px; }
.sidebar-top .logo { width: 30px; height: 32px; color: var(--text); flex: none; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; flex: 1; }
.brand small { display: block; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.icon-btn { width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: color-mix(in srgb, var(--border) 40%, transparent); color: var(--text); }
.icon-btn:focus-visible, .nav-item:focus-visible, .seg button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.nav-sec { display: flex; align-items: center; gap: 8px; margin: 10px 4px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.nav-sec::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.nav-item { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 11px; border-radius: 14px; border: 0; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; width: 100%; text-align: left; white-space: nowrap; }
.nav-item:hover { background: color-mix(in srgb, var(--border) 40%, transparent); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item svg { width: 22px; height: 22px; }
.nav { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: var(--muted); padding: 8px 4px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; height: 50px; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 8px; background: var(--bg); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs b { color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }
.pillbar { display: flex; align-items: center; gap: 6px; background: var(--content2); border-radius: 999px; padding: 4px 6px 4px 10px; }
.pillbar select, .pillbar input { border: 0; background: transparent; font: inherit; color: var(--text); padding: 6px 4px; min-width: 0; }
.pillbar input { width: 180px; }
.pillbar .sep { width: 1px; height: 18px; background: var(--border-strong); }
.content { flex: 1; overflow-y: auto; padding: 0 16px 16px; }

/* ---- page card ------------------------------------------------------ */
.page { background: var(--surface); border-radius: 14px; padding: 8px; box-shadow: var(--shadow); }
/* a thin bar along the top of the card while the page loads its data; the delay keeps fast loads quiet */
.page.loading { background-image: linear-gradient(var(--primary), var(--primary)); background-size: 30% 3px; background-repeat: no-repeat; animation: loadbar 1.1s .25s ease-in-out infinite both; }
@keyframes loadbar { 0% { background-position: -40% 0; } 100% { background-position: 140% 0; } }
.page-h { display: flex; align-items: center; gap: 14px; padding: 12px; flex-wrap: wrap; }
.page-h > div:not(.tile):not(.actions) { flex: 1 1 320px; min-width: 0; }
.page-h .tile { width: 58px; height: 58px; border-radius: 14px; background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.page-h .tile svg { width: 34px; height: 34px; }
.page-h h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-h p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.page-h .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.page-b { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c6 { grid-column: span 6; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
@media (max-width: 1100px) { .c3 { grid-column: span 6; } .c4, .c8 { grid-column: span 12; } }
@media (max-width: 720px) { .c3, .c6 { grid-column: span 12; } }

/* ---- filter row ----------------------------------------------------- */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 10px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0/.12); }

/* ---- widgets -------------------------------------------------------- */
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; min-width: 0; }
.widget-h { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px; }
.widget-h h4 { margin: 0; font-size: 15px; font-weight: 700; color: var(--primary); }
.widget-h .vsep { width: 1px; height: 12px; background: var(--border-strong); margin: 0 4px; }
.widget-h .sub { font-size: 12px; font-weight: 500; color: var(--muted); }
.widget-h .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.widget-b { padding: 0 8px 16px; flex: 1; min-height: 0; }
.widget-b.table { padding: 0; }
.widget.chart { min-height: 340px; }

.kpi { position: relative; height: 150px; overflow: hidden; }
.kpi .kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; padding: 2px 16px 0; }
.kpi .kpi-sub { display: flex; gap: 8px; align-items: center; padding: 6px 16px 0; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
.kpi svg.spark { position: absolute; left: 0; right: 0; bottom: 0; height: 40px; width: 100%; display: block; opacity: .9; }
.delta { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; letter-spacing: 0; text-transform: none; white-space: nowrap; flex: none; }
.delta.up { color: #0a8f5c; background: color-mix(in srgb, #10b981 12%, transparent); }
.delta.down { color: #c3244a; background: color-mix(in srgb, #f43f5e 12%, transparent); }
.delta.flat { color: var(--muted); background: var(--surface-2); }

/* ---- chart chrome --------------------------------------------------- */
.chart-host { position: relative; width: 100%; }
.chart-host svg { display: block; width: 100%; overflow: visible; }
.chart-host text { font-family: "Plus Jakarta Sans", sans-serif; fill: var(--label); font-size: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 12px 0; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.sq { width: 10px; height: 10px; border-radius: 3px; }
.donut-wrap { display: flex; align-items: center; gap: 14px; padding: 4px 8px; flex-wrap: wrap; }
.donut-list { flex: 1; min-width: 190px; font-size: 12px; }
.donut-list div { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--surface-2); }
.donut-list div:last-child { border: 0; }
.donut-list .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.donut-list .name { flex: 1; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-list .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-list .pct { color: var(--muted); width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.hbars { display: flex; flex-direction: column; gap: 10px; padding: 6px 12px 4px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; font-size: 12px; }
.hbar .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.hbar .name .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.hbar .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar .track { grid-column: 1 / -1; height: 10px; background: var(--surface-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 0 4px 4px 0; transition: width .3s ease; }
.meter { height: 8px; background: var(--primary-100); border-radius: 4px; overflow: hidden; width: 120px; }
.meter i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.meter.warn { background: color-mix(in srgb, var(--warning) 22%, transparent); } .meter.warn i { background: var(--warning); }
.meter.bad { background: color-mix(in srgb, var(--danger) 22%, transparent); } .meter.bad i { background: var(--danger); }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px 16px; color: var(--muted); text-align: center; }
.empty .ico svg { width: 30px; height: 30px; }
.empty .ico { width: 64px; height: 64px; border-radius: 24px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; box-shadow: inset 0 2px 6px rgb(0 0 0/.08); color: var(--muted-2); }
.empty b { font-size: 16px; color: var(--text); }
.empty p { margin: 0; font-size: 13px; max-width: 340px; line-height: 1.5; }
.empty .btn { margin-top: 8px; }

.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--tip-bg); border: 1px solid var(--tip-border); border-radius: 16px; box-shadow: 0 8px 24px rgb(0 0 0/.14); padding: 12px; min-width: 160px; font-size: 12px; color: var(--text); opacity: 0; transition: opacity .12s; }
.tip.show { opacity: 1; }
.tip .th { font-size: 13px; font-weight: 700; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--tip-border); }
.tip .tr { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.tip .tr i { width: 12px; height: 3px; border-radius: 2px; }
.tip .tr .n { color: var(--muted); flex: 1; font-weight: 600; }
.tip .tr .v { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.tip .big { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.tip .big .dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---- tables --------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--th); color: var(--muted); font-family: "Plus Jakarta Sans", sans-serif; font-weight: 600; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; text-align: left; padding: 10px 12px; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--surface-2); vertical-align: middle; height: 48px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .k { font-weight: 600; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
td .mono { font-size: 11px; }
.scroll { max-height: 360px; overflow: auto; }
.scroll thead th { position: sticky; top: 0; z-index: 1; }
.share { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 5px; overflow: hidden; width: 100%; }
.share i { display: block; height: 100%; border-radius: 2px; }

/* ---- chips ---------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.success { background: var(--success-soft); color: #0a8f5c; } .chip.warning { background: var(--warning-soft); color: #b0700d; } .chip.danger { background: var(--danger-soft); color: #c3244a; } .chip.primary { background: var(--primary-soft); color: var(--primary-700); }
:root[data-theme="dark"] .chip.success, :root[data-theme="dark"] .chip.warning, :root[data-theme="dark"] .chip.danger { color: var(--text); }
.chip.kind { background: color-mix(in srgb, var(--kc) 14%, transparent); color: var(--text); }
.chip.kind .dot { background: var(--kc); }
.route { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 12px; }
.route .alias { font-weight: 700; background: var(--content2); padding: 1px 7px; border-radius: 6px; }
.route .arrow { color: var(--muted-2); }
.route .tgt { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
td.nw { white-space: nowrap; }
table.dense td, table.dense th { padding: 7px 8px; font-size: 12px; height: auto; }
table.dense .chip { height: 20px; font-size: 10px; padding: 0 7px; }

/* ---- text helpers --------------------------------------------------- */
.meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.muted { color: var(--muted); }
td.muted { font-size: 12px; }
td.notes { max-width: 360px; }
.text-danger { color: var(--danger); }
.pad { padding: 4px 16px 16px; }
.prose { font-size: 13px; line-height: 1.6; color: var(--muted); }
.prose b { color: var(--text); }
.chips-cell { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.cell-title { font-size: 12px; width: 100%; }
.pane-label { font-size: 10px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 0 6px; }
.kv-k { width: 45%; }
.notice { display: block; margin: 0 0 16px !important; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.notice.danger { background: var(--danger-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.notice.warning { background: var(--warning-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); line-height: 1.5; }
.notice.info { background: var(--surface-2, transparent); color: var(--text); border: 1px solid var(--border); line-height: 1.5; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li + li { margin-top: 4px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.narrow { max-width: 920px; }
.push { margin-left: auto; }
.spacer { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.hint.pad, .widget > .hint { padding: 4px 16px 16px; }
.docs-frame { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: 12px; background: #fff; }

/* ---- buttons -------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--primary); color: #fff; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--primary-600); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg.i { width: 18px; height: 18px; margin-left: -2px; }
.btn.ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 9px; }
.btn.sm svg.i { width: 15px; height: 15px; }
.btn.icon { padding: 0; width: 36px; }
.btn.sm.icon { width: 28px; }
.btn.icon svg.i { margin: 0; }
.btn.danger { color: #c3244a; border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn.danger-solid { background: var(--danger); }
.btn.danger-solid:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
:root[data-theme="dark"] .btn.danger { color: #ff6b93; }
/* actions stay in view when a wide table scrolls sideways */
td.row-actions { white-space: nowrap; text-align: right; width: 1%; position: sticky; right: 0; background: var(--surface); }
tbody tr:hover td.row-actions { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.scroll td.row-actions, .widget-b > table td.row-actions { box-shadow: -8px 0 8px -8px rgb(0 0 0/.12); }
td.row-actions .btn + .btn { margin-left: 4px; }

/* export menu: a button that opens a short list */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; }
.menu-list button { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu-list button:hover, .menu-list button:focus-visible { background: var(--surface-2); outline: none; }

/* ---- fields: one look everywhere -------------------------------------- */
:where(input:not([type="checkbox"], [type="radio"]), select, textarea) { font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; min-width: 0; }
:where(input:not([type="checkbox"], [type="radio"]), select) { height: 36px; }
:where(input:not([type="checkbox"], [type="radio"]), select, textarea):focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
:where(input, select, textarea):disabled { opacity: .65; cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; }
textarea { min-height: 72px; resize: vertical; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; }
textarea.plain { font-family: inherit; font-size: 14px; }
.mono-input { font-family: "IBM Plex Mono", ui-monospace, monospace !important; font-size: 13px !important; }
.drawer label, .dlg label, .card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.drawer label small, .card label small, .field-label small { font-weight: 500; color: var(--muted-2); }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.filters label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.filters select, .filters input { font-size: 13px; padding: 5px 9px; height: 32px; }
.w-text { width: 180px; }
.grow { flex: 1 1 200px; }
.span-all { grid-column: 1 / -1; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 200; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 13px; opacity: 0; transition: opacity .2s; box-shadow: var(--shadow); pointer-events: none; max-width: min(520px, calc(100vw - 40px)); }
.toast.show { opacity: 1; } .toast.bad { background: var(--danger); }
[hidden] { display: none !important; }

/* ---- structured editors ---------------------------------------------- */
.rb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.rb-route { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 12px; margin-bottom: 10px; background: var(--surface-2); }
.rb-alias { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 8px; }
.rb-alias label { flex: 1; max-width: 320px; }
.rb-targets { display: flex; flex-direction: column; gap: 6px; }
.rb-target { display: grid; grid-template-columns: 22px minmax(180px, 1fr) minmax(240px, 1.6fr) auto auto auto; gap: 6px; align-items: center; }
.rb-target.rb-pattern { grid-template-columns: minmax(120px, .7fr) minmax(200px, 1.6fr) minmax(120px, .8fr) auto; }
.rb-target .rb-n { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.rb-targets > button { align-self: flex-start; }
.rb-target.rb-out select, .rb-target.rb-out input { border-color: color-mix(in srgb, var(--warning) 70%, transparent); }
.rb-why { margin: -2px 0 2px 28px; font-size: 12px; color: var(--muted, inherit); }
.rb-policy { display: flex !important; align-items: center; justify-content: space-between; gap: 10px; }
/* Skipped by an enforced policy: struck through. Outside a policy in report mode it is still
   served, so it keeps its look and carries the warning chip only. */
.route .tgt.out > :not(.chip.warning) { opacity: .55; text-decoration: line-through; }
.rb-target > .field-err { order: 1; grid-column: 2 / -1; }
.rb-model { display: flex; gap: 6px; min-width: 0; }
.rb-model select { flex: 1 1 auto; min-width: 0; }
.rb-model input { flex: 1 1 160px; min-width: 0; }
.rb-model .rb-weight { flex: 0 0 70px; width: 70px; }
.rb-model .rb-tier { flex: 0 0 104px; width: 104px; }
#k-routes { width: 100%; min-height: 160px; }

/* ---- viewer (read-only modal) ------------------------------------------- */
.viewer { position: fixed; inset: 0; z-index: 150; background: color-mix(in srgb, #0b1a26 38%, transparent); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; animation: fadein .15s ease-out; }
.viewer-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); width: min(1200px, 100%); }
.viewer-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 4px 16px 16px; }
.viewer-body .span-all { grid-column: 1 / -1; }
.viewer-body pre { margin: 0; background: var(--surface-2); border-radius: 10px; padding: 12px; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto; font-family: "IBM Plex Mono", ui-monospace, monospace; }
.viewer .widget-h h4 { overflow-wrap: anywhere; }
@media (max-width: 900px) { .viewer-body { grid-template-columns: 1fr; } }

/* ---- compact stat tiles (inside widgets) --------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 0 16px 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; font-family: "Plus Jakarta Sans", sans-serif; }
.stat span { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat .meter { width: 100%; margin-top: 8px; }
.widget-h.sub-h { padding-top: 8px; }
.widget-h.sub-h h4 { font-size: 13px; }
.team-budget { padding: 0 16px 10px; max-width: 360px; }

/* ---- sign-in -------------------------------------------------------- */
.user { font-size: 13px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user:empty { display: none; }
.login { max-width: 420px; margin: 10vh auto 0; padding: 32px 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; text-align: center; }
.login .tile { margin: 0 auto 14px; width: 58px; height: 58px; border-radius: 14px; background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--text); display: flex; align-items: center; justify-content: center; }
.login .tile svg { width: 32px; height: 34px; }
.login h2 { margin: 0 0 6px; font-size: 20px; }
.login p { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }

/* ---- getting started ------------------------------------------------ */
/* One column: the endpoint rows and code blocks need the full width to stay on one line. */
.start { display: grid; grid-template-columns: 1fr; gap: 16px; }
.start .widget { min-width: 0; }
.start #gs-agent { max-height: 420px; white-space: pre-wrap; word-break: break-word; }
.start .widget-b { padding: 4px 16px 16px; }
.start p { margin: 8px 0; line-height: 1.55; color: var(--muted); }
.start ol { margin: 8px 0; padding-left: 20px; line-height: 1.6; }
.endpoint { display: flex; align-items: center; gap: 10px; margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.endpoint b { font-size: 12px; color: var(--muted); min-width: 120px; }
.endpoint code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; user-select: all; overflow-wrap: anywhere; min-width: 0; }
.start pre { margin: 8px 0 0; background: var(--surface-2); border-radius: 10px; padding: 12px; font-size: 12px; line-height: 1.5; white-space: pre; overflow: auto; font-family: "IBM Plex Mono", ui-monospace, monospace; }
.start .seg { margin-top: 6px; }

/* ---- form errors ------------------------------------------------------ */
.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft) !important; }
.field-err { display: block; color: var(--danger); font-size: 11px; font-weight: 500; margin-top: 2px; }

/* ---- table filters ---------------------------------------------------- */
.tfilter { height: 28px; padding: 0 10px !important; border-radius: 8px !important; font-size: 12px !important; width: 180px; }
.tcount { white-space: nowrap; }
.tcount:empty { display: none; }
@media (max-width: 700px) { .tfilter { width: 120px; } }

/* ---- live view --------------------------------------------------------- */
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #f31260; margin-right: 2px; box-shadow: 0 0 0 0 rgba(243, 18, 96, .6); animation: livepulse 1.4s infinite; }
.live-dot.off { background: var(--muted-2); animation: none; box-shadow: none; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(243, 18, 96, .55); } 70% { box-shadow: 0 0 0 8px rgba(243, 18, 96, 0); } 100% { box-shadow: 0 0 0 0 rgba(243, 18, 96, 0); } }
.live .kpi-value { font-variant-numeric: tabular-nums; transition: color .3s; }
.live tr.fresh td { animation: livefresh 1.6s ease-out; }
@keyframes livefresh { from { background: color-mix(in srgb, var(--primary) 22%, transparent); } to { background: transparent; } }
.live .chart-host svg path, .live .chart-host svg circle { transition: none; }

/* ---- drawer: every editor ------------------------------------------------------ */
body.drawer-open { overflow: hidden; }
body.drawer-open .toast { bottom: 84px; }
.drawer-backdrop { position: fixed; inset: 0; background: color-mix(in srgb, #0b1a26 38%, transparent); backdrop-filter: blur(2px); z-index: 80; animation: fadein .15s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--bg); z-index: 81; display: flex; flex-direction: column; box-shadow: -18px 0 48px rgba(0, 0, 0, .18); animation: slidein .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; } }
.drawer-h { display: flex; align-items: flex-start; gap: 12px; padding: 20px 24px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer-h > div { flex: 1; min-width: 0; }
.drawer-h h3 { margin: 0; font-size: 19px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.drawer-h p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.drawer-h p:empty { display: none; }
.drawer-b { flex: 1; overflow: auto; padding: 18px 24px 28px; display: flex; flex-direction: column; gap: 12px; }
.drawer-b > * { flex: none; }  /* sections keep their height; the body scrolls */
.drawer-f { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); }
.drawer-f .hint { margin-left: auto; color: var(--warning); font-weight: 600; }
.drawer .widget { border-radius: 14px; }
.drawer .empty { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.ks-lead { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.ks-lead.one { grid-template-columns: 1fr; }
.ks-lead.three { grid-template-columns: 1.6fr 1fr 1fr; }
.ks-lead.three > label:first-child select { font-weight: 600; }
.rp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rp-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; }
.rp-opt:has(input:checked) { border-color: var(--primary, #00a5a6); box-shadow: 0 0 0 1px var(--primary, #00a5a6); }
.rp-opt input { margin-top: 3px; accent-color: var(--primary, #00a5a6); }
.rp-opt span { display: flex; flex-direction: column; gap: 2px; }
.rp-opt small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.lbl-t { display: block; font-size: 12px; margin-bottom: 6px; color: var(--muted); }
@media (max-width: 720px) { .rp-grid, .ks-lead.three { grid-template-columns: 1fr; } }
.ks-lead > label:first-child input { font-size: 16px; font-weight: 600; }
.ks { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.ks > summary, .ks-head { list-style: none; display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.ks > summary { cursor: pointer; user-select: none; }
.ks > summary::-webkit-details-marker { display: none; }
.ks > summary:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.ks > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ks-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.ks-ico svg.i { width: 18px; height: 18px; }
.ks-t { display: flex; flex-direction: column; min-width: 0; }
.ks-t b { font-size: 14px; font-family: "Plus Jakarta Sans", sans-serif; }
.ks-t small { color: var(--muted); font-size: 12px; }
.ks-sum { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.ks[open] .ks-sum { display: none; }
.ks-chev { width: 16px !important; height: 16px !important; color: var(--muted); stroke-width: 2 !important; transition: transform .15s; }
.ks[open] .ks-chev { transform: rotate(90deg); margin-left: auto; }
.ks-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); }
.ks-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.ks-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 14px; color: var(--text); }
.ks-row > span { white-space: nowrap; }
.ks-note { color: var(--muted); font-size: 12px; white-space: normal !important; }
.ks-row .w-num, .w-num { width: 96px; }
.w-money { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding-left: 10px; }
.w-money i { font-style: normal; color: var(--muted); }
.w-money input { border: 0 !important; box-shadow: none !important; width: 110px; padding-left: 6px; height: 34px; }
.w-money:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ks-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ks-more .ks-grid { padding-top: 10px; }
.ks-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary); }
.ks-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tog { flex-direction: row !important; }
.tog input { position: absolute; opacity: 0; pointer-events: none; }
.tog span { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; font-family: "Work Sans", system-ui, sans-serif; }
.tog span:hover { border-color: var(--border-strong); }
.tog input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-700); }
:root[data-theme="dark"] .tog input:checked + span { color: var(--text); }
.tog input:checked + span::before { content: "✓"; margin-right: 6px; font-weight: 700; }
.tog input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.filters .ks-chips { gap: 6px; }
.filters .tog span { min-height: 28px; font-size: 12px; }

/* ---- settings cards: the same groups, on the page ------------------------------ */
.card .widget-h { gap: 12px; padding: 14px 16px; }
.card-b { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.card-f { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.card-f .hint { color: var(--warning); font-weight: 600; }
.dest-row { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(200px, 2fr) minmax(160px, 1fr) auto; gap: 10px; align-items: end; }
.dest-row .btn { margin-bottom: 4px; }

/* ---- dialogs ---------------------------------------------------------------- */
.dlg { position: fixed; z-index: 160; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100vw - 32px)); background: var(--surface); border-radius: 18px; padding: 24px; box-shadow: 0 24px 64px rgba(0, 0, 0, .25); animation: fadein .15s ease-out; }
.dlg-backdrop { z-index: 159; }
.dlg h3 { margin: 0 0 6px; font-size: 18px; overflow-wrap: anywhere; }
.dlg p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.dlg code { display: block; padding: 12px; border-radius: 10px; background: var(--surface-2); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; overflow-wrap: anywhere; user-select: all; }
.dlg .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---- phone ---------------------------------------------------------------- */
@media (max-width: 720px) {
  #menu { display: inline-flex; }
  #collapse, .crumbs, .user, .pillbar .sep { display: none; }
  .topbar .spacer { display: none; }
  .pillbar { flex: 1; min-width: 0; justify-content: flex-end; }
  .card-f { flex-wrap: wrap; }
  .sidebar { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(var(--sidebar-w), 86vw) !important; overflow-y: auto; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 69; background: color-mix(in srgb, #0b1a26 38%, transparent); }
  .shell.collapsed .sidebar .lbl, .shell.collapsed .nav-sec span { display: inline; }
  .shell.collapsed .sidebar .brand, .shell.collapsed .sidebar-foot { display: block; }
  .topbar { padding: 0 8px; gap: 6px; }
  .pillbar select { flex: 1; min-width: 0; }
  .content { padding: 0 8px 8px; }
  .page-h .tile { display: none; }
  .page-h .actions { margin-left: 0; flex-wrap: wrap; }
  .dest-row { grid-template-columns: 1fr auto; }
  .dest-row label:nth-child(2), .dest-row label:nth-child(3) { grid-column: 1 / -1; }
  .dest-row .btn { grid-row: 1; grid-column: 2; }
}
@media (max-width: 640px) {
  .ks-lead, .ks-grid { grid-template-columns: 1fr; }
  .drawer-b { padding: 14px 16px 24px; }
  .drawer-h, .drawer-f { padding-left: 16px; padding-right: 16px; }
  .ks-sum { display: none; }
  .drawer .rb-target { display: flex; flex-wrap: wrap; align-items: center; }
  .drawer .rb-target > select, .drawer .rb-target > .rb-model { flex: 1 1 calc(100% - 32px); min-width: 0; }
  .drawer .rb-target > .rb-model { margin-left: 28px; flex-wrap: wrap; }
  .drawer .rb-target > button { flex: none; }
  .drawer .rb-pattern > input { flex: 1 1 100%; }
  .w-text { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-backdrop, .dlg, .viewer, .live-dot, .live tr.fresh td { animation: none; }
  .sidebar { transition: none; }
  .page.loading { animation: none; background-size: 100% 3px; }
}

/* ---- shadow semantic cache (System) ------------------------------------------- */
tr.ref td { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.shadow-examples { display: flex; flex-direction: column; gap: 12px; }
.shadow-ex { border: 1px solid var(--border); border-left: 4px solid var(--danger); border-radius: 12px; padding: 12px 14px; }
.shadow-ex.ok { border-left-color: var(--success); }
.shadow-ex-h { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; margin-bottom: 10px; }
.shadow-ex-h .muted { margin-left: auto; }
.shadow-ex-b { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.shadow-ex-b p { margin: 0 0 10px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 900px) { .shadow-ex-b { grid-template-columns: 1fr; } }
#ai-form textarea { font-family: inherit; font-size: 14px; }

/* ---- needs attention (Overview) ---------------------------------------------- */
.attn { list-style: none; margin: 0; padding: 0 8px; display: flex; flex-direction: column; gap: 4px; }
.attn li { display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 0 0 0 12px; background: var(--surface-2); }
.attn li.danger { background: var(--danger-soft); } .attn li.warning { background: var(--warning-soft); }
.attn .attn-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--primary); }
.attn li.danger .attn-dot { background: var(--danger); } .attn li.warning .attn-dot { background: var(--warning); }
.attn a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 0; color: var(--text); text-decoration: none; line-height: 1.45; }
.attn a > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.attn a svg.i { width: 18px; height: 18px; color: var(--muted); }
.attn a:hover > span { text-decoration: underline; text-underline-offset: 3px; }
.attn a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }

/* Entity names that lead to their detail. Underlined on hover and focus only, so dense tables
   stay readable; the colour says they are links (with the underline, not colour alone). */
a.ent { color: inherit; font-weight: inherit; text-decoration: underline dotted color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 3px; }
a.ent:hover, a.ent:focus-visible { color: var(--primary-700); text-decoration: underline solid; }
:root[data-theme="dark"] a.ent:hover { color: var(--primary); }
.hbar .name a.ent { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Long tables: the first rows, then one button for the rest. */
.tmore { margin: 8px 8px 0; }
.widget .scroll:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

@media (max-width: 720px) {
  /* The company picker keeps its own line short: long names end in an ellipsis. */
  #company { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 100%; }
  .kpi .kpi-sub { flex-wrap: nowrap; min-width: 0; }
  .kpi .kpi-sub > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  #company { flex: 1 1 8em; min-width: 7em; }
}

/* Virtual keys: routes wrap per target and the access chips wrap, so a row fits a 1440 px
   screen; narrower screens scroll the table sideways. */
.keys-table td:nth-child(2) { min-width: 260px; }
.keys-table td:nth-child(3) > div:first-child { flex-wrap: wrap; row-gap: 2px; }
.keys-table td:nth-child(5) { min-width: 150px; }
/* One line per target under its alias, in failover order. */
.keys-table .route { flex-direction: column; align-items: flex-start; gap: 3px; }
.keys-table .route + .route { margin-top: 8px; }
.keys-table .route .arrow { display: none; }
.keys-table .route .tgt { white-space: normal; flex-wrap: wrap; padding-left: 14px; position: relative; }
.keys-table .route .tgt::before { content: "→"; position: absolute; left: 0; top: 2px; color: var(--muted-2); }
.keys-table .route .tgt > span:not(.chip) { overflow-wrap: anywhere; }

/* ---- discovery and resolver ------------------------------------------------------------ */
/* Hidden visually, kept for screen readers (sort announcements, captions, field labels). */
.visually-hidden:where(:not(:focus-within, :active)) { position: absolute !important; clip-path: inset(50%) !important; overflow: hidden !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; border: 0 !important; white-space: nowrap !important; }

/* Sortable headers: the button fills the cell; the direction icon follows th[aria-sort]. */
th:has(> .th-sort) { padding: 0; }
.th-sort { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 4px; width: 100%; min-height: 32px; padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; }
th.num .th-sort { justify-content: flex-end; }
.th-sort:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 6px; }
.th-sort .sort-ico { width: 14px; height: 14px; opacity: .35; flex: none; }
th[aria-sort] .sort-ico { opacity: 1; color: var(--primary); }
th[aria-sort="ascending"] .sort-ico .down, th[aria-sort="descending"] .sort-ico .up { display: none; }

/* Allow/block switch: native where `switch` is supported, a styled checkbox elsewhere. */
.switch-l { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; min-height: 24px; }
.switch-l input { accent-color: var(--danger); margin: 0; cursor: pointer; width: 18px; height: 18px; }
.switch-l input[switch] { width: auto; height: auto; }
.switch-l input:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.switch-l input:checked + span { color: #c3244a; font-weight: 600; }
.switch-l input:disabled { cursor: progress; }

/* Editable lists of addresses: errors appear only after the person leaves the field. */
.src-list { display: grid; gap: 8px; margin-bottom: 10px; }
.src-list:empty { display: none; }
.src-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.src-row input { width: 100%; box-sizing: border-box; }
.error-msg { display: none; color: #c3244a; font-size: 12px; margin-top: 4px; align-items: center; gap: 4px; }
.error-msg .i { width: 14px; height: 14px; }
.src-row input:user-invalid { border-color: var(--danger); background: var(--danger-soft); }
.src-row input:user-invalid + .error-msg { display: flex; }
@media (max-width: 720px) { .src-row { grid-template-columns: minmax(0, 1fr) auto; } .src-row > .field:nth-child(2) { grid-column: 1; } }

.kv { display: grid; grid-template-columns: 8.5em minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.kv > span { color: var(--muted); }
.kv code { background: var(--surface-2); padding: 4px 8px; border-radius: 6px; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 720px) { .kv { grid-template-columns: minmax(0, 1fr) auto; } .kv > span { grid-column: 1 / -1; } }
pre.code { margin: 8px 0 0; background: var(--surface-2); border-radius: 10px; padding: 12px; font-size: 12px; line-height: 1.5; white-space: pre; overflow: auto; }
#rs-devices input { width: 100%; min-width: 7em; box-sizing: border-box; }
.stats.six { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.hscroll { overflow-x: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 11em; }
.dev-list { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.dev-list legend { padding: 0; margin-bottom: 6px; }
.tog-row { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.ks-label { display: block; margin-bottom: 6px; font-size: 13px; }
.switch-l, .tog-row { flex-direction: row !important; justify-content: flex-start; align-self: flex-start; }
.eff { margin: 4px 0 8px; padding-left: 18px; display: grid; gap: 2px; }
.sel-sm { width: auto; min-width: 0; padding-block: 4px; font-size: 13px; }
