* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.boot-message { display: grid; min-height: 100vh; place-items: center; color: var(--ink-2);
  font-family: var(--sans); }

.site-folio { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--paper) 96%, transparent);
  border-bottom: 1px solid var(--rule); }
.folio-inner { width: min(100% - 32px, var(--measure-wide)); min-height: 58px; margin: auto;
  display: flex; align-items: center; gap: var(--s3); }
.wordmark { color: var(--ink); font-family: var(--sans); font-size: 14px; font-weight: 800;
  letter-spacing: var(--track-wide); text-decoration: none; }
.wordmark .dot { color: var(--gold-ink); }
.folio-context { flex: 1; overflow: hidden; color: var(--ink-2); font-family: var(--sans);
  font-size: var(--fs-xs); letter-spacing: var(--track-caps); text-overflow: ellipsis;
  text-transform: uppercase; white-space: nowrap; }
.folio-actions { display: flex; align-items: center; gap: var(--s3); }

.text-button { padding: 2px 0; color: var(--gold-ink); background: transparent; border: 0;
  border-bottom: 1px solid var(--gold); font-family: var(--sans); font-size: var(--fs-xs);
  font-weight: 650; letter-spacing: .06em; }
.text-button:hover { color: var(--ink); }
.mode-button::before { content: "◐ "; }
.btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s2); padding: 0 24px; border: 1px solid var(--ink); border-radius: var(--radius-pill);
  background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 14px;
  font-weight: 700; letter-spacing: .06em; text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--gold-soft); }
