/* Review Desk — a verification instrument for civic-meeting drafts.
   Palette and type are deliberate: editorial paper, one petrol accent for
   actions, and a semantic signal set (green/amber/red) that encodes the only
   thing that matters here — whether a fact agrees with the official record. */

:root {
  --paper:   #F4F5F3;
  --surface: #FFFFFF;
  --ink:     #14181C;
  --muted:   #5A6470;
  --hair:    #E4E7E3;
  --hair-2:  #EDEFEC;

  --petrol:  #0F5C5B;   /* primary action + links */
  --petrol-d:#0B4544;

  --green:   #1C7C54;   --green-bg:  #E8F2EC;
  --amber:   #9C6206;   --amber-bg:  #F6EEDD;
  --red:     #B0382D;   --red-bg:    #F6E7E4;
  --quiet:   #6B7480;   --quiet-bg:  #ECEEEB;

  --r: 10px;
  --shadow: 0 1px 2px rgba(20,24,28,.04), 0 8px 24px rgba(20,24,28,.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--petrol); text-decoration: none; }
a:hover { color: var(--petrol-d); }

code, pre, .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }

:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; border-radius: 4px; }

/* ---------- Masthead ---------------------------------------------------- */
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  padding: 0 clamp(1rem, 4vw, 3rem);
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--hair);
  position: sticky; top: 0; z-index: 20;
}
.wordmark {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: "Newsreader", serif;
  font-weight: 600; font-size: 1.18rem; letter-spacing: -.01em;
  color: var(--ink);
}
.wordmark-rule { width: 22px; height: 2px; background: var(--petrol); display: inline-block; }
.wordmark-sub {
  font-family: "Inter", sans-serif; font-size: .68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  border-left: 1px solid var(--hair); padding-left: .6rem; margin-left: .2rem;
}
.nav { display: flex; gap: 1.4rem; font-size: .9rem; font-weight: 500; }
.nav a { color: var(--muted); padding: .3rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--petrol); }

/* ---------- Layout shell ------------------------------------------------ */
.main { max-width: 1180px; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem); }

.page-head { margin-bottom: 1.8rem; }
.page-head h1, .review-title, .published .published-body {
  font-family: "Newsreader", serif;
}
.page-head h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 500;
  letter-spacing: -.02em; margin: 0 0 .4rem;
}
.lede { color: var(--muted); max-width: 60ch; margin: 0; }
.muted { color: var(--muted); }

/* ---------- Chips ------------------------------------------------------- */
.chip {
  font-family: "IBM Plex Mono", monospace; font-size: .72rem; font-weight: 500;
  padding: .2rem .5rem; border-radius: 999px; white-space: nowrap;
}
.chip-green { background: var(--green-bg); color: var(--green); }
.chip-amber { background: var(--amber-bg); color: var(--amber); }
.chip-red   { background: var(--red-bg);   color: var(--red); }
.chip-quiet { background: var(--quiet-bg); color: var(--quiet); }

/* ---------- Queue ------------------------------------------------------- */
.queue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.queue-link {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r);
  padding: 1rem 1.2rem; color: var(--ink);
  transition: border-color .15s ease, transform .15s ease;
}
.queue-link:hover { border-color: var(--petrol); transform: translateX(2px); }
.queue-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.queue-body {
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--petrol);
}
.queue-title { font-family: "Newsreader", serif; font-size: 1.15rem; }
.queue-meta { display: flex; align-items: center; gap: .9rem; flex-shrink: 0; }
.date { font-family: "IBM Plex Mono", monospace; font-size: .8rem; color: var(--muted); }

/* ---------- Review: two-column desk ------------------------------------- */
.review-head {
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.4rem; padding-bottom: 1rem; border-bottom: 1px solid var(--hair);
}
.back { font-size: .85rem; font-weight: 500; }
.review-title { font-size: 1.7rem; font-weight: 500; letter-spacing: -.01em; margin: 0; }
.review-date { font-family: "IBM Plex Mono", monospace; color: var(--muted); }
.rec-link { margin-left: auto; font-size: .85rem; font-weight: 500; }

.review-grid {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  gap: 1.6rem; align-items: start;
}

