/* IBM Plex (SIL OFL 1.1, see fonts/OFL.txt), self-hosted: the CSP only allows 'self'. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-500.woff2") format("woff2"); }

:root {
  --bg: oklch(0.982 0.003 264); --side: oklch(0.962 0.004 264); --panel: #fff; --soft: oklch(0.955 0.004 264);
  --text: oklch(0.23 0.015 264); --muted: oklch(0.50 0.015 264); --line: oklch(0.915 0.005 264);
  --accent: oklch(0.52 0.16 272); --accent-soft: oklch(0.95 0.03 272); --on-accent: #fff;
  --ok: oklch(0.55 0.13 155); --ok-soft: oklch(0.95 0.04 155);
  --warn: oklch(0.56 0.13 65); --warn-soft: oklch(0.96 0.045 80);
  --danger: oklch(0.55 0.19 27); --danger-soft: oklch(0.955 0.03 27);
  /* chart series: same lightness and chroma, different hue */
  --c1: oklch(0.58 0.14 272); --c2: oklch(0.62 0.14 200); --c3: oklch(0.60 0.14 155);
  --c4: oklch(0.66 0.14 65); --c5: oklch(0.60 0.14 330); --c6: oklch(0.60 0.14 27);
  --shadow: 0 1px 2px oklch(0.2 0.02 264 / 0.05);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
  --code: oklch(0.975 0.004 264);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(0.165 0.006 264); --side: oklch(0.145 0.006 264); --panel: oklch(0.20 0.007 264); --soft: oklch(0.24 0.008 264);
    --text: oklch(0.94 0.005 264); --muted: oklch(0.70 0.012 264); --line: oklch(0.285 0.008 264);
    --accent: oklch(0.72 0.12 272); --accent-soft: oklch(0.30 0.06 272); --on-accent: oklch(0.16 0.02 272);
    --ok: oklch(0.76 0.13 155); --ok-soft: oklch(0.29 0.05 155);
    --warn: oklch(0.80 0.12 75); --warn-soft: oklch(0.31 0.05 75);
    --danger: oklch(0.73 0.15 27); --danger-soft: oklch(0.30 0.06 27);
    --c1: oklch(0.74 0.12 272); --c2: oklch(0.76 0.12 200); --c3: oklch(0.76 0.12 155);
    --c4: oklch(0.80 0.12 75); --c5: oklch(0.74 0.12 330); --c6: oklch(0.73 0.13 27);
    --shadow: none;
    --code: oklch(0.18 0.006 264);
    color-scheme: dark;
  }
}
/* Dark chosen in the sidebar switch, whatever the OS says. */
:root[data-theme="dark"] {
  --bg: oklch(0.165 0.006 264); --side: oklch(0.145 0.006 264); --panel: oklch(0.20 0.007 264); --soft: oklch(0.24 0.008 264);
  --text: oklch(0.94 0.005 264); --muted: oklch(0.70 0.012 264); --line: oklch(0.285 0.008 264);
  --accent: oklch(0.72 0.12 272); --accent-soft: oklch(0.30 0.06 272); --on-accent: oklch(0.16 0.02 272);
  --ok: oklch(0.76 0.13 155); --ok-soft: oklch(0.29 0.05 155);
  --warn: oklch(0.80 0.12 75); --warn-soft: oklch(0.31 0.05 75);
  --danger: oklch(0.73 0.15 27); --danger-soft: oklch(0.30 0.06 27);
  --c1: oklch(0.74 0.12 272); --c2: oklch(0.76 0.12 200); --c3: oklch(0.76 0.12 155);
  --c4: oklch(0.80 0.12 75); --c5: oklch(0.74 0.12 330); --c6: oklch(0.73 0.13 27);
  --shadow: none;
  --code: oklch(0.18 0.006 264);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 13.5px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
code, .mono, pre { font-family: var(--mono); }
code { font-size: 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.error { color: var(--danger); margin: 0; }
.note { background: var(--warn-soft); color: var(--warn); padding: 9px 12px; border-radius: 8px; margin: 0 0 14px; }
h2 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 10px; }
b { font-weight: 600; }

/* controls */
button, select, input, textarea { font: inherit; color: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line);
  background: var(--panel); border-radius: 8px; font-weight: 500; cursor: pointer; box-shadow: var(--shadow); white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s; }
