:root {
  color-scheme: dark;
  --background: #0f0f0d;
  --surface: #181816;
  --surface-raised: #20201d;
  --border: #4b4942;
  --control-border: #77736a;
  --control-surface: #292823;
  --text: #f1ede4;
  --muted: #c1baad;
  --accent: #c4ac72;
  --accent-ink: #17140d;
  --error: #ffb4ad;
  --error-surface: #351d1b;
  --success: #b9cda6;
  --measure: 78rem;
  --radius: 0.35rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color: var(--text);
}

body {
  margin: 0;
  min-width: 20rem;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  line-height: 1.55;
}

body,
button,
input,
select,
textarea {
  font-size: 1rem;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 0.14em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 11ch;
  margin-bottom: 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.5rem, 11vw, 8rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.86;
}

h2 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

h3 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-header,
#review-workflow,
.page-footer,
.status-region {
  width: min(calc(100% - 2rem), var(--measure));
  margin-inline: auto;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 0.6fr);
  gap: 2rem;
  padding: clamp(4rem, 10vw, 8rem) 0 3rem;
  border-bottom: 1px solid var(--border);
}

.page-header .eyebrow,
.page-header h1,
.page-header .lede {
  grid-column: 1;
}

.eyebrow,
.step-number,
.control-label,
.revision-status {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.lede {
  max-width: 48rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.3rem);
}

