/* Dan's search UI. Values come from the approved Design prototype ("Prospect search for Stanford Basketball"). */
:root {
  --ground: #191919;
  --ground-home: #140e0e;
  --cardinal: #8c1515;
  --panel: #202020;
  --surface: #282626;
  --raised: #2c2c2a;
  --fill: rgba(255, 255, 255, 0.03);
  --fill-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.08);
  --line-3: rgba(255, 255, 255, 0.12);
  --line-4: rgba(255, 255, 255, 0.14);
  --ink: #ecebe6;
  --ink-strong: #f2f1ec;
  --ink-2: #d9d8d2;
  --muted: #a9a9a1;
  --muted-2: #9a9a92;
  --label: #8e8e86;
  --faint: #85857e;
  --gold: #c9b37e;
  --gold-ink: #e4d3a8;
  --green: #4e9b7f;
  --danger: #e59a92;
  --serif: Newsreader, Georgia, serif;
  --sans: Inter, system-ui, -apple-system, sans-serif;

  /* One scale for every gap and padding (4-point), every corner, every type size and every movement: values off
     these scales were what made pages feel assembled rather than designed (Max, November 10). */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-base: 14px; --fs-lg: 15px; --fs-xl: 18px; --fs-2xl: 24px; --fs-3xl: 32px; --fs-4xl: 40px;
  --h-sm: 28px; --h-md: 32px; --h-lg: 40px;
  --dur-fast: 120ms; --dur: 180ms; --dur-slow: 280ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 10px 30px rgba(0, 0, 0, 0.18);
  --shadow-pop: 0 18px 48px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  /* Every page has the home screen's cardinal glow, so the search pages keep the accent (Max, November 5: the
     flat ground of November 4 lost it). */
  background:
    radial-gradient(1200px 700px at 70% 10%, rgba(140, 21, 21, 0.42), transparent 60%),
    radial-gradient(900px 600px at 15% 90%, rgba(110, 16, 16, 0.32), transparent 60%),
    var(--ground-home);
  background-attachment: fixed;
  color: var(--ink);
  font: var(--fs-base)/1.5 var(--sans);
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
time, .count, .spend, .head-meta, [data-filter-count], .dim-level, .cite, .sources a span:first-child { font-variant-numeric: tabular-nums; }
a { color: var(--ink); }
a:hover { color: #fff; }
button, input, textarea { font-family: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--label);
}

/* ---- Shell ---------------------------------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }

.sidebar {
  flex: none; width: 232px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-6);
  background: rgba(255, 255, 255, 0.025); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.logo { flex: none; display: block; object-fit: contain; }
.monogram {
  width: 24px; height: 24px; border-radius: 6px; flex: none; background: var(--cardinal); border: 1px solid rgba(255, 255, 255, 0.12);
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 14px; color: var(--ink-strong);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-weight: 600; font-size: 13px; }
.brand-text span { font-size: 12px; color: var(--muted-2); }
.new-search {
  display: flex; align-items: center; gap: var(--sp-2); min-height: var(--h-lg); padding: 0 var(--sp-3); background: var(--fill-2);
  border: 1px solid var(--line-2); border-radius: var(--r-md); color: var(--ink); font-size: 13px; font-weight: 500; text-decoration: none;
}
.new-search:hover { background: rgba(255, 255, 255, 0.09); color: var(--ink); }
.new-search span:nth-child(2) { flex: 1 1 auto; }
.kbd { font-size: 11px; color: var(--muted-2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .label { padding: 0 var(--sp-3) var(--sp-2); }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-2); min-height: 34px; padding: 0 var(--sp-3); border-radius: var(--r-sm);
  font-size: 13px; color: var(--ink-2); text-decoration: none;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--ink-strong); }
.nav-item[aria-current="page"] { background: rgba(255, 255, 255, 0.07); color: var(--ink-strong); }
.nav-item .title { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { font-size: 12px; color: var(--muted-2); }
.nav-empty { padding: 0 10px; font-size: 12px; color: var(--muted-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.dot-done, .dot-completed, .dot-partial { background: var(--green); }
.dot-running, .dot-planning { background: var(--gold); }
.dot-plan { border: 1px solid var(--muted); }
.dot-failed, .dot-canceled { background: var(--danger); }
.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.spend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-2); }
.spend b { color: var(--ink); font-weight: 400; }
.meter { height: 3px; border-radius: 3px; background: var(--line-2); }
.meter span { display: block; height: 3px; border-radius: 3px; background: var(--gold); min-width: 2px; }
.user { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; }
.sign-out { margin: 0 0 0 auto; }
.sign-out button { background: none; border: 0; padding: 2px 0; font: inherit; font-size: 12px; color: var(--muted-2); cursor: pointer; }
.sign-out button:hover, .sign-out button:focus-visible { color: var(--ink); text-decoration: underline; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; background: #2a2f2d; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600;
}

/* ---- Start screen --------------------------------------------------------------------------------- */
.home {
  flex: 1 1 auto; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 24px; gap: 28px;
}
.greeting {
  margin: 0; font-family: var(--serif); font-size: 40px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink-strong); text-align: center;
}
.composer-wrap { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 10px; }
.composer {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 14px;
}
.composer:focus-within { border-color: rgba(255, 255, 255, 0.16); }
.composer-input { display: flex; gap: 12px; align-items: flex-start; }
.composer-input svg { margin-top: 4px; flex: none; }
.composer textarea {
  flex: 1 1 auto; min-width: 0; background: transparent; border: none; resize: none; color: var(--ink-strong);
  font-size: 17px; line-height: 1.5; padding: 0;
}
.composer textarea::placeholder, .refine input::placeholder { color: var(--label); }
.composer textarea:focus, .refine input:focus { outline: none; }
.composer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.composer-bar .spacer { flex: 1 1 auto; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; background: transparent;
  border: 1px solid var(--line-3); border-radius: 999px; color: var(--ink-2); font-size: 13px;
}
.pill:disabled { color: var(--muted-2); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-3); border-radius: 999px; }
.segmented button {
  min-height: 28px; padding: 0 12px; border: none; border-radius: 999px; font-size: 12px; background: transparent; color: var(--muted);
}
.segmented button[aria-pressed="true"] { background: var(--line-4); color: var(--ink-strong); }
.send {
  width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--ink-strong); color: #111; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.send:disabled { background: rgba(242, 241, 236, 0.35); }
