/* ResearchArena trace viewer — shares the design language of the main
   site (../index.html): same palette, radii, and type. Both themes are
   driven entirely by the tokens below; theme.js stamps data-theme on
   <html> before first paint. */

:root {
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  color-scheme: light;
  --bg: #FBFBFC;
  --surface: #FFFFFF;
  --surface-2: #F5F6F8;
  --surface-3: #EEF0F3;
  --border: #E6E9ED;
  --border-strong: #CFD5DC;
  --ink: #15191F;
  --ink-soft: #454C57;
  --muted: #6E7681;

  --green: #2A6046;
  --wine:  #7E2E3D;
  --steel: #4C6B8A;
  --accent: #2E3D7E;

  --green-soft: rgba(42, 96, 70, 0.10);
  --wine-soft:  rgba(126, 46, 61, 0.10);
  --steel-soft: rgba(76, 107, 138, 0.12);
  --accent-soft: rgba(46, 61, 126, 0.09);

  --shadow: 0 1px 2px rgba(20,30,45,0.04), 0 6px 18px rgba(20,30,45,0.05);
  --radius: 10px;
  --maxw: 1200px;
}

/* Dark theme: same roles, re-toned. Accents are lightened so they keep
   their meaning as text on a dark surface, and the soft fills are given a
   little more alpha to stay visible. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0E1116;
  --surface: #161A20;
  --surface-2: #1D222A;
  --surface-3: #262C35;
  --border: #2B323C;
  --border-strong: #414B57;
  --ink: #E8EBEF;
  --ink-soft: #B2BAC5;
  --muted: #868F9B;

  --green: #58B489;
  --wine:  #D97387;
  --steel: #7FA8CE;
  --accent: #8C9EEA;

  --green-soft: rgba(88, 180, 137, 0.13);
  --wine-soft:  rgba(217, 115, 135, 0.13);
  --steel-soft: rgba(127, 168, 206, 0.15);
  --accent-soft: rgba(140, 158, 234, 0.14);

  --shadow: 0 1px 2px rgba(0,0,0,0.40), 0 6px 18px rgba(0,0,0,0.34);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

h1, h2, h3, h4 { font-weight: 650; line-height: 1.2; letter-spacing: -0.015em; margin: 0; }

code { font-family: var(--font-mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---- topbar ---------------------------------------------------------- */

header.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 14px; height: 54px; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-sub { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.brand-sub:hover { text-decoration: none; color: var(--ink); }
.nav-spacer { margin-right: auto; }
.nav-links { display: flex; gap: 18px; align-items: center; }
.nav-links a { color: var(--ink-soft); font-size: 13.5px; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

/* theme toggle: moon while light, sun while dark */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: 7px;
  color: var(--ink-soft);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--border-strong); }
.theme-toggle svg { width: 15px; height: 15px; display: block; }
.theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }

/* ---- listing hero ---------------------------------------------------- */

.page-head { padding: 40px 0 26px; }
.page-head h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -0.025em; }
.page-head .tag { font-size: 15.5px; color: var(--ink-soft); max-width: 68ch; margin: 10px 0 0; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 10px;
}

.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: start; margin-top: 26px; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-stats { display: flex; flex-direction: column; gap: 10px; min-width: 150px; }
@media (max-width: 900px) { .hero-stats { flex-direction: row; flex-wrap: wrap; } }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 16px; box-shadow: var(--shadow); min-width: 130px;
}
.stat-tile .n { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-tile .l { font-size: 12px; color: var(--muted); margin-top: 1px; }
.stat-meta { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); padding-left: 2px; }

/* ---- matrix ---------------------------------------------------------- */

.matrix-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px 14px; box-shadow: var(--shadow); overflow-x: auto;
}
.matrix-cap { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.matrix-cap b { color: var(--ink); font-weight: 600; }
.matrix-grid { display: grid; gap: 3px; min-width: 560px; }
.matrix-corner { min-height: 20px; }
.matrix-colhead {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft);
  text-align: center; align-self: end; padding: 2px 2px 4px; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.matrix-sethead {
  grid-column: 1 / -1;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent);
  padding: 10px 0 3px;
}
.matrix-rowhead {
  font-size: 12.5px; color: var(--ink); padding: 0 10px 0 0;
  display: flex; align-items: center; justify-content: flex-end; text-align: right;
  white-space: nowrap;
}
.matrix-cell {
  position: relative; border: 1px solid var(--border); border-radius: 6px;
  min-height: 30px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink);
  background:
    linear-gradient(color-mix(in srgb, var(--wine) calc(var(--cell-intensity, 0) * 62%), var(--surface-2)),
                    color-mix(in srgb, var(--wine) calc(var(--cell-intensity, 0) * 62%), var(--surface-2)));
  cursor: pointer; padding: 0; font-variant-numeric: tabular-nums;
}
.matrix-cell:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.matrix-cell[style*="--cell-intensity: 0.4"], .matrix-cell.deep { color: #fff; }
.matrix-cell-empty { background: transparent; border-style: dashed; color: var(--border-strong); cursor: default; }
/* Runs exist but none were successful: no mean to show, still clickable. */
.matrix-cell-nosucc {
  background: transparent; border-style: dashed; color: var(--muted);
  font-size: 9.5px; letter-spacing: -0.01em;
}
.matrix-legend { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.legend-scale { display: inline-flex; gap: 2px; }
.legend-step { width: 18px; height: 10px; border-radius: 3px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--wine) calc(var(--cell-intensity, 0) * 62%), var(--surface-2)); }