button:hover:not(:disabled) { border-color: color-mix(in oklch, var(--accent) 45%, var(--line)); }
button:focus-visible, select:focus-visible, input:focus-visible, .logbox:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover:not(:disabled) { background: color-mix(in oklch, var(--accent) 88%, var(--text)); border-color: transparent; }
button.ghost { background: transparent; box-shadow: none; }
button.danger { color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 40%, var(--line)); }
button.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
button.danger.solid:hover:not(:disabled) { background: color-mix(in oklch, var(--danger) 88%, black); }
td button, .secretrow button, .toolbar button.ghost { min-height: 28px; padding: 0 10px; font-size: 12.5px; }
select, input[type="search"], input[type="url"], input[type="email"], input[type="text"], input:not([type]), input[type="password"] {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; min-height: 32px; padding: 0 10px; box-shadow: var(--shadow); }
input[type="file"] { font-size: 12.5px; }
input[type="search"] { min-width: 200px; flex: 1 1 200px; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
::placeholder { color: color-mix(in oklch, var(--muted) 80%, transparent); }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand > span:last-child { display: grid; line-height: 1.25; }
.brand b { font-size: 14px; letter-spacing: -0.01em; }
.brand small { font: 11px var(--mono); color: var(--muted); }
.mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; flex: none; }
.mark i { width: 10px; height: 10px; border-radius: 50%; background: var(--on-accent); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px;
  display: grid; gap: 16px; box-shadow: 0 8px 30px oklch(0.2 0.02 264 / 0.07); }
.login-card label { display: grid; gap: 6px; font-weight: 500; }
.login-card input { min-height: 36px; }
.login-card button.primary { min-height: 36px; }
.login-card p { margin: 0; }

/* shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--side) 231px, var(--line) 231px 232px, transparent 232px); }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); border-right: 1px solid var(--line);
  padding: 18px 12px 12px; display: flex; flex-direction: column; gap: 22px; }
.side > .brand { padding: 0 8px; }
.tabs { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.navgroup { display: flex; flex-direction: column; gap: 1px; }
.navgroup:not(:has(button:not([hidden]))) { display: none; }
.navbottom { margin-top: auto; }
.navlabel { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0 10px 6px; }
.tabs button { justify-content: flex-start; gap: 10px; min-height: 34px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent;
  box-shadow: none; color: var(--muted); text-align: left; font-weight: 500; }
.tabs button > span:first-of-type { flex: 1; }
.tabs button:hover:not(:disabled) { color: var(--text); background: color-mix(in oklch, var(--panel) 60%, transparent); }
.tabs button.active { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.sprite { display: none; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active .ic { color: var(--accent); }
.badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 500 11px/18px var(--mono); text-align: center; }
.badge.danger { background: var(--danger); color: #fff; }
.tag { font: 500 10px/16px var(--mono); padding: 0 6px; border-radius: 4px; color: var(--warn); background: var(--warn-soft); text-transform: uppercase; letter-spacing: .03em; }
.sidefoot { display: flex; align-items: center; gap: 8px; padding: 12px 4px 0 6px; border-top: 1px solid var(--line); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;
  font-weight: 600; font-size: 11.5px; flex: none; }
.who { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.who b { font-weight: 500; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 11.5px; color: var(--muted); }
.sidefoot button { color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 18px 28px;
  background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.head h1 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.head p { margin: 2px 0 0; font-size: 12.5px; }
.live { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.wrap { width: 100%; max-width: 1600px; padding: 22px 28px calc(40px + env(safe-area-inset-bottom, 0px)); }
.wrap > section { display: flex; flex-direction: column; gap: 18px; }
.wrap > section > * { margin-bottom: 0; }
.spacer { flex: 1; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; min-width: 0; }
.wrap > section > .panel, .vdr-grid .panel { margin-bottom: 0; }
.panel > .muted:not(.small) { font-size: 12.5px; max-width: 820px; text-wrap: pretty; margin: 0 0 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr)); gap: 12px; }
.grid2 .panel { margin-bottom: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.wrap > section > .toolbar { margin-bottom: 0; }
.sechead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; margin-top: 6px; }
.sechead h2 { font-size: 14px; white-space: nowrap; }

/* overview: health, services, vitals, stats */
.health { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.health:empty { display: none; }
.health .grow { flex: 1; min-width: 0; }
.health b { font-size: 15px; }
.health p { margin: 1px 0 0; color: var(--muted); }
.hdot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px var(--ok-soft); flex: none; margin: 0 2px; }
.health.warn .hdot { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-soft); }
.health.down { border-color: color-mix(in oklch, var(--danger) 45%, var(--line)); }
.health.down .hdot { background: var(--danger); box-shadow: 0 0 0 5px var(--danger-soft); }

