/* Trajectory Inspector — no frameworks, no external fonts */
:root {
  --bg: #0a0f15;
  --bg2: #0d141d;
  --panel: #101822;
  --panel2: #15202c;
  --panel3: #1a2734;
  --line: #223141;
  --line-soft: #1b2735;
  --line-strong: #30455c;
  --text: #dde7f2;
  --text-soft: #c3d0e0;
  --muted: #8fa2b8;
  --dim: #63758b;
  --accent: #62b6ff;
  --accent2: #9d8cff;
  --ok: #4bd6a4;
  --ok-bg: rgba(75, 214, 164, .10);
  --bad: #ff7288;
  --bad-bg: rgba(255, 114, 136, .10);
  --warn: #ffbf66;
  --warn-bg: rgba(255, 191, 102, .10);
  --rejected: #e8aa62;
  --rejected-bg: rgba(232, 170, 98, .10);
  --think: #c4a7ff;
  --think-bg: rgba(157, 140, 255, .075);
  --think-line: rgba(157, 140, 255, .30);
  --radius: 10px;
  --radius-sm: 7px;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1000px 500px at 80% -20%, #17243a 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); }
pre { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #263647; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #344a61; }

.hidden { display: none !important; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* ---------- top bar ---------- */
.topbar {
  position: relative;
  z-index: 30;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 15, 21, .92);
  backdrop-filter: blur(8px);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 21px; line-height: 1; }
.brand-text { font-size: 14px; letter-spacing: .01em; color: var(--muted); }
.brand-text b { color: var(--text); font-weight: 650; }
.crumb {
  display: flex; align-items: center; gap: 7px;
  min-width: 0; color: var(--muted); font-size: 12.5px;
}
.crumb .sep { color: var(--dim); }
.crumb .crumb-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb .crumb-task { color: var(--text); font-family: var(--mono); font-size: 11.5px; }
.top-spacer { flex: 1; }
.top-meta { color: var(--dim); font-size: 11.5px; font-family: var(--mono); white-space: nowrap; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--muted);
  font-size: 15px; line-height: 1;
}
.icon-btn:hover { background: var(--panel2); color: var(--text); border-color: var(--line); }
.tex-btn {
  height: 28px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 7px;
  background: transparent; color: var(--dim);
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em;
}
.tex-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel2); }
.tex-btn.on { color: var(--accent); border-color: rgba(98,182,255,.35); background: rgba(98,182,255,.09); }

/* ---------- layout ---------- */
.shell {
  display: grid;
  grid-template-columns: 252px 344px minmax(0, 1fr);
  height: calc(100vh - 52px);
  min-height: 0;
}
.pane {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 27, 38, .55), rgba(12, 18, 26, .25));
}
.pane-head {
  display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}