.btn.primary { border-color: var(--gold); background: var(--gold); color: #1a1714; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-mid); }
.btn.on-night { border-color: var(--stock-night-gold); background: var(--stock-night-gold); color: #1a1714; }
.btn.compact { min-height: 34px; padding: 0 14px; font-size: 12px; }
.btn[disabled] { cursor: wait; opacity: .55; transform: none; box-shadow: none; }

.page { width: min(100% - 40px, var(--measure-wide)); margin: 0 auto; padding: var(--s6) 0 var(--s7); }
.page.narrow { max-width: 760px; }
.page-kicker, .eyebrow { display: block; margin-bottom: var(--s2); color: var(--gold-ink);
  font-family: var(--sans); font-size: var(--fs-xs); font-weight: 700; letter-spacing: var(--track-wide);
  text-transform: uppercase; }
.page-title { max-width: 930px; margin: 0; font-size: var(--fs-display); font-weight: 400;
  line-height: var(--lh-tight); letter-spacing: var(--track-tight); }
.page-lede { max-width: var(--measure); margin: var(--s3) 0 0; color: var(--ink-2);
  font-size: var(--fs-lede); font-style: italic; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }

.sign-in { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); }
.sign-in-story { min-height: 100vh; padding: clamp(48px, 8vw, 112px); display: flex;
  flex-direction: column; justify-content: space-between; }
.sign-in-story h1 { max-width: 920px; margin: var(--s3) 0; font-size: clamp(64px, 10vw, 144px);
  font-weight: 400; line-height: .9; letter-spacing: -.04em; }
.sign-in-story .tagline { max-width: 680px; color: var(--stock-night-faint); font-size: var(--fs-lede);
  font-style: italic; }
.sign-in-mark { color: var(--stock-night-gold); font-family: var(--sans); font-size: 13px;
  font-weight: 800; letter-spacing: .24em; }
.sign-in-panel { padding: clamp(36px, 6vw, 80px); display: flex; flex-direction: column;
  justify-content: center; background: var(--paper-deep); border-left: 1px solid var(--rule); }
.sign-in-panel h2 { margin: 0; font-size: var(--fs-h1); font-weight: 500; }
.sign-in-panel p { color: var(--ink-2); }
.trust-list { margin: var(--s4) 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.trust-list li { padding: var(--s3) 0; border-bottom: 1px solid var(--rule); font-family: var(--sans);
  font-size: var(--fs-sm); }

.alert { margin: var(--s4) 0; padding: var(--s3) var(--s4); border: 1px solid var(--rule-mid);
  border-left: 4px solid var(--gold); border-radius: var(--radius-sm); background: var(--leaf); }
.alert.bad { border-left-color: var(--stitch); }
.alert strong { font-family: var(--sans); }
.alert p { margin: 4px 0 0; color: var(--ink-2); }

.dashboard-grid { margin-top: var(--s6); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: var(--s4); align-items: start; }
.panel, .form-card { padding: var(--s5); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--leaf); box-shadow: var(--shadow); }
.panel h2, .form-card h2 { margin: 0; font-size: var(--fs-h2); font-weight: 500; }
.field { display: grid; gap: var(--s2); margin-top: var(--s4); }
.field > span, label.lbl { color: var(--ink-2); font-family: var(--sans); font-size: var(--fs-xs);
  font-weight: 700; letter-spacing: var(--track-caps); text-transform: uppercase; }
input, select { width: 100%; min-height: 50px; padding: 10px 14px; border: 1px solid var(--rule-mid);
  border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font-family: var(--sans); }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.field-hint { color: var(--ink-faint); font-family: var(--sans); font-size: var(--fs-xs); }
.form-actions { margin-top: var(--s4); }
.tribe-list { margin: var(--s3) 0 0; padding: 0; list-style: none; }
.tribe-list li + li { border-top: 1px solid var(--rule); }
.tribe-row { width: 100%; padding: var(--s3) 0; display: flex; align-items: center; gap: var(--s3);
  color: var(--ink); background: transparent; border: 0; text-align: left; }
.tribe-row:hover .tribe-name { color: var(--gold-ink); }
.patch-mini { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center;
  border: 2px solid var(--stock-felt-gold); border-radius: 50%; background: var(--stock-felt);
  color: var(--stock-felt-gold); font-family: var(--score); }
.tribe-name { display: block; font-size: 18px; }
.tribe-date { display: block; color: var(--ink-faint); font-family: var(--sans); font-size: var(--fs-xs); }
.arrow { margin-left: auto; color: var(--gold-ink); font-family: var(--sans); }

.steps { display: flex; margin: 0 0 var(--s6); padding: 0; list-style: none; counter-reset: step; }
.steps li { flex: 1; position: relative; padding-top: 26px; color: var(--ink-faint);
  font-family: var(--sans); font-size: var(--fs-xs); text-align: center; }
.steps li::before { counter-increment: step; content: counter(step); width: 22px; height: 22px;
  position: absolute; top: 0; left: calc(50% - 11px); z-index: 1; display: grid; place-items: center;
  border: 1px solid var(--rule-mid); border-radius: 50%; background: var(--paper); }
.steps li::after { content: ""; position: absolute; top: 11px; left: 0; right: 0; height: 1px;
  background: var(--rule); }
.steps li:first-child::after { left: 50%; }
.steps li:last-child::after { right: 50%; }
.steps li.active { color: var(--ink); font-weight: 700; }
.steps li.active::before, .steps li.done::before { border-color: var(--gold); background: var(--gold); color: #1a1714; }

.upload-grid { margin-top: var(--s5); display: grid; grid-template-columns: 2fr 1fr; gap: var(--s4); }
.upload-zone { min-height: 260px; position: relative; display: grid; place-items: center; padding: var(--s5);
  border: 2px dashed var(--rule-mid); border-radius: var(--radius-lg); text-align: center;
  transition: border-color var(--dur-fast), background var(--dur-fast); }
.upload-zone.dragging { border-color: var(--gold); background: var(--gold-soft); }
.upload-zone input[type="file"] { position: absolute; inset: 0; min-height: 0; opacity: 0; cursor: pointer; }
.upload-mark { display: block; color: var(--gold-ink); font-family: var(--score); font-size: 52px; }
.upload-zone strong { display: block; font-size: var(--fs-h3); }
.upload-zone small { display: block; margin-top: var(--s2); color: var(--ink-2); font-family: var(--sans); }
.source-card { display: grid; align-content: start; }
.source-card .field { margin-top: 0; }
.privacy-note { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--rule);
  color: var(--ink-2); font-size: var(--fs-sm); }

.processing-page { min-height: calc(100vh - 58px); padding: clamp(40px, 8vw, 104px) 0; }
.processing-inner { width: min(100% - 40px, 1040px); margin: auto; }
.processing-title { max-width: 900px; margin: 0; font-size: var(--fs-display); font-weight: 400;
  line-height: var(--lh-tight); }
.press-line { margin-top: var(--s6); border-top: 1px solid var(--stock-night-rule); }
.press-row { min-height: 72px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center; gap: var(--s3); border-bottom: 1px solid var(--stock-night-rule);
  color: var(--stock-night-faint); font-family: var(--sans); }
.press-row.current, .press-row.complete { color: var(--stock-night-text); }
.press-index { color: var(--stock-night-gold); font-family: var(--score); }
.press-value { color: var(--stock-night-gold); font-variant-numeric: tabular-nums; }
.press-detail { justify-self: end; text-align: right; color: var(--stock-night-gold);
  font-variant-numeric: tabular-nums; font-size: var(--fs-xs); max-width: 55%; }
.processing-note { margin-top: var(--s4); color: var(--stock-night-faint); font-style: italic; }

.question-panel { margin-top: var(--s5); padding: var(--s4); border: 1px solid var(--stock-night-gold);
  border-radius: var(--radius); background: #232019; }
.question-panel h2 { margin: 0; font-size: var(--fs-h2); }
.question-card { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--stock-night-rule); }
.question-names { font-size: var(--fs-h3); }
.question-reason { color: var(--stock-night-faint); }
.question-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.question-actions .btn.ghost { color: var(--stock-night-text); border-color: var(--stock-night-rule); }

.review-scoreboard { margin-top: var(--s5); padding: var(--s5); border-radius: var(--radius-lg); }
.review-scoreboard .scoreboard .digit { font-size: clamp(44px, 8vw, 92px); }
.metric-grid { margin-top: var(--s3); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.metric { padding: var(--s3); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--leaf); }
.metric-value { font-family: var(--sans); font-size: var(--fs-h2); font-variant-numeric: tabular-nums; }
.metric-label { color: var(--ink-2); font-family: var(--sans); font-size: var(--fs-xs);
  letter-spacing: var(--track-caps); text-transform: uppercase; }
.import-list { margin-top: var(--s4); }
.import-row { padding: var(--s3) 0; display: grid; grid-template-columns: 1fr auto; gap: var(--s3);
  border-bottom: 1px solid var(--rule); }
.import-meta { color: var(--ink-2); font-family: var(--sans); font-size: var(--fs-sm); }
.confirm-card { margin-top: var(--s5); padding: var(--s4); border: 2px solid var(--ink);
  border-radius: var(--radius-lg); }
.confirm-card h2 { margin: 0; }
.check-label { margin: var(--s3) 0; display: flex; align-items: flex-start; gap: var(--s2);
  font-family: var(--sans); font-size: var(--fs-sm); }
/* Both classes carry a checkbox and must escape the global
   `input { width: 100%; min-height: 50px }` above. `.check-row` is the
   production journey's pre-spend consent row; `.check-label` is the durable
   journey's. Keep them together so removing either bundle cannot silently
   strand the other's checkbox at full width. */
.check-label input, .check-row input { width: 20px; min-height: 20px; margin: 1px 0 0; }

.history-layout { width: min(100% - 32px, 1280px); margin: auto; display: grid;
  grid-template-columns: minmax(0, 880px) 300px; gap: var(--s4); align-items: start; }
.history-main { min-width: 0; padding-bottom: var(--s7); }
.history-sidebar { position: sticky; top: 82px; margin-top: var(--s5); padding: var(--s4);
  border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--leaf); }
