@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #101820;
  --navy: #112942;
  --navy-2: #1c3d5c;
  --desk: #29313a;
  --ground: #e4e9ed;
  --paper: #ffffff;
  --line: #c5cdd4;
  --muted: #64717c;
  --stamp: #df3c24;
  --correct: #08724d;
  --wrong: #c83224;
  --pending: #9aa5ae;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Archivo", Arial, sans-serif;
}
button, textarea { font: inherit; }
button { cursor: pointer; }

.audit-head {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(210px, .7fr) minmax(320px, 1.4fr) auto;
  align-items: center;
  gap: 28px;
  padding: 12px 24px;
  background: var(--navy);
  color: white;
  border-bottom: 4px solid var(--stamp);
}
.brand { color: white; text-decoration: none; display: flex; flex-direction: column; line-height: 1; }
.brand span { font-weight: 900; letter-spacing: .2em; font-size: 17px; }
.brand small { margin-top: 7px; color: #b9cbd9; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.head-copy { display: flex; flex-direction: column; gap: 4px; }
.head-copy strong { font-size: 16px; }
.head-copy span { color: #c7d4df; font-size: 12px; }
.export {
  border: 1px solid #f37c67;
  background: var(--stamp);
  color: white;
  padding: 11px 15px;
  font-weight: 800;
}
.export b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 6px; background: white; color: var(--stamp); }
.export:disabled { opacity: .45; cursor: not-allowed; }

.audit-tools {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 8px 24px;
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.kind-filter { display: flex; border: 1px solid var(--line); }
.kind-filter button { border: 0; border-right: 1px solid var(--line); background: white; padding: 8px 12px; color: var(--muted); font-size: 12px; font-weight: 700; }
.kind-filter button:last-child { border-right: 0; }
.kind-filter button[aria-pressed="true"] { background: var(--navy); color: white; }
.progress { display: flex; gap: 15px; font-size: 11px; color: var(--muted); }
.progress span { display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pending); }
.dot.correct { background: var(--correct); }
.dot.wrong { background: var(--wrong); }
.position { margin-left: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.audit-layout {
  height: calc(100vh - 130px);
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  overflow: hidden;
}
.viewer { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.viewer-topline {
  min-height: 48px;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #d8dee3;
  border-bottom: 1px solid #bac4cc;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.viewer-topline > div { display: flex; align-items: center; gap: 10px; }
.kind-chip { padding: 4px 6px; background: var(--navy-2); color: white; font-size: 9px; font-weight: 800; }
.desk {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 28px 34px 52px 62px;
  background: var(--desk);
  overflow: auto;
  display: grid;
  justify-items: center;
  align-items: start;
}
.case-ruler {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40px;
  background: #1b2229;
  border-right: 1px solid #515b64;
  color: #aeb8bf;
  display: flex;
  justify-content: center;
  padding-top: 22px;
  font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em;
  writing-mode: vertical-rl;
}
.loading { color: #e2e7eb; font-size: 12px; padding-top: 80px; letter-spacing: .05em; }
.paper { position: relative; background: var(--paper); box-shadow: 0 14px 38px rgba(0,0,0,.38); }
.paper canvas { display: block; width: 100%; height: 100%; }
.stamp-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.marker-tick { position: absolute; left: 0; width: 26px; height: 2px; background: var(--stamp); box-shadow: 0 0 0 1px rgba(255,255,255,.65); }
.marker-leaders { position: absolute; inset: 0 auto 0 0; overflow: visible; }
.marker-leaders line { stroke: var(--stamp); stroke-width: 1.25; }
.marker-label {
  position: absolute;
  left: 27px;
  min-width: 30px;
  height: 16px;
  padding: 1px 5px;
  background: var(--stamp);
  color: white;
  box-shadow: 0 1px 0 rgba(94,18,9,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  line-height: 14px;
  letter-spacing: -.01em;
}
.marker-label::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 4px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-right: 4px solid var(--stamp);
}

.inspector {
  padding: 22px;
  background: #f8fafb;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow: auto;
}
.eyebrow { display: block; color: var(--muted); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; }
.case-title h1 { margin: 7px 0 5px; font-size: 22px; letter-spacing: -.03em; }
.case-title code, .target-list code { font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); overflow-wrap: anywhere; }
.shared-note { padding: 12px; border-left: 4px solid var(--stamp); background: #fff0ed; display: flex; flex-direction: column; gap: 4px; }
.shared-note strong { font-size: 12px; }
.shared-note span { color: #6d4037; font-size: 11px; line-height: 1.45; }
.target-list { margin-top: 8px; display: grid; gap: 6px; max-height: 210px; overflow: auto; }
.target-item { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 7px; padding: 7px 8px; background: white; border: 1px solid #dce2e6; }
.target-item b { color: var(--stamp); }
.target-item span { font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.decision-box { padding-top: 18px; border-top: 1px solid var(--line); }
.decision-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 9px 0 12px; }
.decision { border: 2px solid currentColor; background: white; padding: 12px 8px; font-weight: 900; }
.decision.correct { color: var(--correct); }
.decision.wrong { color: var(--wrong); }
.decision[aria-pressed="true"].correct { background: var(--correct); color: white; }
.decision[aria-pressed="true"].wrong { background: var(--wrong); color: white; }
.note-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
textarea { width: 100%; resize: vertical; border: 1px solid var(--line); background: white; padding: 9px; font-size: 11px; line-height: 1.4; }
textarea:disabled { background: #edf1f3; color: #8a949c; }
.clear-decision { margin-top: 8px; border: 0; background: transparent; color: var(--muted); padding: 2px 0; font-size: 10px; text-decoration: underline; }
.nav-row { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nav-row button { border: 1px solid var(--navy); background: white; color: var(--navy); padding: 11px 9px; font-weight: 800; }
.nav-row button:last-child { background: var(--navy); color: white; }
.nav-row button:disabled { opacity: .4; cursor: not-allowed; }
.keys { margin: -12px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
kbd { border: 1px solid #aeb7be; background: white; padding: 1px 4px; margin: 0 2px; font-family: inherit; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: white; padding: 10px 14px; font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 50; }
.toast.on { opacity: 1; }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #58a6d6; outline-offset: 2px; }

@media (max-width: 900px) {
  .audit-head { grid-template-columns: 1fr auto; }
  .head-copy { display: none; }
  .audit-layout { height: auto; min-height: 0; grid-template-columns: 1fr; overflow: visible; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); }
  .progress { display: none; }
  .desk { min-height: 540px; padding-right: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