.svcs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; }
.svcs:empty { display: none; }
.status { background: var(--panel); padding: 12px 14px; display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 4px 8px; align-items: center; min-width: 0; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.status.down .dot { background: var(--danger); }
.status.warn .dot { background: var(--warn); }
.status > div:last-child { display: contents; }
.status b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status span { grid-column: 1 / -1; font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.down span { color: var(--danger); }
.status.unknown .dot { background: var(--line); box-shadow: inset 0 0 0 1.5px var(--muted); }

.vitals { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.vitals:empty { display: none; }
.vitals .kpi { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.vitals .kpi .v { order: 2; font: 500 26px/1.1 var(--mono); letter-spacing: -0.02em; }
.vitals .kpi .l { order: 1; display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 500; }
.kpi .of { font-family: var(--mono); white-space: nowrap; }
.vitals .kpi .bar { order: 3; height: 4px; margin-top: 6px; }

/* Each cell draws its own left/top hairline (the outer ones are clipped), so a short last row leaves no grey holes. */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.kpis:empty { display: none; }
.wrap > section > .kpis, #vdrResult > .kpis { margin-bottom: 0; }
.kpi { background: var(--panel); padding: 11px 14px; min-width: 0; margin: -1px 0 0 -1px; box-shadow: inset 1px 0 0 var(--line), inset 0 1px 0 var(--line); }
.vitals .kpi { box-shadow: none; margin: 0; }
.kpi .v { font: 500 16px/1.3 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi.bad .v { color: var(--danger); }
.kpi .bar { height: 4px; margin-top: 8px; }
.kpi .bar i.hot { background: var(--warn); }
.kpi .bar i.crit { background: var(--danger); }
#vdrResult > .kpis { margin: 14px 0 10px; }

/* charts */
.chart { position: relative; height: 170px; }
.chart canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; }
.legend b { color: var(--text); font: 500 12px var(--mono); }
.chart .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 8px; padding: 8px 10px;
  font-size: 12px; line-height: 1.55; max-width: 320px; box-shadow: 0 8px 24px rgb(0 0 0 / 18%); }
.tooltip .muted { color: color-mix(in oklch, var(--bg) 70%, var(--text)); }
.tooltip b { font: 500 12px var(--mono); }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* tables */
.tablewrap { overflow-x: auto; margin: 0 -8px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: 11.5px; color: var(--muted); font-weight: 500; padding-top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in oklch, var(--soft) 55%, transparent); }
td code { color: var(--muted); }
td.ua { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
td.num, th.num { text-align: right; }
td.num, td.tnum { font: 12.5px var(--mono); }
td.mono.small { word-break: normal; }
td.ua { max-width: 200px; }
td .meter { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); vertical-align: middle; margin-right: 8px; opacity: .7; }
.empty-row { color: var(--muted); padding: 18px 8px; }
tbody tr:hover td.empty-row { background: transparent; }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 8px 1px; border-radius: 999px; background: var(--soft); color: var(--muted);
  font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip.ok, .chip.done, .chip.streaming, .chip.inactive, .chip.delivered { color: var(--ok); background: var(--ok-soft); }
.chip.cancelled, .chip.upstream_error, .chip.firing, .chip.critical, .chip.crit, .chip.failed { color: var(--danger); background: var(--danger-soft); }
.chip.client_gone, .chip.pending, .chip.warning, .chip.warn, .chip.retrying { color: var(--warn); background: var(--warn-soft); }
.chip.processing, .chip.downloading, .chip.probing, .chip.analyzing, .chip.finalizing { color: var(--accent); background: var(--accent-soft); }
.chip.queued, .chip.uploading, .chip.expired, .chip.deleted, .chip.skipped { color: var(--muted); }

/* requests */
.cards2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.cards2:empty { display: none; }
.engine { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px 10px; }
.engine > b { font-weight: 600; }
.engine .stats { flex-basis: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.engine .stats b { display: block; font: 500 22px/1.2 var(--mono); }
.engine .stats span { font-size: 12px; color: var(--muted); }
section[data-view="requests"] > p.muted { max-width: 860px; text-wrap: pretty; margin: 0; }

/* logs */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); box-shadow: var(--shadow); }
.seg button { min-height: 26px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; box-shadow: none; color: var(--muted); font-size: 12.5px; }
.seg button:hover:not(:disabled) { color: var(--text); }
.seg button.active { background: var(--soft); color: var(--text); }
.headactions { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 7px; }
.logpanel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.logbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.logbar input[type="search"] { flex: 1 1 90px; min-width: 90px; }
.logbar { column-gap: 8px; }
.logbar > button { min-height: 30px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--line); transition: background-color .15s; flex: none; }
.switch-ui::before { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 20%); transition: transform .15s; }
.toggle input:checked + .switch-ui { background: var(--accent); }
.toggle input:checked + .switch-ui::before { transform: translateX(12px); }
.toggle input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.logbox { height: calc(100vh - 262px); min-height: 360px; overflow: auto; font: 12px/1.65 var(--mono); padding: 8px 0; background: var(--panel); }
.logline { display: grid; grid-template-columns: 118px 48px 76px minmax(0, 1fr); gap: 12px; padding: 1px 16px; align-items: baseline;
  white-space: pre-wrap; word-break: break-word; }