.pane-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .075em; color: var(--muted); }
.pane-title .count { margin-left: 5px; color: var(--dim); font-weight: 500; letter-spacing: 0; }
.pane-tools { padding: 9px 10px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line-soft); flex: 0 0 auto; }
.pane-scroll { flex: 1 1 auto; overflow: auto; min-height: 0; }
.pane-foot { flex: 0 0 auto; padding: 7px 12px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 11px; }
.pane-loading, .pane-empty { padding: 22px 16px; color: var(--dim); font-size: 12.5px; text-align: center; }
.input {
  width: 100%; min-width: 0;
  background: #0b121a; color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 6px 9px; font-size: 12.5px; outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(98, 182, 255, .12); }
.input::placeholder { color: var(--dim); }
.toggle {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 11.5px; white-space: nowrap; cursor: pointer;
  user-select: none;
}
.toggle input { accent-color: var(--accent); margin: 0; }

/* ---------- runs pane ---------- */
.run-row {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px 9px; border: 0; border-bottom: 1px solid var(--line-soft);
  background: transparent; color: var(--text); position: relative;
}
.run-row:hover { background: rgba(30, 46, 63, .35); }
.run-row.active { background: linear-gradient(90deg, rgba(98, 182, 255, .10), rgba(98, 182, 255, .02)); }
.run-row.active::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--accent);
}
.run-row-top { display: flex; align-items: center; gap: 6px; }
.run-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-soft);
}
.run-row.active .run-name { color: var(--text); }
.run-tasks { color: var(--dim); font-size: 10.5px; font-family: var(--mono); }
.run-row-sub {
  margin-top: 2px; color: var(--muted); font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.run-stack { display: flex; gap: 2px; height: 3px; margin-top: 6px; border-radius: 3px; overflow: hidden; background: var(--line-soft); }
.stack-seg { min-width: 2px; }
.stack-verified { background: var(--ok); }
.stack-rejected { background: var(--rejected); }
.stack-no_output { background: var(--bad); }
.stack-other { background: var(--dim); }
.run-row-meta { display: flex; align-items: center; gap: 5px; margin-top: 5px; overflow: hidden; }
.run-row-meta .date { margin-left: auto; color: var(--dim); font-size: 10.5px; white-space: nowrap; }
/* ---------- browse mode switch (group by run / by problem) ---------- */
.browse-seg { flex: 0 0 auto; }
.browse-seg .seg-btn { height: 22px; font-size: 10.5px; letter-spacing: .03em; text-transform: uppercase; }
.pane-head .count { margin-left: auto; margin-right: 2px; color: var(--dim); font-size: 11px; font-family: var(--mono); }
/* ---------- problem grouping ---------- */
.problem-row .run-row-sub { color: var(--muted); }
.task-row.problem-task .task-uid { color: var(--accent2); }
.task-row.problem-task.active .task-uid { color: var(--text); }
.problem-statement .md-body { max-width: 78ch; }
.problem-run-table td:first-child { font-family: var(--mono); font-size: 11px; }
.badge {
  display: inline-flex; align-items: center; height: 16px; padding: 0 5px;
  border-radius: 4px; font-size: 10px; font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,.02);
  white-space: nowrap;
}
.badge-minimal { color: var(--accent); border-color: rgba(98,182,255,.28); background: rgba(98,182,255,.07); }
.badge-codex { color: var(--warn); border-color: rgba(255,191,102,.28); background: rgba(255,191,102,.07); }
.badge-dry { color: var(--dim); }
.badge-major { color: var(--accent2); border-color: rgba(157,140,255,.28); background: rgba(157,140,255,.07); }

/* ---------- tasks pane ---------- */
.run-summary { padding: 10px 12px 9px; border-bottom: 1px solid var(--line-soft); background: rgba(21, 32, 44, .35); }
.run-summary-title { font-family: var(--mono); font-size: 12px; color: var(--text); word-break: break-all; }
.run-summary-meta { margin-top: 3px; color: var(--muted); font-size: 11px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.run-summary-meta b { color: var(--text-soft); font-weight: 600; }
.outcome-bar { display: flex; height: 4px; margin-top: 8px; border-radius: 4px; overflow: hidden; background: var(--line-soft); }
.outcome-bar > span { display: block; min-width: 2px; }
.task-filters { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 7px; position: sticky; top: 0; z-index: 7; background: #0d151f; box-shadow: 0 4px 10px rgba(0,0,0,.22); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-filter {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 20px; padding: 1px 8px; font-size: 10.5px; line-height: 17px;
}
.chip-filter:hover { border-color: var(--line-strong); color: var(--text); }
.chip-filter.active { background: var(--panel3); border-color: var(--line-strong); color: var(--text); }
.chip-filter .n { color: var(--dim); margin-left: 3px; }
.task-row {
  scroll-margin-top: 112px;
  display: block; width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid var(--line-soft);
  background: transparent; padding: 7px 12px 8px; color: var(--text); position: relative;
}
.task-row:hover { background: rgba(30, 46, 63, .32); }
.task-row.active { background: linear-gradient(90deg, rgba(157, 140, 255, .10), rgba(157, 140, 255, .02)); }
.task-row.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent2); }
.task-uid { font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); }
.task-row.active .task-uid { color: var(--text); }
.task-sub { color: var(--dim); font-size: 10.5px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.task-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--dim); font-size: 10.5px; }
.task-meta .spacer { flex: 1; }
.transcript-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .85; }
.proof-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); opacity: .7; }
.outcome-chip {
  display: inline-flex; align-items: center; height: 16px; padding: 0 5px;
  border-radius: 4px; font-size: 9.5px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap; border: 1px solid transparent;
}
.outcome-verified, .outcome-completed_and_verified { color: var(--ok); background: var(--ok-bg); border-color: rgba(75,214,164,.22); }
.outcome-rejected, .outcome-completed_and_rejected { color: var(--rejected); background: var(--rejected-bg); border-color: rgba(232,170,98,.22); }
.outcome-no_output, .outcome-failed, .outcome-verifier_failure { color: var(--bad); background: var(--bad-bg); border-color: rgba(255,114,136,.22); }
.outcome-running, .outcome-queued, .outcome-verifying { color: var(--warn); background: var(--warn-bg); border-color: rgba(255,191,102,.22); }
.outcome-pending, .outcome-unknown, .outcome-null { color: var(--muted); background: rgba(255,255,255,.03); border-color: var(--line); }

