/* Interop Medic judge page. Look: web/reference/hub-v4.html (the approved mockup). */
:root {
  --ink: #13241f;
  --muted: #5b6f68;
  --faint: #8a9b95;
  --page: #f7faf9;
  --hub: #eef3f1;
  --dots: #d6e3de;
  --line: #d5e2dd;
  --card: #fff;
  --brand: #1f5f50;
  --brand-glow: #7ff0c9;
  --green: #2f8a73;
  --amber: #f5a524;
  --red: #ef5350;
  --blue: #60a5fa;
  --violet: #7c3aed;
  --wire: #8cbcae;
  --screen: #10251f;
  --screen-ink: #d9efe7;
  --screen-accent: #7fd8b9;
  --screen-soft: #9fb9b0;
  --screen-hover: #1a3a31;
  --drawer: #0b1b16;
  --strip: #13241f;
  --strip-ink: #e6f2ee;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); line-height: 1.4; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.top {
  max-width: 1320px; margin: 0 auto; padding: 28px 24px 18px; display: grid;
  grid-template-columns: minmax(250px, .7fr) minmax(420px, 1.3fr); gap: 56px; align-items: end;
}
.top h1 { margin: 3px 0 2px; font-size: 34px; line-height: 1.05; letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--green); font-size: 11px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.tagline { margin: 0; color: var(--muted); font-size: 14px; }
.lede { margin: 0; max-width: 740px; color: var(--ink); font-size: 16px; line-height: 1.5; }
.about { margin: 7px 0 0; font-size: 12px; color: var(--faint); }
.about:empty { display: none; }
.notice { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: #fff4dc; color: #7a5b16; font-size: 14px; font-weight: 600; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px 24px; }
.view-tabs {
  max-width: 1320px; margin: 0 auto 16px; padding: 0 24px; display: flex; gap: 28px;
  border-bottom: 1px solid var(--line);
}
.view-tab {
  position: relative; border: 0; padding: 10px 0 12px; background: none; color: var(--muted);
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.view-tab::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: transparent; }
.view-tab.on { color: var(--ink); }
.view-tab.on::after { background: var(--green); }

/* ---------- Hub ---------- */
.hub {
  background: var(--hub);
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 18px 18px;
  border-radius: 20px 20px 0 0;
  padding: 24px;
  display: grid;
  grid-template-columns: 200px 44px minmax(300px, 1.2fr) 44px minmax(230px, 1fr) minmax(240px, 1fr);
  align-items: center;
}
.h { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }

.col-chips { min-width: 0; }
.chips { display: flex; flex-direction: column; }
.chip {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 14px; margin: 9px 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; transition: all .2s;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 6px 16px rgba(31, 95, 80, .25); }
.chip.on .dot { background: var(--brand-glow); }
.chip.more { background: transparent; border-style: dashed; color: var(--muted); }
.chip:disabled { cursor: wait; opacity: .75; }
.chip.on:disabled { opacity: 1; }
.batch-btn {
  margin-top: 14px; width: 100%; min-height: 38px; border-radius: 12px; border: 1px solid var(--brand);
  background: var(--card); color: var(--brand); font-size: 14px; font-weight: 700; cursor: pointer;
}
.batch-btn:disabled { cursor: wait; opacity: .6; }
.batch-note { margin: 6px 2px 0; min-height: 1.2em; font-size: 12px; color: var(--muted); }

.wire { width: 44px; align-self: stretch; height: 100%; }
#wire-out { height: 260px; align-self: center; }
.wire path { stroke: var(--wire); stroke-width: 1.6; fill: none; }
.wire path.live, #wire-out.on path { stroke: var(--brand); stroke-width: 2.4; stroke-dasharray: 6 6; animation: flow 1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -12; } }

/* ---------- Device ---------- */
.device {
  min-width: 0;
  background: linear-gradient(#fbfcfb, #eef2f0); border: 1px solid #d5e0db; border-radius: 34px;
  padding: 16px 16px 12px; box-shadow: 0 18px 40px rgba(20, 50, 40, .12);
}
.scr { background: var(--screen); border-radius: 18px; padding: 14px 14px 10px; color: var(--screen-ink); min-height: 250px; }
.scr-top { font-size: 12px; color: var(--screen-accent); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.badge { background: var(--violet); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge[hidden] { display: none; }
.steps { display: flex; flex-direction: column; }
.step {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 6px; border: 0; border-radius: 8px;
  background: transparent; color: var(--screen-ink); font-size: 13px; text-align: left; cursor: pointer; animation: fade .35s ease;
}
.step:hover, .step.open { background: var(--screen-hover); }
.step .stage { flex: none; }
.step .v { margin-left: auto; color: var(--screen-soft); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.s { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.s.ok { background: var(--green); color: #fff; }
.s.warn { background: var(--amber); color: #2a1a00; }
.s.bad { background: var(--red); color: #fff; }
.s.hum { background: var(--blue); color: #0b1b30; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.idle { margin: 18px 6px; color: var(--screen-soft); font-size: 14px; }
.step-error { margin: 12px 6px; color: #ffb4b0; font-size: 13px; overflow-wrap: anywhere; }
.thinking-shell { min-height: 190px; padding: 4px 6px 0; overflow: hidden; }
.thinking { display: flex; align-items: center; gap: 8px; padding: 4px 0 10px; font-size: 13px; color: var(--screen-accent); }
.thinking b { font-variant-numeric: tabular-nums; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--screen-accent); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }
.glyph-draw { position: relative; display: grid; gap: 7px; padding: 14px 13px; overflow: hidden; border: 1px solid rgba(127, 216, 185, .16); border-radius: 10px; background: rgba(2, 14, 10, .22); }
.glyph-draw::after { content: ''; position: absolute; top: 8px; bottom: 8px; left: 0; width: 1px; background: var(--screen-accent); opacity: .55; animation: glyph-scan 2.8s ease-in-out infinite; }
.glyph-line { display: block; overflow: hidden; color: #8dcab5; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; white-space: nowrap; clip-path: inset(0 100% 0 0); opacity: .3; animation: glyph-draw 3.2s cubic-bezier(.22, 1, .36, 1) infinite; }
.glyph-line-2 { animation-delay: .22s; }
.glyph-line-3 { animation-delay: .44s; }
.glyph-line-4 { animation-delay: .66s; }
.glyph-line-5 { animation-delay: .88s; }
.thinking-note { margin: 10px 0 0; color: var(--screen-soft); font-size: 10px; letter-spacing: .02em; }
@keyframes glyph-draw {
  0%, 8% { clip-path: inset(0 100% 0 0); opacity: .2; transform: translateX(-3px); }
  34%, 76% { clip-path: inset(0 0 0 0); opacity: 1; transform: translateX(0); }
  92%, 100% { clip-path: inset(0 0 0 100%); opacity: .15; transform: translateX(3px); }
}
@keyframes glyph-scan { 0%, 100% { transform: translateX(8px); opacity: 0; } 20%, 80% { opacity: .6; } 50% { transform: translateX(430px); } }
.drawer {
  margin-top: 6px; background: var(--drawer); border-left: 3px solid var(--screen-accent); border-radius: 6px;
  padding: 7px 10px; font-family: var(--mono); font-size: 11px; color: #b9d8cd; overflow-wrap: anywhere;
}
.drawer .ms { color: var(--screen-soft); }
.knobs { display: flex; justify-content: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; position: relative; }
.knob .name::after { content: ''; display: inline-block; margin-left: 6px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.knob:disabled .name::after { display: none; }
.model-menu {
  position: absolute; z-index: 20; display: flex; flex-direction: column; padding: 4px; border-radius: 12px;
  background: var(--card); border: 1px solid #d3ddd9; box-shadow: 0 8px 24px rgba(20, 50, 40, .14);
}
.model-menu .opt {
  text-align: left; padding: 7px 12px; border: 0; border-radius: 8px; background: none; font-size: 12px; cursor: pointer; color: inherit;
}
.model-menu .opt:hover, .model-menu .opt:focus-visible { background: rgba(31, 92, 74, .08); outline: none; }
.model-menu .opt.on { font-weight: 700; }
.model-menu .opt:disabled { color: #9aa9a4; cursor: not-allowed; background: none; }
.model-menu .opt small { margin-left: 8px; font-size: 10px; font-weight: 500; }
.model-menu .opt.on::before { content: '✓ '; }
.knob {
  min-width: 104px; height: 34px; padding: 0 14px; border-radius: 17px; background: var(--card); border: 1px solid #d3ddd9;
  display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.knob small { color: #7a8c86; font-weight: 500; }
.knob:disabled { cursor: default; color: var(--muted); }
.knob-note { margin: 6px 0 0; text-align: center; font-size: 11px; color: var(--faint); min-height: 1.3em; }

/* ---------- Build your own ---------- */
.builder { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 13px 14px; min-width: 0; }
.builder[hidden] { display: none; }
.builder h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.bf { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); }
.bf > span { display: block; margin-bottom: 3px; }
.builder select, .builder textarea, .builder input[type="text"], .builder input[type="number"] {
  width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink); font: inherit; font-size: 13px;
}
.builder textarea { font-family: var(--mono); font-size: 12px; resize: vertical; min-height: 110px; }
.builder :is(select, textarea, input):focus-visible { outline: 3px solid var(--blue); outline-offset: 1px; }
.bf-fmt { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.builder input[type="file"] { width: 100%; min-width: 0; font: inherit; font-size: 12px; color: var(--ink); }
.builder input[type="file"]:focus-visible { outline: 3px solid var(--blue); outline-offset: 1px; }
.bf-note { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.bf-note:empty, .bf-pick[hidden], .builder button[hidden] { display: none; }
.bf-ep { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; font-size: 13px; }
.bf-check, .bf-min { display: flex; align-items: center; gap: 6px; }
.builder .bf-min input { width: 80px; }
.builder .err:empty { display: none; }

/* ---------- Cards ---------- */
.out { display: flex; flex-direction: column; gap: 12px; padding-right: 14px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 13px 15px; box-shadow: 0 4px 12px rgba(20, 50, 40, .06); min-width: 0; overflow-wrap: anywhere; }
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.muted { margin: 0; font-size: 13px; color: var(--faint); }
.pill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.p-esc { background: #fde2e1; color: #b42318; }
.p-res { background: #dcf3e6; color: #1e6b3a; }
.p-fix { background: #dff4ef; color: #11604f; }
.p-rer { background: #e0ecff; color: #1d4ed8; }
.p-q { background: #efe7d6; color: #7a5b16; }
.target { font-size: 12px; color: var(--muted); font-weight: 600; }
.row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.row.by { margin-top: 10px; }
.bar { height: 7px; border-radius: 4px; background: #edf1ef; margin-top: 3px; }
.bar i { display: block; height: 100%; border-radius: 4px; transition: width .4s; }
.sev-low, .conf { background: var(--green); }
.sev-mid { background: var(--amber); }
.sev-high { background: var(--red); }
.msg { margin: 0; font-size: 13px; line-height: 1.45; }
.msg .alert { color: #b42318; }
.msg.good { color: #1e6b3a; font-weight: 600; }
.msg.sub { margin-top: 6px; color: var(--muted); }
.err { margin: 8px 0 0; font-size: 12px; color: #b42318; }
.act { display: flex; gap: 8px; margin-top: 10px; }
.act button, .ovr button {
  flex: 1; min-height: 30px; padding: 4px 6px; border-radius: 9px; border: 1px solid var(--line); background: var(--card);
  font-weight: 600; font-size: 12px; cursor: pointer; overflow-wrap: anywhere;
}
.act .pri { background: var(--brand); color: #fff; border-color: var(--brand); }
.act button:disabled, .ovr button:disabled { opacity: .6; cursor: wait; }
.ovr { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ovr button { flex: 0 0 calc(50% - 3px); }
.link { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }

/* ---------- Audit trail ---------- */
.audit { align-self: stretch; padding: 0; overflow: hidden; }
.audit h3 { margin: 0; padding: 14px 16px; display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); background: #f8fbfa; }
.audit h3 .sub { font-weight: 500; color: var(--faint); }
.events { list-style: none; margin: 0; padding: 12px 16px; }
.ev { position: relative; display: grid; grid-template-columns: 58px 1fr; gap: 8px; margin-left: 6px; padding: 10px 8px 10px 20px; border-left: 1px solid #c9dbd5; border-top: 0; border-radius: 0 8px 8px 0; background: #f8fbfa; font-size: 11px; animation: fade .35s ease; }
.ev + .ev { margin-top: 7px; }
.ev::before { content: ""; position: absolute; top: 14px; left: -5px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px #cce9df; }
.ev > span { min-width: 0; }
.ev.empty { display: block; border-left-color: #dbe7e3; color: var(--faint); }
.ev .tm { color: var(--faint); font-variant-numeric: tabular-nums; }
.ev .who { font-weight: 600; }
.mem { margin: 8px 0 0; font-size: 12px; background: #f3f0ff; color: #5b21b6; border-radius: 8px; padding: 7px 9px; }

/* ---------- KPI strip ---------- */
.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; background: var(--strip); color: var(--strip-ink); border-radius: 0 0 20px 20px; padding: 14px 24px; }
.kpi { min-width: 0; }
.kpi .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11px; color: var(--screen-soft); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Batch list ---------- */
.batch { margin-top: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; overflow-wrap: normal; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid #f0f3f2; }
td.case { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.yes { color: #1e6b3a; font-weight: 700; }
td.no { color: #b42318; font-weight: 700; }

.foot {
  max-width: none; margin: 0; padding: 18px 24px 26px; display: flex; justify-content: space-between;
  gap: 32px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px;
}
.foot div { display: flex; flex-direction: column; gap: 3px; }
.foot b { color: var(--ink); font-size: 12px; }
.foot p { margin: 0; text-align: right; white-space: nowrap; }

/* ---------- Inside the agent ---------- */
.inside { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.inside-head {
  padding: 32px 36px 28px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px;
  background: #f3f8f6; border-bottom: 1px solid var(--line);
}
.inside-head h2 { margin: 7px 0 0; max-width: 650px; font-size: clamp(28px, 3vw, 44px); line-height: 1.05; letter-spacing: -.04em; }
.inside-head > p { margin: 2px 0 0; align-self: end; color: var(--muted); font-size: 14px; line-height: 1.65; }
.pipeline { list-style: none; margin: 0; padding: 10px 36px; }
.pipeline li {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) 76px; gap: 18px; align-items: center;
  min-height: 90px; border-bottom: 1px solid #e8efec;
}
.pipeline li:last-child { border-bottom: 0; }
.pipeline .agent-stage { margin: 0 -36px; padding: 0 36px; background: #eef8f4; }
.stage-no { color: var(--green); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.pipeline b { display: block; margin-bottom: 4px; font-size: 16px; }
.pipeline p { margin: 0; color: var(--muted); font-size: 13px; }
.stage-tech { justify-self: end; color: var(--brand); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.proof-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; border-top: 1px solid var(--line); }
.proof-grid article { padding: 28px 30px; border-right: 1px solid var(--line); }
.proof-grid article:last-child { border-right: 0; }
.proof-kicker { margin: 0 0 6px !important; color: var(--green) !important; font-size: 10px !important; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.proof-grid h3 { margin: 0 0 12px; font-size: 18px; letter-spacing: -.02em; }
.proof-grid p, .proof-grid li { color: var(--muted); font-size: 12px; line-height: 1.6; }
.proof-grid p { margin: 0; }
.proof-grid ul { margin: 0; padding-left: 18px; }
.proof-grid code { color: var(--brand); font-family: var(--mono); font-size: 11px; }
.judge-note { margin: 0; padding: 20px 30px; display: grid; grid-template-columns: 130px 1fr auto; gap: 22px; align-items: center; background: var(--strip); color: var(--strip-ink); }
.judge-note > span { color: var(--screen-accent); font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.judge-note p { margin: 0; font-size: 13px; line-height: 1.5; }
.judge-note button { padding: 9px 14px; border: 1px solid #52756a; border-radius: 9px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 700; cursor: pointer; }

/* ---------- Narrower screens ---------- */
/* 900-1180 px: chips | device | cards, with the audit trail as a full-width row below. */
@media (max-width: 1180px) {
  .hub { grid-template-columns: minmax(170px, 200px) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .wire { display: none; }
  .out { padding-right: 0; }
  .audit { grid-column: 1 / -1; }
}
/* Below 900 px: one column. */
@media (max-width: 899px) {
  .top { grid-template-columns: 1fr; gap: 18px; align-items: start; }
  .hub { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 14px; }
  .chips { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .chip { margin: 0; }
  .inside-head { grid-template-columns: 1fr; gap: 18px; }
  .proof-grid { grid-template-columns: 1fr; }
  .proof-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .judge-note { grid-template-columns: 1fr; gap: 8px; }
}
@media (max-width: 760px) {
  .top { padding: 20px 16px 10px; }
  .top h1 { font-size: 30px; }
  .view-tabs { margin-bottom: 12px; padding: 0 16px; }
  .wrap { padding: 0 16px 16px; }
  .foot { margin: 0 16px 20px; padding: 16px 0 0; flex-direction: column; gap: 10px; }
  .foot p { text-align: left; white-space: normal; }
  .device { border-radius: 26px; padding: 12px; }
  .strip { grid-template-columns: repeat(2, 1fr); padding: 14px 16px; }
  .inside-head { padding: 24px 20px; }
  .pipeline { padding: 8px 20px; }
  .pipeline li { grid-template-columns: 36px 1fr; padding: 14px 0; }
  .pipeline .agent-stage { margin: 0 -20px; padding: 14px 20px; }
  .stage-tech { display: none; }
  .proof-grid article { padding: 24px 20px; }
  .judge-note { padding: 20px; }
  table { font-size: 12px; }
  th { letter-spacing: 0; }
  th, td { padding: 6px 3px; }
  td.case { font-size: 11px; word-break: break-all; }
}

@media (prefers-reduced-motion: reduce) {
  .wire path.live, #wire-out.on path, .pulse, .step, .ev, .glyph-line, .glyph-draw::after { animation: none; }
  .glyph-line { clip-path: none; opacity: 1; transform: none; }
  .chip, .bar i { transition: none; }
}

/* ---------- Evidence Canvas tab ---------- */
.top {
  max-width: none; padding: 14px 24px; grid-template-columns: 270px minmax(0, 1fr) auto 155px;
  gap: 24px; align-items: center; background: #fbfdfc; border-bottom: 1px solid #e4ece9;
}
.brand-block { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 48px; height: 48px; object-fit: contain; }
.top h1 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.tagline { font-size: 13px; color: #435d72; }
.intro-block { min-width: 0; padding-left: 24px; border-left: 1px solid #cbd9d5; }
.lede { margin: 0; color: #1e3650; font-size: 13px; line-height: 1.25; }
.lede span { display: block; margin-top: 3px; overflow: hidden; color: #536b7f; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.status-block { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.live-pill { display: inline-flex; gap: 9px; align-items: center; justify-content: center; padding: 10px 18px; border-radius: 22px; background: #eaf7f2; color: #174b3d; font-weight: 750; }
.live-pill b { font-weight: inherit; }
.live-pill i { width: 11px; height: 11px; border-radius: 50%; background: #00a878; }
.live-pill.replay { background: #eef1f4; color: #51687b; }
.live-pill.replay i { background: #9aa9a4; }
.status-block .about { margin: 0; color: #5b7182; font-size: 10px; max-width: 320px; }
.header-time { padding-left: 24px; border-left: 1px solid #cbd9d5; color: #2d465c; font-size: 12px; white-space: nowrap; }
.view-tabs { max-width: none; margin: 0; padding: 0 30px; background: #fbfdfc; }
.wrap { max-width: none; padding: 14px; }

.evidence { border: 1px solid #dce8e4; border-radius: 14px; overflow: hidden; background: #f8fbfa; box-shadow: 0 12px 36px rgba(24, 74, 60, .05); }
.evidence-kpis { display: grid; grid-template-columns: repeat(4, 1fr); padding: 14px 18px; background: #fff; border-bottom: 1px solid #dce8e4; }
.e-kpi { position: relative; min-height: 72px; padding: 3px 34px 8px 76px; border-right: 1px solid #dce8e4; }
.e-kpi:last-child { border-right: 0; }
.e-kpi b { display: block; color: #10253c; font-size: 24px; line-height: 1.1; }
.e-kpi span { color: #4f6578; font-size: 12px; }
.e-meter { height: 7px; margin-top: 10px; overflow: hidden; border-radius: 5px; background: #e8efed; }
.e-meter i { display: block; height: 100%; border-radius: inherit; background: #008866; }
.evidence-grid { display: grid; grid-template-columns: 350px minmax(520px, 1fr) 305px; min-height: 680px; }
.message-queue, .case-canvas, .evidence-audit { min-width: 0; background: #fff; }
.message-queue { display: flex; flex-direction: column; border-right: 1px solid #dce8e4; }
.queue-head, .evidence-audit > header { min-height: 50px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #dce8e4; }
.queue-head h2, .evidence-audit h2 { margin: 0; font-size: 15px; }
.queue-head > span, .evidence-audit header > span { color: #536b7f; font-size: 11px; }
.queue-list { flex: 1; }
.queue-row { width: 100%; min-height: 58px; padding: 8px 16px; display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; border: 0; border-bottom: 1px solid #edf2f0; background: #fff; text-align: left; cursor: pointer; }
.queue-row.on { background: #e8f5f1; box-shadow: inset 2px 0 #008866; }
.queue-row:disabled { opacity: .7; cursor: wait; }
.queue-dot { width: 9px; height: 9px; border-radius: 50%; background: #ef3340; }
.queue-dot.q1 { background: #f29b13; }
.queue-dot.q2 { background: #008866; }
.queue-copy { display: flex; flex-direction: column; min-width: 0; }
.queue-copy b { overflow: hidden; color: #142a42; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.queue-copy small { margin-top: 3px; color: #657a8d; font-size: 10px; }
.queue-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.queue-side time { color: #657a8d; font-size: 10px; }
.queue-side em { padding: 3px 8px; border-radius: 10px; background: #fff0ef; color: #dc2933; font-size: 9px; font-style: normal; white-space: nowrap; }
.queue-actions { padding: 10px 12px; display: grid; grid-template-columns: .9fr 1.2fr; gap: 8px; border-top: 1px solid #dce8e4; }
.queue-actions button { min-height: 42px; border-radius: 7px; font-size: 11px; font-weight: 700; cursor: pointer; }
.queue-actions .secondary { border: 1px solid #008866; background: #fff; color: #006f55; }
.queue-actions .primary { border: 1px solid #00785b; background: #00785b; color: #fff; }
.case-canvas { padding: 0 12px 10px; }
.case-head { min-height: 96px; padding: 15px 10px 10px; display: flex; justify-content: space-between; gap: 16px; }
.case-head h2 { margin: 0; color: #122a43; font-size: 22px; letter-spacing: -.025em; }
.case-head p { margin: 5px 0 0; color: #5e7386; font-size: 11px; }
.issue-pill { align-self: flex-start; padding: 7px 12px; border-radius: 10px; background: #ffe7e6; color: #df2530; font-size: 10px; }
.stage-line { list-style: none; margin: 0 18px 14px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.stage-line li { position: relative; text-align: center; color: #263d52; font-size: 10px; }
.stage-line li::before { content: ""; position: absolute; top: 15px; right: 50%; left: -50%; height: 1px; background: #a9bab5; z-index: 0; }
.stage-line li:first-child::before { display: none; }
.stage-line span { position: relative; z-index: 1; width: 31px; height: 31px; margin: 0 auto 5px; display: grid; place-items: center; border: 1px solid #789087; border-radius: 50%; background: #fff; font-weight: 700; }
.stage-line .done span { background: #00785b; color: #fff; border-color: #00785b; }
.stage-line .done::before { background: #008866; }
.stage-line .current span { outline: 4px solid #dff3ec; }
.stage-line b { display: block; line-height: 1.15; }
.analysis-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.analysis-card { min-width: 0; border: 1px solid #dce8e4; border-radius: 9px; overflow: hidden; }
.analysis-card > header { min-height: 48px; padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.analysis-card h3 { margin: 0; flex: 1; font-size: 12px; }
.evidence-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #e4f5ef; color: #00785b; font-weight: 800; }
.timing { padding: 4px 8px; border-radius: 10px; background: #eff8f5; color: #00785b; font-size: 9px; font-weight: 700; }
.analysis-body { min-height: 235px; margin: 0 10px 10px; padding: 12px; border-radius: 7px; background: #f2f7f5; }
.fast-card .analysis-body { background: #ebf8f3; }
.analysis-body small, .result-row small { display: block; margin-bottom: 3px; color: #21374c; font-size: 10px; font-weight: 700; }
.analysis-body > b { display: block; margin-bottom: 14px; color: #132b43; font-size: 14px; }
.analysis-body p { margin: 0 0 14px; color: #536b7f; font-size: 10px; line-height: 1.55; }
.analysis-body ul { margin: 0 0 12px; padding-left: 16px; color: #536b7f; font-size: 10px; line-height: 1.7; }
.confidence { margin-top: 35px; display: flex; justify-content: space-between; font-size: 10px; }
.meter { height: 6px; margin-top: 6px; border-radius: 4px; background: #dfeae6; overflow: hidden; }
.meter i { display: block; height: 100%; background: #009b76; }
.result-row { min-height: 66px; margin-top: 8px; padding: 10px 12px; display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center; border: 1px solid #dce8e4; border-radius: 9px; }
.result-row b { display: block; color: #142a42; font-size: 12px; }
.result-row p { margin: 2px 0 0; color: #657a8d; font-size: 10px; }
.safe-pill { padding: 5px 8px; border-radius: 10px; background: #e4f6ef; color: #00785b; font-size: 9px; white-space: nowrap; }
.canvas-controls { position: relative; min-height: 56px; display: flex; gap: 8px; align-items: center; color: #51687b; font-size: 10px; }
.canvas-controls > span { margin-right: 4px; }
.canvas-controls button { min-height: 35px; padding: 7px 14px; border: 1px solid #d5e2de; border-radius: 7px; background: #fff; color: #18334a; font-size: 10px; font-weight: 700; cursor: pointer; }
.canvas-controls .model.on { background: #00785b; color: #fff; border-color: #00785b; }
.canvas-controls .model .name::after { content: ''; display: inline-block; margin-left: 6px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.canvas-controls .model:disabled { cursor: default; opacity: .7; }
.canvas-controls .model:disabled .name::after { display: none; }
.canvas-controls .run-again { margin-left: auto; padding-right: 0; border: 0; color: #00785b; text-decoration: underline; }
.evidence-audit { border-left: 1px solid #dce8e4; }
.evidence-audit ol { list-style: none; margin: 0; padding: 15px 18px; }
.evidence-audit li { position: relative; min-height: 82px; margin-bottom: 8px; padding: 9px 10px 16px 28px; display: grid; grid-template-columns: 58px 1fr; border-radius: 8px; background: #f8fbfa; color: #51687b; font-size: 10px; }
.evidence-audit li::before { content: ""; position: absolute; top: 10px; bottom: -2px; left: 4px; width: 1px; background: #c6d7d1; }
.evidence-audit li:last-child::before { display: none; }
.audit-dot { position: absolute; top: 14px; left: 0; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: #008866; box-shadow: 0 0 0 2px #cce9df; }
.evidence-audit time { color: #617789; font-variant-numeric: tabular-nums; }
.evidence-audit b { color: #183047; font-size: 11px; }
.evidence-audit p { margin: 4px 0 0; line-height: 1.5; }

@media (max-width: 1180px) {
  .top { grid-template-columns: 240px 1fr 300px; }
  .header-time { display: none; }
  .evidence-grid { grid-template-columns: 300px minmax(500px, 1fr); }
  .evidence-audit { grid-column: 1 / -1; border-top: 1px solid #dce8e4; border-left: 0; }
  .evidence-audit ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
@media (max-width: 820px) {
  .top { padding: 16px; grid-template-columns: 1fr; gap: 12px; }
  .intro-block { padding: 0; border-left: 0; }
  .status-block { grid-template-columns: auto 1fr; }
  .status-block .about { white-space: normal; }
  .view-tabs { padding: 0 16px; }
  .evidence-kpis { grid-template-columns: 1fr 1fr; }
  .e-kpi:nth-child(2) { border-right: 0; }
  .evidence-grid { grid-template-columns: 1fr; }
  .message-queue { border-right: 0; }
  .queue-list { max-height: 300px; overflow-y: auto; }
  .evidence-audit { grid-column: auto; }
  .evidence-audit ol { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .e-kpi { padding-left: 18px; }
  .analysis-pair { grid-template-columns: 1fr; }
  .stage-line { margin-inline: 0; }
  .canvas-controls { flex-wrap: wrap; }
  .canvas-controls .run-again { margin-left: 0; }
}

/* API keys dialog: the judge's own keys, kept in this tab only. */
.keys-dialog { width: min(460px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); box-shadow: 0 18px 48px rgba(20, 50, 40, .22); }
.keys-dialog::backdrop { background: rgba(19, 36, 31, .35); }
.keys-form { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.keys-form h3 { margin: 0; font-size: 16px; }
.keys-form .muted { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.key-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 10px; align-items: center; }
.key-name { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.key-name small { color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-row input { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 12px; background: var(--page); color: var(--ink); }
.key-row input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.keys-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.keys-actions button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.keys-actions .primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.keys-actions button:first-child { margin-right: auto; }
@media (max-width: 480px) { .key-row { grid-template-columns: 1fr; gap: 4px; } }