.logline:hover { background: var(--soft); }
.logline .t { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logline .s { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lvl { font: 500 10.5px/16px var(--mono); text-align: center; border-radius: 4px; color: var(--muted); }
.lvl.err { color: var(--danger); background: var(--danger-soft); }
.lvl.warn { color: var(--warn); background: var(--warn-soft); }
.logline.ERROR, .logline.CRITICAL { background: color-mix(in oklch, var(--danger-soft) 70%, transparent); }
.logline.ERROR .m, .logline.CRITICAL .m { color: var(--danger); }
.logline.WARNING .m { color: var(--warn); }
.logfoot { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--side); font-size: 12px; color: var(--muted); }
.livedot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.livedot.off { background: var(--danger); }
mark { background: color-mix(in oklch, var(--warn) 35%, transparent); color: inherit; border-radius: 2px; }

/* video analysis */
.vdr-grid { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 12px; align-items: start; }
.vdr-form { display: grid; gap: 14px; }
.vdr-form h3 { margin: 0; }
.vdr-form .seg { justify-self: start; }
.vdr-form p { margin: 0; }
.fld { display: grid; gap: 6px; font-weight: 500; min-width: 0; }
.fld input, .fld select { width: 100%; min-width: 0; font-weight: 400; }
.fld .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bar { height: 6px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.bar.big { height: 8px; margin: 6px 0 12px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .4s; }
.bar i.indeterminate { width: 35%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .bar i.indeterminate { animation: none; width: 100%; opacity: .4; } }
.upload { display: grid; gap: 4px; }
td .bar { width: 110px; margin-top: 5px; }
tr.selected td, tr.selected:hover td { background: var(--accent-soft); }
tr.clickable { cursor: pointer; }
.mono { word-break: break-all; }
.logpre { font: 12px/1.55 var(--mono); background: var(--soft); border-radius: 8px; padding: 12px 14px; max-height: 340px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; }
.panel.inner { background: var(--soft); border-color: transparent; }
.nomargin { margin: 0; }
.thumb { width: 132px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; cursor: zoom-in; display: block; background: var(--soft); }
td.wrap { white-space: normal; min-width: 260px; max-width: 520px; }
#vdrDetail .toolbar h2 { margin-right: 4px; }
.markdown { line-height: 1.65; text-wrap: pretty; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { font-size: 14px; margin: 16px 0 6px; color: var(--text); }
.markdown h1 { font-size: 16px; }
.markdown ul, .markdown ol { margin: 4px 0 8px; padding-left: 22px; }
.markdown p { margin: 6px 0; }
.markdown:not(.muted) { color: var(--text); }
details.report { margin-top: 12px; }
details summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgb(0 0 0 / 82%); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 80px); border-radius: 8px; }
.lightbox p { color: #fff; margin: 8px 0 0; text-align: center; }

/* settings: keys & webhooks */
.wh-form { display: grid; gap: 12px; max-width: 640px; margin: 4px 0 18px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.wh-form .toolbar { margin: 0; }
.wh-form fieldset { border: 0; padding: 0; margin: 0; }
.wh-form legend { font-weight: 500; margin-bottom: 8px; }
#whEvents { display: grid; gap: 6px; }
.secret { margin: 4px 0 16px; background: var(--accent-soft); color: var(--text); padding: 14px 16px; }
.secretrow { display: flex; gap: 8px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.secretrow code { background: var(--panel); color: var(--text); padding: 7px 10px; border-radius: 6px; word-break: break-all; border: 1px solid var(--line); }
.secret .logpre { background: var(--panel); margin: 0; }
td .urlcell { display: flex; gap: 6px; align-items: center; min-width: 280px; }
td .urlcell input { flex: 1; min-width: 200px; min-height: 30px; font: 12.5px var(--mono); box-shadow: none; }
td.actions { text-align: right; }
td.actions button:not([hidden]) ~ button { margin-left: 6px; }
.switch { position: relative; width: 34px; height: 20px; display: inline-block; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 20px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%;
  transition: .2s; box-shadow: 0 1px 2px rgb(0 0 0 / 20%); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
input.inline { border: 1px solid transparent; background: transparent; box-shadow: none; border-radius: 6px; min-height: 30px; padding: 0 6px;
  min-width: 160px; width: 100%; }
input.inline:hover, input.inline:focus { border-color: var(--line); background: var(--panel); }

.toast { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--text); color: var(--bg);
  padding: 10px 14px; border-radius: 9px; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgb(0 0 0 / 20%); }

/* matches the design's 5 x 2 stat strip on wide screens */
#kpis, #apiKpis, #cpuKpis, #mineKpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1180px) { #kpis, #apiKpis, #cpuKpis, #mineKpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack > * { margin-bottom: 0; }

/* panels that hold a table run the table edge to edge (design: "flush") */
.panel:has(> .tablewrap) { padding: 14px 6px 6px; }
.panel:has(> .tablewrap) > :not(.tablewrap) { margin-left: 10px; margin-right: 10px; }
.panel:has(> .tablewrap) > .tablewrap { margin: 0; }
.panel > .toolbar h2 { font-size: 13px; }
#inflightCount { font: 500 12.5px var(--mono); color: var(--muted); margin-left: 4px; }
th { padding: 0 10px 8px; }
td { padding: 9px 10px; }

/* sidebar bottom: theme switch + signed-in user */
.themeseg { display: flex; box-shadow: none; flex: none; }
.themeseg button { min-height: 24px; width: 24px; padding: 0; justify-content: center; }
.themeseg .ic { width: 13px; height: 13px; }
.iconbtn { width: 28px; min-height: 28px; padding: 0; justify-content: center; flex: none; }
.sidefoot .iconbtn { border-color: transparent; background: transparent; box-shadow: none; }
.sidefoot .iconbtn:hover:not(:disabled) { color: var(--text); border-color: transparent; background: var(--soft); }

/* analytics */
h3 .unit { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); }
.panel h3:has(.unit) { display: flex; align-items: baseline; gap: 8px; }
.chart.tall { height: 190px; }
.barlist { display: flex; flex-direction: column; gap: 10px; }
.barrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.barrow .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .k.mono { font-size: 12.5px; word-break: normal; }
.barrow .v { font: 500 12.5px var(--mono); white-space: nowrap; }
.barrow .v .muted { font-weight: 400; }
.track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; }
.track i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--accent); }
.track i.red { background: var(--danger); }
.share { display: inline-block; width: 64px; height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; vertical-align: middle; margin-right: 8px; }
.share i { display: block; height: 100%; width: 0; background: var(--accent); }
td.strong { font-weight: 500; }
td.error { color: var(--danger); }

