:root {
  --paper: #e7e3d7;
  --ink: #2e2622;
  --muted: #6b6157;
  --accent: #a8362a;
  --card: #fffdf8;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Public Sans', Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.landing-card {
  max-width: 560px;
  background: var(--card);
  border-radius: 12px;
  padding: 48px 44px;
  box-shadow: 0 18px 48px -22px rgba(0, 0, 0, 0.4);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}

.landing-card h1 {
  margin: 0 0 16px;
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 500;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.lede {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

.scaffold-note {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid #dcd6cb;
  padding-top: 16px;
}

/* ── Auth pages (login / signup / forgot / reset) ── */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: 0 18px 48px -22px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.login-card__seal { display: block; margin: 0 auto 14px; }
.login-card__name {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
}
.login-card__tag {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: #ab8a57;
  margin-bottom: 24px;
}
/* minmax(0,1fr) column + min-width:0 fields + width:100% inputs prevent a grid blowout:
   without them the .onboard-row (2fr/1fr/1fr) can't shrink below its inputs' intrinsic
   width, overflows the card, and drags every input wide with it (nrac onboarding layout). */
.auth-form { text-align: left; margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.auth-form .input { width: 100%; }
.field { display: grid; gap: 6px; min-width: 0; }
.field__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid #d3ccbe;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.form-error {
  font-size: 13px;
  color: #8a2318;
  background: #f6e6e3;
  border: 1px solid #e6c4bd;
  border-radius: 6px;
  padding: 8px 10px;
}
.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: 11px 18px;
  cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn--primary { background: var(--accent); color: #fff; }
.auth-links {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.auth-links a { color: var(--accent); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.auth-note { font-size: 14px; line-height: 1.6; color: var(--muted); margin: 8px 0 0; }
.auth-note a { color: var(--accent); }

/* ── App shell ── */
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.masthead { background: #211b19; }
.masthead__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
}
.masthead__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.masthead__seal { border-radius: 50%; background: #fff; padding: 3px; }
.masthead__name {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
.masthead__tag {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: #ab8a57;
}
.masthead__nav { display: flex; align-items: center; gap: 4px; }
.masthead__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: #d8d0c6;
  text-decoration: none;
}
.masthead__link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.masthead__link[aria-current='page'] { color: #fff; background: rgba(171, 138, 87, 0.22); }
.masthead__link--button { background: none; border: none; cursor: pointer; font: inherit; font-weight: 500; }
.shell__main { padding-top: 32px; padding-bottom: 64px; }
.page-title {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 500;
  font-size: 28px;
  margin: 0 0 8px;
  color: var(--ink);
}
.page-lede { font-size: 15px; color: var(--muted); margin: 0; }

/* ── Cases list ── */
.cases-controls { display: flex; gap: 12px; align-items: center; margin: 24px 0; flex-wrap: wrap; }
.cases-search { flex: 1; min-width: 220px; }
.cases-serious { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); }
.cases-empty { color: var(--muted); padding: 40px 0; }
.case-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.case-card { background: var(--card); border: 1px solid #e0dacd; border-radius: 10px; transition: box-shadow 0.12s, border-color 0.12s; }
.case-card:hover { border-color: #cfc6b3; box-shadow: 0 8px 24px -16px rgba(0, 0, 0, 0.4); }
.case-card__link { display: block; padding: 16px 18px; text-decoration: none; color: inherit; }
.case-card__top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.case-card__drugs { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; color: var(--accent); text-transform: uppercase; }
.case-card__date { margin-left: auto; font-size: 12px; color: #9a9084; }
.case-card__title { font-family: 'Newsreader', Georgia, serif; font-size: 17px; line-height: 1.3; color: var(--ink); }
.case-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 11.5px; background: #efe9dc; color: #6b6157; padding: 2px 8px; border-radius: 999px; }
.pill { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; }
.pill--serious { background: #f3ddd9; color: #8a2318; }

/* ── Pager ── */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 28px 0; }
.pager__btn { background: var(--card); border: 1px solid #d3ccbe; color: var(--ink); }
.pager__btn:not(:disabled):hover { border-color: var(--accent); }
.pager__status { font-size: 13px; color: var(--muted); }

/* ── Dossier ── */
.back-link { display: inline-block; margin-bottom: 16px; font-size: 13px; color: var(--accent); text-decoration: none; }
.dossier { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
@media (max-width: 860px) { .dossier { grid-template-columns: 1fr; } }
.dossier__header { border-bottom: 1px solid #dcd6cb; padding-bottom: 18px; margin-bottom: 8px; }
.dossier__eyebrow { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.03em; color: var(--accent); text-transform: uppercase; margin-bottom: 10px; }
.dossier__title { font-family: 'Newsreader', Georgia, serif; font-weight: 500; font-size: 28px; line-height: 1.2; margin: 0; color: var(--ink); }
.dossier__meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.dossier__section { margin-top: 26px; }
.dossier__h2 { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #8a8076; margin: 0 0 10px; }
.dossier__summary { font-size: 15px; line-height: 1.65; color: var(--ink); background: #fbfaf6; border: 1px solid #e6e0d3; border-radius: 8px; padding: 16px 18px; margin: 0; }
.dossier__narrative { font-size: 14.5px; line-height: 1.7; color: #4a423b; margin: 0; white-space: pre-wrap; }
.dossier__facts { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.dossier__facts dt { color: var(--muted); font-weight: 600; }
.dossier__facts dd { margin: 0; color: var(--ink); }
.dossier__refs { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; color: #4a423b; }
.dossier__muted { color: #9a9084; font-size: 13.5px; }
.dossier__aside { position: sticky; top: 24px; background: var(--card); border: 1px solid #e0dacd; border-radius: 10px; padding: 18px; }
.related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.related-item__link { display: block; text-decoration: none; color: inherit; }
.related-item__label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: var(--accent); }
.related-item__title { display: block; font-size: 13.5px; line-height: 1.35; color: var(--ink); margin: 2px 0 6px; }
.related-item__meter { display: block; height: 4px; background: #e8e1d3; border-radius: 999px; overflow: hidden; }
.related-item__meter-fill { display: block; height: 100%; background: var(--accent); }

/* ── Watchlist ── */
.watch-add { display: flex; gap: 10px; align-items: center; margin: 24px 0 8px; flex-wrap: wrap; }
.watch-add__kind { flex: 0 0 auto; }
.watch-add__value { flex: 1; min-width: 200px; }
.watch-groups { display: grid; gap: 24px; margin-top: 20px; }
.watch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.watch-item { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid #e0dacd; border-radius: 8px; padding: 10px 14px; }
.watch-item__value { font-size: 14.5px; color: var(--ink); }
.watch-item__remove { background: none; border: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 6px; border-radius: 4px; }
.watch-item__remove:hover { color: #8a2318; background: #f6e6e3; }

/* ── Admin ── */
.admin-nav { display: flex; gap: 4px; border-bottom: 1px solid #dcd6cb; margin: 8px 0 4px; }
.admin-nav__link { padding: 8px 14px; font-size: 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-nav__link:hover { color: var(--ink); }
.admin-nav__link[aria-current='page'] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid #e0dacd; border-radius: 10px; padding: 16px 18px; }
.stat__value { font-family: 'Newsreader', Georgia, serif; font-size: 28px; font-weight: 500; color: var(--ink); line-height: 1.1; }
.stat__label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.admin-table-wrap { overflow-x: auto; margin-top: 16px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #8a8076; padding: 8px 12px; border-bottom: 1px solid #dcd6cb; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid #ece7db; color: var(--ink); }
.admin-table__actions { display: flex; gap: 6px; white-space: nowrap; }

/* ── Admin entries (review & edit) ── */
.dossier__source-note { margin-top: 24px; font-size: 12.5px; color: #9a9084; font-style: italic; border-top: 1px solid #ece7db; padding-top: 14px; }
.entries { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 16px; }
@media (max-width: 900px) { .entries { grid-template-columns: 1fr; } }
.entries__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 70vh; overflow-y: auto; }
.entries__item { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid #e0dacd; border-radius: 8px; padding: 10px 12px; cursor: pointer; font: inherit; }
.entries__item:hover { border-color: #cfc6b3; }
.entries__item--active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.entries__item-title { display: block; font-size: 13.5px; color: var(--ink); line-height: 1.3; }
.entries__item-tags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.entries__editor { background: var(--card); border: 1px solid #e0dacd; border-radius: 10px; padding: 20px; }
.editor__source { display: grid; gap: 12px; }
.editor__source-field b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #8a8076; margin-bottom: 3px; }
.editor__source-field > div { font-size: 13.5px; color: var(--ink); }
.editor__source-original { background: #f6f2e8; border: 1px solid #e6e0d3; border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; max-height: 220px; overflow-y: auto; font-size: 13px; line-height: 1.6; }
.editor__form { display: grid; gap: 14px; }
.editor__actions { display: flex; gap: 10px; }

/* ── Onboarding ── */
.onboard-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