.panel {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r);
  margin-bottom: 1rem; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem 1rem; border-bottom: 1px solid var(--hair-2); cursor: default;
}
summary.panel-head { cursor: pointer; list-style: none; }
summary.panel-head::-webkit-details-marker { display: none; }
.panel-head h2 { font-size: .82rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; margin: 0; color: var(--ink); }
.hint, .panel-head .hint { font-size: .75rem; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

.draft-area {
  width: 100%; min-height: 60vh; border: 0; resize: vertical;
  padding: 1.1rem 1.2rem; font-family: "Newsreader", serif; font-size: 1.02rem;
  line-height: 1.65; color: var(--ink); background: var(--surface);
}
.draft-area:focus { outline: none; }

.factcheck, .agenda {
  margin: 0; padding: 1rem 1.2rem; white-space: pre-wrap;
  font-size: .85rem; line-height: 1.55; color: #2B3138; background: var(--surface);
  max-height: 50vh; overflow: auto;
}
.agenda { color: var(--muted); }

/* ---------- The verification ledger (signature) ------------------------- */
.col-ledger { position: sticky; top: 84px; display: grid; gap: 1rem; }
.ledger {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden;
}
.ledger-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.1rem; border-bottom: 2px solid var(--ink);
}
.ledger-head h2 { font-family: "Newsreader", serif; font-size: 1.1rem; font-weight: 600; margin: 0; }
.src { font-family: "IBM Plex Mono", monospace; font-size: .68rem; padding: .15rem .45rem; border-radius: 4px; }
.src-ok { background: var(--green-bg); color: var(--green); }
.src-manual { background: var(--amber-bg); color: var(--amber); }
.ledger-note { padding: .9rem 1.1rem; margin: 0; font-size: .85rem; color: var(--muted); }
.ledger-sub {
  padding: .7rem 1.1rem .2rem; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}

.fact { padding: .85rem 1.1rem; border-top: 1px solid var(--hair-2);
  border-left: 3px solid var(--hair); }
.fact-corroborated { border-left-color: var(--green); }
.fact-conflict     { border-left-color: var(--red);   background: #FCF8F7; }
.fact-unverified   { border-left-color: var(--amber); }
.fact-manual       { border-left-color: var(--quiet); }
.fact-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .35rem; }
.fact-tag { font-size: .74rem; font-weight: 600; }
.fact-corroborated .fact-tag { color: var(--green); }
.fact-conflict .fact-tag     { color: var(--red); }
.fact-unverified .fact-tag   { color: var(--amber); }
.fact-manual .fact-tag       { color: var(--quiet); }
.fact-tally { font-family: "IBM Plex Mono", monospace; font-size: .9rem; font-weight: 500; }
.fact-claim { margin: 0; font-size: .88rem; line-height: 1.5; }
.fact-official { margin: .4rem 0 0; font-size: .82rem; }

/* ---------- Decisions --------------------------------------------------- */
.decisions {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r);
  padding: 1.1rem; display: grid; gap: .6rem;
}
.gate-note { margin: 0 0 .3rem; font-size: .82rem; color: var(--muted); }
.btn {
  font-family: "Inter", sans-serif; font-size: .9rem; font-weight: 600;
  padding: .6rem 1rem; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.btn-approve { background: var(--petrol); color: #fff; width: 100%; }
.btn-approve:hover { background: var(--petrol-d); }
.btn-reject { background: transparent; color: var(--red); border-color: var(--hair); width: 100%; }
.btn-reject:hover { border-color: var(--red); }
.btn-ghost { background: transparent; color: var(--petrol); border-color: var(--hair); }
.btn-ghost:hover { border-color: var(--petrol); }

/* ---------- Archive ----------------------------------------------------- */
.search { display: flex; gap: .6rem; margin-bottom: 1.6rem; }
.search-input {
  flex: 1; padding: .7rem .9rem; font-size: .95rem; font-family: "Inter", sans-serif;
  border: 1px solid var(--hair); border-radius: 8px; background: var(--surface); color: var(--ink);
}
.search-input:focus { outline: none; border-color: var(--petrol); }
.archive-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.archive-row { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: .9rem 1.1rem; }
.archive-row > a { display: flex; align-items: baseline; gap: .9rem; flex-wrap: wrap; color: var(--ink); }
.archive-body { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--petrol); }
.archive-title { font-family: "Newsreader", serif; font-size: 1.1rem; }
.archive-row > a .date { margin-left: auto; }
.snip { margin: .5rem 0 0; font-size: .85rem; color: var(--muted); }
.snip :is(b) { color: var(--ink); }

/* ---------- Published article ------------------------------------------- */
.published { max-width: 70ch; margin: 0 auto; }
.published-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.2rem; padding-bottom: .8rem; border-bottom: 1px solid var(--hair); }
.published-body { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--petrol); }
.published-body-text { font-family: "Newsreader", serif; font-size: 1.12rem; line-height: 1.7; }
.published-body-text h1, .published-body-text h2, .published-body-text h3 { font-weight: 600; letter-spacing: -.01em; }
.published-body-text a { text-decoration: underline; text-underline-offset: 2px; }
.published-body-text hr { border: 0; border-top: 1px solid var(--hair); margin: 1.6rem 0; }
.published-body-text em { color: var(--muted); }