.suggestions { display: flex; flex-direction: column; padding: 4px 6px; }
.suggestion {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 8px; background: transparent; border: none;
  border-radius: 8px; color: var(--muted); font-size: 14px; line-height: 1.4; text-align: left;
}
.suggestion:hover { background: rgba(255, 255, 255, 0.04); color: var(--ink-2); }
.suggestion svg { flex: none; }

/* ---- Thread --------------------------------------------------------------------------------------- */
.thread-layout { display: flex; min-height: 100vh; }
.thread { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.thread-head {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4);
  min-height: 56px; padding: var(--sp-2) var(--sp-8);
  /* Nearly opaque: where the blur is not drawn, scrolled text must still not read through the header. */
  border-bottom: 1px solid var(--line); background: rgba(20, 14, 14, 0.94); backdrop-filter: blur(12px);
}
.thread-head h1 {
  margin: 0; flex: 1 1 320px; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.head-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.thread-body {
  flex: 1 1 auto; width: 100%; max-width: 1040px; margin: 0 auto; padding: var(--sp-8) var(--sp-8) var(--sp-12);
  display: flex; flex-direction: column; gap: var(--sp-6);
}
.bubble {
  align-self: flex-end; max-width: min(560px, 90%); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) var(--r-xs) var(--r-lg); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-lg); line-height: 1.45;
  overflow-wrap: anywhere;
}
.say { margin: 0; font-size: 15px; color: var(--ink-2); }
.say strong { color: var(--ink-strong); font-weight: 600; }
.notice { margin: 0; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(229, 154, 146, 0.35); color: var(--danger); font-size: 14px; }
.thinking { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

.card { background: var(--fill); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plan-col { padding: var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-2); color: var(--ink-2); border-right: 1px solid var(--line); }
.plan-col:last-child { border-right: none; }
.plan-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); padding: var(--sp-3) var(--sp-6); border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.plan-foot b { color: var(--ink); font-weight: 400; }
.plan-foot .spacer { flex: 1 1 auto; }
.plan-actions { display: flex; gap: 8px; }
.plan.is-started .plan-col { padding-top: 12px; padding-bottom: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--h-md); padding: 0 var(--sp-4); background: transparent; border: 1px solid var(--line-4);
  border-radius: 999px; color: var(--ink); font-size: 13px; text-decoration: none;
}
.btn:hover { color: var(--ink-strong); background: rgba(255, 255, 255, 0.04); }
.btn-primary { background: var(--ink-strong); border-color: var(--ink-strong); color: #111; font-weight: 600; padding: 0 16px; }
.btn-primary:hover { background: #fff; color: #111; }
.btn-sm { min-height: var(--h-sm); padding: 0 var(--sp-3); font-size: var(--fs-sm); }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.steps .mark { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.steps .done { color: var(--muted); }
.steps .done .mark { background: var(--green); }
.steps .live { color: var(--ink); }
.steps .live .mark { border: 2px solid var(--gold); }
.steps .todo { color: var(--faint); }
.steps .todo .mark { border: 1px solid rgba(255, 255, 255, 0.2); }
.worked { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-2); }
.worked svg { color: var(--green); stroke-width: 1.8; }
.outcome { display: flex; flex-direction: column; gap: 14px; }
.earlier { font-size: 13px; color: var(--muted-2); }

/* ---- Results -------------------------------------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.toolbar .spacer { flex: 1 1 auto; }
.tab {
  min-height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; background: transparent; color: var(--ink-2);
  border: 1px solid var(--line-4);
}
.tab[aria-pressed="true"] { background: var(--ink-strong); color: #111; border-color: var(--ink-strong); }
.table { min-width: 0; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 150px minmax(0, 0.9fr) minmax(0, 1.5fr) auto;
  gap: var(--sp-4); align-items: center; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); font-size: var(--fs-base);
}
.row:last-of-type { border-bottom: none; }
.row-head {
  padding-top: var(--sp-3); padding-bottom: var(--sp-3); font-size: var(--fs-sm); font-weight: 500; letter-spacing: 0.01em; color: var(--label);
  border-bottom: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.015);
}
.person-row:hover { background: rgba(255, 255, 255, 0.02); }
.person-row.is-open { background: rgba(255, 255, 255, 0.04); }
.person-row.is-quiet > * { opacity: 0.4; }
.who { display: flex; flex-direction: column; min-width: 0; }
.name {
  align-self: flex-start; max-width: 100%; background: none; border: none; padding: 0; color: var(--ink-strong); font-size: 14px;
  font-weight: 500; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.name:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.3); }
.role { font-size: 13px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tie { color: var(--ink-2); overflow-wrap: anywhere; }
.tie-note { display: block; font-size: 12px; color: var(--muted-2); }
.why { font-size: var(--fs-md); line-height: 1.45; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.why time { color: var(--ink-strong); font-weight: 600; }
.why.is-empty { color: var(--muted-2); }
.bars { display: inline-flex; gap: 3px; }
.bars i { width: 14px; height: 4px; border-radius: 2px; background: var(--line-3); }
.bars i.on { background: var(--ink); }
.bars.is-unknown i { background: transparent; border: 1px dashed rgba(255, 255, 255, 0.25); }
.reach { font-size: 12px; color: var(--ink-2); }
/* Fit: said once, in words, with a dot that carries the tier's colour down the column. */
.fit-cell { position: relative; min-width: 0; }
.fit-score {
  display: flex; flex-wrap: nowrap; align-items: flex-start; column-gap: var(--sp-2); max-width: 100%; padding: 0; background: none; border: none;
  color: var(--ink); text-align: left;
}
.fit-dot { flex: none; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--muted-2); }
.fit-strong .fit-dot { background: var(--gold); }
.fit-no .fit-dot { background: var(--danger); }
.fit-dot.is-unknown { background: transparent; border: 1px dashed var(--muted-2); }
.fit-label { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fit-strong .fit-label { color: var(--gold-ink); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.req { display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--ink); }
.req-mark { flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, 0.35); transform: translateY(-1px); }
.req.is-meets .req-mark { background: var(--green); border: none; }
.req.is-partial .req-mark { background: linear-gradient(90deg, var(--gold) 50%, transparent 50%); border: 1px solid var(--gold); }
.req.is-does_not_meet .req-mark { background: var(--danger); border: none; }
.req-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.req-head b { font-weight: 600; color: var(--ink-strong); }
.req-reason { color: var(--muted); font-size: 12px; }
.req-tag {
  display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-4);
}
.req-tag.is-must { color: var(--gold-ink); border-color: rgba(201, 179, 126, 0.5); }
.who-line { display: block; }
.fit-section .fit-label-full { margin: 0; font-size: 14px; color: var(--ink-2); }
.lead time { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--ink-strong); }
.lead.is-empty { font-family: var(--sans); font-size: 14px; color: var(--muted-2); }
.link-btn { padding: 0; background: none; border: none; color: var(--ink-2); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn[data-not-fit]:hover { color: var(--danger); border-color: rgba(229, 154, 146, 0.5); }
.actions { display: flex; gap: 4px; justify-content: flex-end; }
.actions .icon-btn { width: 28px; height: 28px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.1); background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn:hover { color: var(--ink-strong); border-color: rgba(255, 255, 255, 0.2); }
.icon-btn[data-list="shortlist"][aria-pressed="true"] { color: var(--gold); }
.icon-btn[data-list="shortlist"][aria-pressed="true"] svg { fill: var(--gold); }
.icon-btn[data-list="known"][aria-pressed="true"] { color: var(--green); border-color: rgba(78, 155, 127, 0.5); }
.cell-label { display: none; }
.empty { margin: 0; padding: 20px 14px; color: var(--muted); }
.set-aside { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.set-aside summary { cursor: pointer; }
.set-aside ul { margin: 10px 0 4px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.set-aside b { color: var(--ink-2); font-weight: 400; }

/* ---- Refinement composer -------------------------------------------------------------------------- */
.dock { position: sticky; bottom: 0; padding: 12px 28px 20px; background: linear-gradient(to top, rgba(20, 14, 14, 0.92) 55%, rgba(20, 14, 14, 0)); }
.dock-inner { max-width: 924px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 30px; padding: 0 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px;
  color: var(--ink-2); font-size: 12px;
}
.chip:hover { color: var(--ink-strong); border-color: rgba(255, 255, 255, 0.2); }
.refine {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 8px 8px 8px 14px;
}
.refine input { flex: 1 1 auto; min-width: 0; background: transparent; border: none; color: var(--ink-strong); font-size: 14px; }
.refine input:disabled::placeholder { color: var(--faint); }
.refine .send { width: 32px; height: 32px; }

/* ---- Person panel --------------------------------------------------------------------------------- */
.person {
  flex: none; width: 440px; position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; background: var(--panel);
  border-left: 1px solid var(--line); padding: 0 var(--sp-8) var(--sp-12); display: flex; flex-direction: column; gap: var(--sp-6);
}
.person[hidden] { display: none; }
/* The panel's top bar stays put while its evidence scrolls. */
.person-top {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  margin: 0 calc(-1 * var(--sp-8)); padding: var(--sp-4) var(--sp-8) var(--sp-3);
  background: linear-gradient(var(--panel) 80%, rgba(32, 32, 32, 0));
}
.close {
  width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.close:hover { color: var(--ink-strong); background: rgba(255, 255, 255, 0.05); }
.person-id { display: flex; flex-direction: column; gap: var(--sp-1); }
.person-id h1, .person-id h2 {
  margin: 0 0 var(--sp-1); font-family: var(--serif); font-size: var(--fs-3xl); font-weight: 500; line-height: 1.1; letter-spacing: -0.015em; color: #f4f3ee;
  text-wrap: balance;
}
.person-page .person-id h1 { font-size: var(--fs-4xl); }
.person-id .role-full { color: var(--ink-2); }
.person-id .where { font-size: 13px; color: var(--muted); }
.person-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.mark-btn { min-height: var(--h-md); padding: 0 var(--sp-4); border-radius: var(--r-pill); font-size: var(--fs-md); background: transparent; border: 1px solid var(--line-4); color: var(--ink-2); }
.mark-btn[data-list="shortlist"] { background: var(--ink-strong); border-color: var(--ink-strong); color: #111; }
.mark-btn[data-list="shortlist"][aria-pressed="true"] { background: var(--gold); border-color: var(--gold); }
.mark-btn[data-list="known"][aria-pressed="true"] { border-color: rgba(78, 155, 127, 0.6); color: #9fd3bf; }
.mark-btn[data-list="dnc"] { color: var(--danger); }
.mark-btn[data-list="dnc"][aria-pressed="true"] { border-color: rgba(229, 154, 146, 0.6); background: rgba(229, 154, 146, 0.08); }
.lead { margin: 0; font-family: var(--serif); font-size: var(--fs-xl); line-height: 1.5; color: #e9e7e1; text-wrap: pretty; }
.section { display: flex; flex-direction: column; gap: var(--sp-3); padding-top: var(--sp-5); border-top: 1px solid var(--line); }
.dim-head { display: flex; align-items: center; gap: 10px; }
.dim-head .label { flex: 1 1 auto; }
.dim-level { font-size: 12px; color: var(--ink-2); min-width: 56px; text-align: right; }
.ev { display: flex; gap: 10px; align-items: baseline; }
.ev p { flex: 1 1 auto; margin: 0; font-size: 14px; color: var(--ink); }
.ev.is-inference p { color: var(--muted); font-style: italic; }
.ev .tag { font-style: normal; color: var(--muted-2); }
.ev.is-from-dan p .tag { color: var(--gold-ink); }
.caution { margin: 10px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.caution .tag { color: var(--gold-ink); }
.caution-line { display: none; margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.look-wider { margin-top: -4px; }
.more-evidence { border-top: 1px solid var(--line); padding-top: 14px; }
.more-evidence > summary { cursor: pointer; font-size: 13px; color: var(--ink-2); list-style: none; display: flex; gap: 8px; align-items: baseline; }
.more-evidence > summary::-webkit-details-marker { display: none; }
.more-evidence > summary::before { content: "▸"; color: var(--muted); }
.more-evidence[open] > summary::before { content: "▾"; }
.more-evidence[open] > summary { margin-bottom: 4px; }
.cite {
  flex: none; font-size: 11px; color: var(--muted); text-decoration: none; border: 1px solid var(--line-4); border-radius: 4px; padding: 0 5px;
}
.cite:hover { color: var(--ink-strong); border-color: rgba(255, 255, 255, 0.3); }
.ev-none { margin: 0; font-size: 13px; color: var(--muted-2); }
.more summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.more[open] summary { margin-bottom: 10px; }
.more > div { display: flex; flex-direction: column; gap: 10px; }
.path { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.node { display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.node-you { background: var(--fill-2); color: var(--ink-2); }
.node-via { border: 1px solid rgba(201, 179, 126, 0.6); color: var(--gold-ink); }
.node-them { background: var(--ink-strong); color: #111; }
.arrow { color: var(--faint); }
.reach-detail { font-size: 13px; color: var(--muted); }
.draft {
  align-self: flex-start; min-height: 34px; padding: 0 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2);
  border-radius: 999px; color: var(--label); font-size: 12px;
}
.sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sources a { display: flex; gap: 10px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.sources a:hover span:last-child { text-decoration: underline; text-underline-offset: 3px; }
.sources a span:first-child { color: var(--label); width: 14px; flex: none; }
.sources .src-site { color: var(--ink-strong); }
.sources .src-date { color: var(--muted); }
.sources a:target, .sources li:target a { color: var(--ink-strong); }

/* ---- Lists ---------------------------------------------------------------------------------------- */
.list-row {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row a.name { text-decoration: none; }
.list-row a.name:hover { text-decoration: underline; }
.list-row .muted { color: var(--muted-2); font-size: 13px; }

/* ---- UX plan steps 1 to 7 ------------------------------------------------------------------------- */
.spacer { flex: 1 1 auto; }
.muted { color: var(--muted-2); font-size: 13px; }
.sub { display: block; font-size: 12px; color: var(--muted-2); }
.thread-body.wide { max-width: 1240px; }
.role-line { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.person-row .role-line, .live-row .role-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.badges:empty { display: none; }
.badge {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 11px; color: var(--ink-2);
  border: 1px solid var(--line-4); background: var(--fill);
}
.badge-danger { color: var(--danger); border-color: rgba(229, 154, 146, 0.45); }
.badge-stage { color: var(--gold-ink); border-color: rgba(201, 179, 126, 0.45); }
.stage-gift { color: #9fd3bf; border-color: rgba(78, 155, 127, 0.6); }
.overdue, .is-overdue { color: var(--danger) !important; }

/* Sidebar: title, date and count on two lines; a finished search Dan hasn't opened is bold. */
.nav-search { min-height: 44px; align-items: flex-start; padding-top: 7px; padding-bottom: 7px; }
.nav-search .dot { margin-top: 7px; }
.nav-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.nav-text .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-search.is-unseen .title { font-weight: 600; color: var(--ink-strong); }
.new-tag { color: var(--gold-ink); }
.nav-more { padding: 4px 10px; font-size: 12px; color: var(--muted-2); text-decoration: none; }
.nav-more:hover, .nav-more[aria-current="page"] { color: var(--ink-strong); }
a.pill { text-decoration: none; }
a.pill:hover { color: var(--ink-strong); border-color: rgba(255, 255, 255, 0.24); }

/* Search header menu */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 280px; padding: 12px; display: flex; flex-direction: column; gap: 8px;
  background: var(--raised); border: 1px solid var(--line-3); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.menu-form { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.menu-item { width: 100%; text-align: left; padding: 6px 4px; background: none; border: none; color: var(--ink-2); font-size: 13px; border-radius: 6px; }
.menu-item:hover { background: var(--fill-2); color: var(--ink-strong); }
.menu input, .inline-form input, .field input, .field select, .field textarea, .inline-input, .stage-select, .sort select {
  background: var(--surface); border: 1px solid var(--line-3); border-radius: 8px; color: var(--ink); font-size: 13px; padding: 6px 8px;
  font-family: inherit; min-width: 0;
}
.inline-input.is-saved, .stage-select.is-saved { border-color: rgba(78, 155, 127, 0.7); }

/* The plan, folded to one line once a run starts */
details.plan.is-started > summary { list-style: none; }
details.plan.is-started > summary::-webkit-details-marker { display: none; }
.plan-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 16px; font-size: 13px; color: var(--muted); cursor: pointer; }
.plan-line .show-plan { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
details.plan[open] .show-plan { visibility: hidden; }
details.plan[open] .plan-line { border-bottom: 1px solid var(--line); }

/* Live results while a run is going, and the notify offer */
.live { display: flex; flex-direction: column; }
.live-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.live-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 170px minmax(0, 1.6fr); gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.live-row:last-child { border-bottom: none; }
.live-row .name, .found-row a, .list-row .name { font-weight: 500; color: var(--ink-strong); }
.fit-mini { display: inline-flex; align-items: flex-start; gap: 8px; }
.fit-mini .fit-label { flex-basis: auto; }
.notify-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.notify-row[hidden] { display: none; }

/* Results toolbar: filters, sort, export, keys */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.tab[hidden] { display: none; }
.tab-link { display: inline-flex; align-items: center; text-decoration: none; }
.toolbar form { margin: 0; }
.keys-btn { width: 30px; padding: 0; }
.keys-help { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 14px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.keys-help[hidden] { display: none; }
kbd { font-family: inherit; font-size: 11px; padding: 0 5px; border: 1px solid var(--line-4); border-radius: 4px; color: var(--ink-2); }
.shortfall { font-size: 14px; color: var(--muted); }
.person-row:focus { outline: none; }
.person-row.is-current { box-shadow: inset 3px 0 0 var(--gold); background: rgba(255, 255, 255, 0.03); }
.row .name { white-space: normal; }

/* Set aside: every name opens */
.aside-note { margin: 8px 0 0; }
.aside-reason { color: var(--muted); }
.set-aside .link-btn { font-size: 13px; color: var(--ink-2); }

/* Panels */
.person-actions .spacer { flex: 1 1 auto; }
.mark-quiet { color: var(--muted-2) !important; }
.mark-quiet[aria-pressed="true"] { color: var(--danger) !important; }
.way-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.way-actions form { margin: 0; }
.lead .cite { font-family: var(--sans); vertical-align: middle; }

/* Lists as a workspace */
.ws-row {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) 150px minmax(0, 1.2fr); gap: 16px; align-items: start;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.ws-table.is-dnc .ws-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 1fr); }
.ws-row:last-child { border-bottom: none; }
.ws-head { font-size: 13px; font-weight: 500; color: var(--muted-2); padding-top: 12px; padding-bottom: 12px; }
.ws-row a.name { text-decoration: none; }
.ws-row a.name:hover { text-decoration: underline; }
.ws-fit { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ws-fit .why { font-size: 13px; }
.ws-next { display: flex; flex-direction: column; gap: 6px; }
.stage-select { width: 100%; }
.list-row .who { min-width: 0; }

/* A person's own page */
.pp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-10); align-items: start; }
.pp-main { display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; }
.pp-side { display: flex; flex-direction: column; gap: var(--sp-4); position: sticky; top: 80px; }
.pp-card { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); overflow: visible; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.field textarea { resize: vertical; line-height: 1.5; }
.notes { min-height: 96px; }
.contact-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 13px; }
.contact-row form { margin: 0; flex: none; }
.contact-row .sub { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; }
.inline-form input { flex: 1 1 140px; }
.found-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--sp-4); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.found-row:last-child { border-bottom: none; }
.found-row a { text-decoration: none; }
.found-row a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.3); }
.found-row .fit-mini { grid-column: 2; grid-row: 1 / span 2; }
.draft-box { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.draft-box textarea { font-size: 14px; }
.draft-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.draft-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.draft-actions .sub { display: inline; }
.facts { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }

/* Your lists */
.upload { overflow: visible; }
.upload-grid, .mapping-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 16px; }
.mapping { padding: 0 16px 8px; border-top: 1px solid var(--line); }
.mapping .label { display: block; padding-top: 14px; }
.mapping-grid { padding: 10px 0; }
.mapping[hidden] { display: none; }

/* ---- Sign in ---------------------------------------------------------------------------------------- */
.signin { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 48px 16px; }
.signin-brand { display: flex; align-items: center; gap: 12px; }
.signin-brand .logo { width: 40px; height: 40px; }
.signin-brand .brand-text b { font-size: 15px; }
.signin-card {
  width: 100%; max-width: 420px; padding: 28px; display: flex; flex-direction: column; gap: 14px; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.signin-card h1 { margin: 0; font-family: var(--serif); font-size: 30px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink-strong); }
.signin-card p { margin: 0; font-size: 15px; color: var(--ink-2); }
.signin-card p b { color: var(--ink-strong); font-weight: 500; overflow-wrap: anywhere; }
.signin-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.signin-card input {
  min-height: 44px; padding: 0 14px; background: var(--ground); border: 1px solid var(--line-3); border-radius: 10px;
  color: var(--ink-strong); font-size: 15px; font-family: inherit;
}
.signin-card input::placeholder { color: var(--label); }
.signin-card input:focus { outline: none; border-color: var(--gold); }
.signin-card .btn-primary { min-height: 44px; justify-content: center; font-size: 14px; }
.signin-small { font-size: 13px !important; color: var(--muted) !important; }
.signin-link { align-self: flex-start; font-size: 13px; color: var(--ink-2); text-underline-offset: 3px; }
.signin-foot { margin: 0; font-size: 12px; color: var(--muted-2); }

/* ---- Admin (operator pages) in the app's look ---------------------------------------------------------- */
.admin .thread-body { gap: 14px; }
.admin h1 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 400; color: var(--ink-strong); }
.thread-head h1 { font-family: var(--sans); font-size: 14px; }
.admin h2 { margin: 18px 0 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--label); }
.admin p { margin: 0; color: var(--ink-2); }
.admin a { color: var(--ink-strong); text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.3); }
.admin .muted { color: var(--muted-2); }
.admin .small { font-size: 12px; }
.admin .panel { background: var(--fill); border: 1px solid var(--line-2); border-radius: 14px; padding: 16px 18px; }
.admin .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.admin .stat .v { font-family: var(--serif); font-size: 26px; color: var(--ink-strong); }
.admin .stat .k { font-size: 12px; color: var(--muted-2); }
.admin table {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--fill); border: 1px solid var(--line-2);
  border-radius: 14px; overflow: hidden; font-size: 13px;
}
.admin th, .admin td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.admin tr:last-child td { border-bottom: none; }
.admin th { font-size: 12px; font-weight: 500; color: var(--muted-2); background: rgba(255, 255, 255, 0.02); }
.admin .panel table { border: none; background: none; border-radius: 0; }
.admin .chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--line-4); color: var(--ink-2);
}
.admin .s-completed, .admin .r-strong, .admin .t-confirmed { color: #9fd3bf; border-color: rgba(78, 155, 127, 0.5); }
.admin .s-partial, .admin .r-some, .admin .t-likely { color: var(--gold-ink); border-color: rgba(201, 179, 126, 0.5); }
.admin .s-failed, .admin .s-canceled, .admin .t-uncertain { color: var(--danger); border-color: rgba(229, 154, 146, 0.5); }
.admin .r-unknown { border-style: dashed; color: var(--muted-2); }
.admin .claim { margin: 8px 0 0; padding-left: 10px; border-left: 2px solid var(--line-3); }
.admin .claim .meta { color: var(--muted-2); font-size: 12px; }
.admin .excerpt { font-size: 12px; color: var(--muted); background: var(--ground); padding: 8px 10px; border-radius: 8px; margin-top: 4px; white-space: pre-wrap; }
.admin details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.admin textarea, .admin input[type=text] {
  width: 100%; background: var(--ground); color: var(--ink); border: 1px solid var(--line-3); border-radius: 10px; padding: 8px 10px; font-size: 13px;
}
.admin textarea { font: 12px/1.45 ui-monospace, Menlo, monospace; }
.admin button {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--ink-strong); border: 1px solid var(--ink-strong); color: #111;
}
.admin button.secondary { background: transparent; color: var(--ink); border-color: var(--line-4); font-weight: 400; }
.admin .error { color: var(--danger); border: 1px solid rgba(229, 154, 146, 0.35); padding: 10px 14px; border-radius: 12px; }
.admin .rationale { font-size: 12px; margin-top: 4px; color: var(--muted); }
.admin .rule { font-size: 11px; color: var(--danger); }
@media (max-width: 859px) { .admin table { display: block; overflow-x: auto; } }

/* ---- Refinement: controls that look like the app ----------------------------------------------------- */
:root { --radius: 10px; --pop: #2a2727; --ease: cubic-bezier(0.2, 0.8, 0.2, 1); }
input, textarea, select { color-scheme: dark; }
::selection { background: rgba(140, 21, 21, 0.55); }

/* Select: a button and a menu */
.select { position: relative; display: inline-block; }
.select-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; padding: 0 10px 0 12px; width: 100%;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-3); border-radius: var(--radius); color: var(--ink-2); font-size: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.select-btn:hover { border-color: rgba(255, 255, 255, 0.2); color: var(--ink-strong); }
.select-btn[aria-expanded="true"] { border-color: rgba(255, 255, 255, 0.24); background: rgba(255, 255, 255, 0.07); }
.select-btn svg { color: var(--muted-2); flex: none; transition: transform 0.15s var(--ease); }
.select-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.select-btn.is-saved { border-color: rgba(78, 155, 127, 0.7); }
.select-menu {
  position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; min-width: 100%; margin: 0; padding: 4px; list-style: none;
  background: var(--pop); border: 1px solid var(--line-3); border-radius: 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  animation: pop-in 0.12s var(--ease);
}
.toolbar .select-menu { left: auto; right: 0; }
.select-menu [role="option"] {
  position: relative; padding: 7px 28px 7px 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; cursor: pointer;
}
.select-menu [role="option"]:hover, .select-menu [role="option"]:focus { background: rgba(255, 255, 255, 0.07); color: var(--ink-strong); outline: none; }
.select-menu [aria-selected="true"]::after {
  content: ""; position: absolute; right: 10px; top: 50%; width: 8px; height: 4px; margin-top: -3px; border: solid var(--ink-strong);
  border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg);
}
.field .select { display: block; }
.field .select-btn { min-height: 36px; font-size: 13px; }
.ws-row .select { min-width: 132px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }

/* Native selects and dates that remain (the upload's column mapping, due dates) match the inputs */
.admin select {
  appearance: none; -webkit-appearance: none; width: 100%; min-height: 34px; padding: 0 28px 0 10px; background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-3); border-radius: var(--radius); color: var(--ink-2); font-size: 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%239a9a92' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.inline-input, .field input, .field textarea, .stack-form input {
  min-height: 34px; padding: 6px 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-3); border-radius: var(--radius);
  color: var(--ink-strong); font-size: 13px; transition: border-color 0.15s;
}
.inline-input:hover, .stack-form input:hover { border-color: rgba(255, 255, 255, 0.2); }
.inline-input:focus, .field input:focus, .field textarea:focus, .stack-form input:focus { outline: none; border-color: rgba(255, 255, 255, 0.32); }
.inline-input::placeholder, .stack-form input::placeholder { color: var(--faint); }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.55; cursor: pointer; }

