:root {
  --paper: #eef7fa;
  --paper-2: #ffffff;
  --ink: #102b3a;
  --muted: #516b77;
  --line: #88a8b5;
  --hairline: #d1e2e8;
  --blue: #006fe8;
  --blue-soft: #dceffc;
  --red: #d93f4a;
  --red-soft: #ffe7ea;
  --lime: #bfeaf7;
  --yellow: #e5f5f9;
  --green: #087866;
  --shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 12px 30px rgba(26,74,94,.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(16, 86, 111, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 86, 111, .045) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  font: 15px/1.5 "Helvetica Neue", Arial, sans-serif;
}
button, select, input { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 14px;
  color: white;
  background: var(--blue);
}
.skip-link:focus { top: 16px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.app-header {
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 58px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 2px solid var(--ink);
  background: rgba(246, 252, 254, .96);
  backdrop-filter: blur(12px);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .08em;
  text-decoration: none;
}
.wordmark-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 5px;
  color: white;
  background: var(--blue);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 5px 12px rgba(0,77,146,.18);
}
.wordmark small {
  display: block;
  color: var(--muted);
  font: 700 9px/1.2 "Courier New", monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.run-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 11px "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.run-identity a {
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.live-pip {
  width: 9px;
  height: 9px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
}

main { max-width: 1540px; margin: 0 auto; padding: 36px clamp(18px, 4vw, 58px) 72px; }
.bench-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  padding: 14px 0 30px;
}
.kicker, .eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font: 800 10px "Courier New", monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 {
  font-family: "Arial Narrow", "Helvetica Neue Condensed", "Helvetica Neue", Arial, sans-serif;
}
h1 {
  margin-bottom: 8px;
  font-size: clamp(44px, 6vw, 78px);
  line-height: .88;
  letter-spacing: -.05em;
  font-weight: 900;
  text-transform: uppercase;
}
.bench-heading > div > p:last-child { max-width: 650px; margin: 18px 0 0; color: var(--muted); font-size: 17px; }
.bench-stamp {
  width: 220px;
  padding: 14px;
  display: grid;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--blue-soft);
  box-shadow: var(--shadow);
  font: 800 10px "Courier New", monospace;
  text-transform: uppercase;
}
.bench-stamp strong { margin: 3px 0; font-size: 30px; }
.replay-banner {
  margin-bottom: 22px;
  padding: 13px 16px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--blue-soft);
}
.replay-banner div { display: grid; }
.replay-banner strong, .replay-banner a { color: var(--blue-dark); font: 900 9px "Courier New", monospace; text-transform: uppercase; }
.replay-banner span { color: var(--muted); font-size: 10px; }
.replay-banner p { margin: 0; font-size: 12px; }
.replay-banner code { white-space: nowrap; }

.lab-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.protocol-panel, .process-card, .chart-card, .sample-lab, .evidence-footer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  box-shadow: var(--shadow);
}
.protocol-panel { padding: 20px; position: sticky; top: 94px; }
.panel-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: -22px 0 20px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--blue-soft);
  font: 900 9px "Courier New", monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.panel-tab span { padding-right: 8px; border-right: 1px solid var(--ink); }
.protocol-panel h2, .process-card h2, .chart-card h2, .sample-lab h2, .evidence-footer h2 {
  margin-bottom: 7px;
  font-size: 28px;
  font-weight: 850;
  letter-spacing: -.035em;
}
.panel-intro { margin-bottom: 24px; color: var(--muted); font-size: 13px; }
label {
  display: block;
  margin: 16px 0 6px;
  font: 800 9px "Courier New", monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}
