/* voicebot-dashboard (T-080). One stylesheet, tokens on :root, light + dark (OS or toggle). */

:root {
  color-scheme: light;
  --page: #f3f5f6;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --sunken: #eaeef0;
  --ink: #15202b;
  --ink-2: #4a5864;
  --muted: #7b8792;
  --line: #dde3e7;
  --line-strong: #c4cdd3;
  --accent: #1f6fb2;
  --accent-ink: #ffffff;
  --accent-wash: #e3eef8;
  --caller: #1baf7a;
  --agent: #2a78d6;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --s7: #4a3aa7;
  --s8: #e34948;
  --good: #0ca30c;
  --good-ink: #0a6e0a;
  --warn: #fab219;
  --warn-ink: #8a5a00;
  --serious: #ec835a;
  --crit: #d03b3b;
  --crit-ink: #b02a2a;
  --neutral-mark: #a9b4bc;
  --grid: #e7ecef;
  --focus: #1f6fb2;
  --shadow: 0 1px 2px rgba(21, 32, 43, 0.06);
  --r-sm: 5px;
  --r: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rail: 208px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1417;
  --surface: #161d21;
  --surface-2: #1b2328;
  --sunken: #11181b;
  --ink: #e9eef1;
  --ink-2: #b5c0c7;
  --muted: #84919a;
  --line: #263137;
  --line-strong: #34424a;
  --accent: #5aa2e6;
  --accent-ink: #0b1a26;
  --accent-wash: #16293a;
  --caller: #199e70;
  --agent: #3987e5;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --s6: #008300;
  --s7: #9085e9;
  --s8: #e66767;
  --good-ink: #3fcf3f;
  --warn-ink: #fab219;
  --crit-ink: #ff7b7b;
  --neutral-mark: #56646d;
  --grid: #222c31;
  --focus: #5aa2e6;
  --shadow: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f1417;
    --surface: #161d21;
    --surface-2: #1b2328;
    --sunken: #11181b;
    --ink: #e9eef1;
    --ink-2: #b5c0c7;
    --muted: #84919a;
    --line: #263137;
    --line-strong: #34424a;
    --accent: #5aa2e6;
    --accent-ink: #0b1a26;
    --accent-wash: #16293a;
    --caller: #199e70;
    --agent: #3987e5;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s6: #008300;
    --s7: #9085e9;
    --s8: #e66767;
    --good-ink: #3fcf3f;
    --warn-ink: #fab219;
    --crit-ink: #ff7b7b;
    --neutral-mark: #56646d;
    --grid: #222c31;
    --focus: #5aa2e6;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; line-height: 1.25; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--ink-2); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- shell */
.shell { background: linear-gradient(to right, var(--surface) calc(var(--rail) - 1px), var(--line) calc(var(--rail) - 1px), var(--line) var(--rail), var(--page) var(--rail)); display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 10px;
}
.wordmark { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--ink); }
.wordmark:hover { text-decoration: none; }
.wordmark svg { flex: none; }
.logo-bg { fill: var(--accent); }
.logo-wave { stroke: var(--accent-ink); fill: none; }
.wordmark b { font-size: 16px; letter-spacing: -0.02em; }
.wordmark span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-wash); color: var(--accent); }
.nav svg { width: 17px; height: 17px; flex: none; }
.nav .count { margin-left: auto; font-size: 11px; background: var(--crit); color: #fff; border-radius: 9px; padding: 0 6px; }
.rail-foot { margin-top: auto; padding: 12px 8px 0; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.rail-foot button { justify-content: flex-start; }

.main { min-width: 0; display: flex; flex-direction: column; }
.strip {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 9px 24px; background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.strip .item { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); white-space: nowrap; }
.strip .item b { color: var(--ink); font-weight: 600; }
.strip .spacer { flex: 1; }
.content { padding: 20px 24px 48px; max-width: 1520px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* live dot: the one animated element */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-mark); flex: none; }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.dot.live { background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------------------------------------------------------------- panels */
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 16px 0; flex-wrap: wrap; }
.panel > header .hint { font-size: 12px; color: var(--muted); }
.panel .body { padding: 12px 16px 14px; }
.panel .body.flush { padding: 8px 0 0; }
.section-gap { margin-top: 14px; }

/* stat row: one continuous band split by hairlines, not a card per number */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 14px;
}
.stat { padding: 12px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; min-width: 0; }
.stat .k { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; white-space: nowrap; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.stat .d { font-size: 12px; color: var(--ink-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.hero .v { font-size: 30px; }
.stat .v.crit { color: var(--crit-ink); }
.stat .v.warn { color: var(--warn-ink); }
.stat .v.good { color: var(--good-ink); }

/* key/value facts */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 18px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 1px 0 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- pills & badges */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap;
  background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line);
}
.pill.good { background: color-mix(in srgb, var(--good) 13%, transparent); color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pill.crit { background: color-mix(in srgb, var(--crit) 13%, transparent); color: var(--crit-ink); border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.pill.info { background: var(--accent-wash); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.pill svg { width: 12px; height: 12px; }
.code-badge { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 4px; background: var(--sunken); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }

/* ---------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--surface-2); }
.tbl th button.sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.tbl th button.sort:focus-visible { outline: 2px solid var(--focus); }
.tbl th[aria-sort] { color: var(--ink); }
.tbl tfoot td { font-weight: 600; background: var(--surface-2); }
.cell-warn { color: var(--warn-ink); font-weight: 600; }
.cell-crit { color: var(--crit-ink); font-weight: 600; }
.cell-bar { position: relative; }
.cell-bar i { position: absolute; left: 0; bottom: 3px; height: 3px; border-radius: 2px; background: var(--s1); opacity: 0.55; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 13px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 4px 10px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); }
.input, select.input {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm);
  padding: 5px 8px; min-height: 31px; font-size: 13px; min-width: 0; max-width: 100%;
}
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters .field { flex: 0 1 160px; }
.filters .field.grow { flex: 1 1 220px; }
.filterbox > summary { display: none; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: 13px; }

/* ---------------------------------------------------------------- charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--line-strong); stroke-width: 1; }
.chart .threshold { stroke: var(--crit); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .threshold-label { fill: var(--crit-ink); font-size: 11px; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 2; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); padding-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 1px; width: 14px; }
.legend i.dash { height: 0; border-top: 2px dashed; width: 14px; background: none !important; }
.tip {
  position: absolute; pointer-events: none; z-index: 30; min-width: 120px; max-width: 260px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); padding: 7px 9px; font-size: 12px; display: none;
}
.tip .t { color: var(--muted); margin-bottom: 3px; }
.tip .row { display: flex; justify-content: space-between; gap: 12px; }
.tip .row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tip .row span { display: inline-flex; align-items: center; gap: 5px; }
.tip .row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.empty { padding: 26px 16px; color: var(--muted); text-align: center; font-size: 13px; }
.na { color: var(--muted); font-style: italic; }

/* bar list (magnitude, one hue) */
.bars { display: flex; flex-direction: column; gap: 5px; }
.bars .b { display: grid; grid-template-columns: minmax(80px, 36%) minmax(0, 1fr) 72px; align-items: center; gap: 10px; font-size: 13px; }
.bars .b .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .b .track { height: 12px; background: var(--sunken); border-radius: 3px; overflow: hidden; }
.bars .b .fill { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; min-width: 2px; }
.bars .b .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.bars .b.link { cursor: pointer; }
.bars .b.link:hover .l { color: var(--accent); }

/* meter (value vs threshold) */
.meter { position: relative; height: 8px; background: var(--sunken); border-radius: 4px; }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--s1); }
.meter .fill.crit { background: var(--crit); }
.meter .fill.warn { background: var(--warn); }
.meter .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); border-radius: 1px; }

