:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
  color: #192423;
  background: #eff2f0;
  --ink: #192423;
  --muted: #4c5d58;
  --line: #cdd8d3;
  --surface: #fff;
  --tint: #f2f6f4;
  --accent: #176453;
  --accent-dark: #104b3e;
  --selected: #e4f1eb;
  --time: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
:where(button, input, textarea) { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
a { color: var(--accent-dark); }
:where(button, input, textarea, summary, a, [tabindex]):focus-visible {
  outline: 3px solid #137a67;
  outline-offset: 3px;
}
h1, h2, p, figure { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.4rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1rem; line-height: 1.25; letter-spacing: -.012em; }
summary { cursor: pointer; font-size: .9rem; font-weight: 650; }
.shell { width: min(calc(100% - 56px), 1480px); margin-inline: auto; }
.muted, .output-note { color: var(--muted); }
.eyebrow, .time, .timeline, .cue span, .frame-chip span {
  font-family: var(--time);
  font-variant-numeric: tabular-nums;
}
.eyebrow { color: var(--accent-dark); font-size: .81rem; font-weight: 650; margin-bottom: 5px; }
.time { color: var(--muted); font-size: .79rem; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar-inner, .header-actions, .workspace-actions, .monitor-actions, .cue-action, .edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.bar-inner { min-height: 64px; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 750; font-size: 1.16rem; letter-spacing: -.04em; text-decoration: none; }
.brand img { display: block; }
.primary, .secondary, .text-button {
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 8px 12px;
  min-height: 42px;
  line-height: 1.25;
  font-weight: 650;
  font-size: .9rem;
}
.primary { background: var(--accent); color: white; }
.primary:hover:enabled { background: var(--accent-dark); }
.secondary { background: var(--surface); border-color: #abbeb5; color: var(--ink); }
.secondary:hover:enabled { background: var(--selected); }
.text-button { background: transparent; color: var(--accent-dark); }
.text-button:hover:enabled { text-decoration: underline; }

.workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 28px 0 20px;
}
.workspace-title { min-width: 0; }
#source-kind { overflow-wrap: anywhere; }
.output-note { font-size: .91rem; margin-top: 5px; }
.desk {
  display: grid;
  grid-template-columns: minmax(165px, .81fr) minmax(0, 2.55fr) minmax(284px, 1.15fr);
  grid-template-areas: "queue monitor review";
  gap: 12px;
  align-items: start;
}
.cue-panel { grid-area: queue; }
.screen-panel { grid-area: monitor; }
.repair-panel { grid-area: review; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.panel-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 11px;
  min-height: 53px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}
.screen-head .time { margin-left: auto; }
.panel-body, .monitor-body { padding: 14px; }
#queue { list-style: none; margin: 0; padding: 8px; max-height: 70vh; overflow: auto; }
#queue li + li { margin-top: 4px; }
.cue {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 50px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  overflow-wrap: anywhere;
  font-size: .88rem;
}
.cue:hover { background: var(--tint); }
.cue[aria-current=true] { background: var(--selected); border-color: #a6c7b8; }
.cue span { display: block; color: var(--accent-dark); font-size: .77rem; margin-bottom: 3px; }
#empty-queue { margin: 0 12px 12px; font-size: .88rem; }

.media-stage {
  background: #182422;
  color: #f6f9f7;
  border-radius: 5px;
  display: grid;
  place-items: center;
  min-width: 0;
}
.media-stage video { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: contain; max-height: 470px; border-radius: 5px; }
.monitor-modes { display: flex; padding: 2px; gap: 1px; border: 1px solid var(--line); border-radius: 5px; background: var(--tint); }
.monitor-modes button { border: 1px solid transparent; background: transparent; color: var(--muted); padding: 4px 8px; border-radius: 3px; font-size: .82rem; line-height: 1.15; }
.monitor-modes button[aria-pressed=true] { background: white; border-color: var(--line); color: var(--ink); }
#evidence-view { width: 100%; }
.frame-image { position: relative; max-width: 100%; margin-inline: auto; line-height: 0; }
.frame-image img { display: block; width: 100%; border-radius: 5px 5px 0 0; }
.frame-image.marking { cursor: crosshair; }
#evidence-box {
  position: absolute;
  pointer-events: none;
  outline: 2px solid #ffdc6f;
  box-shadow: 0 0 0 2px #102a24;
  background: #fff19a33;
}
#evidence-caption { padding: 7px 10px; font-size: .82rem; color: #e8f0eb; }
.timeline { margin-top: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px 6px; background: var(--tint); }
.timeline-head, .ruler { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: .74rem; color: var(--muted); }
.timeline-head output { color: var(--accent-dark); }
.cue-track {
  position: relative;
  height: 23px;
  border-block: 1px solid #c5d5ce;
  margin-top: 5px;
  background: repeating-linear-gradient(90deg, #e9eeeb 0 calc(10% - 1px), #cfdbd4 calc(10% - 1px) 10%);
}
.cue-marker { position: absolute; top: 3px; bottom: 3px; min-width: 5px; border: 1px solid #7b9789; border-radius: 2px; background: #c5d9cf; padding: 0; }
.cue-marker[data-reviewed=true] { border-color: #176453; background: #a1c8b6; }
.cue-marker[aria-current=true] { border-color: var(--accent-dark); background: var(--accent); }
#playhead { display: block; width: 100%; margin: 4px 0 0; accent-color: var(--accent); cursor: ew-resize; }
.monitor-actions { margin-top: 10px; }
#frame-details { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 11px; }
.frame-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 99px), 1fr)); gap: 7px; margin-top: 8px; }
.frame-chip {
  min-width: 0;
  overflow: hidden;
  padding: 0 0 5px;
  border: 1px solid #adc0b5;
  border-radius: 5px;
  background: var(--tint);
  color: var(--ink);
  text-align: left;
}
.frame-chip[aria-pressed=true] { border-color: var(--accent); background: var(--selected); }
.frame-chip img { display: block; width: 100%; height: clamp(45px, 6vw, 76px); object-fit: contain; background: #202b28; }
.frame-chip strong, .frame-chip span { display: block; margin: 3px 6px 0; }
.frame-chip strong { font-size: .76rem; }
.frame-chip span { color: var(--muted); font-size: .68rem; overflow-wrap: anywhere; }

.original { background: var(--tint); border-left: 3px solid #8baa9e; padding: 9px 11px; margin-bottom: 10px; overflow-wrap: anywhere; }
.original .subhead { font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
#original { font-size: .95rem; }
.status, #decision-hint { font-size: .84rem; }
.status { margin: 7px 0 0; }
.status:empty { display: none; }
#compact-actions { padding: 8px 10px; border-top: 1px solid var(--line); }
.suggestion { margin-top: 10px; padding: 8px 9px; background: var(--selected); border: 1px solid #a9c8ba; border-radius: 4px; color: var(--accent-dark); font-weight: 650; font-size: .87rem; }
.candidates { display: flex; flex-wrap: wrap; gap: 5px; max-height: 130px; overflow: auto; padding: 3px; margin-top: 4px; }
.candidates:empty { display: none; }
.candidate {
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid #a9bdb2;
  border-radius: 4px;
  color: var(--ink);
  background: var(--tint);
  padding: 5px 7px;
  text-align: left;
  min-height: 33px;
  font-size: .84rem;
}
.candidate[aria-pressed=true] { background: var(--selected); border-color: var(--accent); }
#other-labels, .outcomes { margin-top: 7px; }
.draft { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
.draft label { font-size: .9rem; font-weight: 700; }
.draft textarea { display: block; width: 100%; resize: vertical; color: var(--ink); background: white; border: 1px solid #a9bdb2; border-radius: 4px; padding: 8px; margin: 5px 0; }
.attached-evidence, .guide-source { color: var(--accent-dark); font-size: .82rem; overflow-wrap: anywhere; }
.attached-evidence { margin-top: 6px; border-left: 2px solid #659b85; padding-left: 7px; }
.edit-actions { margin-top: 8px; }

dialog { width: min(630px, calc(100% - 24px)); max-height: 88vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 17px 20px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #122520ac; }
.dialog-head { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
dialog h2 { font-size: 1.2rem; }
dialog li { overflow-wrap: anywhere; margin-bottom: 8px; }
dialog details { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 10px; }
dialog details p { margin-top: 5px; }
#guide-list { padding-left: 1.4rem; }
#guide-list li { border-bottom: 1px solid var(--line); padding: 5px 0; }
#guide-list li p { margin: 4px 0; }

.sample-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 15px; }
.sample-options button { text-align: left; }
.sample-options span { display: block; margin-top: 5px; color: var(--muted); font-size: .83rem; font-weight: 400; }
.file-row { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 7px; }
.file-row label { font-weight: 650; }
.file-row label span { color: var(--muted); font-weight: 400; font-size: .84rem; }
.file-row input { min-width: 0; padding: 5px; color: var(--ink); border: 1px solid var(--line); border-radius: 4px; background: var(--tint); }
.file-row button { justify-self: start; }
.error { color: #9b2334; font-size: .89rem; }
.alert { margin-top: 25px; color: var(--muted); }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 7px 12px; padding: 15px 0; margin-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; }

@media (max-width: 1060px) {
  .desk { grid-template-columns: minmax(0, 1fr) minmax(278px, .66fr); grid-template-areas: "queue queue" "monitor review"; }
  #queue { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 4px; max-height: 10rem; }
  #queue li + li { margin-top: 0; }
}
@media (max-width: 700px) {
  .shell { width: calc(100% - 24px); }
  .bar-inner { min-height: 57px; }
  .workspace-head { padding: 16px 0 12px; }
  .desk { grid-template-columns: minmax(0, 1fr); grid-template-areas: "queue" "monitor" "review"; gap: 9px; }
  .panel-heading { min-height: 43px; padding: 7px 10px; }
  .panel-body, .monitor-body { padding: 10px; }
  #queue { grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr)); }
}
@media (max-width: 370px) {
  .header-actions { gap: 4px; }
  .header-actions button { padding-inline: 7px; }
  .sample-options { grid-template-columns: 1fr; }
}