select {
  width: 100%;
  min-height: 44px;
  padding: 8px 34px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
  box-shadow: inset 0 2px 5px rgba(26,74,94,.08);
}
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fixture-note {
  margin: -2px 0 18px;
  padding-left: 9px;
  border-left: 3px solid var(--blue);
  color: var(--muted);
  font: 9px/1.5 "Courier New", monospace;
}
.tolerance-head { display: flex; justify-content: space-between; align-items: end; }
.tolerance-head output {
  padding: 3px 7px;
  color: white;
  background: var(--ink);
  font: 800 11px "Courier New", monospace;
}
input[type="range"] { width: 100%; accent-color: var(--blue); }
.range-scale { display: flex; justify-content: space-between; color: var(--muted); font: 9px "Courier New", monospace; }
.protocol-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 22px; }
.protocol-actions button, .evidence-actions button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-weight: 800;
}
button:disabled {
  cursor: not-allowed;
  opacity: .48;
  box-shadow: none !important;
}
.primary-action {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 13px;
  color: white;
  background: var(--blue);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 7px 18px rgba(0,77,146,.16);
}
.primary-action:hover { background: #123bc6; }
.primary-action kbd { color: var(--ink); background: white; padding: 2px 6px; }
.secondary-action { background: var(--blue-soft); }
.text-action { background: transparent; }
.pin-card { margin-top: 22px; border-top: 2px solid var(--ink); }
.pin-card div { padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.pin-card span { display: block; color: var(--muted); font: 800 8px "Courier New", monospace; text-transform: uppercase; }
.pin-card code { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 10px; white-space: nowrap; }
.pin-card .mismatch {
  margin: 0 -10px;
  padding-left: 10px;
  padding-right: 10px;
  border: 1px solid var(--red);
  border-radius: 5px;
  background: var(--red-soft);
}
.pin-card .mismatch span, .pin-card .mismatch code { color: var(--red); }

.analysis-column { min-width: 0; display: grid; gap: 18px; }
.process-card { padding: 22px; }
.process-head { display: flex; justify-content: space-between; gap: 30px; }
.process-head p { margin-bottom: 0; color: var(--muted); }
.sample-vial {
  width: 38px;
  height: 62px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 0 0 18px 18px;
  background: white;
}
.sample-vial:before { content: ""; position: absolute; left: -4px; right: -4px; top: 5px; border-top: 3px solid var(--ink); }
.sample-vial i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--blue-soft); transition: height .35s; }
.process-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin: 26px 0 20px;
  padding: 0;
  list-style: none;
  border: 1.5px solid var(--ink);
}
.process-steps li {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #f4fafc;
}
.process-steps li:last-child { border-right: 0; }
.process-steps li span { float: right; color: var(--line); font: 900 18px "Arial Narrow", "Helvetica Neue Condensed", Arial, sans-serif; }
.process-steps b, .process-steps small { display: block; }
.process-steps b { font: 800 10px "Courier New", monospace; text-transform: uppercase; }
.process-steps small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.process-steps li.active { background: var(--blue-soft); }
.process-steps li.complete { color: white; background: var(--blue); }
.process-steps li.complete small, .process-steps li.complete span { color: white; }
.chromatogram { padding-top: 13px; border-top: 1px dashed var(--line); }
.chrom-track { height: 28px; position: relative; overflow: hidden; border: 1.5px solid var(--ink); background: white; }
.chrom-track:before, .chrom-track:after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 38px, rgba(24,33,43,.14) 39px 40px);
}
.chrom-track:after { background: linear-gradient(90deg, transparent 40%, rgba(214,52,44,.18) 40% 45%, transparent 45% 70%, rgba(25,75,255,.22) 70% 76%, transparent 76%); }
.chrom-track i { display: block; height: 100%; width: 0; background: var(--blue-soft); transition: width .4s; }
.chrom-labels { display: flex; justify-content: space-between; margin-top: 4px; color: var(--muted); font: 8px "Courier New", monospace; text-transform: uppercase; }

