:root {
  color-scheme: light;
  --paper: #f3f1e9;
  --surface: #fffefa;
  --ink: #202a25;
  --muted: #59655e;
  --faint: #626e65;
  --control-border: #7c887f;
  --line: #cfd4ca;
  --line-soft: #e2e4dc;
  --green: #315d49;
  --green-soft: #e8eee8;
  --rust: #984e34;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Arial, Helvetica, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.5 var(--sans);
}
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid #29745b; outline-offset: 3px; }
::selection { color: #fff; background: var(--green); }

.skip-link {
  position: absolute;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.page { max-width: 1380px; margin: 0 auto; padding: 0 42px 58px; }
.topbar {
  min-height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 13px; text-decoration: none; }
.brand > span { font-size: 13px; font-weight: 700; letter-spacing: .13em; }
.brand small { color: var(--faint); font: 10px var(--mono); letter-spacing: .04em; }
.topnav, .top-right { display: flex; align-items: center; gap: 22px; }
.topnav { color: var(--muted); font-size: 12px; }
.topnav a { text-decoration: none; }
.topnav a:hover, .foot a:hover { color: var(--rust); }
.free-note { color: var(--muted); font: 10px var(--mono); letter-spacing: .04em; }
.button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--green);
  border-radius: 3px;
  color: #fff;
  background: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  transition: background-color .15s, border-color .15s;
}
.button:hover { border-color: #234735; background: #234735; }
.button.secondary { color: var(--ink); background: transparent; border-color: var(--control-border); }
.button.secondary:hover { color: var(--green); border-color: var(--green); background: var(--green-soft); }
.button.small { min-height: 35px; padding: 7px 11px; }
.button:disabled { cursor: wait; opacity: .55; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(235px, 310px);
  gap: 44px;
  align-items: end;
  padding: 35px 0 27px;
  border-bottom: 1px solid var(--line);
}
.eyebrow, .label, .stat-label, .people-table thead th, .profile-box h3,
.field label, .source-label, .source-state, .score-label, .method-label {
  color: var(--muted);
  font: 10px/1.4 var(--mono);
  letter-spacing: .045em;
  text-transform: uppercase;
}
.eyebrow { margin-bottom: 10px; color: var(--green); }
h1 {
  max-width: 760px;
  margin: 0;
  font: 500 clamp(38px, 4.7vw, 59px)/1.05 var(--serif);
  letter-spacing: -.035em;
  text-wrap: balance;
}
.hero-lede { max-width: 660px; margin: 13px 0 0; color: #4b5750; font-size: 14px; }
.hero-note { padding: 0 0 2px 16px; border-left: 2px solid var(--rust); font-size: 12px; }
.hero-note strong { display: block; margin-bottom: 4px; font-size: 12px; }
.hero-note span { color: var(--muted); }
.stats { display: flex; border-bottom: 1px solid var(--line); }
.stat { display: flex; align-items: baseline; gap: 10px; padding: 13px 22px 13px 0; margin-right: 22px; }
.stat + .stat { padding-left: 22px; border-left: 1px solid var(--line); }
.stat-num { color: var(--ink); font: 20px/1 var(--serif); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 9px; }

.tabs { display: flex; gap: 24px; margin: 22px 0 0; border-bottom: 1px solid var(--line); }
.tab {
  min-height: 44px;
  margin-bottom: -1px;
  padding: 8px 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }
.view { display: none; }
.view.active { display: block; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 26px 0 14px;
}
.section-head h2 { margin: 0; font: 500 28px/1.15 var(--serif); letter-spacing: -.02em; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.section-actions { display: flex; align-items: center; gap: 9px; }
.count-chip, .badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid #c7d0c5;
  border-radius: 2px;
  color: #355343;
  background: var(--green-soft);
  font: 9px var(--mono);
  letter-spacing: .02em;
  white-space: nowrap;
}
.filterbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 17px 0 12px; }
.search, .select, .field input, .field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--control-border);
  border-radius: 2px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}
