/* Tokens from the Strange design system. Roles: danger, warning, info, ok
   and neutral each have a background and an ink that pass 4.5:1. */
:root {
  --surface: #f7f8fa;
  --surface-raised: #ffffff;
  --surface-sunken: #eceef2;
  --hairline: #d7dbe2;
  --border-strong: #7a828f;
  --ink: #14181f;
  --ink-muted: #4a5260;
  --accent: #1d4ed8;
  --on-accent: #ffffff;
  --danger-bg: #fde8e8;
  --danger-ink: #9b1c1c;
  --warning-bg: #fdf0d5;
  --warning-ink: #7a4a00;
  --info-bg: #e0ecfd;
  --info-ink: #1e3a8a;
  --ok-bg: #dcf3ec;
  --ok-ink: #0a5240;
  --neutral-bg: #e6e9ee;
  --neutral-ink: #2f3642;
  --shadow-sm: 0 1px 2px rgba(20, 24, 31, .10), 0 1px 3px rgba(20, 24, 31, .06);
  --shadow-md: 0 4px 12px rgba(20, 24, 31, .12), 0 2px 4px rgba(20, 24, 31, .06);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0f1218;
    --surface-raised: #171b23;
    --surface-sunken: #0a0d12;
    --hairline: #2a303b;
    --border-strong: #7d8798;
    --ink: #e8ebf0;
    --ink-muted: #a3acba;
    --accent: #7aa7ff;
    --on-accent: #0b1220;
    --danger-bg: #3a1517;
    --danger-ink: #ffb4b4;
    --warning-bg: #35260a;
    --warning-ink: #fbd38d;
    --info-bg: #12264a;
    --info-ink: #a8c7ff;
    --ok-bg: #0e3328;
    --ok-ink: #8fe3c5;
    --neutral-bg: #232936;
    --neutral-ink: #d3d9e3;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .60), 0 1px 3px rgba(0, 0, 0, .40);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, .60), 0 2px 4px rgba(0, 0, 0, .40);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 15px/22px var(--font-sans);
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 600; }
h2 { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; }
p { margin: 0; }
svg { flex: none; }
.small { font-size: 13px; line-height: 18px; }
.muted { color: var(--ink-muted); }
.strong { font-weight: 600; }
.sub { font-size: 13px; line-height: 18px; font-weight: 400; color: var(--ink-muted); }
.grow { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wrap { overflow-wrap: anywhere; }
.mono { font-family: var(--font-mono); }
.link { color: var(--accent); text-decoration: underline; align-self: flex-start; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.time { font-family: var(--font-mono); font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.icon-danger { color: var(--danger-ink); display: inline-flex; }
.text-danger { color: var(--danger-ink); }
.text-ok { color: var(--ok-ink); }
.icon-muted { color: var(--ink-muted); display: inline-flex; }

/* ---- header and page ---- */
.top {
  background: var(--surface-raised);
  border-bottom: 1px solid var(--hairline);
  padding: 0 16px;
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
}
.brand { font-weight: 600; padding: 12px 0; }
.top-link { margin-left: auto; padding: 12px 8px; font-weight: 600; color: var(--accent); }
.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.page-wide { max-width: 1440px; }
@media (min-width: 600px) { .page { padding: 32px; } }
section { display: flex; flex-direction: column; gap: 12px; }
#home-body, #inc-body, #prog-body { display: flex; flex-direction: column; gap: 24px; }

/* ---- surfaces ---- */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
.block { border-color: var(--border-strong); padding: 32px 16px; display: flex; flex-direction: column; gap: 16px; }
.row-block { flex-direction: row; flex-wrap: wrap; align-items: center; }
.banner {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 16px;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.banner.danger { background: var(--danger-bg); color: var(--danger-ink); }
.banner.ok { background: var(--ok-bg); color: var(--ok-ink); padding: 32px 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 600px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.count {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.count-n { font-size: 22px; line-height: 28px; font-weight: 600; }

/* ---- lists ---- */
.list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.list > li + li { border-top: 1px solid var(--hairline); }
.row {
  min-height: 44px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
a.row:hover { background: var(--surface); }
.row-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { font-weight: 500; overflow-wrap: anywhere; }
.chev { color: var(--ink-muted); }
.list-empty { padding: 12px 16px; }

/* ---- badges and pills ---- */
.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}
.pill { border-radius: 999px; padding: 2px 12px; }
.pill.open { background: var(--accent); color: var(--on-accent); }
.danger { background: var(--danger-bg); color: var(--danger-ink); }
.warning { background: var(--warning-bg); color: var(--warning-ink); }
.info { background: var(--info-bg); color: var(--info-ink); }
.ok { background: var(--ok-bg); color: var(--ok-ink); }
.neutral { background: var(--neutral-bg); color: var(--neutral-ink); }
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---- buttons ---- */
.btn {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover:not(:disabled) { box-shadow: var(--shadow-md); }
.btn:disabled { color: var(--ink-muted); background: var(--surface-sunken); box-shadow: none; cursor: not-allowed; }

/* ---- loading ---- */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.bar { background: var(--surface-sunken); border-radius: 4px; animation: pulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .bar, .dot { animation: none; } }

/* ---- incident ---- */
.analysis { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.analysis h3 { margin: 0 0 4px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.note { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.state { border-color: var(--border-strong); padding: 32px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.timeline { padding: 8px 16px 12px; }
.minutes { list-style: none; margin: 0; padding: 0; }
.minute {
  min-height: 36px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 184px;
  align-items: center;
  column-gap: 12px;
}
.minute + .minute { border-top: 1px solid var(--hairline); }
.track { height: 12px; background: var(--surface-sunken); border-radius: 4px; overflow: hidden; display: block; }
.fill { display: block; height: 12px; border-radius: 4px; }
.fill.danger { background: var(--danger-ink); }
.fill.warning { background: var(--warning-ink); }
.fill.info { background: var(--info-ink); }
.fill.neutral { background: var(--neutral-ink); }
.minute .n { text-align: right; }
.more-row { padding: 12px 16px; }
.hit { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.hit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
/* A source's facts: label above value, two to a row, one on a narrow screen;
   its folder (a bucket's prefixes) in a monospaced box. */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin: 0; }
@media (max-width: 600px) { .facts { grid-template-columns: minmax(0, 1fr); } }
.fact { min-width: 0; }
.fact.wide { grid-column: 1 / -1; }
.fact-label { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.fact dd { margin: 0; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.fact-path { margin-top: 4px; padding: 6px 8px; border-radius: 4px; background: var(--surface-sunken); font-family: var(--font-mono); font-size: 13px; line-height: 18px; overflow-wrap: anywhere; }
.viewer { display: flex; flex-direction: column; gap: 8px; }
.viewer-crumbs a { overflow-wrap: anywhere; }
.viewer-prefix { display: flex; flex-direction: column; gap: 6px; }
.viewer-prefix-head { display: flex; align-items: center; gap: 4px; }
/* A viewer's two sections are always shown, each under a plain heading; each
   table scrolls inside a fixed height: --rows rows of 31px (13px text, 18px
   line, 6px padding above and below, a 1px rule) under its header, 5 for
   Files and 4 for Explore folders. */
.viewer-section { border-top: 1px solid var(--hairline); padding-top: 12px; }
.viewer-title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }
.viewer-body { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.viewer-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.viewer-more { margin: 8px 10px; }
.viewer-table-wrap {
  --rows: 5;
  max-height: calc((var(--rows) + 1) * 31px + 2px);
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-raised);
}
.explore .viewer-table-wrap { --rows: 4; }
.viewer-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.viewer-table { width: 100%; border-collapse: collapse; }
.viewer-table th { text-align: left; font-weight: 600; color: var(--ink-muted); background: var(--surface-sunken); position: sticky; top: 0; z-index: 1; }
.viewer-table th, .viewer-table td { padding: 6px 10px; border-bottom: 1px solid var(--hairline); white-space: nowrap; vertical-align: middle; }
.viewer-table tbody tr:last-child td { border-bottom: 0; }
/* A name stays on one line, in the monospaced font, so each row keeps its
   height in the fixed box; on a narrow screen the table scrolls sideways. */
.viewer-table td.name { white-space: nowrap; font-family: var(--font-mono); }
.viewer-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.viewer-table tr.group td { background: var(--surface-sunken); font-weight: 600; }
.viewer-prefix-head .ico { display: inline-flex; vertical-align: -3px; margin-right: 6px; color: var(--ink-muted); }
.folder-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.hit-where { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.log {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  background: var(--surface-sunken);
  border-radius: 4px;
  padding: 8px 12px;
  overflow-wrap: anywhere;
}
.cmp { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cmp > div { border: 1px solid var(--hairline); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; }
.cmp-label { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.cmp-value { font-size: 17px; line-height: 24px; font-weight: 600; }
.affected { display: flex; flex-direction: column; gap: 16px; }
.affected h3 { margin: 0 0 8px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.id-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.id-list .btn { font-variant-numeric: tabular-nums; }
.id-pair { display: inline-flex; gap: 4px; }
.bulk-row { margin: 0 0 8px; }
a.btn { text-decoration: none; }
.btn.icon-btn { padding: 0 12px; }

/* Failing requests: a row opens its summary, downloads and payload in place. */
.fail-head {
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.fail-head:hover { background: var(--surface-sunken); }
.fail-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chev { width: 14px; font-size: 16px; line-height: 22px; color: var(--ink-muted); }
.fail-msg { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.fail-body { padding: 0 16px 16px 40px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.summary { display: flex; flex-direction: column; gap: 12px; }
.summary-section h3 { margin: 0 0 4px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.summary dl { margin: 0; display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 4px 16px; }
.summary dt { color: var(--ink-muted); font-size: 13px; line-height: 22px; }
.summary dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.fold summary { cursor: pointer; overflow-wrap: anywhere; }
.code {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  background: var(--surface-sunken);
  border-radius: 4px;
  padding: 8px 12px;
  white-space: pre;
  overflow: auto;
  max-height: 480px;
}
.fail-actions, .downloads { display: flex; flex-wrap: wrap; gap: 8px; }
.downloads { margin-top: 12px; }
.payload-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 600px) {
  .fail-body { padding-left: 16px; }
  .summary dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .summary dd { margin-bottom: 8px; }
}
.alert-row { min-height: 44px; padding: 8px 16px; display: flex; align-items: center; font-weight: 600; overflow-wrap: anywhere; }

/* ---- chat ---- */
.title-row { min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
/* The list and the chat sit side by side and stack when they no longer fit.
   They fill the window's height below the header and title (57 + 32 + 44 + 24
   + 32 px), at least --pane-min. */
.chat-layout { --pane-h: max(var(--pane-min), calc(100dvh - 189px)); --pane-min: 420px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.side { flex: 0 1 320px; min-width: 240px; max-width: 100%; height: var(--pane-h); display: flex; flex-direction: column; overflow: hidden; }
.side h2 { padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.side-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.side-list > li + li { border-top: 1px solid var(--hairline); }
.side-list a { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; min-height: 44px; }
.side-list a:hover { background: var(--surface); }
.side-list .pills { gap: 4px; }
.side-note { padding: 12px 16px; }
.convo { flex: 999 1 480px; min-width: 0; height: var(--pane-h); display: flex; flex-direction: column; overflow: hidden; }
.thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.empty { display: flex; flex-direction: column; gap: 16px; }
.examples { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.examples .btn { width: 100%; justify-content: flex-start; text-align: left; font-weight: 400; padding: 10px 16px; }
/* Questions filled from the logs now. */
.examples .btn.info { background: var(--info-bg); color: var(--info-ink); }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 85%; }
.msg.user { align-self: flex-end; }
.msg.note { align-self: center; max-width: 100%; }
/* Answers and errors take the thread's whole width; the waiting dots stay small. */
.msg.assistant, .msg.error { max-width: 100%; }
.msg .waiting { align-self: flex-start; }
.msg.user .who { text-align: right; }
.who { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.bubble { padding: 12px 16px; border-radius: 8px; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: var(--on-accent); white-space: pre-wrap; }
.msg.assistant .bubble { background: var(--surface); border: 1px solid var(--hairline); }
.msg.error .bubble {
  background: var(--danger-bg);
  color: var(--danger-ink);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.waiting { display: flex; align-items: center; gap: 12px; color: var(--ink-muted); }
.dots { display: inline-flex; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); animation: pulse 1.2s ease-in-out infinite; }
.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }
.composer {
  flex: none;
  border-top: 1px solid var(--hairline);
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  resize: none;
  padding: 8px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.composer textarea:disabled { background: var(--surface-sunken); color: var(--ink-muted); }

/* Charts in answers: drawn from the server's numbers, like the incident timeline. */
.answer { display: flex; flex-direction: column; gap: 12px; }
.chart { margin: 0; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.chart-head { display: flex; flex-direction: column; gap: 4px; }
.chart .minute { grid-template-columns: 48px minmax(0, 1fr) 168px; }
.chart .dated .minute { grid-template-columns: 96px minmax(0, 1fr) 168px; }
@media (max-width: 600px) { .chart .minute, .chart .dated .minute { grid-template-columns: auto minmax(48px, 1fr) auto; } }
.chart-empty { padding: 8px 0; }
.chart-incidents { margin: 0 -16px -12px; border-top: 1px solid var(--hairline); }
.bars { list-style: none; margin: 0; padding: 0; }
.bar-row { padding: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.bar-row + .bar-row { border-top: 1px solid var(--hairline); }
.bar-label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bar-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
.bar-line .n { min-width: 48px; text-align: right; }

@media (max-width: 860px) {
  .side { flex-basis: 100%; height: 320px; }
}

/* ---- rendered markdown: chat answers and pre-analyses ---- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md table, .md blockquote { margin: 0 0 8px; }
.md ul, .md ol { padding-left: 20px; }
.md li { margin: 4px 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-size: inherit; line-height: inherit; font-weight: 600; margin: 12px 0 4px; }
.md strong { font-weight: 600; }
.md a { color: var(--accent); text-decoration: underline; }
.md code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-sunken);
  overflow-wrap: anywhere;
}
.md pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--surface-sunken);
  overflow-x: auto;
}
.md pre code { padding: 0; background: none; overflow-wrap: normal; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border-bottom: 1px solid var(--hairline); padding: 4px 8px; text-align: left; }
.md blockquote { margin-left: 0; padding-left: 12px; border-left: 3px solid var(--hairline); color: var(--ink-muted); }

/* ---- setup warnings ---- */
.config-banner {
  max-width: 848px;
  margin: 16px auto 0;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: var(--warning-bg);
  color: var(--warning-ink);
  border: 1px solid var(--warning-ink);
  border-radius: 8px;
}
@media (max-width: 880px) { .config-banner { margin: 16px 16px 0; } }
.config-banner p, .config-banner ul { margin: 0; }
.config-banner ul { padding-left: 18px; }
/* How far the data has arrived, while it trails the current time. */
.data-banner {
  max-width: 848px;
  margin: 16px auto 0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--info-bg);
  color: var(--info-ink);
  border-radius: 8px;
}
@media (max-width: 880px) { .data-banner { margin: 16px 16px 0; } }
.data-banner p { margin: 0; }
.data-banner .link { align-self: center; color: inherit; font-weight: 600; }
.banner.info { background: var(--info-bg); color: var(--info-ink); }
.catchup-track { margin-top: 8px; background: var(--surface-raised); }

/* ---- status page: header and tabs ---- */
.page-head { display: flex; flex-direction: column; gap: 4px; }
.banner h3 { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; }
/* position: relative makes each tab's offsetLeft count from the tab list, which app.js scrolls. */
.tabs { position: relative; display: flex; gap: 8px; border-bottom: 1px solid var(--hairline); overflow-x: auto; }
.tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px;
  background: none;
  border: 0;
  color: var(--ink-muted);
  font: inherit;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }
.tab-badge { padding: 0 6px; border-radius: 4px; font-size: 12px; line-height: 18px; font-weight: 600; }
.tab-panel { gap: 24px; }
.areas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 600px) { .areas { grid-template-columns: minmax(0, 1fr); } }
.area { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 16px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.area:hover { border-color: var(--border-strong); }
.notice { margin: 0; color: var(--danger-ink); font-weight: 600; }

/* ---- settings ---- */
.top-link + .top-link { margin-left: 0; }
.settings-body { display: flex; flex-direction: column; gap: 24px; }
.settings-card { padding: 24px 16px; gap: 16px; }
@media (min-width: 600px) { .settings-card { padding: 24px; } }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 600; }
.field input, .field select, .field textarea {
  min-height: 44px;
  width: 100%;
  padding: 8px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.field textarea { font-family: var(--mono, ui-monospace, monospace); font-size: 13px; resize: vertical; }
.field input[readonly] { background: var(--surface-sunken); color: var(--ink-muted); }
.field input:focus-visible, .field select:focus-visible, .check input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.field [aria-invalid="true"] { border-color: var(--danger-ink); }
.field-error { margin: 0; color: var(--danger-ink); font-size: 14px; font-weight: 600; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.inline input { flex: 1 1 220px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; min-height: 44px; }
.check input { width: 20px; height: 20px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.result { margin: 0; }
.result.bad { color: var(--danger-ink); font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ---- the confirmation before moving a log source ---- */
.confirm { width: min(560px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow-md); }
.confirm::backdrop { background: rgba(10, 13, 18, .55); }
.confirm h2 { margin: 0 0 12px; }
.confirm-move { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0 0 12px; }
.confirm-move dt { font-weight: 600; }
.confirm-move dd { margin: 0; }
.confirm .bad { color: var(--danger-ink); font-weight: 600; }
.confirm-warnings { margin: 12px 0 16px; padding-left: 20px; color: var(--ink-muted); }
.confirm-warnings li + li { margin-top: 4px; }

/* ---- an order's evidence under a chat answer ---- */
.evidence { margin-top: 12px; padding: 12px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface-raised); display: flex; flex-direction: column; gap: 8px; }
.evidence-title { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; overflow-wrap: anywhere; }
.evidence-body { display: flex; flex-direction: column; gap: 8px; }
.evidence-body p { margin: 0; }
.evidence .downloads { margin-top: 4px; }
.evidence.confirm { border: 2px solid var(--accent); background: var(--info-bg); color: var(--info-ink); }
.evidence.confirm .muted { color: var(--info-ink); opacity: .85; }
.confirm-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.confirm-head svg { width: 16px; height: 16px; }
.confirm-time { font-size: 24px; line-height: 30px; font-weight: 700; }
.btn.big { padding: 8px 16px; font-size: 15px; }
.progress-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.progress-head .dot { display: inline-block; margin-right: 8px; vertical-align: middle; background: var(--accent); }
.progress { height: 10px; border-radius: 5px; background: var(--surface-sunken); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width .4s ease; }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }
.evidence-order { margin: 8px 0 0; font-size: 13px; line-height: 18px; font-weight: 600; overflow-wrap: anywhere; }
.runs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.runs > li { border-bottom: 1px solid var(--hairline); }
.runs .more-row { padding: 8px 0; }
.run { padding: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.run-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.run-where { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 260px; }
.run-flow { overflow-wrap: anywhere; min-width: 0; }
.stages { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.stage { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; line-height: 16px; border: 1px dashed var(--border-strong); color: var(--ink-muted); }
.stage.reached { border-style: solid; border-color: transparent; background: var(--ok-bg); color: var(--ok-ink); }
.stage.last { font-weight: 700; outline: 2px solid var(--ok-ink); outline-offset: 1px; }
.stage.failure { border: 1px solid transparent; background: var(--danger-bg); color: var(--danger-ink); font-weight: 600; }
.stage-arrow { color: var(--ink-muted); font-size: 12px; }
/* The evidence of an incident's affected orders: a search per batch. */
.affected-evidence { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.affected-evidence h3 { margin: 0; }
.affected-evidence p { margin: 0; }
.incident-batch .evidence { margin-top: 0; }
/* A finished search's runs, folded under its workbook. */
.evidence-flows > summary { cursor: pointer; font-size: 13px; line-height: 20px; font-weight: 600; padding: 4px 0; }
.evidence-flows[open] > summary { margin-bottom: 8px; }
/* The evidence workbook's rows, under a finished search. */
.workbook { border-top: 1px solid var(--hairline); padding-top: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.workbook-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.workbook-head .evidence-order { margin: 0; }
.workbook-rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.workbook-row { padding: 8px 0; border-bottom: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.workbook-row p { margin: 0; overflow-wrap: anywhere; }
.workbook-row .fold pre { max-height: 320px; overflow: auto; }