/* ---------- main pane ---------- */
.main-pane { min-width: 0; min-height: 0; overflow: auto; position: relative; }
.task-view { min-height: 100%; }
.landing { min-height: 100%; display: flex; justify-content: center; align-items: flex-start; padding: 8vh 30px 60px; }
.landing-inner { width: 100%; max-width: 780px; }
.landing-mark { font-size: 42px; color: var(--accent); line-height: 1; margin-bottom: 12px; }
.landing h1 { font-size: 30px; letter-spacing: -.02em; }
.landing-sub { color: var(--muted); font-size: 14.5px; margin: 7px 0 26px; max-width: 620px; }
.landing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.landing-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: rgba(21, 32, 44, .4); }
.landing-card-title { font-size: 12px; font-weight: 650; color: var(--text); margin-bottom: 5px; }
.landing-card p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.landing-hints { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 22px; color: var(--dim); font-size: 11.5px; }
.kbd {
  display: inline-block; min-width: 16px; padding: 0 4px; border: 1px solid var(--line-strong);
  border-bottom-width: 2px; border-radius: 4px; background: var(--panel2);
  color: var(--text-soft); font-family: var(--mono); font-size: 10.5px; line-height: 15px; text-align: center;
}
.landing-recent { margin-top: 30px; }
.landing-recent h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin-bottom: 8px; }
.recent-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.recent-row:hover { color: var(--text); }
.recent-row .mono { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-row .recent-meta { color: var(--dim); font-size: 10.5px; }

/* loading */
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--line-strong);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-box { padding: 26px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; }
.skeleton { height: 100%; padding: 18px; }
.sk-line { height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--panel2), var(--panel3), var(--panel2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin-bottom: 10px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- task hero ---------- */
.task-hero {
  padding: 16px 22px 13px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(600px 140px at 85% 0%, rgba(98, 182, 255, .07), transparent 70%),
    linear-gradient(180deg, rgba(21, 32, 44, .65), rgba(12, 18, 26, .25));
}
.hero-top { display: flex; align-items: flex-start; gap: 18px; }
.hero-main { min-width: 0; flex: 1; }
.hero-eyebrow { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 11px; }
.hero-eyebrow .mono { color: var(--muted); }
.hero-title { font-size: 22px; line-height: 1.2; margin: 5px 0 4px; word-break: break-word; }
.hero-title .uid-prefix { color: var(--dim); font-weight: 500; }
.hero-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 6px; }
.hero-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 320px; }
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 27px; padding: 0 9px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--panel2); color: var(--text-soft);
  font-size: 11.5px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.btn-primary { background: rgba(98, 182, 255, .13); border-color: rgba(98, 182, 255, .38); color: var(--accent); }