.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.measurement-card, .verdict-card { min-height: 172px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper-2); box-shadow: inset 0 1px 0 white; }
.measure-label { display: block; margin-bottom: 17px; font: 800 9px "Courier New", monospace; text-transform: uppercase; letter-spacing: .08em; }
.measurement-card strong { font: 900 38px "Arial Narrow", "Helvetica Neue Condensed", Arial, sans-serif; letter-spacing: -.035em; }
.measurement-card small { display: block; margin-top: 8px; color: var(--muted); font: 10px "Courier New", monospace; }
.measure-rule { height: 9px; margin-top: 13px; border: 1px solid var(--ink); background: #eee; }
.measure-rule i { display: block; width: 0; height: 100%; transition: width .4s; }
.measure-rule.blue i { background: var(--blue); }
.measure-rule.red i { background: var(--red); }
.ci-readout { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; margin-top: 16px; font: 9px "Courier New", monospace; }
.ci-readout i { height: 2px; background: var(--red); position: relative; }
.ci-readout i:before, .ci-readout i:after { content: ""; position: absolute; top: -3px; width: 2px; height: 8px; background: var(--red); }
.ci-readout i:after { right: 0; }
.verdict-card { position: relative; overflow: hidden; }
.verdict-card strong { display: block; max-width: 180px; font: 900 26px "Courier New", monospace; }
.verdict-card p { max-width: 190px; margin: 10px 0 0; font-size: 11px; }
.verdict-card.blocked { background: var(--red-soft); }
.verdict-card.passed { background: #dff4e7; }
.verdict-card.contract-error { background: #fff3d6; border-color: #c77b16; }
.verdict-card #recover-button {
  margin-top: 12px;
  padding: 7px 9px;
  border: 1px solid var(--blue);
  border-radius: 4px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font: 800 8px "Courier New", monospace;
  text-transform: uppercase;
}
.proof-mark {
  position: absolute;
  right: -16px;
  bottom: 12px;
  padding: 4px 18px;
  border: 3px double var(--red);
  color: var(--red);
  font: 900 12px "Courier New", monospace;
}
.passed .proof-mark { border-color: var(--green); color: var(--green); }
.contract-error .proof-mark { border-color: var(--ink); color: var(--ink); }

.chart-card { padding: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.section-head .panel-tab { margin-bottom: 13px; }
.chart-legend, .plate-legend { display: flex; flex-wrap: wrap; gap: 15px; font: 9px "Courier New", monospace; text-transform: uppercase; }
.chart-legend span, .plate-legend span { display: flex; align-items: center; gap: 5px; }
.blue-dot, .red-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }
.red-dot { background: var(--red); }
.band-key { width: 20px; height: 9px; background: var(--red-soft); border: 1px solid var(--red); }
.chart-wrap { min-height: 280px; position: relative; border: 1.5px solid var(--ink); background: white; }
#score-chart { display: block; width: 100%; height: 280px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; color: var(--muted); font: 11px "Courier New", monospace; text-align: center; }
.chart-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; }

.sample-lab { margin-top: 22px; padding: 24px; }
.sample-lab .section-head p { max-width: 720px; margin: 7px 0 0; color: var(--muted); }
.filter-set { display: flex; gap: 6px; }
.filter {
  padding: 8px 10px;
  border: 1.5px solid var(--ink);
  background: white;
  font: 800 9px "Courier New", monospace;
  text-transform: uppercase;
}
.filter span { margin-left: 5px; color: var(--muted); }
.filter.active { color: white; background: var(--ink); }
.filter.active span { color: white; }
.sample-workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .45fr); gap: 20px; margin-top: 24px; }
.plate-wrap { padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: #e5f1f5; box-shadow: inset 0 2px 8px rgba(26,74,94,.08); }
.plate-labels { display: grid; grid-template-columns: repeat(5, 1fr); padding: 0 8px 6px; color: var(--muted); font: 9px "Courier New", monospace; text-align: center; }
.sample-plate { display: grid; grid-template-columns: repeat(20, minmax(16px, 1fr)); gap: 7px; }
.sample-well {
  aspect-ratio: 1;
  min-width: 14px;
  padding: 0;
  position: relative;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: #ccd0ca;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.5);
}
.sample-well.held { background: var(--blue-soft); }
.sample-well.regressed { background: var(--red); }
.sample-well.improved { background: var(--green); }
.sample-well.pending { background: #c8dce4; }
.sample-well:hover, .sample-well.selected { transform: scale(1.22); z-index: 2; }
.sample-well.selected { outline: 3px solid var(--blue); outline-offset: 2px; }
.sample-well[hidden] { display: none; }
.plate-legend { justify-content: flex-end; margin-top: 17px; }
.well-legend { width: 11px; height: 11px; border: 1px solid var(--ink); border-radius: 50%; background: #c8dce4; }
.well-legend.held { background: var(--blue-soft); }
.well-legend.regressed { background: var(--red); }
.well-legend.improved { background: var(--green); }
.specimen-drawer { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--paper-2); }
.drawer-head { display: flex; justify-content: space-between; gap: 10px; padding: 16px; border-bottom: 1.5px solid var(--ink); }
.drawer-head h3 { margin: 0; font-size: 23px; font-weight: 850; }
.specimen-status { align-self: start; padding: 4px 7px; color: white; background: var(--ink); font: 800 9px "Courier New", monospace; }
.specimen-meta { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-bottom: 1px solid var(--line); }
.specimen-meta div { padding: 11px 16px; }
.specimen-meta div + div { border-left: 1px solid var(--line); }
.specimen-meta dt { color: var(--muted); font: 800 8px "Courier New", monospace; text-transform: uppercase; }
.specimen-meta dd { margin: 3px 0 0; font: 700 11px "Courier New", monospace; }
.specimen-field { padding: 16px; border-bottom: 1px solid var(--line); }
.specimen-field span, .diff-columns span { display: block; margin-bottom: 5px; color: var(--muted); font: 800 8px "Courier New", monospace; text-transform: uppercase; }
.specimen-field code, .diff-columns code { font-size: 11px; overflow-wrap: anywhere; }
.diff-columns { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.diff-columns div { min-width: 0; padding: 16px; }
.diff-columns div + div { border-left: 1px solid var(--line); }
.drawer-note { margin: 0; padding: 16px; color: var(--muted); font-size: 11px; }

.evidence-footer {
  margin-top: 22px;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: center;
  background: var(--blue-soft);
}
.evidence-footer p { max-width: 650px; margin-bottom: 0; color: var(--muted); }
.evidence-actions { display: flex; gap: 9px; }
.evidence-actions button { padding: 0 16px; background: white; box-shadow: inset 0 1px 0 white, 0 6px 14px rgba(26,74,94,.12); }
.evidence-actions button:last-child { color: white; background: var(--blue); }
.toast { grid-column: 1 / -1; min-height: 20px; color: var(--green) !important; font: 800 10px "Courier New", monospace; }
.app-footer {
  padding: 24px clamp(18px, 4vw, 58px);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  font: 10px "Courier New", monospace;
  text-transform: uppercase;
}
.app-footer nav { display: flex; gap: 18px; }

@media (max-width: 1100px) {
  .lab-layout { grid-template-columns: 1fr; }
  .protocol-panel { position: static; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .sample-workspace { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .run-identity span:not(.live-pip), .run-identity a { display: none; }
  main { padding-top: 20px; }
  .bench-heading { grid-template-columns: 1fr; }
  .replay-banner { grid-template-columns: 1fr; }
  .bench-stamp { width: 180px; }
  .field-pair, .result-grid, .diff-columns { grid-template-columns: 1fr; }
  .diff-columns div + div { border-left: 0; border-top: 1px solid var(--line); }
  .process-steps { grid-template-columns: 1fr; }
  .process-steps li { border-right: 0; border-bottom: 1px solid var(--line); }
  .section-head, .evidence-footer { display: grid; grid-template-columns: 1fr; align-items: start; }
  .filter-set, .evidence-actions { flex-wrap: wrap; }
  .sample-plate { grid-template-columns: repeat(10, 1fr); }
  .plate-labels { display: none; }
  .app-footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { scroll-behavior: auto !important; transition: none !important; }
}