/* ---------- Empty states ------------------------------------------------ */
.empty { background: var(--surface); border: 1px dashed var(--hair); border-radius: var(--r);
  padding: 2.4rem; text-align: center; }
.empty p { margin: .3rem 0; }
.empty code { background: var(--hair-2); padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }

/* ---------- Responsive + motion ----------------------------------------- */
@media (max-width: 860px) {
  .review-grid { grid-template-columns: 1fr; }
  .col-ledger { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .queue-link:hover { transform: none; }
}

/* --- Health dashboard ------------------------------------------------------ */
.health-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.health-alert { color: #b3261e; font-weight: 600; margin: 0; }
.health-ok { color: var(--petrol); margin: 0; }
.health-table { width: 100%; border-collapse: collapse; margin: 1rem 0 2rem;
  font-family: 'Inter', sans-serif; font-size: .9rem; }
.health-table th { text-align: left; font-weight: 600; color: var(--petrol);
  border-bottom: 2px solid #e3e8e7; padding: .5rem .6rem; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .03em; }
.health-table td { padding: .55rem .6rem; border-bottom: 1px solid #eef2f1;
  vertical-align: top; }
.src-name { font-weight: 600; color: var(--ink); }
.src-note { color: #5b6a69; max-width: 32ch; }
.errtext { color: #b3261e; font-family: 'IBM Plex Mono', monospace; font-size: .82rem; }
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; letter-spacing: .02em; }
.badge-ok    { background: #e3f3ec; color: #1a7f52; }
.badge-error { background: #fdecea; color: #b3261e; }
.badge-stale { background: #fff4e0; color: #a6660a; }
.badge-new   { background: #eef0f2; color: #5b6a69; }
.runs-head { font-family: 'Newsreader', serif; font-size: 1.1rem; color: var(--ink);
  margin-top: 1.5rem; }
.runs-table { font-size: .86rem; }

/* --- Publish worklist ------------------------------------------------------ */
.pub-head h1 { margin-bottom: .2rem; }
.pub-sub { color: #5b6a69; font-family: 'Inter', sans-serif; font-size: .9rem; max-width: 60ch; }
.pub-empty { color: var(--petrol); font-family: 'Inter', sans-serif; }
.pub-section { margin: 1.6rem 0; }
.pub-section-name { font-family: 'Newsreader', serif; color: var(--ink); font-size: 1.25rem;
  border-bottom: 2px solid #e3e8e7; padding-bottom: .3rem; }
.pub-count { display: inline-block; background: #e3f3ec; color: #1a7f52; border-radius: 999px;
  font: 600 .72rem 'Inter'; padding: .1rem .5rem; vertical-align: middle; margin-left: .4rem; }
.pub-card { border: 1px solid #e3e8e7; border-radius: 8px; padding: 1rem 1.1rem; margin: .9rem 0;
  background: #fff; }
.pub-card-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.pub-title { font-family: 'Newsreader', serif; font-weight: 600; color: var(--ink); font-size: 1.05rem; }
.pub-meta { color: #6b7a79; font-family: 'Inter', sans-serif; font-size: .8rem; margin-top: .2rem; }
.pub-tag { font-family: 'IBM Plex Mono', monospace; background: #eef2f1; padding: .05rem .4rem;
  border-radius: 4px; font-size: .78rem; }
.pub-actions { display: flex; gap: .5rem; align-items: center; }
.btn-copy, .btn-posted { font: 500 .85rem 'Inter'; padding: .45rem .8rem; border-radius: 6px;
  cursor: pointer; border: 1px solid var(--petrol); }
.btn-copy { background: var(--petrol); color: #fff; }
.btn-copy.copied { background: #1a7f52; border-color: #1a7f52; }
.btn-posted { background: #fff; color: var(--petrol); }
.pub-body { border-top: 1px dashed #e3e8e7; padding-top: .7rem; font-family: 'Newsreader', serif;
  color: var(--ink); line-height: 1.6; max-height: 280px; overflow-y: auto; }
.pub-body h1, .pub-body h2, .pub-body h3 { font-family: 'Newsreader', serif; }
.pub-backfill { display: inline-block; margin-left: .4rem; background: #fff4e0; color: #a6660a;
  border-radius: 4px; font: 600 .72rem 'Inter'; padding: .08rem .45rem; }

/* --- Fact-check corrections panel ------------------------------------------ */
.corrections { display: flex; flex-direction: column; gap: .7rem; }
.corr { border: 1px solid #e3e8e7; border-left: 3px solid #cfd8d7; border-radius: 6px;
  padding: .6rem .75rem; background: #fff; }
.corr-ready { border-left-color: #1a7f52; }
.corr-notfound, .corr-ambiguous { border-left-color: #cfd8d7; opacity: .8; }
.corr-type { font: 600 .7rem 'Inter', sans-serif; text-transform: uppercase;
  letter-spacing: .04em; color: #6b7a79; margin-bottom: .35rem; }
.corr-diff { font-family: 'IBM Plex Mono', monospace; font-size: .82rem; line-height: 1.5; }
.corr-old { background: #fdecea; color: #9a2820; padding: .05rem .25rem; border-radius: 3px;
  text-decoration: line-through; }
.corr-arrow { color: #6b7a79; margin: 0 .35rem; }
.corr-new { background: #e3f3ec; color: #1a6b45; padding: .05rem .25rem; border-radius: 3px; }
.corr-reason { font: 400 .82rem/1.45 'Inter', sans-serif; color: #5b6a69; margin-top: .4rem; }
.corr-action { margin-top: .5rem; }
.btn-apply { font: 500 .8rem 'Inter', sans-serif; padding: .35rem .8rem; border-radius: 6px;
  border: 1px solid #1a7f52; background: #1a7f52; color: #fff; cursor: pointer; }
.corr-note { font: 400 .78rem 'Inter', sans-serif; color: #8a9897; font-style: italic; }
.corr-applied { background: #e3f3ec; color: #1a6b45; border: 1px solid #bfe3d0;
  border-radius: 6px; padding: .5rem .7rem; margin-bottom: .7rem;
  font: 500 .85rem 'Inter', sans-serif; }
.corr-applied-none { background: #fff4e0; color: #a6660a; border-color: #f0dcb0; }

/* --- AI fact-check, item-level handled/manual marking ---------------------- */
.fc-pre { margin-bottom: .6rem; }
.fc-items { display: flex; flex-direction: column; gap: .5rem; }
.fc-item { border-radius: 6px; padding: .5rem .7rem .55rem; position: relative;
  font: 400 .86rem/1.5 'Inter', sans-serif; }
.fc-text { white-space: pre-wrap; }
.fc-badge { display: inline-block; font: 600 .64rem 'Inter', sans-serif;
  text-transform: uppercase; letter-spacing: .05em; padding: .1rem .4rem;
  border-radius: 4px; margin-bottom: .35rem; }
.fc-manual { background: #fff7ed; border: 1px solid #f3d9b0; }
.fc-manual .fc-badge { background: #b3590a; color: #fff; }
.fc-handled { background: #f4f7f6; border: 1px solid #e3e8e7; opacity: .6; }
.fc-handled .fc-badge { background: #cdd6d5; color: #45514f; }
.fc-handled .fc-text { text-decoration: none; }
.fc-verdict { margin-top: .7rem; font: 700 .8rem 'Inter', sans-serif;
  letter-spacing: .03em; color: #45514f; }

/* --- Narrative summary editor --------------------------------------------- */
.panel-narrative { border-top: 3px solid #1a7f52; }
.narrative-area { min-height: 9rem; }
.narrative-regen-form { display: flex; align-items: center; gap: .6rem;
  margin: -.4rem 0 1rem; }