/* ---- filter bar ------------------------------------------------------ */

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 14px 0 6px;
}
.filter-bar select {
  font-family: var(--font-sans); font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 10px; box-shadow: none;
}
.filter-bar select:hover { border-color: var(--border-strong); }
.filter-bar select.active { border-color: var(--accent); background: var(--accent-soft); }
.view-meta { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; font-size: 12.5px; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 12.5px; cursor: pointer; padding: 0; font-family: var(--font-sans); }
.link-btn:hover { text-decoration: underline; }

/* ---- run table ------------------------------------------------------- */

.group-head { display: flex; align-items: baseline; gap: 12px; margin: 26px 0 10px; flex-wrap: wrap; }
.group-head h3 { font-size: 17px; }
.group-head .gmeta { font-size: 12.5px; color: var(--muted); }
.group-head .gset { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }

table.runtable {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; font-size: 13.5px;
}
.runtable th {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.runtable th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.runtable th.sortable:hover, .runtable th.sorted { color: var(--ink); }
.runtable th.sortable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.runtable th .sort-ind { margin-left: 5px; opacity: 0; }
.runtable th.sortable:hover .sort-ind { opacity: 0.4; }
.runtable th.sorted .sort-ind { opacity: 1; color: var(--accent); }
.runtable td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.runtable tbody tr:last-child td { border-bottom: none; }
.runtable tbody tr { cursor: pointer; }
.runtable tbody tr:hover td { background: var(--accent-soft); }
.col-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.task-cell .t1 { font-weight: 600; font-size: 13.5px; }
.task-cell .t2 { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.cat-dot { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 7px; position: relative; top: -1px; }
.cat-dot.baseline { background: var(--border-strong); }
.cat-dot.embedded { background: var(--wine); }
.cat-dot.independent { background: var(--steel); }

/* Banner on the run page for a run kept out of the analysis, stating why.
   Notice-coloured rather than error-coloured: the run is valid to read, it
   just does not count towards any aggregate. */
.summary-excluded {
  margin: 10px 0 2px; padding: 9px 11px; font-size: 12.5px; line-height: 1.45;
  color: var(--ink); background: var(--wine-soft);
  border: 1px dashed var(--border-strong); border-left: 3px solid var(--wine);
  border-radius: 6px;
}
.summary-excluded b { color: var(--wine); }

/* Runs that missed a success threshold: desaturated and dimmed so they read as
   excluded from the analysis, while staying legible and clickable. */
.runtable tbody tr.excluded td { color: var(--muted); filter: grayscale(1); opacity: 0.62; }
.runtable tbody tr.excluded:hover td { opacity: 0.85; }
.runtable tbody tr.excluded .score-fill { background: var(--border-strong); }
.excl-tag {
  font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: 100px;
  padding: 1px 6px; margin-left: 7px; filter: none;
}

.agent-cell { white-space: nowrap; }
.agent-cell .harness {
  font-family: var(--font-mono); font-size: 10px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 100px; padding: 1px 7px; margin-left: 7px;
}

.score-cell { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.score-bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; min-width: 42px; }
.score-fill { height: 100%; background: var(--green); border-radius: 4px; }
.score-num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12px; }

.susp-cell { display: flex; align-items: center; gap: 8px; }
.susp-strip { display: inline-flex; gap: 2px; }
.susp-dot {
  width: 9px; height: 14px; border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  background: color-mix(in srgb, var(--wine) calc(var(--susp, 0) * 1%), var(--surface-3));
}
.susp-max { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.susp-max.hot { color: var(--wine); font-weight: 600; }

.empty-state { text-align: center; padding: 48px 0; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 550; border-radius: 7px; padding: 7px 14px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; font-family: var(--font-sans);
}
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn svg { width: 13px; height: 13px; }

footer.site { border-top: 1px solid var(--border); margin-top: 56px; padding: 26px 0 44px; color: var(--muted); font-size: 12.5px; }

/* ====== run detail page =============================================== */

.layout {
  display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px;
  max-width: var(--maxw); margin: 0 auto; padding: 22px 24px 60px;
  align-items: start;
}
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }

.rail { position: sticky; top: 68px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 880px) { .rail { position: static; } }

.back-link { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); }
.back-link:hover { color: var(--ink); text-decoration: none; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.summary-title { font-size: 18px; }
.summary-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.summary-cover { font-size: 12px; color: var(--ink-soft); font-style: italic; margin-top: 8px; }
.summary-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }

.cat-pill {
  display: inline-block; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 100px; border: 1px solid; margin-bottom: 8px;
}
.cat-pill.baseline { color: var(--muted); background: var(--surface-2); border-color: var(--border-strong); }
.cat-pill.embedded { color: var(--wine); background: var(--wine-soft); border-color: color-mix(in srgb, var(--wine) 34%, transparent); }
.cat-pill.independent { color: var(--steel); background: var(--steel-soft); border-color: color-mix(in srgb, var(--steel) 40%, transparent); }

dl.stats { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 14px 0 0; font-size: 12.5px; }
dl.stats dt { color: var(--muted); font-family: var(--font-mono); font-size: 11px; padding-top: 1px; white-space: nowrap; }
dl.stats dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
/* Score components load in async; `contents` lets their dt/dd join the
   parent grid instead of the wrapper taking a cell of its own. */
#summary-components { display: contents; }
#summary-components dt { padding-left: 10px; border-left: 2px solid var(--border); }

.summary-footer { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.run-id { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); cursor: pointer; overflow-wrap: anywhere; }
.run-id:hover { color: var(--ink); }
.run-id .copy-ok { color: var(--green); font-weight: 600; }

/* monitor nav in rail */
.rail-monitors .rm-fam { margin-top: 10px; }
.rail-monitors .rm-fam:first-of-type { margin-top: 4px; }
.rm-name { font-size: 12.5px; font-weight: 600; }
.rm-name .harness { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); margin-left: 5px; }
.rm-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.rm-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 10.5px; padding: 2px 7px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
  cursor: pointer; color: var(--ink-soft);
}
.rm-chip:hover { border-color: var(--border-strong); color: var(--ink); }
.rm-chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.rm-chip .s { font-weight: 700; font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--wine) calc(var(--susp, 0) * 1%), var(--muted)); }

/* tabs */
.tab-nav { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn {
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 550; color: var(--ink-soft);
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 12px 9px; cursor: pointer; display: inline-flex; gap: 7px; align-items: center;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn .count {
  font-family: var(--font-mono); font-size: 10.5px; background: var(--surface-3);
  padding: 1px 7px; border-radius: 100px; color: var(--muted);
}
.section { display: none; }
.section.active { display: block; }

/* trace toolbar */
.trace-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 0 12px; font-size: 12.5px; color: var(--muted);
}
.trace-toolbar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.toggle-label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-size: 12.5px; color: var(--ink-soft); user-select: none; }
.jump-label { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-soft); }
.jump-label input {
  width: 68px; font-family: var(--font-mono); font-size: 12px;
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 7px; background: var(--surface);
}
.jump-miss { border-color: var(--wine) !important; }

/* trace events */
.trace-stream { display: flex; flex-direction: column; gap: 10px; }
.event { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; }
.event-marker { text-align: right; padding-top: 3px; user-select: none; }
.event-marker .turn-num { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.event-marker .turn-role { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.event-marker .ev-time { font-family: var(--font-mono); font-size: 9.5px; color: var(--border-strong); margin-top: 2px; }
.event-marker .sub-tag { font-family: var(--font-mono); font-size: 8.5px; color: var(--steel); margin-top: 2px; }
.event-flash { animation: evflash 1.4s ease; }
@keyframes evflash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }

.event-body { min-width: 0; display: flex; flex-direction: column; gap: 8px; }

.block-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 13px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.block-user { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, transparent); }
.block-thinking { font-style: italic; color: var(--ink-soft); background: var(--surface-2); }
.block-thinking summary {
  cursor: pointer; font-style: normal; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.block-thinking summary::-webkit-details-marker { display: none; }
.block-thinking summary::after { content: "▸"; font-size: 9px; transition: transform .15s; }
.block-thinking[open] summary::after { transform: rotate(90deg); }
.block-thinking .thinking-body { margin-top: 7px; white-space: pre-wrap; }

.block-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px;
}