.history-sidebar h2 { margin: 0; font-size: var(--fs-h3); }
.history-sidebar p { color: var(--ink-2); font-size: var(--fs-sm); }
.curation-progress { margin: var(--s3) 0; padding: var(--s3) 0; border-block: 1px solid var(--rule);
  font-family: var(--sans); font-size: var(--fs-sm); }
.publish-result { margin-top: var(--s4); }
.share-link { display: block; margin: var(--s2) 0; padding: var(--s2); overflow-wrap: anywhere;
  border-radius: var(--radius-sm); background: var(--paper-deep); color: var(--gold-ink);
  font-family: var(--mono); font-size: 12px; }
.member-links { margin: var(--s3) 0 0; padding: 0; list-style: none; }
.member-links li { padding: var(--s2) 0; border-top: 1px solid var(--rule); }
.member-links a { color: var(--gold-ink); font-family: var(--sans); font-size: var(--fs-sm); }

.mythology-document { counter-reset: chapter; }
.cover { min-height: min(760px, calc(100vh - 58px)); margin: 0; padding: clamp(64px, 10vw, 120px) clamp(28px, 7vw, 72px);
  display: flex; flex-direction: column; justify-content: center; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.cover h1 { max-width: 820px; margin: var(--s2) 0 0; font-size: clamp(64px, 11vw, 142px);
  font-weight: 400; line-height: .9; letter-spacing: -.045em; }
.cover .tagline { max-width: 680px; margin: var(--s4) 0 0; color: var(--stock-night-gold);
  font-size: clamp(20px, 3vw, 32px); font-style: italic; }
.cover-facts { margin-top: auto; padding-top: var(--s5); border-top: 1px solid var(--stock-night-rule); }
.chapter { position: relative; margin: var(--s7) clamp(20px, 5vw, 52px) 0; counter-increment: chapter; }
.chapter-head { position: relative; padding-top: var(--s4); border-top: 2px solid var(--ink); }
.chapter-head::before { content: counter(chapter, decimal-leading-zero); position: absolute; right: 0; top: -24px;
  z-index: -1; color: var(--ink); font-family: var(--score); font-size: clamp(82px, 13vw, 150px); opacity: .055; }
.chapter h2 { max-width: 780px; margin: 0; font-size: var(--fs-display); font-weight: 400;
  line-height: var(--lh-tight); letter-spacing: var(--track-tight); }
.chapter .lede { max-width: var(--measure); color: var(--ink-2); font-size: var(--fs-lede); font-style: italic; }
.felt-hero, .gold-plate, .night-plate { margin-top: var(--s5); padding: var(--s5); border-radius: var(--radius-lg); }
.felt-hero .scoreboard .digit { font-size: clamp(48px, 9vw, 110px); }
.history-lineage, .history-eras, .record-list, .cards, .tiles { margin-top: var(--s4); }
.cards { display: grid; gap: var(--s3); }
.artifact-card { transition: opacity var(--dur-fast), border-color var(--dur-fast); }
.artifact-hidden { opacity: .58; border-color: var(--stitch) !important; }
.artifact-hidden > :not(.curator) { filter: grayscale(.75); }
.when { color: var(--ink-faint); font-family: var(--sans); font-size: var(--fs-xs); }
.what { margin: 2px 0 0; font-size: 20px; font-weight: 500; }
.note, .aftermath { color: var(--ink-2); font-style: italic; }
.deposition .line { display: grid; grid-template-columns: minmax(80px, auto) 1fr; gap: 2px var(--s3); }
.deposition .ref { grid-column: 2; grid-row: 1; text-align: right; }
.deposition .speaker { grid-column: 1; grid-row: 1 / span 2; }
.deposition .testimony { grid-column: 2; }
.redact-button { grid-column: 2; width: max-content; margin-top: 3px; color: inherit; opacity: .72; }
.ledger-entry + .ledger-entry { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid rgba(26,23,20,.26); }
.night-plate .chart-bars { height: 180px; display: flex; align-items: flex-end; gap: 6px;
  margin: var(--s4) 0 var(--s5); border-bottom: 2px solid var(--stock-night-rule); }
.night-plate .bar { min-height: 2px; flex: 1; position: relative; border-radius: 4px 4px 0 0; background: var(--chart-night); }
.night-plate .bar span { position: absolute; bottom: -26px; left: 50%; transform: translateX(-50%);
  color: var(--stock-night-faint); font-family: var(--sans); font-size: 10px; }
.night-plate details { color: var(--stock-night-faint); font-family: var(--sans); font-size: var(--fs-sm); }
.night-plate table { margin-top: var(--s2); border-collapse: collapse; }
.night-plate th, .night-plate td { padding: 3px 16px 3px 0; text-align: left; }
.silence-note { color: var(--stock-night-faint); font-style: italic; }
.curator { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px dashed currentColor;
  color: inherit; font-family: var(--sans); }
.curator-verdict { display: flex; align-items: center; gap: var(--s3); }
.curator .stamp { flex: 0 0 auto; font-size: 11px; }
.curator-copy { font-size: var(--fs-xs); opacity: .75; }
.curator-actions { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); }
.retitle-form { margin-top: var(--s3); display: grid; grid-template-columns: 1fr auto; align-items: end; gap: var(--s2); }
.retitle-form label { display: grid; gap: var(--s2); }
.retitle-form input { min-height: 38px; }
.gold-plate .curator .btn.ghost { border-color: rgba(26,23,20,.35); color: var(--stock-gold-text); }
.gold-plate .curator .text-button { color: var(--stock-gold-text); border-color: var(--stock-gold-text); }
.night-plate .curator .btn.ghost { border-color: var(--stock-night-rule); color: var(--stock-night-text); }
.night-plate .curator .text-button { color: var(--stock-night-gold); }
.history-foot { margin: var(--s7) var(--s4) 0; color: var(--ink-faint); font-family: var(--sans);
  font-size: var(--fs-xs); text-align: center; }
