:root {
  --paper: #f2eee5;
  --paper-2: #fbf8f0;
  --paper-3: #e9e3d6;
  --paper-4: #f6f2e8;
  --ink: #17180f;
  --ink-2: #33352a;
  --muted: #6d6a5c;
  --line: #d4ccba;
  --line-strong: #b8ad96;
  --accent: #c2432c;
  --accent-soft: #f3dcd5;
  --teal: #14665a;
  --teal-soft: #dcebe5;
  --amber: #96621b;
  --amber-soft: #f3e5cc;
  --blue: #3c5568;
  --blue-soft: #dfe7ec;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --sans: "IBM Plex Sans Thai", "Leelawadee UI", sans-serif;
  --display: "Bai Jamjuree", "IBM Plex Sans Thai", sans-serif;
  --radius: 3px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

body {
  min-height: 100vh;
  background-image:
    linear-gradient(to right, rgba(23, 24, 15, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23, 24, 15, 0.025) 1px, transparent 1px);
  background-size: 72px 72px, 72px 72px;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(rgba(23, 24, 15, 0.14) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}

button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}

h1, h2, h3, h4 { font-family: var(--display); margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex;
  align-items: stretch;
  gap: 28px;
  padding: 0 24px;
  height: 76px;
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  position: relative;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 330px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--ink);
  position: relative;
  display: grid;
  place-items: center;
  background: var(--paper-2);
}

.brand-mark span {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.brand-mark i {
  position: absolute;
  right: -1.5px;
  bottom: -1.5px;
  width: 10px;
  height: 10px;
  background: var(--accent);
}

.brand-text h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text p {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 34px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
}

.top-meta div { display: flex; flex-direction: column; gap: 2px; }
.top-meta span { color: var(--muted); font-size: 9px; letter-spacing: 0.06em; }

.top-actions { display: flex; align-items: center; padding-left: 24px; border-left: 1px solid var(--line); }

.replay-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--amber);
  background: var(--amber-soft);
  padding: 7px 12px;
}

.replay-badge i {
  width: 8px;
  height: 8px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(150, 98, 27, 0.14);
}

.replay-badge strong {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--amber);
}

.replay-badge span { font-size: 10px; color: var(--ink-2); }

/* ------------------------------------------------------------------- tabs */
.tabs {
  display: flex;
  align-items: stretch;
  height: 49px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper-2);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 18;
}

.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 0 24px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.tab:first-child { border-left: 1px solid var(--line); }

.tab .tab-no {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--line-strong);
}

.tab:hover { background: var(--paper-3); color: var(--ink); }

.tab.is-active {
  background: var(--ink);
  color: var(--paper-2);
}

.tab.is-active .tab-no { color: var(--accent); }

.tab-spacer { flex: 1; }

.tab-hint {
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------- views */
.view { display: none; }
.view.is-active { display: block; }

/* --------------------------------------------------------------- workspace */
.ws-grid {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 392px;
  height: calc(100vh - 76px - 49px);
  min-height: 560px;
}

.scene-rail {
  border-right: 1px solid var(--line-strong);
  background: rgba(233, 227, 214, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.rail-head h2 { font-size: 14px; font-weight: 700; }
.rail-head span { font-family: var(--mono); font-size: 10px; color: var(--muted); }

.scene-list { overflow-y: auto; flex: 1; }

.scene-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 26px 1fr 8px;
  gap: 8px;
  align-items: start;
  text-align: left;
}

.scene-item .n {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--line-strong);
  padding-top: 2px;
}

.scene-item .t {
  display: block;
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}

.scene-item .k {
  display: block;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-top: 3px;
}

.scene-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--line-strong);
}

.scene-item .dot.ready { background: var(--teal); }
.scene-item .dot.blocked { background: var(--accent); }
.scene-item .dot.escalated { background: var(--amber); }
.scene-item .dot.neutral { background: var(--blue); }

.scene-item:hover { background: var(--paper-2); }

.scene-item.is-active { background: var(--ink); }
.scene-item.is-active .t { color: var(--paper-2); }
.scene-item.is-active .k, .scene-item.is-active .n { color: #a9a493; }
.scene-item.is-active .dot { box-shadow: 0 0 0 3px rgba(251, 248, 240, 0.15); }

.rail-foot {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.conversation-col {
  overflow-y: auto;
  padding-bottom: 40px;
  min-width: 0;
}

.scene-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); background: rgba(251, 248, 240, 0.5); }