.privacy-contract {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: end;
  padding: 1.4rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

.privacy-contract h2 {
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.privacy-contract p {
  margin-bottom: 0;
  color: var(--muted);
}

.status-region {
  min-height: 3.5rem;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-left: 0.25rem solid var(--accent);
  background: var(--surface);
}

.status-region.is-error {
  border-left-color: var(--error);
  background: var(--error-surface);
}

#review-workflow {
  padding: 1rem 0 4rem;
}

.panel {
  margin-top: 1rem;
  padding: clamp(1.15rem, 3vw, 2rem);
  border: 1px solid var(--border);
  background: var(--surface);
}

.section-heading {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.section-heading p:last-child {
  max-width: 58rem;
  margin-bottom: 0;
  color: var(--muted);
}

.step-number {
  margin: 0.2rem 0 0;
}

.source-grid,
.field-grid,
.filter-row,
.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.demo-kit {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(15rem, 0.65fr);
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.2rem;
  border: 1px solid var(--accent);
  background: var(--surface-raised);
}

.demo-kit h3 {
  margin-bottom: 0.4rem;
}

.demo-kit p:last-child {
  max-width: 58rem;
  margin-bottom: 0;
  color: var(--muted);
}

.demo-actions {
  display: grid;
  align-content: center;
  gap: 0.65rem;
}

.drop-zone,
.file-choice,
.inspection,
.draft-panel,
.evidence-copy {
  padding: 1.2rem;
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

.drop-zone {
  border-style: dashed;
}

.drop-zone.is-dragging {
  border-style: solid;
  border-color: var(--accent);
  outline: 0.18rem solid var(--accent);
  outline-offset: 0.15rem;
}

.drop-zone p:not(.control-label),
.file-choice p:not(.control-label) {
  color: var(--muted);
}

.inspection,
.facts,
.draft-panel,
.error-box {
  margin-top: 1rem;
}

.phase-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.5rem;
  color: var(--muted);
}

.phase-list li::marker {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.phase-list li[data-state="active"] {
  color: var(--text);
}

.phase-list li[data-state="complete"]::after {
  margin-left: 0.55rem;
  color: var(--success);
  content: "Complete";
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phase-list li[data-state="failed"]::after {
  margin-left: 0.55rem;
  color: var(--error);
  content: "Failed";
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.error-box {
  padding: 1rem;
  border: 1px solid var(--error);
  background: var(--error-surface);
  color: var(--text);
}

.error-box p:last-child,
.error-box ul:last-child {
  margin-bottom: 0;
}

.facts dl,
.print-context {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--border);
}

.facts dl > div,
.print-context > div {
  min-width: 0;
  padding: 1rem;
  background: var(--surface-raised);
}

.facts .wide-fact {
  grid-column: 1 / -1;
}

dt {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

dd {
  margin: 0;
}

.hash-value {
  overflow-wrap: anywhere;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
}

.match-status {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-left: 0.2rem solid var(--muted);
  color: var(--muted);
}

.match-status[data-match="matched"] {
  border-color: var(--success);
  color: var(--text);
}

.match-status[data-match="mismatched"] {
  border-color: var(--error);
  color: var(--error);
}

.button,
button,
input,
select,
textarea {
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
}

.button,
button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0.66rem 1rem;
  background: var(--control-surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 680;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.button:hover,
button:hover:not(:disabled) {
  border-color: var(--accent);
  background: #343229;
}

.button.primary,
button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

button.danger {
  border-color: var(--error);
  color: var(--error);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.62rem 0.72rem;
  background: #11110f;
  color: var(--text);
}

textarea {
  min-height: 6.2rem;
  resize: vertical;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}

label {
  display: inline-block;
  margin-bottom: 0.38rem;
  font-weight: 650;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--border);
}

legend {
  padding: 0 0.45rem;
  font-weight: 700;
}

.field-wide {
  grid-column: 1 / -1;
}

.button-row,
.transport {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.draft-panel .button-row,
.note-editor .button-row {
  margin-top: 1rem;
}

#audio-player {
  display: block;
  width: 100%;
  min-height: 54px;
  margin-bottom: 1rem;
}

.waveform-shell {
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0a0a09;
}

#waveform-canvas {
  display: block;
  width: 100%;
  height: clamp(12rem, 28vw, 18rem);
  cursor: crosshair;
  touch-action: none;
}

#waveform-canvas[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.58;
}

.time-readout {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--surface-raised);
}

.time-value {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.transport {
  justify-content: center;
  margin-top: 1rem;
}

.transport button {
  flex: 1 1 10rem;
}

.keyboard-help {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.note-editor,
.filters,
.notes-list {
  margin-top: 1rem;
}

.note-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filters {
  background: var(--surface-raised);
}

.notes-list {
  display: grid;
  gap: 0.8rem;
  padding: 0;
  list-style: none;
}

.note-card {
  display: grid;
  grid-template-columns: minmax(8rem, 0.25fr) minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

.note-card.is-filtered {
  display: none;
}

.note-meta,
.note-copy {
  min-width: 0;
}

.note-seek {
  width: 100%;
  margin-bottom: 0.5rem;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.note-id,
.note-status {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.note-status {
  margin-top: 0.35rem;
  color: var(--accent);
}

.note-text {
  margin-bottom: 0.65rem;
  white-space: pre-wrap;
}

.note-action {
  margin-bottom: 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.note-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.empty-notes {
  padding: 1.2rem;
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
}

.export-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.evidence-copy {
  margin-top: 1rem;
}

.evidence-copy p:last-child {
  margin-bottom: 0;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.page-footer p {
  margin-bottom: 0;
}

.page-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem 1rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.print-only {
  display: none;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 0.2rem solid var(--accent);
  outline-offset: 0.18rem;
}

input.visually-hidden:focus-visible + label.button {
  outline: 0.2rem solid var(--accent);
  outline-offset: 0.18rem;
}

@media (max-width: 720px) {
  .page-header,
  .source-grid,
  .demo-kit,
  .field-grid,
  .filter-row,
  .export-grid,
  .facts dl,
  .note-card {
    grid-template-columns: 1fr;
  }

  .page-header .eyebrow,
  .page-header h1,
  .page-header .lede,
  .privacy-contract,
  .field-wide,
  .facts .wide-fact {
    grid-column: 1;
  }

  .privacy-contract {
    grid-row: auto;
  }

  .section-heading {
    grid-template-columns: 2.2rem minmax(0, 1fr);
  }

  .note-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .page-footer {
    flex-direction: column;
  }

  .page-footer nav {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    min-width: 0;
    background: #fff;
    color: #111;
    font-size: 10.5pt;
  }

  .skip-link,
  .status-region,
  .privacy-contract,
  .demo-kit,
  #source-section .source-grid,
  #source-section .inspection,
  #source-section .error-box,
  #draft-controls,
  #playback-section,
  #revision-fields,
  #add-note,
  #note-editor,
  #note-filters,
  #validation-errors,
  .export-grid,
  .note-actions,
  .page-footer {
    display: none !important;
  }

  .page-header,
  #review-workflow {
    width: 100%;
    margin: 0;
  }

  .page-header {
    display: block;
    padding: 0 0 1rem;
    border-color: #555;
  }

  .page-header h1 {
    margin-bottom: 0.5rem;
    font-size: 34pt;
  }

  .page-header .eyebrow,
  .page-header .lede {
    display: block;
  }

  #review-workflow {
    padding: 0;
  }

  .panel {
    margin: 0;
    padding: 1rem 0;
    break-inside: avoid;
    border: 0;
    border-bottom: 1px solid #777;
    background: #fff;
  }

  .section-heading {
    margin-bottom: 0.8rem;
  }

  .step-number,
  .eyebrow,
  .revision-status,
  .note-status {
    color: #4b4023;
  }

  .print-only {
    display: grid;
  }

  .print-context,
  .facts dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: #777;
  }

  .print-context > div,
  .facts dl > div,
  .note-card,
  .evidence-copy {
    background: #fff;
    color: #111;
  }

  #audio-facts[hidden] {
    display: none !important;
  }

  .notes-list {
    display: block;
  }

  .note-card,
  .note-card.is-filtered {
    display: grid !important;
    grid-template-columns: 9rem minmax(0, 1fr);
    margin-bottom: 0.5rem;
    break-inside: avoid;
    border-color: #777;
  }

  .note-seek {
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111;
    text-align: left;
  }

  .evidence-copy {
    border-color: #777;
  }

  a {
    color: #111;
    text-decoration: none;
  }
}