/* alerts */
.alertlist { display: flex; flex-direction: column; gap: 10px; }
.alertlist:empty { display: none; }
.alertcard { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.alertcard.firing { border-color: color-mix(in oklch, var(--danger) 35%, var(--line)); }
.alertcard .name { font: 500 13.5px var(--mono); }
.alertcard .labels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lbl { font: 11.5px/20px var(--mono); padding: 0 7px; border-radius: 5px; background: var(--soft); color: var(--muted); }
.alertcard .since { display: grid; justify-items: end; gap: 6px; font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.state { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.sd { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.sd.ok { background: var(--ok); }
.sd.warn { background: var(--warn); }
.sd.bad { background: var(--danger); }
td.ua.wide { max-width: 520px; }
@media (max-width: 640px) {
  .alertcard { grid-template-columns: minmax(0, 1fr); }
  .alertcard .since { justify-items: start; text-align: left; }
  .logline { grid-template-columns: 1fr; gap: 0; padding: 4px 12px; }
  .logline .lvl { justify-self: start; padding: 0 6px; }
}

/* settings */
.subview { display: flex; flex-direction: column; gap: 16px; }
.actionbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
#keySearch { flex: 0 1 280px; min-width: 200px; }
.count { font: 500 11px/16px var(--mono); color: var(--muted); margin-left: 2px; }
.seg button.active .count { color: var(--text); }
.formcard { display: grid; gap: 12px; max-width: 720px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.formcard h3 { margin: 0; }
.formcard fieldset { border: 0; padding: 0; margin: 0; }
.formcard legend { font-weight: 500; margin-bottom: 8px; }
.reveal { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; padding: 14px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in oklch, var(--accent) 25%, var(--line)); color: var(--text); }
.reveal .keybox { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.reveal .keyval { flex: 1; min-width: 0; font: 500 13px var(--mono); background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; word-break: break-all; color: var(--text); }
.panel:has(> .tablewrap) > .tablewrap:only-child { margin-top: -2px; }
td.namecell { min-width: 260px; }
td.namecell input.inline { display: block; min-height: 24px; padding: 0 6px; margin-left: -6px; }
td.namecell input.strong { font-weight: 500; }
td.namecell input.small { font-size: 12px; color: var(--muted); }
tr.revoked td { color: var(--muted); }
tr.revoked input.inline { color: var(--muted); }
.sd.off { background: var(--muted); opacity: .5; }
td.actions button + button { margin-left: 6px; }
.hooklist { display: flex; flex-direction: column; gap: 12px; }
.hook .keyline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hook .keyline select { min-height: 28px; max-width: min(420px, 100%); font-size: 12.5px; box-shadow: none; }
td.access { min-width: 170px; }
td.access select { min-height: 28px; font-size: 12.5px; box-shadow: none; }
td.access .ua { max-width: 220px; margin-top: 3px; }
.linkbtn { min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; color: var(--accent); font-size: 12px; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; background: none; }
.reveal .credrow { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.reveal .credlabel { flex: none; width: 116px; font-size: 12.5px; color: var(--muted); }
/* settings: users */
.formcard > .check { justify-self: start; }
.fld > .fldname { display: flex; align-items: baseline; gap: 6px; }
td.keycell { min-width: 240px; }
td.keycell .chips { margin: 0 0 6px; }
td.keycell select, td select.userrole { min-height: 28px; font-size: 12.5px; box-shadow: none; }
td.keycell select { max-width: 240px; }
.chip.keychip { gap: 4px; padding-right: 3px; color: var(--text); }
.chipx { min-height: 0; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%; background: none; box-shadow: none;
  color: var(--muted); font-size: 13px; line-height: 1; }
.chipx:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.hooklist:empty { display: none; }
.hook { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px 14px; align-items: start; padding: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.hook .toggle { margin-top: 4px; }
.hookmain { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hook .urlcell { display: flex; gap: 6px; align-items: center; }
.hook .urlcell input { flex: 1; min-width: 0; font: 500 13.5px var(--mono); border-color: transparent; background: transparent; box-shadow: none;
  padding: 0 6px; margin-left: -6px; min-height: 28px; }
.hook .urlcell input:hover, .hook .urlcell input:focus { border-color: var(--line); background: var(--panel); }
.hook .chips { margin: 6px 0 0; }
.hookactions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hookactions button { min-height: 28px; padding: 0 10px; font-size: 12.5px; }
.hookstats { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.hookstats b { display: block; font: 500 15px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hookstats span { font-size: 12px; color: var(--muted); }
.hook.disabled .hookmain, .hook.disabled .hookstats { opacity: .6; }
.toggle input:checked + .switch-ui.ok { background: var(--ok); }

/* documentation */
.docs { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: start; padding-top: 4px; }
.toc { position: sticky; top: 104px; display: flex; flex-direction: column; gap: 2px; }
.toc-title { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0 10px 8px; }
.toc a { padding: 5px 10px; border-radius: 6px; color: var(--muted); font-size: 13px; text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--text); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.article { max-width: 820px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.article h2 { font-size: 17px; margin: 18px 0 0; letter-spacing: -0.01em; }
.article h2:first-child { margin-top: 0; }
.article h4 { font-size: 13px; font-weight: 600; margin: 6px 0 0; }
.article p { margin: 0; text-wrap: pretty; }
.article p.muted { color: var(--muted); }
.article code { font-size: 12.5px; }
.doclist { margin: 0; padding-left: 20px; display: grid; gap: 6px; text-wrap: pretty; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kv div { background: var(--panel); padding: 12px 14px; min-width: 0; }
.kv div:first-child { grid-column: 1 / -1; }
.kv b { display: block; font: 500 13px var(--mono); margin-top: 2px; overflow-wrap: anywhere; }
.codeblock { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--code); }
.codehead { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.langs { display: flex; gap: 2px; }
.langs button { min-height: 24px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; box-shadow: none; color: var(--muted); font-size: 12px; }
.langs button:hover:not(:disabled) { color: var(--text); }
.langs button.active { background: var(--soft); color: var(--text); }
.codelabel { font-size: 12px; font-weight: 500; color: var(--muted); padding: 3px 0; }
.codehead [data-copy-code] { min-height: 26px; padding: 0 10px; font-size: 12.5px; color: var(--muted); }
.codebody { margin: 0; padding: 12px 14px; font: 12.5px/1.65 var(--mono); white-space: pre; overflow-x: auto; color: var(--text); background: transparent; }
.c-com { color: var(--muted); }
.c-str { color: var(--ok); }
.c-key { color: var(--accent); }
.ptable { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.ptable th { font-size: 11.5px; color: var(--muted); font-weight: 500; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--side); }
.ptable td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: normal; text-wrap: pretty; }
.ptable tbody tr:last-child td { border-bottom: 0; }
.ptable tbody tr:hover td { background: transparent; }
.ptable td:first-child { white-space: nowrap; }
.article .tablewrap { margin: 0; }
.aibrief { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--accent-soft); }
.aibrief > div { display: grid; gap: 2px; min-width: 0; flex: 1; }
.aibrief b { font-size: 13px; }
.aibrief button { flex: none; }
@media (max-width: 560px) { .aibrief { flex-direction: column; align-items: stretch; } }
.callout { display: flex; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--text); font-size: 13px; }
.callout b { color: var(--warn); flex: none; }
@media (max-width: 900px) {
  .docs { grid-template-columns: 1fr; gap: 16px; }
  .toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .toc-title { display: none; }
  .kv { grid-template-columns: 1fr; }
  .hook { grid-template-columns: auto minmax(0, 1fr); }
  .hookactions { grid-column: 1 / -1; justify-content: flex-start; }
  .hookstats { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* request/response body drawer */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-backdrop { position: absolute; inset: 0; background: oklch(0.2 0.02 264 / 0.35); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgb(0 0 0 / 18%); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font: 600 15px var(--mono); }
.drawer-head p { margin: 2px 0 0; }
.drawer-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 20px 0; }
.drawer-info { margin: 8px 20px 0; }
.bodypre { flex: 1; min-height: 0; max-height: none; margin: 10px 20px 20px; background: var(--panel); border: 1px solid var(--line); white-space: pre-wrap; }
a.button { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
  color: var(--text); text-decoration: none; border: 1px solid transparent; }
a.button:hover { background: var(--soft); }

/* narrow screens: the sidebar becomes a top bar with a scrolling tab strip */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; background: none; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 16px;
    border-right: 0; border-bottom: 1px solid var(--line); }
  .side > .brand { padding: 0; }
  .tabs { order: 3; flex-basis: 100%; flex-direction: row; gap: 2px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .navgroup { flex-direction: row; gap: 2px; }
  .navlabel, .tabs .ic, .tag { display: none; }
  .tabs { flex: 0 0 100%; }
  .navbottom { margin-top: 0; }
  .tabs button { flex: none; min-height: 32px; }
  .sidefoot { margin-left: auto; padding: 0; border: 0; }
  .who { display: none; }
  .head { position: static; padding: 14px 16px; }
  .wrap { padding: 16px 16px calc(32px + env(safe-area-inset-bottom, 0px)); }
  .vdr-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .logline { grid-template-columns: 1fr; gap: 0; padding: 4px 12px; }
  .chart { height: 180px; }
  .engine .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .vitals .kpi .v { font-size: 20px; }
  .vitals .kpi .l { flex-direction: column; gap: 0; }
  .head .live { display: none; }
  .health { flex-wrap: wrap; }
}

a[data-goto], .toc a { text-decoration: none; }
a[data-goto]:hover { text-decoration: underline; }

/* images embedded in request/response bodies */
.req-images { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 20px 0; flex-shrink: 0; max-height: 40vh; overflow-y: auto; }
.req-img { margin: 0; width: 168px; display: grid; gap: 4px; }
.req-img img { width: 168px; height: 118px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line);
  background: repeating-conic-gradient(var(--soft) 0% 25%, transparent 0% 50%) 50% / 16px 16px; cursor: zoom-in; display: block; }
.req-img figcaption { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-img.broken img { display: none; }
.req-img.broken figcaption { color: var(--warn); white-space: normal; }
.req-img.remote { width: auto; max-width: 100%; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; }
.req-img.remote code { word-break: break-all; white-space: normal; }

/* chat view of a request (drawer default) */
.bodypre[hidden], .chat-view[hidden] { display: none; }
.chat-view { flex: 1; min-height: 0; overflow-y: auto; margin: 10px 0 0; padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.chat-params { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-msg { display: grid; gap: 4px; max-width: min(88%, 620px); min-width: 0; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.assistant, .chat-msg.tool { align-self: flex-start; }
.chat-msg.system { align-self: stretch; max-width: none; }
.chat-role { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); min-width: 0; }
.chat-role b { color: var(--text); font-weight: 600; }
.chat-role span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-msg.user .chat-role { justify-content: flex-end; }
.chat-body { display: grid; gap: 8px; min-width: 0; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow-wrap: anywhere; }
.chat-msg.user .chat-body { background: var(--accent-soft); border-color: color-mix(in oklch, var(--accent) 22%, var(--line)); border-top-right-radius: 4px; }
.chat-msg.assistant .chat-body, .chat-msg.tool .chat-body { border-top-left-radius: 4px; }
.chat-msg.system .chat-body { background: var(--soft); border-style: dashed; }
.chat-msg.error .chat-body { background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 35%, var(--line)); color: var(--danger); }
.chat-body.clamped { max-height: 150px; overflow: hidden; mask-image: linear-gradient(#000 60%, transparent); }
.chat-more { justify-self: start; min-height: 24px; padding: 0 8px; font-size: 12px; }
.chat-text { white-space: pre-wrap; }
.chat-rich { display: grid; gap: 6px; min-width: 0; }
.chat-rich .markdown p { margin: 2px 0; }
.chat-rich .markdown > :first-child { margin-top: 0; }
.chat-code { margin: 0; padding: 8px 10px; font: 12px/1.5 var(--mono); background: var(--soft); border-radius: 8px; white-space: pre-wrap;
  overflow-wrap: anywhere; max-height: 460px; overflow: auto; }
.chat-msg.user .chat-code, .chat-msg.system .chat-code { background: var(--panel); }
.chat-tool { display: grid; gap: 4px; }
.chat-tool b { font: 500 12px var(--mono); color: var(--muted); }
.chat-gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-img { width: auto; max-width: 100%; }
.chat-img img { width: auto; height: auto; max-width: min(300px, 100%); max-height: 220px; min-width: 80px; min-height: 60px; }
.chat-img.broken, .chat-img.remote { padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; }
.chat-file { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.chat-file .ficon { width: 34px; height: 34px; border-radius: 8px; background: var(--soft); color: var(--muted); display: grid; place-items: center;
  font: 600 10px var(--mono); text-transform: uppercase; flex: none; }
.chat-file .fmeta { display: grid; flex: 1; min-width: 120px; }
.chat-file .fmeta b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file .fmeta span { font-size: 12px; color: var(--muted); }
.chat-file audio, .chat-file video { flex-basis: 100%; width: 100%; max-height: 320px; }
.chat-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 0; font-size: 12px; }
.chat-fields dt { font-family: var(--mono); color: var(--muted); }
.chat-fields dd { margin: 0; white-space: pre-wrap; }
.chat-reason summary { font-size: 12px; margin-bottom: 4px; }
.chat-reason .chat-text { color: var(--muted); font-size: 12.5px; }
.chat-note { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.chat-note.warn { color: var(--warn); background: var(--warn-soft); padding: 8px 10px; border-radius: 8px; text-align: left; }
@media (max-width: 640px) { .chat-msg { max-width: 100%; } .chat-view { padding: 4px 16px 16px; } }

/* finished-request history: toolbar + pager */
.histhead { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 10px; }
.histhead input[type="search"] { flex: 0 1 280px; min-width: 180px; }
.histhead select { min-height: 30px; }
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-top: 12px; }
.pager .spacer { flex: 1; }
.pager select { margin-left: 6px; }

/* overview header fun fact */
.funfact { position: relative; display: inline-flex; align-items: center; gap: 8px; max-width: min(560px, 100%);
  padding: 5px 12px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  font-size: 12.5px; color: var(--text); cursor: help; box-shadow: var(--shadow); }
.funfact .ff-tag { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.funfact #funFactText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funfact .ff-tip { display: none; position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(460px, 90vw);
  padding: 10px 12px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 12px; line-height: 1.5;
  white-space: normal; box-shadow: 0 8px 24px rgb(0 0 0 / 20%); }
.funfact .ff-tip div + div { margin-top: 6px; }
.funfact .ff-tip .muted { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.funfact:hover .ff-tip, .funfact:focus .ff-tip, .funfact:focus-within .ff-tip { display: block; }
@media (max-width: 720px) { .funfact #funFactText { white-space: normal; } }
.maint-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
#maintRows tr.clickable { cursor: pointer; }
#maintRows tr.clickable:hover td { background: var(--soft); }
#maintRows .maint-log td { padding: 0 8px 12px; }
#maintRows .maint-log .logpre { margin: 0; white-space: pre-wrap; }