.kicker {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

.scene-head h2 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 4px;
}

.scene-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 5px; max-width: 70ch; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.tag {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  padding: 3px 7px;
  color: var(--ink-2);
}

.step-switch {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.step-switch .lbl { font-family: var(--mono); font-size: 9px; color: var(--muted); margin-right: 12px; letter-spacing: 0.04em; }

.step-btn {
  border: 1px solid var(--line-strong);
  background: transparent;
  padding: 5px 14px;
  font-size: 11.5px;
  font-family: var(--display);
  font-weight: 600;
  margin-right: -1px;
}

.step-btn.is-active { background: var(--ink); color: var(--paper-2); border-color: var(--ink); }

.diff-strip {
  margin: 12px 24px 0;
  border: 1px solid var(--amber);
  background: var(--amber-soft);
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  align-items: baseline;
}

.diff-strip .dl { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.06em; color: var(--amber); width: 100%; }

.diff-strip .di { font-size: 11.5px; }
.diff-strip .di b { font-family: var(--mono); font-size: 10px; }
.diff-strip .di .from { color: var(--muted); text-decoration: line-through; }
.diff-strip .di .arrow { color: var(--amber); margin: 0 4px; }
.diff-strip .di .to { font-weight: 600; }

.panel {
  margin: 14px 24px 0;
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; }
.panel-meta { font-family: var(--mono); font-size: 8.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; text-align: right; }

.chat { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 10px; }

.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg.customer { align-self: flex-start; }
.msg.merchant { align-self: flex-end; align-items: flex-end; }

.msg .who {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 3px;
}

.msg .bubble {
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.62;
  border-radius: var(--radius);
  white-space: pre-wrap;
}

.msg.merchant .bubble { background: var(--paper-3); border-color: var(--line); }

.msg.is-dup .bubble { border-style: dashed; opacity: 0.75; }
.msg .dup-note { font-family: var(--mono); font-size: 8px; color: var(--accent); margin-top: 3px; }

.table-wrap { overflow-x: auto; }

.items-table { width: 100%; border-collapse: collapse; }
.items-table th {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
.items-table th.num, .items-table td.num { text-align: right; }
.items-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; vertical-align: middle; }
.items-table tr:last-child td { border-bottom: 0; }

.field-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 1px 2px;
  text-align: left;
  border-bottom: 1px dotted var(--line-strong);
}

.field-btn:hover { background: var(--accent-soft); border-bottom-color: var(--accent); }
.field-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field-btn .v { font-weight: 500; }
.field-btn .v.null { color: var(--muted); font-style: italic; }

.chip {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.03em;
  border: 1px solid var(--line-strong);
  padding: 1px 4px;
  color: var(--muted);
  background: var(--paper);
  white-space: nowrap;
}