.btn-sm { height: 24px; padding: 0 7px; font-size: 11px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel2); border-color: var(--line); }
.btn:disabled { opacity: .45; cursor: default; }
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 1px; margin-top: 13px;
  background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden;
}
.stat { padding: 7px 9px; background: rgba(13, 20, 29, .72); min-width: 0; }
.stat-label { color: var(--dim); font-size: 9.5px; text-transform: uppercase; letter-spacing: .055em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { color: var(--text); font-family: var(--mono); font-size: 12.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value.ok { color: var(--ok); }
.stat-value.bad { color: var(--bad); }
.stat-value.warn { color: var(--warn); }
.stat-value.think-val { color: var(--think); }
.usage-line { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--dim); font-size: 10.5px; font-family: var(--mono); }
.usage-line b { color: var(--muted); font-weight: 500; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 0 16px; border-bottom: 1px solid var(--line);
  background: rgba(13, 20, 29, .75);
  position: sticky; top: 0; z-index: 18;
  overflow-x: auto;
}
.tab {
  height: 37px; padding: 0 11px; border: 0; background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 500;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .tab-count { color: var(--dim); font-size: 10px; margin-left: 4px; font-family: var(--mono); }
.tab-body { padding: 0; }

/* ---------- trajectory toolbar ---------- */
.traj-toolbar {
  position: sticky; top: 37px; z-index: 16;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 15, 21, .94);
  backdrop-filter: blur(6px);
}
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg-btn { height: 24px; padding: 0 9px; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn:hover { color: var(--text); background: var(--panel2); }
.seg-btn.active { color: var(--text); background: var(--panel3); }
.toolbar-label { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; margin-left: 3px; }
.traj-search { display: flex; align-items: center; gap: 5px; min-width: 180px; flex: 1 1 180px; max-width: 330px; }
.traj-search .input { height: 25px; font-size: 11.5px; padding: 3px 8px; }
.jump-select {
  height: 25px; max-width: 130px;
  background: #0b121a; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font-size: 11px; padding: 0 6px; outline: none;
}
.compact-toggle { font-size: 10.5px; }
.traj-stats { color: var(--dim); font-size: 10.5px; padding: 7px 16px 0; font-family: var(--mono); }
.search-panel {
  margin: 8px 16px 0; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); overflow: hidden;
}
.search-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 11px;
  background: var(--panel2);
}
.search-head .spacer { flex: 1; }
.search-results { max-height: 260px; overflow: auto; }
.search-hit {
  display: flex; width: 100%; text-align: left; gap: 9px; align-items: flex-start;
  padding: 6px 10px; border: 0; border-bottom: 1px solid var(--line-soft);
  background: transparent; color: var(--text-soft); font-size: 11.5px;
}
.search-hit:hover { background: var(--panel2); }
.search-hit:last-child { border-bottom: 0; }
.hit-kind { flex: 0 0 auto; color: var(--accent); font-family: var(--mono); font-size: 10px; padding-top: 1px; min-width: 62px; }
.hit-text { min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit:hover .hit-text { color: var(--text); }
mark { background: rgba(255, 191, 102, .30); color: var(--text); border-radius: 2px; padding: 0 1px; }

/* ---------- trajectory ---------- */
.traj { padding: 12px 16px 60px; max-width: 1180px; }
.traj.compact { font-size: 13px; }
.traj.compact .turn-body { padding-bottom: 14px; }
.traj.compact .turn-rail { width: 58px; }

.msg-card { border: 1px solid var(--line); border-radius: var(--radius); margin: 5px 0 5px 76px; background: rgba(21, 32, 44, .28); }
.traj.compact .msg-card { margin-left: 58px; }
.msg-card.system { border-color: rgba(255, 191, 102, .16); background: rgba(255, 191, 102, .025); }
.msg-card.user { border-color: rgba(98, 182, 255, .16); background: rgba(98, 182, 255, .025); }
.msg-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border: 0; background: transparent; text-align: left; color: var(--muted);
}
.msg-label { text-transform: uppercase; letter-spacing: .07em; font-size: 9.5px; font-weight: 650; }
.msg-card.system .msg-label { color: var(--warn); }
.msg-card.user .msg-label { color: var(--accent); }
.msg-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 11px; }
.msg-card .msg-body { display: none; padding: 0 12px 12px; }
.msg-card.open .msg-body { display: block; }
.msg-card.open .msg-head .chev { transform: rotate(90deg); }
.msg-body .md-body, .msg-body .pre-body { font-size: 12.5px; }