/* Icon buttons, with a quiet tooltip from data-tip */
.icon-btn { text-decoration: none; font-size: 13px; font-weight: 600; }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; z-index: 60; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 4px 8px; border-radius: 6px; background: #3a3636; color: var(--ink-strong); font-size: 11px; font-weight: 500; white-space: nowrap;
  pointer-events: none; animation: pop-in 0.12s var(--ease) 0.25s both;
}

/* Results: the row is the target; actions are quiet until the row is */
.person-row { cursor: pointer; transition: background 0.12s; }
.actions { gap: 2px; flex-wrap: nowrap; }
.act {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--muted-2); opacity: 0; transition: opacity 0.12s, color 0.12s, background 0.12s;
}
.person-row:hover .act, .person-row:focus-within .act, .person-row.is-current .act, .person-row.is-open .act, .act[aria-pressed="true"] { opacity: 1; }
.act:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink-strong); }
.act[data-list="shortlist"][aria-pressed="true"] { color: var(--gold); }
.act[data-list="shortlist"][aria-pressed="true"] svg { fill: var(--gold); }
.act[data-list="known"][aria-pressed="true"] { color: #9fd3bf; }
.act-quiet:hover { color: var(--danger); }
@media (hover: none) { .act { opacity: 1; } }
.act-text { display: none; }
@media (max-width: 759px), (hover: none) {
  .actions { gap: 4px; flex-wrap: nowrap; }
  .act { width: auto; height: 32px; padding: 0 9px; gap: 5px; opacity: 1; border-color: var(--line-4); font-size: 12.5px; white-space: nowrap; }
  .act-text { display: inline; }
  .caution-line { display: block; }
  .badge-caution { display: none; }
}

/* The checklist: must-haves, then nice-to-haves, each a short name and its status */
.req-group { display: block; margin: 4px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--label); }
.checklist + .req-group { margin-top: 16px; }
.req-head { display: flex; justify-content: space-between; gap: 12px; }
.req-name { color: var(--ink-strong); }
.req-status { flex: none; font-size: 12px; color: var(--muted); }
.req.is-meets .req-status { color: #9fd3bf; }
.req.is-partial .req-status { color: var(--gold-ink); }
.req.is-does_not_meet .req-status { color: var(--danger); }

/* Dialog */
.dialog-back {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(8, 5, 5, 0.6); backdrop-filter: blur(3px); animation: fade-in 0.12s ease;
}
.dialog {
  width: 100%; max-width: 420px; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--pop);
  border: 1px solid var(--line-3); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); animation: pop-in 0.16s var(--ease);
}
.dialog h2 { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.45; color: var(--ink-strong); }
.dialog input {
  min-height: 40px; padding: 0 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line-3); border-radius: var(--radius);
  color: var(--ink-strong); font-size: 14px;
}
.dialog input:focus { outline: none; border-color: rgba(255, 255, 255, 0.3); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-danger { background: var(--cardinal); border-color: var(--cardinal); color: #fff; font-weight: 600; }
.btn-danger:hover { background: #a51c1c; color: #fff; }
@keyframes fade-in { from { opacity: 0; } }

/* Toasts */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 14px; padding: 9px 10px 9px 14px; border-radius: 12px; background: #322e2e; border: 1px solid var(--line-3);
  color: var(--ink-strong); font-size: 13px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); animation: pop-in 0.16s var(--ease); transition: opacity 0.3s;
}
.toast button { background: none; border: none; padding: 2px 6px; color: var(--gold-ink); font-size: 13px; font-weight: 600; border-radius: 6px; }
.toast button:hover { background: rgba(255, 255, 255, 0.06); }
.toast.is-leaving { opacity: 0; }

/* Person page: folded add forms, a quiet back link */
.btn-back { gap: 6px; }
.add-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.add-row form { margin: 0; }
details.add > summary { list-style: none; gap: 6px; cursor: pointer; }
details.add > summary::-webkit-details-marker { display: none; }
details.add[open] { flex-basis: 100%; }
details.add[open] > summary { display: none; }
.stack-form { display: flex; flex-direction: column; gap: 6px; }
.stack-form .btn { align-self: flex-start; }

/* Lists */
.ws-row[data-row-href] { cursor: pointer; transition: background 0.12s; }
.ws-row[data-row-href]:hover { background: rgba(255, 255, 255, 0.025); }
.source-line { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.source-line a { color: var(--muted); text-decoration: none; }
.source-line a:hover { color: var(--ink-strong); text-decoration: underline; }
.file-pick { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.file-pick .btn { gap: 6px; }
.file-name { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick:focus-within .btn { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.menu-danger { color: var(--danger); }
.menu-danger:hover { color: #f2b3ac; }
.person-top .menu-pop, .thread-head .menu-pop { width: auto; min-width: 200px; }
.person-actions { align-items: center; }
/* An empty date shows a word, not the browser's mm/dd/yyyy */
.date-pick { position: relative; display: block; }
.date-pick input { width: 100%; }
.date-ph { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--faint); pointer-events: none; }
.date-pick:not(.is-empty) .date-ph, .date-pick:focus-within .date-ph { display: none; }
.date-pick.is-empty input:not(:focus)::-webkit-datetime-edit { color: transparent; }

/* ---- Moving between pages: a thin bar when the next page takes more than a moment --------------------- */
.main:focus { outline: none; }
.nav-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--cardinal) 30%, #d4524f 70%, transparent);
  transform: scaleX(0); transform-origin: left; opacity: 0;
}
.nav-progress.is-on { opacity: 1; animation: nav-progress 1.4s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes nav-progress { from { transform: scaleX(0); } to { transform: scaleX(.85); } }
@media (prefers-reduced-motion: reduce) { .nav-progress.is-on { animation: none; transform: scaleX(.85); } }
/* The person page names them once, in the page itself; the bar above holds only the way back and the menu. */
.person-page .thread-head .menu { margin-left: auto; }

/* Several people at once: a selected row, and the bar that appears only while rows are selected. */
.person-row.is-selected { background: rgba(140, 21, 21, 0.08); box-shadow: inset 3px 0 0 #8c1515; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 8px 12px; margin-bottom: 8px; border-radius: 8px; background: rgba(127, 127, 127, 0.12); font-size: 13px; }
.bulk-bar [data-bulk-count] { font-weight: 600; }

/* A person's page on paper: who they are, the tie, the evidence and the way in, without the app around it. */
@media print {
  .sidebar, .nav, .scrim, .person-actions, .btn, .icon-btn, form, .notice, .draft-actions, .add-row, [data-print] { display: none !important; }
  .shell, .main, .pp-grid { display: block !important; margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { border: none !important; box-shadow: none !important; break-inside: avoid; }
  details { display: block; }
  details > summary { list-style: none; }
  a { color: inherit; text-decoration: none; }
}


/* ---- Results header: what was found and the way to widen it, on one line ------------------------------------ */
.outcome { gap: var(--sp-4); }
.outcome-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.outcome-head .say { flex: 1 1 320px; }
.outcome-head .look-wider { margin: 0; }

/* ---- Motion: every control answers the hand, and things arrive and leave instead of blinking --------------- */
.btn, .tab, .chip, .pill, .mark-btn, .icon-btn, .act, .nav-item, .new-search, .menu-item, .suggestion, .send, .close, .link-btn,
.select-btn, .name, .cite, .sources a, .person-row, .ws-row, .found-row a {
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
:is(.btn, .tab, .chip, .pill, .mark-btn, .icon-btn, .act, .new-search, .send, .suggestion, .menu-item):active:not(:disabled) {
  transform: scale(0.97);
}
.send:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.card:has(.person-row:hover) { border-color: var(--line-3); }

/* Rows rise in once, in order, when results arrive; a refresh after a mark keeps them still. */
.person-row, .live-row, .ws-row:not(.ws-head) { animation: rise var(--dur-slow) var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 14) * 26ms); }
html.is-quiet :is(.person-row, .live-row, .ws-row) { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.person-row.is-leaving { animation: row-out 220ms var(--ease-in) forwards; pointer-events: none; }
@keyframes row-out { to { opacity: 0; transform: translateX(-16px); } }

/* The person panel slides in from the side it lives on, and back out when closed. */
.person:not([hidden]) { animation: panel-in var(--dur) var(--ease-out); }
.person.is-instant { animation: fade-in 90ms linear; }
.person.is-leaving { animation: panel-out 160ms var(--ease-in) forwards; }
@keyframes panel-in { from { opacity: 0; transform: translateX(20px); } }
@keyframes panel-out { to { opacity: 0; transform: translateX(20px); } }
.person > :not(.person-top) { animation: rise var(--dur-slow) var(--ease-out) both; animation-delay: 40ms; }
.person.is-instant > * { animation: none; }

/* A mark lands with a small spring; the sidebar count it changes does too. */
.is-popped { animation: pop 380ms var(--ease-spring); }
@keyframes pop { 40% { transform: scale(1.22); } }
.is-bumped { display: inline-block; animation: bump 420ms var(--ease-spring); }
@keyframes bump { 35% { transform: scale(1.4); color: var(--gold-ink); } }
.mark-btn[aria-pressed="true"]::before {
  content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; display: inline-block;
  animation: pop 380ms var(--ease-spring);
}
.mark-btn { display: inline-flex; align-items: center; }

/* Menus, toasts and the progress of a run */
.menu[open] > .menu-pop { animation: pop-in 140ms var(--ease-out); transform-origin: top right; }
.toast { animation: toast-in 240ms var(--ease-spring); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.28s var(--ease-in), transform 0.28s var(--ease-in); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.steps .live .mark { position: relative; }
.steps .live .mark::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--gold); opacity: 0;
  animation: ring 1.6s var(--ease-out) infinite;
}
@keyframes ring { 0% { opacity: 0.55; transform: scale(0.6); } 100% { opacity: 0; transform: scale(1.4); } }
.steps li { animation: rise var(--dur-slow) var(--ease-out) both; }
.composer { transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.composer:focus-within { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(140, 21, 21, 0.22); }
.composer textarea { max-height: 240px; overflow-y: auto; }
.home > * { animation: rise 420ms var(--ease-out) both; }
.home > :nth-child(2) { animation-delay: 60ms; }
.home > :nth-child(3) { animation-delay: 120ms; }

/* Moving between pages: the page crossfades and settles; the sidebar holds still. */
.main { view-transition-name: page; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(page) { animation: fade-out 110ms var(--ease-in) both; }
::view-transition-new(page) { animation: page-in 220ms var(--ease-out) both; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(page), ::view-transition-new(page) { animation: none; }
}

/* ---- Narrower screens ------------------------------------------------------------------------------
   Last in the file on purpose: these override base rules, and a base rule written after its override wins. */
@media (max-width: 1599px) {
  .person {
    position: fixed; right: 0; top: 0; bottom: 0; z-index: 20; width: min(440px, 100%);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.45);
  }
}

@media (max-width: 859px) {
  .shell { display: block; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 15; padding: 10px 16px;
    background: rgba(20, 14, 14, 0.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  }
  body.is-home .topbar { background: transparent; border-bottom-color: transparent; backdrop-filter: none; position: absolute; left: 0; right: 0; }
  .topbar .spacer { flex: 1 1 auto; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; height: auto; width: min(280px, 85vw); background: #1d1f1e;
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 24px 0 60px rgba(0, 0, 0, 0.45);
  }
  body.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, 0.5); }
  .scrim[hidden] { display: none; }
  .home { min-height: 100svh; padding: 72px 16px 40px; justify-content: flex-start; padding-top: 18vh; }
  .greeting { font-size: 32px; }
  .thread-head { top: 53px; padding: 12px 16px; }
  /* The panel opens under the top bar, which paints above the page: at top 0 its close button sat behind the bar. */
  .person { top: 53px; }
  .thread-body { padding: 20px 16px; }
  .dock { padding: 10px 16px 16px; }
  .plan-col { border-right: none; border-bottom: 1px solid var(--line); }
  .plan-col:last-child { border-bottom: none; }
  .list-row { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 759px) {
  .row-head { display: none; }
  .row {
    grid-template-columns: 1fr; grid-template-areas: "who" "fit" "tie" "why" "act";
    gap: 8px; padding: 14px 14px;
  }
  .row > .who { grid-area: who; }
  .row > .fit-cell { grid-area: fit; }
  .row > .tie { grid-area: tie; }
  .row > .why { grid-area: why; }
  .row > .actions { grid-area: act; justify-content: flex-start; }
  .cell-label { display: block; font-size: 11px; color: var(--label); margin-bottom: 4px; }
  .toolbar .sort, .keys-btn, .keys-help { display: none; }
  .ws-row, .ws-table.is-dnc .ws-row { grid-template-columns: 1fr; gap: 8px; }
  .ws-head { display: none; }
  .pp-grid { grid-template-columns: 1fr; }
  .live-row { grid-template-columns: 1fr; gap: 4px; }
}