.chip.explicit { border-color: var(--teal); color: var(--teal); background: var(--teal-soft); }
.chip.from_history { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
.chip.unknown, .chip.not_applicable { border-color: var(--line-strong); color: var(--muted); }
.chip.conflict { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.totals {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--ink);
  background: var(--paper-4);
}

.totals .lbl { font-family: var(--mono); font-size: 9px; letter-spacing: 0.04em; color: var(--muted); }
.totals .amt { font-family: var(--mono); font-size: 19px; font-weight: 500; }
.totals .note { font-size: 9.5px; color: var(--muted); }

.inspector { border-top: 1px solid var(--line); background: var(--paper-4); padding: 12px 14px; min-height: 78px; }
.inspector-empty { font-size: 11px; color: var(--muted); font-style: italic; }
.inspector-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.inspector-head .fname { font-family: var(--mono); font-size: 10px; font-weight: 500; }
.inspector-head .fval { font-size: 13px; font-weight: 600; }
.inspector-head .fstate { font-family: var(--mono); font-size: 8px; color: var(--muted); }
.ref-list { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.ref { display: grid; grid-template-columns: 78px 1fr; gap: 8px; font-size: 11px; }
.ref .rtype { font-family: var(--mono); font-size: 8px; color: var(--accent); letter-spacing: 0.03em; padding-top: 2px; }
.ref .rtext { color: var(--ink-2); }
.ref .rtext q { quotes: "“" "”"; color: var(--ink); }

/* --------------------------------------------------------------- decision */
.decision-col {
  border-left: 1px solid var(--line-strong);
  background: rgba(233, 227, 214, 0.32);
  overflow-y: auto;
  padding-bottom: 30px;
}

.status-banner {
  background: var(--ink);
  color: var(--paper-2);
  padding: 18px 18px 16px;
  position: relative;
}

.status-banner .st-top { display: flex; align-items: center; gap: 9px; }
.status-banner .st-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.status-banner .st-code { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; color: #a9a493; }
.status-banner .st-th { font-family: var(--display); font-size: 27px; font-weight: 700; letter-spacing: -0.03em; margin-top: 6px; }
.status-banner .st-sub { font-size: 10.5px; color: #b9b4a3; margin-top: 4px; }
.status-banner[data-status="DRAFT_BLOCKED"] .st-dot,
.status-banner[data-status="ESCALATED"] .st-dot { background: var(--accent); }
.status-banner[data-status="CANCELLED"] .st-dot,
.status-banner[data-status="NOT_AN_ORDER"] .st-dot { background: #8c897b; }

.panel.compact { margin: 12px 14px 0; }
.panel.compact .panel-head { padding: 8px 11px; }
.panel.compact .panel-head h3 { font-size: 12px; }

.next-action { padding: 11px 12px 4px; font-size: 12.5px; }
.next-action .prio { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.next-action .prio b { font-family: var(--mono); font-size: 18px; color: var(--accent); }
.next-action .prio span { font-family: var(--mono); font-size: 8.5px; color: var(--muted); }
.next-action .reason { color: var(--ink-2); font-size: 11.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 9px 12px 2px; }
.bchip {
  font-family: var(--mono);
  font-size: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 5px;
  letter-spacing: 0.02em;
}
.bchip.ok { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }

.warn-list { padding: 4px 12px 10px; }
.warn {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 7px;
  font-size: 10.5px;
  color: var(--ink-2);
  padding: 4px 0;
  border-top: 1px dotted var(--line);
}
.warn i { width: 6px; height: 6px; margin-top: 4px; background: var(--amber); }
.warn b { font-family: var(--mono); font-size: 8px; color: var(--amber); display: block; letter-spacing: 0.02em; }

#stockTable { padding: 4px 11px 8px; }
.stock-row {
  display: grid;
  grid-template-columns: 1fr 44px 44px 46px;
  gap: 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 5px 0;
  border-bottom: 1px dotted var(--line);
  align-items: baseline;
}
.stock-row.head { color: var(--muted); font-size: 8px; border-bottom: 1px solid var(--line); }
.stock-row .sk { font-family: var(--sans); font-size: 10.5px; }
.stock-row .num { text-align: right; }
.stock-row .ok { color: var(--teal); }
.stock-row .short { color: var(--accent); font-weight: 500; }
.stock-row .bad { color: var(--accent); }
.stock-row .unk { color: var(--muted); }
.stock-empty { font-size: 10.5px; color: var(--muted); padding: 8px 0; font-style: italic; }

.fineprint { font-size: 9.5px; color: var(--muted); padding: 7px 12px 10px; line-height: 1.5; }

.reply-text {
  margin: 11px 12px 0;
  border-top: 2px solid var(--ink);
  background: var(--paper-4);
  padding: 10px 11px;
  font-size: 12px;
  line-height: 1.72;
  white-space: pre-wrap;
}

.approval-row { display: flex; align-items: center; gap: 9px; padding: 10px 12px 4px; flex-wrap: wrap; }
.approval-state { font-family: var(--mono); font-size: 8.5px; color: var(--muted); }
.approval-state.is-on { color: var(--teal); }

.primary-btn, .secondary-btn, .ghost-btn {
  border-radius: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 11.5px;
  padding: 7px 12px;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.primary-btn { border: 1px solid var(--ink); background: var(--ink); color: var(--paper-2); width: 100%; }
.primary-btn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.primary-btn:disabled { opacity: 0.32; cursor: not-allowed; }

.secondary-btn { border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.secondary-btn:hover { background: var(--ink); color: var(--paper-2); }
.secondary-btn.is-on { background: var(--teal); border-color: var(--teal); color: #fff; }

.ghost-btn { border: 1px solid transparent; background: transparent; text-decoration: underline; text-underline-offset: 3px; font-size: 10.5px; padding: 4px 6px; }
.ghost-btn:hover:not(:disabled) { background: var(--paper-3); }
.ghost-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.approval-panel { border-color: var(--ink); }
.approval-panel .primary-btn { margin: 0 12px; width: calc(100% - 24px); }
.export-row { display: flex; gap: 4px; padding: 8px 10px 2px; flex-wrap: wrap; }
.export-row .ghost-btn { border: 1px solid var(--line-strong); }

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  background: var(--ink);
  color: var(--paper-2);
  padding: 10px 14px;
  font-size: 11.5px;
  max-width: 360px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  border-left: 3px solid var(--accent);
}
.toast.is-on { opacity: 1; transform: translateY(0); }

/* ------------------------------------------------------------- benchmark */
#view-benchmark, #view-kit { padding: 30px 34px 80px; max-width: 1320px; margin: 0 auto; }

.bm-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 26px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 22px;
  align-items: end;
}

.bm-hero h2 { font-size: 36px; letter-spacing: -0.035em; margin-top: 5px; }
.bm-hero p { font-size: 13px; color: var(--muted); margin-top: 8px; max-width: 70ch; }
.bm-runmeta { font-family: var(--mono); font-size: 9.5px; color: var(--muted); text-align: right; line-height: 1.8; }
.bm-runmeta b { color: var(--ink); font-weight: 500; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
  margin-top: 24px;
}

.metric {
  background: var(--paper-2);
  padding: 14px 14px 12px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
}

.metric .m-label { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.04em; color: var(--muted); min-height: 26px; }
.metric .m-value { font-family: var(--mono); font-size: 31px; line-height: 1; letter-spacing: -0.04em; margin-top: 8px; }
.metric .m-frac { font-family: var(--mono); font-size: 9px; color: var(--muted); margin-top: 6px; }
.metric.is-risk .m-value { color: var(--accent); }
.metric.is-good .m-value { color: var(--teal); }

.bm-section { margin-top: 36px; }
.bm-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--ink); padding-bottom: 7px; }
.bm-section-head h3 { font-size: 19px; letter-spacing: -0.02em; }
.bm-section-head .note { font-family: var(--mono); font-size: 9px; color: var(--muted); }

.field-table { width: 100%; border-collapse: collapse; margin-top: 2px; }
.field-table th {
  font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); text-align: left; padding: 8px 9px; border-bottom: 1px solid var(--line);
}
.field-table td { padding: 7px 9px; border-bottom: 1px solid var(--line); font-size: 11.5px; vertical-align: middle; }
.field-table td.num { font-family: var(--mono); font-size: 10.5px; text-align: right; }
.field-table .fname { font-family: var(--mono); font-size: 10px; }
.bar { height: 7px; background: var(--paper-3); min-width: 120px; position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--teal); }
.bar.low i { background: var(--accent); }
.bar.mid i { background: var(--amber); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.stat-block { border: 1px solid var(--line-strong); background: var(--paper-2); padding: 16px; }
.stat-block h4 { font-size: 13px; margin-bottom: 8px; }
.stat-block .big { font-family: var(--mono); font-size: 27px; letter-spacing: -0.03em; }
.stat-block .sub { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.stat-block ul { margin: 10px 0 0; padding-left: 16px; font-size: 11.5px; color: var(--ink-2); }
.stat-block li { margin-bottom: 4px; }

.round-table { width: 100%; border-collapse: collapse; margin-top: 2px; }
.round-table th, .round-table td { padding: 8px 9px; border-bottom: 1px solid var(--line); font-size: 11.5px; text-align: right; }
.round-table th:first-child, .round-table td:first-child { text-align: left; }
.round-table th { font-family: var(--mono); font-size: 8px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; border-bottom: 1px solid var(--ink); }
.round-table td.n { font-family: var(--mono); font-size: 10.5px; }
.round-table .primary-col { background: rgba(195, 67, 44, 0.05); }

.failure-table { width: 100%; border-collapse: collapse; margin-top: 2px; }
.failure-table th, .failure-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 11px; text-align: left; vertical-align: top; }
.failure-table th { font-family: var(--mono); font-size: 8px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--ink); }
.failure-table td.m { font-family: var(--mono); font-size: 9.5px; }
.failure-table .gold { color: var(--muted); }
.failure-table .pred { color: var(--accent); }

.caveat {
  border: 1px solid var(--amber);
  background: var(--amber-soft);
  padding: 18px 20px;
  margin-top: 26px;
}
.caveat h4 { font-size: 13px; color: var(--amber); margin-bottom: 8px; }
.caveat ul { margin: 0; padding-left: 18px; font-size: 11.5px; line-height: 1.65; }
.caveat li { margin-bottom: 5px; }

.test-pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--teal); background: var(--teal-soft); color: var(--teal);
  font-family: var(--mono); font-size: 9.5px; padding: 4px 9px;
}
.test-pill i { width: 6px; height: 6px; background: var(--teal); border-radius: 50%; }

/* ------------------------------------------------------------------- kit */
.kit-hero { border-bottom: 1px solid var(--ink); padding-bottom: 20px; }
.kit-hero h2 { font-size: 36px; letter-spacing: -0.035em; margin-top: 5px; }
.kit-hero p { font-size: 13px; color: var(--muted); margin-top: 7px; max-width: 78ch; }

.flow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-top: 24px;
  border: 1px solid var(--line-strong);
}
.flow-step { background: var(--paper-2); padding: 12px 11px 14px; border-right: 1px solid var(--line); position: relative; min-height: 92px; }
.flow-step:last-child { border-right: 0; }
.flow-step .fs-n { font-family: var(--mono); font-size: 8px; color: var(--accent); }
.flow-step .fs-t { display: block; font-family: var(--display); font-size: 12px; font-weight: 600; margin-top: 5px; line-height: 1.3; }
.flow-step .fs-d { display: block; font-size: 9.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

.kit-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 30px; margin-top: 30px; }