.turn { display: flex; gap: 13px; border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 12px; }
.turn:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.turn-rail { flex: 0 0 63px; width: 63px; text-align: right; padding-top: 1px; user-select: none; }
.turn-num { color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 650; }
.turn-time { color: var(--dim); font-size: 9.5px; font-family: var(--mono); margin-top: 1px; }
.turn-body { flex: 1; min-width: 0; padding-bottom: 3px; }
.turn-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 7px; }
.turn-title { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.turn-chip { color: var(--dim); font-size: 10px; font-family: var(--mono); white-space: nowrap; }
.turn-chip.stop-tool { color: var(--accent); }
.turn-chip.stop-error, .turn-chip.stop-aborted { color: var(--bad); }
.turn-head .spacer { flex: 1; }
.turn-copy { opacity: 0; transition: opacity .12s; }
.turn:hover .turn-copy { opacity: 1; }

.block { margin: 0 0 7px; }
.block-head {
  display: flex; align-items: center; gap: 7px; width: 100%;
  border: 0; background: transparent; color: inherit; text-align: left; padding: 0;
}
.chev { color: var(--dim); font-size: 10px; transition: transform .12s; display: inline-block; }
.open > .block-head .chev, .open > .tool-head .chev { transform: rotate(90deg); }

/* thinking */
.think { border-left: 2px solid var(--think-line); background: linear-gradient(90deg, var(--think-bg), transparent 70%); border-radius: 0 8px 8px 0; padding: 7px 10px 7px 10px; }
.think .block-head { cursor: pointer; }
.think-badge { color: var(--think); font-size: 9.5px; font-weight: 700; letter-spacing: .08em; }
.think-meta { color: var(--dim); font-size: 10px; font-family: var(--mono); white-space: nowrap; }
.think-preview { flex: 1; min-width: 0; color: var(--dim); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.think.open .think-preview { display: none; }
.think .block-body { display: none; margin-top: 7px; }
.think.open .block-body { display: block; }
.think-text {
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--mono); font-size: 12px; line-height: 1.58;
  color: #c8d3e2;
}
.traj.compact .think-text { font-size: 11.5px; }

/* prose text */
.text-block { padding: 0 1px; }
.text-block .block-head { cursor: default; }
.text-badge { color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .07em; }
.pre-body {
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--text-soft);
}
.md-body { color: var(--text-soft); overflow-wrap: anywhere; }
.md-body p { margin: 0 0 7px; }
.md-body p:last-child { margin-bottom: 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { color: var(--text); margin: 12px 0 5px; line-height: 1.3; }
.md-body h1 { font-size: 17px; } .md-body h2 { font-size: 15px; } .md-body h3 { font-size: 13.5px; }
.md-body ul, .md-body ol { margin: 0 0 8px; padding-left: 20px; }
.md-body li { margin: 1px 0; }
.md-body blockquote { margin: 0 0 8px; padding: 1px 10px; border-left: 2px solid var(--line-strong); color: var(--muted); }
.md-body pre.md-code { background: #0a1118; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; overflow: auto; margin: 7px 0; font-size: 11.5px; }
.md-body code { background: rgba(255,255,255,.045); border: 1px solid var(--line-soft); border-radius: 4px; padding: 0 3px; font-size: 11.5px; }
.md-body pre code { border: 0; background: transparent; padding: 0; }
.md-body a { color: var(--accent); }
.math-block { display: block; margin: 7px 0; }
.math-block.math-source {
  padding: 7px 10px; border-left: 2px solid var(--line-strong);
  background: rgba(0,0,0,.18); color: var(--text); white-space: pre-wrap;
  font-family: var(--mono); font-size: 12px; overflow-x: auto; overflow-wrap: anywhere;
}
.math-block.math-rendered { padding: 2px 0; overflow-x: auto; }
.math-inline { color: var(--text); }
.math-inline.math-source { font-family: var(--mono); font-size: .96em; overflow-wrap: anywhere; }
.math-error { border-bottom: 1px dotted var(--bad); color: #ffb3c0; }
.math-block.math-error { border-left-color: var(--bad); background: rgba(255,114,136,.05); }
.md-body .katex-display { margin: .45em 0; overflow-x: auto; overflow-y: hidden; }
.think-text .katex { font-size: 1.04em; }
.think-text .math-block.math-rendered { margin: 5px 0; }
.think-text .katex-display { margin: .25em 0; }
.md-body hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }

.copy-row { display: flex; justify-content: flex-end; margin-top: 5px; }
.copy-btn {
  border: 1px solid transparent; background: transparent; color: var(--dim);
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
}
.copy-btn:hover { color: var(--text); border-color: var(--line); background: var(--panel2); }
.block-loading { color: var(--dim); font-size: 11px; font-family: var(--mono); display: flex; align-items: center; gap: 6px; padding: 5px 0; }
.load-more {
  border: 1px dashed var(--line-strong); background: transparent; color: var(--muted);
  border-radius: 6px; padding: 4px 8px; font-size: 11px; margin-top: 5px;
}
.load-more:hover { border-color: var(--accent); color: var(--accent); }

/* tool cards */
.tool { border: 1px solid var(--line); border-radius: 8px; background: rgba(21, 32, 44, .52); overflow: hidden; }
.tool.open { border-color: var(--line-strong); }
.tool-head {
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 6px 9px; border: 0; background: transparent; color: inherit; text-align: left;
}
.tool:hover .tool-head { background: rgba(255,255,255,.018); }
.tool-icon { width: 15px; text-align: center; color: var(--accent); font-size: 12px; flex: 0 0 auto; }
.tool-name { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--accent); }
.tool-edit .tool-name { color: var(--warn); }
.tool-write .tool-name { color: var(--accent2); }
.tool-read .tool-name { color: var(--ok); }
.tool-summary { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 10.5px; font-family: var(--mono); }
.tool-badges { display: flex; gap: 4px; flex: 0 0 auto; }
.tool-body { display: none; padding: 0 9px 9px; }
.tool.open .tool-body { display: block; }
.tool-section { margin-top: 6px; }
.tool-section-label { color: var(--dim); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 3px; }
.tool-args pre, .tool-result pre {
  background: #0a1118; border: 1px solid var(--line-soft); border-radius: 6px;
  padding: 7px 9px; overflow: auto; max-height: 480px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5; color: var(--text-soft);
}
.tool-result.error pre { border-color: rgba(255, 114, 136, .28); background: rgba(255, 114, 136, .035); }
.result-head { display: flex; align-items: center; gap: 7px; margin: 7px 0 3px; }
.result-label { color: var(--dim); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; }
.result-meta { color: var(--dim); font-size: 10px; font-family: var(--mono); }
.result-error { color: var(--bad); }
.result-ok { color: var(--ok); }
.arg-path { color: var(--warn); font-family: var(--mono); font-size: 11px; margin-bottom: 4px; word-break: break-all; }
.arg-kv { display: flex; gap: 8px; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.arg-kv .k { color: var(--dim); }
.arg-kv .v { font-family: var(--mono); color: var(--text-soft); }
.edits { display: flex; flex-direction: column; gap: 7px; }
.edit-item { border: 1px solid var(--line-soft); border-radius: 6px; overflow: hidden; }
.edit-title { padding: 3px 7px; background: var(--panel3); color: var(--dim); font-size: 9.5px; font-family: var(--mono); }
.diff-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); }
.diff-side { min-width: 0; background: #0a1118; }
.diff-side pre { border: 0; border-radius: 0; max-height: 280px; background: transparent; }
.diff-title { padding: 2px 6px; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; font-family: var(--sans); }
.diff-old .diff-title { color: var(--bad); background: var(--bad-bg); }
.diff-new .diff-title { color: var(--ok); background: var(--ok-bg); }
.diff-old pre { color: #e9a6b0; }
.diff-new pre { color: #a9e8cf; }

.marker {
  display: flex; align-items: center; gap: 9px;
  margin: 14px 0 14px 76px; color: var(--dim); font-size: 10.5px;
}
.traj.compact .marker { margin-left: 58px; }
.marker::before, .marker::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }
.marker .marker-label { color: var(--warn); font-family: var(--mono); font-size: 10px; white-space: nowrap; }
.marker.error .marker-label { color: var(--bad); }

.orphan-result { margin-left: 76px; }
.traj.compact .orphan-result { margin-left: 58px; }
.turn-target { scroll-margin-top: 110px; }
.flash { animation: flash 1.4s ease-out; }
@keyframes flash {
  0% { box-shadow: 0 0 0 2px var(--accent), 0 0 24px rgba(98,182,255,.30); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.hit-target { outline: 1px solid rgba(255,191,102,.45); outline-offset: 2px; }

/* ---------- prompt/proof/verdict/files/meta pages ---------- */
.doc-page { padding: 16px 22px 80px; max-width: 1000px; }
.doc-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.doc-meta { color: var(--dim); font-size: 10.5px; font-family: var(--mono); margin-left: auto; }
.doc-card { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(16, 24, 34, .72); overflow: hidden; }
.doc-card-head { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); background: var(--panel2); }
.doc-card-title { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.doc-card-body { padding: 14px 16px; }
.doc-pre {
  white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono);
  font-size: 12px; line-height: 1.55; color: var(--text-soft);
  background: #0a1118; border: 1px solid var(--line-soft); border-radius: 7px;
  padding: 11px 13px; max-height: 70vh; overflow: auto;
}
.doc-empty { padding: 30px; text-align: center; color: var(--dim); font-size: 12.5px; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.info-card { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 11px 13px; }
.info-card-title { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); margin-bottom: 5px; }
.info-card-body { color: var(--text-soft); font-size: 12.5px; line-height: 1.55; }
.big-verdict { display: inline-flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 650; }
.verdict-dot { width: 10px; height: 10px; border-radius: 50%; }
.verdict-verified { color: var(--ok); } .verdict-dot.verified { background: var(--ok); box-shadow: 0 0 12px rgba(75,214,164,.5); }
.verdict-rejected { color: var(--rejected); } .verdict-dot.rejected { background: var(--rejected); box-shadow: 0 0 12px rgba(232,170,98,.5); }
.verdict-none { color: var(--muted); } .verdict-dot.none { background: var(--dim); }
.error-list { margin: 5px 0 0; padding-left: 18px; color: var(--text-soft); font-size: 12px; }
.error-list li { margin: 3px 0; }
.details-block { margin-top: 12px; }
.details-block > summary {
  cursor: pointer; color: var(--muted); font-size: 11.5px; font-weight: 600;
  padding: 5px 0; user-select: none;
}
.details-block > summary:hover { color: var(--text); }
.details-block[open] > summary { margin-bottom: 6px; }
.kv-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.kv-table td { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.kv-table td:first-child { color: var(--dim); width: 190px; font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.kv-table td:last-child { color: var(--text-soft); font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }
.obligation { border: 1px solid var(--line-soft); border-radius: 6px; padding: 7px 9px; margin: 5px 0; background: rgba(0,0,0,.12); }
.obligation .req { color: var(--text-soft); font-size: 12px; }
.obligation .status { font-size: 10px; font-family: var(--mono); margin-left: 6px; }
.obligation .status.resolved { color: var(--ok); }
.obligation .status.unresolved { color: var(--bad); }
.obligation .ev { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.file-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.file-table th { text-align: left; color: var(--dim); font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; padding: 5px 8px; border-bottom: 1px solid var(--line); font-weight: 600; }
.file-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.file-table tr:hover td { background: rgba(255,255,255,.015); }
.file-name { font-family: var(--mono); color: var(--text-soft); font-size: 11.5px; }
.file-size { color: var(--dim); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.file-actions { display: flex; gap: 5px; justify-content: flex-end; }
.file-tag { color: var(--dim); font-size: 9.5px; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 5px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 8, 12, .72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: min(980px, 100%); max-height: min(86vh, 900px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.55);
  overflow: hidden;
}
.modal.small { width: min(620px, 100%); }
.modal-head { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel2); flex: 0 0 auto; }
.modal-title { font-size: 13px; font-weight: 650; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-sub { color: var(--dim); font-size: 10.5px; font-family: var(--mono); white-space: nowrap; }
.modal-actions { margin-left: auto; display: flex; gap: 6px; }
.modal-body { padding: 14px; overflow: auto; min-height: 0; }
.modal-body.modal-pre { padding: 0; }
.modal-body .doc-pre { max-height: none; border: 0; border-radius: 0; }
.modal-foot { padding: 8px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 10.5px; display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.help-section h3 { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin-bottom: 6px; }
.help-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; font-size: 12px; color: var(--muted); }
.help-row .kbd { min-width: 54px; }
.help-row .keys { color: var(--text-soft); font-family: var(--mono); font-size: 11px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; max-width: 640px;
  background: #17222e; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 14px; color: var(--text); font-size: 12px;
  box-shadow: 0 10px 35px rgba(0,0,0,.45);
}
.toast.error { border-color: rgba(255,114,136,.5); color: #ffd6dc; }
.toast.ok { border-color: rgba(75,214,164,.4); }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .shell { grid-template-columns: 226px 310px minmax(0, 1fr); }
  .turn-rail { width: 52px; flex-basis: 52px; }
  .msg-card, .marker, .orphan-result { margin-left: 65px; }
}
@media (max-width: 1040px) {
  .shell { grid-template-columns: 210px 292px minmax(0, 1fr); }
  .hero-actions { max-width: 240px; }
  .diff-pair { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 200px minmax(0, 1fr); }
  .tasks-pane { display: none; }
  .shell.show-tasks .tasks-pane { display: flex; }
  .shell.show-tasks .runs-pane { display: none; }
  .shell.show-tasks { grid-template-columns: 1fr; }
  .landing-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .shell { grid-template-columns: 1fr; }
  .pane.runs-pane { display: none; }
  .shell.show-run .runs-pane { display: flex; }
  .shell.show-run .main-pane { display: none; }
  .shell.show-tasks { grid-template-columns: 1fr; }
  .brand-text { display: none; }
  .top-meta { display: none; }
  .task-hero { padding: 12px 14px; }
  .hero-top { flex-direction: column; }
  .hero-actions { max-width: none; justify-content: flex-start; }
  .traj { padding: 10px 10px 60px; }
  .turn { gap: 7px; }
  .turn-rail { width: 30px; flex-basis: 30px; }
  .turn-num { font-size: 10px; }
  .msg-card, .marker, .orphan-result { margin-left: 37px; }
  .help-grid { grid-template-columns: 1fr; }
}