/* tool call */
.tool-call { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.tool-call > summary {
  list-style: none; cursor: pointer; padding: 7px 13px;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-soft);
  background: var(--surface-2);
}
.tool-call > summary::-webkit-details-marker { display: none; }
.tool-call > summary .tool-name { font-weight: 600; color: var(--ink); }
.tool-call > summary .tool-meta { margin-left: auto; font-size: 10px; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.tool-call > summary .tool-title { color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.tool-body { border-top: 1px solid var(--border); }
.tool-args { padding: 9px 13px; font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tool-args .bash-cmd { color: var(--ink); }
.tool-args .bash-cmd::before { content: "$ "; color: var(--muted); }
.tool-args .arg-desc { color: var(--muted); font-size: 11px; margin-top: 4px; font-family: var(--font-sans); }
.tool-args pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-remove { color: var(--wine); background: var(--wine-soft); border-radius: 5px; padding: 5px 8px; margin: 5px 0 0; }
.diff-add { color: var(--green); background: var(--green-soft); border-radius: 5px; padding: 5px 8px; margin: 4px 0 0; }

.tool-output { border-top: 1px dashed var(--border); padding: 8px 13px 10px; }
.tool-output-head {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); display: flex; gap: 9px; align-items: center; margin-bottom: 5px;
}
.chip { font-family: var(--font-mono); font-size: 9.5px; padding: 1px 7px; border-radius: 100px; }
.chip.bad { color: var(--wine); background: var(--wine-soft); }
.chip.ok { color: var(--green); background: var(--green-soft); }
.tool-output-body {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-soft);
  white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 130px; overflow: hidden; position: relative;
}
.tool-output-body.error { color: var(--wine); }
.tool-output-body.clamped::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34px;
  background: linear-gradient(transparent, var(--surface));
}
.tool-output-body.expanded { max-height: none; }
.output-more {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: 11px; font-family: var(--font-mono); padding: 3px 0 0;
}

/* todos */
.todo-list { list-style: none; margin: 0; padding: 9px 13px; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.todo-item { display: flex; gap: 8px; align-items: baseline; }
.todo-item .check { font-family: var(--font-mono); color: var(--muted); }
.todo-item.done { color: var(--muted); text-decoration: line-through; }

/* session + result banners */
.session-banner {
  display: flex; align-items: center; gap: 12px; margin: 6px 0;
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
}
.session-banner::before, .session-banner::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.session-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 13px; font-size: 12px; }
.session-card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 6px 0 0; }
.session-card dt { color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; }
.session-card dd { margin: 0; overflow-wrap: anywhere; }
.result-banner {
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  background: var(--green-soft); border-radius: 9px; padding: 10px 13px; font-size: 12.5px;
}
.result-banner .meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 4px; }
.error-banner {
  border: 1px solid color-mix(in srgb, var(--wine) 30%, transparent);
  background: var(--wine-soft); border-radius: 9px; padding: 10px 13px; font-size: 12.5px; color: var(--wine);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.notice { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: pre-wrap; }
.plain-transcript { white-space: pre-wrap; font-size: 13.5px; }

.show-more-wrap { text-align: center; padding: 16px 0; }

/* loading */
.loading-state { text-align: center; padding: 44px 0; color: var(--muted); font-size: 13.5px; }
.spinner {
  display: inline-block; width: 20px; height: 20px; margin-bottom: 8px;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- monitors section ------------------------------------------------ */

.mon-intro { font-size: 13.5px; color: var(--ink-soft); max-width: 72ch; margin: 0 0 16px; }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.mon-card { padding: 13px 15px; }
.mon-card .mc-name { font-size: 14px; font-weight: 650; }
.mon-card .mc-sub { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 1px; }
.mc-variants { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.mc-variant {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 7px; padding: 5px 9px;
  cursor: pointer; background: var(--surface); font-size: 12px;
  font-family: var(--font-sans); text-align: left; width: 100%;
}
.mc-variant:hover { border-color: var(--accent); background: var(--accent-soft); }
.mc-variant .access { font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); }
.mc-variant .access sub { font-size: 8.5px; }
.mc-variant .vs {
  margin-left: auto; font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--wine) calc(var(--susp, 0) * 1%), var(--muted));
}
.mc-variant .vs.na { color: var(--border-strong); font-weight: 400; }

/* monitor detail */
.mon-detail-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.mon-detail-head h3 { font-size: 18px; }
.mon-detail-head .access-pill {
  font-family: var(--font-mono); font-size: 11px; padding: 3px 10px; border-radius: 100px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, transparent);
  color: var(--accent); background: var(--accent-soft);
}
.susp-big {
  margin-left: auto; display: flex; align-items: baseline; gap: 4px;
  font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
  color: color-mix(in srgb, var(--wine) calc(var(--susp, 0) * 1%), var(--green));
}
.susp-big .den { font-size: 12px; font-weight: 400; color: var(--muted); font-family: var(--font-mono); }
.judgement-card { margin-bottom: 16px; }
.judgement-card .jc-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 7px;
}
.judgement-card .jc-body { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mon-trace-label { margin: 20px 0 4px; font-size: 15px; font-weight: 650; }