.public-history .cover { border-radius: 0; }
.public-notice { width: min(100% - 40px, 840px); margin: var(--s4) auto 0; }

.production-actions { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap;
  align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule);
  background: var(--paper); font-family: var(--sans); }
.production-actions strong { margin-right: auto; }
.chapter-controls { width: min(100% - 40px, 900px); margin: var(--s4) auto; padding: var(--s3);
  display: flex; flex-wrap: wrap; gap: var(--s3); border: 1px solid var(--rule); border-radius: var(--radius); }
.chapter-controls strong { flex-basis: 100%; font-family: var(--sans); }
.chapter-controls label, .check-row { display: flex; align-items: center; gap: var(--s2); font-family: var(--sans); }

@media print {
  .production-actions, .chapter-controls, .site-folio, .toast, .redact-button { display: none !important; }
  .chapter { break-inside: avoid; }
  .cover { min-height: 90vh; }
}

.toast { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 100; max-width: min(420px, calc(100vw - 48px));
  padding: var(--s3) var(--s4); border-radius: var(--radius); background: var(--ink); color: var(--paper);
  box-shadow: 0 14px 36px rgba(0,0,0,.2); font-family: var(--sans); font-size: var(--fs-sm); }
.toast.bad { background: var(--stitch); color: #fff; }
.empty { padding: var(--s4) 0; color: var(--ink-2); font-style: italic; }

@media (max-width: 980px) {
  .sign-in { grid-template-columns: 1fr; }
  .sign-in-story { min-height: 70vh; }
  .sign-in-panel { border-left: 0; border-top: 1px solid var(--rule); }
  .dashboard-grid, .upload-grid { grid-template-columns: 1fr; }
  .history-layout { width: 100%; display: flex; flex-direction: column; }
  .history-sidebar { order: -1; position: relative; top: 0; width: calc(100% - 40px); margin: var(--s4) auto; }
}

@media (max-width: 640px) {
  .folio-context { display: none; }
  .folio-actions { margin-left: auto; }
  .page { width: min(100% - 28px, var(--measure-wide)); padding-top: var(--s5); }
  .sign-in-story, .sign-in-panel { padding: 40px 24px; }
  .sign-in-story h1 { font-size: clamp(58px, 19vw, 88px); }
  .panel, .form-card { padding: var(--s4); }
  .metric-grid { grid-template-columns: 1fr; }
  .steps li { font-size: 10px; }
  .chapter { margin-inline: 16px; }
  .cover { padding-inline: 24px; }
  .felt-hero, .gold-plate, .night-plate { padding: var(--s4) var(--s3); }
  .deposition .line { grid-template-columns: 1fr; }
  .deposition .speaker, .deposition .ref, .deposition .testimony, .redact-button { grid-column: 1; grid-row: auto; }
  .deposition .ref { text-align: left; }
  .retitle-form { grid-template-columns: 1fr; }
}

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