:root {
  --ink: #0f1d2b;
  --ink-2: #3b4a5a;
  --muted: #6b7a8a;
  --line: #e3e8ee;
  --bg: #f5f7fa;
  --card: #ffffff;
  --navy: #0f2a3d;
  --teal: #0d9488;
  --teal-soft: #ccfbf1;
  --high: #15803d;   --high-bg: #dcfce7;
  --mod: #1d4ed8;    --mod-bg: #dbeafe;
  --low: #b45309;    --low-bg: #fef3c7;
  --vlow: #b91c1c;   --vlow-bg: #fee2e2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 29, 43, .06), 0 1px 1px rgba(15, 29, 43, .04);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); }
a { color: var(--teal); }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; } h4 { font-size: 13px; }
p { margin: 0 0 .6em; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- chrome */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 54px; background: var(--navy); color: #e2e8f0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.brand-sep { opacity: .4; } .brand-app { color: #5eead4; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { color: #cbd5e1; text-decoration: none; padding: 7px 12px; border-radius: 7px; font-weight: 500; }
.tabs a:hover { background: rgba(255,255,255,.07); color: #fff; }
.tabs a.active { background: rgba(94,234,212,.14); color: #5eead4; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #cbd5e1; white-space: nowrap; }
.view { max-width: 1320px; margin: 0 auto; padding: 22px 20px 40px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 12px 20px 28px; }
.banner { padding: 10px 20px; font-size: 13px; background: var(--low-bg); color: #7c2d12; border-bottom: 1px solid #fcd34d; }
.banner.err { background: var(--vlow-bg); color: #7f1d1d; border-color: #fca5a5; }
.banner.ok { background: var(--high-bg); color: #14532d; border-color: #86efac; }

/* ---------- primitives */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; }
.card + .card, .view > * + *, .view .grid > div > * + * { margin-top: 14px; }
.view > a + * { margin-top: 8px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.grid { display: grid; gap: 16px; }
.cols-main-side { grid-template-columns: minmax(0, 1fr) 340px; }
.cols-lab { grid-template-columns: 320px minmax(0, 1fr); }
@media (max-width: 1000px) { .cols-main-side, .cols-lab { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 10px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; } .pad { padding: 40px 0; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.grow { flex: 1; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 13px; cursor: pointer;
  font-weight: 500; }
.btn:hover { border-color: #c5ced8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: #0f766e; border-color: #0f766e; }
.btn-danger { color: var(--vlow); border-color: #fca5a5; }
.btn-ghost { background: transparent; border-color: transparent; color: inherit; }
.btn-ghost:hover { background: rgba(255,255,255,.08); border-color: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.linkish { background: none; border: none; color: var(--teal); cursor: pointer; padding: 0; font-weight: 500; }

input[type=text], textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; background: #fff; }
input[type=text]:focus, textarea:focus, select:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
textarea { resize: vertical; }
.editor { font-family: var(--mono); font-size: 13px; line-height: 1.6; min-height: 380px; }
label.field { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }

.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: #eef2f6; color: var(--ink-2); white-space: nowrap; }
.pill-quiet { background: rgba(94,234,212,.16); color: #5eead4; }
.pill-teal { background: var(--teal-soft); color: #115e59; }
.g-high { background: var(--high-bg); color: var(--high); }
.g-moderate { background: var(--mod-bg); color: var(--mod); }
.g-low { background: var(--low-bg); color: var(--low); }
.g-very_low { background: var(--vlow-bg); color: var(--vlow); }
.st-done { background: var(--high-bg); color: var(--high); }
.st-failed { background: var(--vlow-bg); color: var(--vlow); }
.st-processing, .st-running, .st-queued, .st-awaiting_upload { background: var(--mod-bg); color: var(--mod); }

/* ---------- prompt */
.meta-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; }
.counter { font-size: 12px; color: var(--muted); }
.dirty { color: var(--low); font-weight: 600; }
.versions { max-height: 640px; overflow: auto; margin: 0 -6px; }
.ver { display: block; width: 100%; text-align: left; background: none; border: 1px solid transparent;
  border-radius: 8px; padding: 8px 8px; cursor: pointer; }
.ver:hover { background: #f1f5f9; }
.ver.sel { border-color: var(--teal); background: #f0fdfa; }
.ver-top { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ver-note { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.ver-by { color: var(--muted); font-size: 12px; }
.diff { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: 520px; }
.diff div { padding: 1px 10px; }
.d-add { background: #ecfdf5; color: #065f46; }
.d-del { background: #fef2f2; color: #991b1b; text-decoration: line-through; text-decoration-color: rgba(153,27,27,.35); }
.d-same { color: var(--ink-2); }
.conflict { border: 1px solid #fcd34d; background: #fffbeb; border-radius: 8px; padding: 12px 14px; }

/* ---------- evidence */
.drop { border: 1.5px dashed #c5ced8; border-radius: 10px; padding: 22px; text-align: center; color: var(--muted);
  cursor: pointer; background: #fafbfc; }
.drop.over { border-color: var(--teal); background: #f0fdfa; color: #115e59; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button { border: none; background: #fff; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.segmented button.on { background: var(--navy); color: #fff; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; } table.list tr.click:hover td { background: #f8fafc; }
.bars { display: inline-flex; gap: 3px; vertical-align: middle; }
.bars i { width: 7px; height: 12px; border-radius: 2px; background: #e2e8f0; }
.bars i.on { background: var(--teal); }
.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 800px) { .scores { grid-template-columns: 1fr; } }
.score-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.score-num { font-size: 22px; font-weight: 700; } .score-num small { font-size: 12px; color: var(--muted); font-weight: 500; }
.facts { display: grid; grid-template-columns: 140px 1fr; gap: 4px 14px; font-size: 13px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
ul.tight { margin: 0; padding-left: 18px; } ul.tight li + li { margin-top: 4px; }
.say-yes { border-left: 3px solid var(--high); padding-left: 12px; }
.say-no { border-left: 3px solid var(--vlow); padding-left: 12px; }
.suggestion { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.suggestion + .suggestion { margin-top: 10px; }
.quote { font-family: var(--mono); font-size: 12.5px; background: #f8fafc; border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; white-space: pre-wrap; }

/* ---------- lab */
.profile { max-height: 560px; overflow: auto; }
.cond { display: flex; justify-content: space-between; gap: 8px; padding: 5px 2px; border-bottom: 1px solid #f1f5f9; font-size: 12.5px; }
.cond.flag { background: #fffbeb; border-radius: 6px; padding: 6px 8px; border-bottom: none; margin-bottom: 4px; }
.cond .val { font-family: var(--mono); color: var(--ink-2); white-space: nowrap; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px;
  cursor: pointer; font-size: 12.5px; }
.presets button:hover { border-color: var(--teal); color: #115e59; }
.answer { font-size: 14px; line-height: 1.65; }
.answer p { margin: 0 0 .7em; } .answer ul { margin: 0 0 .7em; padding-left: 20px; }
.answer h4 { margin-top: .8em; }
.rubric label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 3px 0; }
details > summary { cursor: pointer; color: var(--teal); font-weight: 500; }
pre.sysprompt { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 420px; overflow: auto; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--teal-soft);
  border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.run { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 8px 2px; cursor: pointer; }
.run:hover { background: #f8fafc; }
.run-q { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