/* ---------------------------------------------------------------- call detail */
.call-title { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.call-title h1 { font-family: var(--mono); font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.call-title h1.sans { font-family: var(--sans); font-size: 20px; }
.player { display: flex; flex-direction: column; gap: 10px; }
.player audio { width: 100%; height: 36px; }
.wave { position: relative; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; overflow: hidden; }
.wave canvas { display: block; width: 100%; height: 132px; }
.wave .lane-label { position: absolute; left: 8px; font-size: 11.5px; font-weight: 600; padding: 0 5px; border-radius: 3px; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.wave .lane-label.caller { top: 5px; color: var(--caller); }
.wave .lane-label.agent { top: 71px; color: var(--agent); }
.transcript { display: flex; flex-direction: column; gap: 2px; max-height: 620px; overflow-y: auto; }
.tr { display: grid; grid-template-columns: 64px 74px minmax(0, 1fr); gap: 10px; padding: 6px 4px; border-radius: var(--r-sm); align-items: baseline; }
.tr:hover { background: var(--surface-2); }
.tr .at { font-family: var(--mono); font-size: 12px; color: var(--muted); cursor: pointer; }
.tr .who { font-size: 12px; font-weight: 600; }
.tr.caller .who { color: var(--caller); }
.tr.agent .who { color: var(--agent); }
.tr .say { overflow-wrap: anywhere; }
.tr .say .meta { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.tr.agent.line .say { color: var(--ink-2); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 64px 14px minmax(0, 1fr); gap: 8px; padding: 4px 0; align-items: baseline; font-size: 13px; }
.timeline .at { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.timeline .mk { width: 9px; height: 9px; border-radius: 50%; background: var(--neutral-mark); align-self: center; }
.timeline .mk.good { background: var(--good); }
.timeline .mk.warn { background: var(--warn); }
.timeline .mk.crit { background: var(--crit); }
.timeline .mk.info { background: var(--accent); }
details.raw summary { cursor: pointer; color: var(--ink-2); padding: 12px 16px; }
details.raw pre { margin: 0; padding: 0 16px 16px; max-height: 520px; overflow: auto; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.navpair { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; }
.login-card .wordmark { padding: 0 0 20px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.login-card .input { width: 100%; min-height: 36px; }
.login-card .btn { justify-content: center; min-height: 36px; }
.login-card .err { color: var(--crit-ink); font-size: 13px; min-height: 18px; }
.login-card p.foot { color: var(--muted); font-size: 12px; margin: 14px 2px 0; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-21, .g-12 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: var(--page); }
  .rail { position: sticky; top: 0; z-index: 25; height: auto; flex-direction: row; align-items: center; padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
  .wordmark { padding: 2px 8px 2px 2px; }
  .wordmark span { display: none; }
  .nav { flex-direction: row; gap: 0; }
  .nav a { padding: 6px 9px; }
  .nav a .lbl { display: none; }
  .nav a[aria-current="page"] .lbl { display: inline; }
  .rail-foot { margin: 0 0 0 auto; padding: 0; flex-direction: row; }
  .rail-foot .who { display: none; }
  .strip { position: static; padding: 8px 16px; }
  .content { padding: 14px 16px 40px; }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .v { font-size: 19px; }
  .stat.hero .v { font-size: 24px; }
  .bars .b { grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) 60px; }
  .tr { grid-template-columns: 50px minmax(0, 1fr); }
  .tr .who { grid-column: 2; }
  .tr .at { grid-row: span 2; }
  .tr .say { grid-column: 2; }
  /* calls table becomes a list of rows */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: 10px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; }
  table.cards td { border: 0; padding: 0 !important; text-align: left !important; font-size: 12.5px; }
  table.cards td[data-l]::before { content: attr(data-l) " "; color: var(--muted); }
  table.cards td.span2 { grid-column: 1 / -1; }
  .filters .field, .filters .field.grow { flex: 1 1 140px; }
  .filterbox > summary { display: block; cursor: pointer; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--accent); font-weight: 500; }
  table.cards td.hide-m { display: none; }
  table.cards .desc { display: none; }
  .detail-top > .stack { order: -1; }
  .facts { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .wordmark div { display: none; }
}

/* ---------------------------------------------------------------- configuration pages */
.nav-sep { font-size: 11.5px; color: var(--muted); padding: 14px 10px 4px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 60; max-width: 440px; background: var(--surface); border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 10px 14px; font-size: 13px; }
.toast.good { border-left-color: var(--good); }
.toast.crit { border-left-color: var(--crit); }
.toast.warn { border-left-color: var(--warn); }
.editor { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.groupnav { position: sticky; top: 56px; display: flex; flex-direction: column; gap: 1px; padding: 8px; }
.groupnav a { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 13px; }
.groupnav a:hover { background: var(--surface-2); text-decoration: none; }
.groupnav a .n { font-size: 11px; color: var(--accent); font-weight: 600; }
.groupnav .input { width: 100%; margin-bottom: 8px; }
.groupnav label.chk { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-2); padding: 6px 4px 2px; }
.fields { display: flex; flex-direction: column; }
.frow { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 118px; gap: 6px 16px; padding: 10px 16px; border-top: 1px solid var(--line); align-items: start; }
.frow:first-child { border-top: 0; }
.frow .fl b { font-weight: 600; font-size: 13.5px; }
.frow .fl .key { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-left: 6px; }
.frow .fl p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.frow .fl .def { font-size: 12px; color: var(--muted); }
.frow .fc { display: flex; gap: 6px; align-items: center; min-width: 0; }
.frow .fc .input { width: 100%; }
.frow .fc textarea.input { min-height: 72px; font-family: var(--sans); resize: vertical; }
.frow .fc .unit { font-size: 12px; color: var(--muted); white-space: nowrap; }
.frow .fs { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.frow.over { background: color-mix(in srgb, var(--accent-wash) 55%, transparent); }
.frow.locked .fc, .frow.locked .fl b { opacity: .6; }
.frow .err { grid-column: 1 / -1; color: var(--crit-ink); font-size: 12.5px; }
.frow .why { font-size: 12px; color: var(--muted); }
.savebar { position: sticky; bottom: 0; z-index: 15; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 16px; margin-top: 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: 0 -6px 18px rgba(0,0,0,.08); }
.savebar .input { flex: 1 1 220px; }
.savebar[hidden] { display: none; }
.secret { font-family: var(--mono); font-size: 14px; padding: 8px 10px; background: var(--sunken); border: 1px dashed var(--warn); border-radius: var(--r-sm); overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.warnbox { border: 1px solid color-mix(in srgb, var(--crit) 45%, transparent); background: color-mix(in srgb, var(--crit) 8%, transparent); color: var(--crit-ink); border-radius: var(--r-sm); padding: 8px 10px; font-size: 13px; }
.diff .old { color: var(--crit-ink); text-decoration: line-through; }
.diff .new { color: var(--good-ink); }
.btn.danger { border-color: color-mix(in srgb, var(--crit) 50%, transparent); color: var(--crit-ink); }
.copy { cursor: pointer; }
.uri { font-family: var(--mono); font-size: 13px; }
@media (max-width: 860px) {
  .nav-sep { display: none; }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .groupnav { position: static; flex-direction: row; flex-wrap: wrap; }
  .groupnav .input { flex: 1 1 100%; }
  .groupnav #gnav-links { display: flex; gap: 2px; overflow-x: auto; white-space: nowrap; width: 100%; }
  .savebar { padding: 8px 10px; gap: 6px; }
  .frow { grid-template-columns: minmax(0, 1fr); }
  .frow .fs { flex-direction: row; align-items: center; justify-content: flex-start; }
  .toast { left: 16px; right: 16px; bottom: 16px; }
}
.err { color: var(--crit-ink); }