.file-list { border-top: 1px solid var(--ink); }
.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 62px 64px;
  gap: 10px;
  align-items: baseline;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.file-row .fn { font-family: var(--mono); font-size: 10px; }
.file-row .fp { color: var(--muted); font-size: 10px; }
.file-row .fs { font-family: var(--mono); font-size: 9px; color: var(--muted); text-align: right; }
.file-row a { font-family: var(--mono); font-size: 9px; text-align: right; text-decoration: underline; text-underline-offset: 2px; }
.file-row:hover { background: var(--paper-2); }

.code-block {
  background: var(--ink);
  color: #e8e3d5;
  padding: 14px 15px;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.8;
  overflow-x: auto;
  white-space: pre;
}
.code-block .c { color: #8f8b7b; }

.boundary-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.boundary-list li { padding: 9px 2px 9px 20px; border-bottom: 1px solid var(--line); font-size: 11.5px; position: relative; }
.boundary-list li::before { content: "×"; position: absolute; left: 2px; color: var(--accent); font-family: var(--mono); }
.boundary-list li.yes::before { content: "✓"; color: var(--teal); }

.kit-note { font-size: 11px; color: var(--muted); margin-top: 12px; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1380px) {
  .ws-grid { grid-template-columns: 224px minmax(0, 1fr) 360px; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .top-meta { gap: 20px; }
}

@media (max-width: 1120px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 18px; gap: 12px; }
  .brand { min-width: 0; }
  .top-meta { display: none; }
  .top-actions { margin-left: auto; border-left: 0; padding-left: 0; }
  .tabs { height: auto; flex-wrap: wrap; padding: 0 12px; }
  .tab { padding: 11px 14px; }
  .tab-hint { display: none; }
  .ws-grid { display: block; height: auto; }
  .scene-rail { border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .scene-list { display: flex; overflow-x: auto; }
  .scene-item { min-width: 210px; border-right: 1px solid var(--line); border-bottom: 0; }
  .rail-foot { display: none; }
  .conversation-col, .decision-col { overflow: visible; }
  .decision-col { border-left: 0; border-top: 1px solid var(--line-strong); }
  .bm-hero { grid-template-columns: 1fr; }
  .bm-runmeta { text-align: left; }
  .two-col { grid-template-columns: 1fr; }
  .kit-grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: repeat(2, 1fr); }
  .flow-step { border-bottom: 1px solid var(--line); }
}

@media (max-width: 700px) {
  #view-benchmark, #view-kit { padding: 20px 16px 60px; }
  .panel, .diff-strip { margin-left: 12px; margin-right: 12px; }
  .scene-head { padding: 16px; }
  .scene-head h2, .bm-hero h2, .kit-hero h2 { font-size: 27px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .file-row { grid-template-columns: 1fr 50px 52px; }
  .file-row .fp { display: none; }
  .tab-hint { display: none; }
  .msg { max-width: 92%; }
  .top-actions .replay-badge span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