.search { max-width: 360px; }
.search::placeholder, .field input::placeholder, .field textarea::placeholder { color: #5f6a62; opacity: 1; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.people-table { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); }
.people-table thead th { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 9px; }
.people-table th:first-child { width: 25%; }
.people-table th:nth-child(2) { width: 29%; }
.people-table th:nth-child(3) { width: 17%; }
.people-table th:nth-child(4) { width: 18%; }
.people-table th:last-child { width: 11%; }
.people-table tbody tr { border-bottom: 1px solid var(--line-soft); }
.people-table tbody tr:last-child { border-bottom: 0; }
.people-table tbody tr:hover { background: #f5f6f0; }
.people-table td, .people-table tbody th { padding: 12px; vertical-align: middle; text-align: left; font-weight: 400; }
.person-open { display: block; padding: 0; border: 0; color: var(--ink); background: transparent; text-align: left; font-size: 13px; font-weight: 700; }
.person-open:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.person-role { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 400; }
.person-summary { display: block; margin-bottom: 6px; color: #48564e; font-size: 11px; line-height: 1.45; }
.tag-row { display: flex; flex-wrap: wrap; gap: 4px 9px; }
.tag { color: #395445; font-size: 10px; }
.tag + .tag::before { content: "/"; margin-right: 9px; color: #90988f; }
.source-links { display: flex; gap: 8px; }
.source-links a, .source-card a {
  display: inline-block;
  padding: 4px 6px;
  border: 1px solid var(--control-border);
  border-radius: 2px;
  color: var(--green);
  font: 10px var(--mono);
  text-decoration: none;
}
.source-links a:hover, .source-card a:hover { border-color: var(--green); background: var(--green-soft); }
.source-state { display: inline-block; font-size: 9px; }
.table-action { white-space: nowrap; }
.empty { padding: 22px 12px; color: var(--muted); text-align: center; font-size: 12px; }

.date-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; }
.date-side, .date-main, .ranking-main { border: 1px solid var(--line); background: var(--surface); }
.date-side { padding: 17px; }
.label { display: block; margin-bottom: 7px; }
.side-copy { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.date-main { min-width: 0; padding: 18px 20px; }
.date-header { display: flex; align-items: start; justify-content: space-between; gap: 15px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.date-header h3, .ranking-top h3 { margin: 0; font: 500 22px/1.2 var(--serif); }
.date-header p, .ranking-top p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.match-row { display: grid; grid-template-columns: 32px minmax(125px, 1fr) minmax(120px, 1.25fr) 68px 116px; gap: 12px; align-items: center; min-height: 67px; border-bottom: 1px solid var(--line-soft); }
.match-row:last-child { border-bottom: 0; }
.rank-num { color: var(--faint); font: 11px var(--mono); font-variant-numeric: tabular-nums; }
.match-name { min-width: 0; font-size: 12px; font-weight: 700; }
.match-name small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 400; }
.match-name .match-evidence { margin-top: 4px; font-size: 9px; line-height: 1.35; }
.match-tags { display: flex; flex-wrap: wrap; gap: 2px 7px; }
.match-score { color: var(--green); font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.score-label { display: block; margin-top: 3px; font-size: 8px; }
.score-track { height: 3px; margin-top: 5px; background: #e3e7df; }
.score-track i { display: block; height: 100%; background: var(--green); }
.date-row-actions { display: flex; justify-content: end; }
.ranking-top { display: grid; grid-template-columns: minmax(0, 1fr) 240px; align-items: end; gap: 20px; margin: 24px 0 15px; }
.ranking-main { padding: 0 18px; }
.ranking-note { padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.ranking-note b { color: var(--ink); }

.foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 37px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.foot a, .method-link { color: var(--green); text-underline-offset: 2px; }
.method-link { padding: 0; border: 0; background: transparent; font: inherit; text-decoration: underline; cursor: pointer; }
.method-link:hover { color: var(--rust); }

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px;
  background: rgb(25 35 29 / 48%);
}
.modal-backdrop.open { display: flex; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 23px; border: 1px solid var(--line); background: var(--surface); }
.modal.small-modal { width: min(660px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin-bottom: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font: 500 26px/1.2 var(--serif); }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.close { width: 36px; min-width: 36px; height: 36px; border: 1px solid var(--control-border); border-radius: 2px; color: var(--ink); background: transparent; font-size: 18px; }
.close:hover { color: var(--rust); border-color: var(--rust); }
.profile-title { display: flex; align-items: baseline; gap: 12px; }
.profile-name { margin: 0; font: 500 28px/1.15 var(--serif); }
.profile-role { color: var(--muted); font-size: 11px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; margin: 15px 0; border-top: 1px solid var(--line); }
.profile-box { padding: 12px 0; border-bottom: 1px solid var(--line); }
.profile-box h3 { margin: 0 0 6px; color: var(--green); }
.profile-box p { margin: 0; color: #46534b; font-size: 11px; line-height: 1.55; }
.profile-box .tag-row { margin-top: 7px; }
.source-card { display: grid; grid-template-columns: 105px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 11px; }
.source-card a { overflow-wrap: anywhere; font-size: 9px; }
.source-label { font-size: 9px; }
.source-evidence { display: grid; min-width: 0; gap: 5px; }
.source-excerpt { max-height: 72px; overflow: auto; color: var(--muted); font-size: 10px; line-height: 1.45; }
.method-list { margin: 0; padding-left: 20px; color: #46534b; font-size: 11px; line-height: 1.75; }
.interpret-note, .sim-footer { margin-top: 13px; padding: 10px 11px; border-left: 2px solid #b68e58; color: #5b5548; background: #f2eee3; font-size: 10px; line-height: 1.5; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { color: #48564e; }
.field input, .field textarea { font: 12px/1.5 var(--sans); }
.field textarea { min-height: 112px; resize: vertical; }
.field .hint, .hint { color: var(--muted); font-size: 10px; line-height: 1.45; }
.consent-check { display: flex; align-items: start; gap: 9px; margin: 6px 0 12px; color: #46534b; font-size: 11px; cursor: pointer; }
.consent-check input { width: 17px; height: 17px; flex: 0 0 auto; margin: 0; accent-color: var(--green); }
.form-status { min-height: 20px; margin: 3px 0 8px; color: var(--muted); font-size: 11px; }
.form-status.error { color: #8e3826; }
.form-status.good { color: #315d49; }
.scrape-panels { margin-top: 5px; padding-top: 13px; border-top: 1px solid var(--line); }
.scrape-panels[hidden] { display: none; }
.scrape-status { margin: 0 0 11px; color: var(--muted); font-size: 10px; }
.modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 13px; }
.left-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.modal-actions .right { display: flex; align-items: center; gap: 8px; }
.sim-intro { display: flex; align-items: center; gap: 13px; margin-bottom: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sim-intro strong { font-size: 12px; }
.sim-intro span { color: var(--muted); font-size: 10px; }
.sim-evidence { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 0 0 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sim-evidence > strong { grid-column: 1 / -1; color: var(--green); font-size: 10px; }
.sim-evidence > div { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 6px; min-width: 0; }
.sim-evidence > div > span { font-size: 10px; font-weight: 700; }
.sim-evidence small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; line-height: 1.5; }
.sim-evidence a { color: var(--green); font-size: 8px; text-underline-offset: 2px; }
.turn-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 4px; }
.turn-controls > span { color: var(--muted); font: 9px var(--mono); font-variant-numeric: tabular-nums; }
.conversation { display: grid; gap: 0; }
.bubble { max-width: 94%; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: 11px; line-height: 1.55; }
.bubble .speaker { display: block; margin-bottom: 4px; color: var(--green); font: 9px var(--mono); letter-spacing: .035em; text-transform: uppercase; }
.bubble.a { justify-self: start; }
.bubble.b { justify-self: end; }
.date-suggestion { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); color: #48534b; font-size: 11px; }
.date-suggestion[hidden] { display: none; }
.date-suggestion b { color: var(--green); }
.toast { position: fixed; z-index: 40; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); padding: 11px 14px; border: 1px solid #b7c2b6; color: var(--ink); background: var(--surface); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.toast.show { opacity: 1; }
.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; }

@media (max-width: 920px) {
  .page { padding-right: 24px; padding-left: 24px; }
  .topnav { gap: 13px; }
  .free-note { display: none; }
  .date-layout { grid-template-columns: 205px minmax(0, 1fr); gap: 13px; }
  .match-row { grid-template-columns: 26px minmax(115px, 1fr) minmax(90px, 1fr) 55px 106px; gap: 8px; }
}
@media (max-width: 680px) {
  .page { padding: 0 15px 38px; }
  .button { min-height: 44px; }
  .button.small { min-height: 44px; }
  .search, .select, .field input, .field textarea { min-height: 44px; }
  .close { width: 44px; min-width: 44px; height: 44px; }
  .source-links a, .source-card a { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .consent-check { min-height: 44px; align-items: center; }
  .topbar { min-height: 58px; }
  .brand { display: block; }
  .brand small { display: block; margin-top: 2px; font-size: 8px; }
  .topnav { display: none; }
  .hero { grid-template-columns: 1fr; gap: 17px; padding: 27px 0 20px; }
  h1 { font-size: clamp(36px, 10vw, 48px); }
  .hero-note { max-width: 460px; }
  .stats { display: grid; grid-template-columns: 1fr; }
  .stat, .stat + .stat { justify-content: start; min-height: 42px; margin: 0; padding: 8px 0; border-left: 0; }
  .stat + .stat { border-top: 1px solid var(--line); }
  .stat-num { min-width: 40px; }
  .tabs { gap: 17px; overflow-x: auto; }
  .tab { white-space: nowrap; }
  .section-head { align-items: start; flex-direction: column; gap: 10px; }
  .section-head h2 { font-size: 25px; }
  .section-actions { flex-wrap: wrap; }
  .filterbar { align-items: stretch; flex-direction: column; }
  .search { max-width: none; }
  .table-scroll { overflow: visible; border: 0; background: transparent; }
  .people-table, .people-table tbody { display: block; background: transparent; }
  .people-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .people-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; margin-bottom: 9px; padding: 10px 11px; border: 1px solid var(--line); background: var(--surface); }
  .people-table tbody th, .people-table td { display: block; width: auto; padding: 5px 0; }
  .people-table tbody th { grid-column: 1; }
  .people-table td[data-col="signals"] { grid-column: 1 / -1; grid-row: 2; }
  .people-table td[data-col="sources"] { grid-column: 1; grid-row: 3; }
  .people-table td[data-col="basis"] { grid-column: 1; grid-row: 4; }
  .people-table td[data-col="action"] { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
  .date-layout { grid-template-columns: 1fr; }
  .date-side { padding: 12px; }
  .date-main { padding: 12px; }
  .date-header { flex-direction: column; }
  .match-row { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 8px; padding: 10px 0; }
  .rank-num { grid-column: 1; grid-row: 1; align-self: start; }
  .match-name { grid-column: 2; grid-row: 1; }
  .match-score { grid-column: 2; grid-row: 2; display: flex; align-items: center; gap: 6px; }
  .score-label { display: inline; margin-top: 0; }
  .score-track { width: 72px; flex: 0 0 72px; margin-top: 0; }
  .match-tags { grid-column: 2; grid-row: 3; }
  .date-row-actions { grid-column: 3; grid-row: 1 / span 3; }
  .date-row-actions .button { padding: 6px 7px; font-size: 9px; }
  .ranking-top { grid-template-columns: 1fr; gap: 10px; }
  .ranking-main { padding: 0 11px; }
  .profile-grid, .field-grid { grid-template-columns: 1fr; }
  .sim-evidence { grid-template-columns: 1fr; }
  .sim-evidence > strong { grid-column: auto; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal, .modal.small-modal { width: 100%; max-height: 90dvh; padding: 18px 15px; border-right: 0; border-bottom: 0; border-left: 0; }
  .source-card { grid-template-columns: 82px minmax(0, 1fr); }
  .source-card a { grid-column: 2; justify-self: start; }
  .modal-actions { align-items: stretch; flex-direction: column; }
  .modal-actions .right { justify-content: end; flex-wrap: wrap; }
  .foot { flex-direction: column; gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
