/* Warm Outreach — one hand-written stylesheet, no build step.
   Colours live in the variables below; dark values follow the system setting. */

:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f3f3ef;
  --surface-3: #ebebe6;
  --border: #e3e3dd;
  --border-strong: #cfcfc7;
  --text: #1a1a17;
  --text-2: #55554e;
  --text-3: #6d6d65;
  --ink: #1a1a17;
  --ink-fg: #ffffff;
  --ink-hover: #33332e;
  --link: #1c57c4;
  --focus: #2f6feb;

  --neutral-bg: #ecece7; --neutral-fg: #45453f; --neutral-dot: #8a8a80;
  --blue-bg: #e2ecff;    --blue-fg: #1a4db0;    --blue-dot: #2f6feb;
  --amber-bg: #fcefc9;   --amber-fg: #7d4b00;   --amber-dot: #d99200;
  --green-bg: #dbf3e2;   --green-fg: #14652f;   --green-dot: #1f9d4c;
  --violet-bg: #ebe5ff;  --violet-fg: #5432ad;  --violet-dot: #7a55e0;
  --red-bg: #fde4e1;     --red-fg: #a3241a;     --red-dot: #d93a2b;
  --orange-bg: #ffe7d2;  --orange-fg: #8f3f05;  --orange-dot: #e2700f;

  --danger: #c0291d;
  --danger-hover: #a52117;
  --ok: #17803c;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 20, 15, .05);
  --shadow-pop: 0 6px 24px rgba(20, 20, 15, .1);
  --side-w: 244px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --avatar-s: 55%; --avatar-l: 90%; --avatar-fg-s: 45%; --avatar-fg-l: 30%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101110;
    --surface: #191a18;
    --surface-2: #20211f;
    --surface-3: #2a2b28;
    --border: #2c2d2a;
    --border-strong: #41423d;
    --text: #edede7;
    --text-2: #b4b4aa;
    --text-3: #96968c;
    --ink: #edede7;
    --ink-fg: #141512;
    --ink-hover: #ffffff;
    --link: #86b3ff;
    --focus: #6ea0ff;

    --neutral-bg: #2a2b28; --neutral-fg: #c9c9bf; --neutral-dot: #8d8d83;
    --blue-bg: #18284a;    --blue-fg: #a3c3ff;    --blue-dot: #5b93ff;
    --amber-bg: #392c0b;   --amber-fg: #f3c96b;   --amber-dot: #e5a81c;
    --green-bg: #12301f;   --green-fg: #84d9a0;   --green-dot: #35b565;
    --violet-bg: #29204c;  --violet-fg: #c2aeff;  --violet-dot: #9274f0;
    --red-bg: #421d19;     --red-fg: #ffa298;     --red-dot: #ef5a4a;
    --orange-bg: #40250e;  --orange-fg: #ffb67f;  --orange-dot: #f08a33;

    --danger: #e5493a;
    --danger-hover: #f05d4e;
    --ok: #2a9d55;
    --shadow: none;
    --shadow-pop: 0 6px 24px rgba(0, 0, 0, .5);
    --avatar-s: 30%; --avatar-l: 24%; --avatar-fg-s: 65%; --avatar-fg-l: 82%;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, blockquote, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ul, ol { list-style: none; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -.015em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 15.5px; line-height: 1.3; font-weight: 600; letter-spacing: -.005em; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.ico { flex: none; display: inline-block; vertical-align: -.15em; }
.muted { color: var(--text-3); font-size: 13px; }
.sub { color: var(--text-2); font-size: 13.5px; margin-top: 4px; max-width: 72ch; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.bad { color: var(--red-fg); }
.good { color: var(--green-fg); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--ink); color: var(--ink-fg); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }

/* ---------- banners & notices ---------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 7px 20px; font-size: 13px; line-height: 1.4; }
.banner.dry { background: var(--amber-bg); color: var(--amber-fg); }
.banner.error { background: var(--red-bg); color: var(--red-fg); }
.banner-pill { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; border: 1.5px solid currentColor; }

.notice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin: 0 0 14px; font-size: 13.5px;
  background: var(--blue-bg); color: var(--blue-fg); border: 1px solid transparent; }
.notice .ico, .notice .spinner { margin-top: 2px; }
.notice.error { background: var(--red-bg); color: var(--red-fg); }
.notice a { color: inherit; text-decoration: underline; font-weight: 600; }
.callout { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm); }
.callout .ico { margin-top: 3px; }
.callout.bad { background: var(--red-bg); color: var(--red-fg); }
.callout.info { background: var(--blue-bg); color: var(--blue-fg); }
.facts { margin: 0; padding: 0 0 0 18px; display: grid; gap: 8px; font-size: 14px; }
.facts li { line-height: 1.5; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px; overflow-y: auto;
  padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border);
}
/* Desktop: banners and sidebar stay put, only the content column scrolls. */
@media (min-width: 901px) {
  body.has-shell { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
  body.has-shell .shell { flex: 1; min-height: 0; }
  body.has-shell .content { overflow-y: auto; scroll-behavior: smooth; scroll-padding-top: 16px; }
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; letter-spacing: -.01em; padding: 4px 8px 14px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: var(--ink-fg); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--surface-3); color: var(--text); }
.side-bottom { display: flex; flex-direction: column; gap: 10px; }

.side-live:empty { display: none; }
.side-live .chrome-live { display: flex; flex-direction: column; gap: 6px; }
#dash > .chrome-live { display: none; }
.meter-block { padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.meter-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.meter-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.meter { height: 5px; border-radius: 999px; background: var(--surface-3); margin: 7px 0 5px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--green-dot); min-width: 2px; }
.meter.full i { background: var(--red-dot); }
.meter-note { font-size: 12px; color: var(--text-3); }
.side-cta { display: block; font-size: 12.5px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.side-cta:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }
.side-cta b { color: var(--text); }
.side-cta.hot { background: var(--orange-bg); border-color: transparent; color: var(--orange-fg); }
.side-cta.hot b { color: inherit; }

.side-send { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.side-send .btn { width: 100%; justify-content: center; }
.side-send-state { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green-dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-dot) 22%, transparent); }
.side-send.is-paused { border-color: var(--red-dot); background: var(--red-bg); }
.side-send.is-paused .side-send-state { color: var(--red-fg); }
.side-send.is-paused .pulse { background: var(--red-dot); box-shadow: none; border-radius: 2px; }
.side-user { display: flex; align-items: center; gap: 8px; padding: 4px 2px 0 6px; }
.side-handle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }

.content { min-width: 0; }
main { max-width: 1120px; margin: 0 auto; padding: 28px 32px 64px; }
main.solo { max-width: 720px; padding: 56px 20px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 12.5px; color: var(--text-3); margin-bottom: 4px; }
.crumb a { color: var(--text-3); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 16px; box-shadow: var(--shadow); }
.panel.flush { padding: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.panel > p { margin-bottom: 12px; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.foot-note { margin-top: 12px; }
#dash > section:target, section.panel:target { border-color: var(--focus); }

.attention.has-items { border-color: var(--orange-dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange-dot) 14%, transparent); }
.attention.has-items .count { background: var(--orange-bg); color: var(--orange-fg); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); transition: border-color .12s; }
.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.stat-num { font-size: 28px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 12px; color: var(--text-3); }
.stat.hot { background: var(--orange-bg); border-color: transparent; }
.stat.hot .stat-label, .stat.hot .stat-foot, .stat.hot .stat-num { color: var(--orange-fg); }

.limits { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 16px; font-size: 12.5px; }
.limit { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.limit b { color: var(--text); font-variant-numeric: tabular-nums; }
.limit.bad { background: var(--red-bg); color: var(--red-fg); border-color: transparent; font-weight: 500; }

/* ---------- badges, chips, avatars, score ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 550; line-height: 1.5; white-space: nowrap; letter-spacing: 0; text-transform: none; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.is-live .dot { animation: blink 1.1s ease-in-out infinite; }
.b-neutral { background: var(--neutral-bg); color: var(--neutral-fg); } .b-neutral .dot { background: var(--neutral-dot); }
.b-blue    { background: var(--blue-bg);    color: var(--blue-fg); }    .b-blue .dot { background: var(--blue-dot); }
.b-amber   { background: var(--amber-bg);   color: var(--amber-fg); }   .b-amber .dot { background: var(--amber-dot); }
.b-green   { background: var(--green-bg);   color: var(--green-fg); }   .b-green .dot { background: var(--green-dot); }
.b-violet  { background: var(--violet-bg);  color: var(--violet-fg); }  .b-violet .dot { background: var(--violet-dot); }
.b-red     { background: var(--red-bg);     color: var(--red-fg); }     .b-red .dot { background: var(--red-dot); }
.b-orange  { background: var(--orange-bg);  color: var(--orange-fg); }  .b-orange .dot { background: var(--orange-dot); }
@keyframes blink { 50% { opacity: .25; } }

.chip { display: inline-block; padding: 0 7px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; line-height: 1.6; }
.chip.warn { background: var(--amber-bg); color: var(--amber-fg); }

.avatar { --h: 220; display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; font-size: 13.5px; font-weight: 600;
  background: hsl(var(--h) var(--avatar-s) var(--avatar-l)); color: hsl(var(--h) var(--avatar-fg-s) var(--avatar-fg-l)); user-select: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 11.5px; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }

.score { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 10px; line-height: 1; font-variant-numeric: tabular-nums; }
.score b { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.score small { font-size: 9.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; opacity: .8; }
.score.hi { background: var(--green-bg); color: var(--green-fg); }
.score.lo, .score.none { background: var(--neutral-bg); color: var(--neutral-fg); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.row-item { padding: 14px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.row-item:first-child { border-top: 0; padding-top: 2px; }
.row-item:last-child { padding-bottom: 2px; }
.row-item.compact { padding: 10px 0; }
.row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-title { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.who { color: var(--text); font-weight: 600; }
.who .handle, .handle { color: var(--text-3); font-weight: 400; }
.reason { color: var(--text); }
.reason-inline { font-size: 13.5px; color: var(--text-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 2px; }
.reply { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 3px solid var(--violet-dot); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13.5px; color: var(--text-2); }
details summary { cursor: pointer; color: var(--text-3); font-size: 13px; width: fit-content; max-width: 100%; border-radius: 4px; }
details summary:hover { color: var(--text); }
details[open] summary { color: var(--text-2); }

.row-link { display: flex; align-items: center; gap: 12px; padding: 11px 10px; margin: 0 -10px; border-radius: var(--radius-sm); color: var(--text); border-top: 1px solid var(--border); }
.row-link:first-child { border-top: 0; }
.row-link:hover { background: var(--surface-2); text-decoration: none; }
.row-link-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chev { color: var(--text-3); font-size: 18px; line-height: 1; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-person { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

.kv > div { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv dt { color: var(--text-2); font-size: 13.5px; }

/* ---------- empty state ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 22px 16px; }
.empty-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-3); color: var(--text-3); margin-bottom: 6px; }
.empty-title { font-weight: 600; }
.empty-hint { color: var(--text-3); font-size: 13px; max-width: 46ch; }
.empty-action { text-align: center; padding-bottom: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: none;
  font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1.3; white-space: nowrap;
  padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ink-fg); font-weight: 600; }
.btn.primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn.danger-outline { color: var(--red-fg); border-color: color-mix(in srgb, var(--red-dot) 55%, var(--border)); }
.btn.danger-outline:hover { background: var(--red-bg); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.big { padding: 11px 20px; font-size: 15px; border-radius: 9px; }
.btn.icon-only { padding: 6px; }
form.inline { display: inline-flex; }
.btn.htmx-request { pointer-events: none; opacity: .7; }
.btn.htmx-request::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }
.btn.htmx-request .ico { display: none; }
.card:has(.htmx-request) { opacity: .75; }

.spinner { flex: none; display: inline-block; width: 14px; height: 14px; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > legend, .draft-label label { font-weight: 600; font-size: 13.5px; }
.field > legend { margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--text-3); font-size: 12.5px; margin-left: 4px; }
.hint { font-size: 12.5px; color: var(--text-3); }
input:not([type]), input[type=text], textarea {
  font: inherit; color: var(--text); width: 100%; padding: 8px 11px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
textarea { resize: vertical; line-height: 1.55; min-height: 64px; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: .85; }
input:not([type]):focus, input[type=text]:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: var(--focus); }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; flex: none; }
.form-actions { display: flex; gap: 8px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented label { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.segmented label:hover { background: var(--surface-2); }
.segmented label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.segmented input { margin-top: 2px; }
.segmented span { display: flex; flex-direction: column; }
.segmented small { color: var(--text-3); font-size: 12.5px; }
/* Progressive enhancement: show only the inputs the chosen mode needs. */
.opt-seeds { display: none; }
.form:has(input[name=mode][value=segment]:checked) .f-seeds { display: none; }
.form:has(input[name=mode][value=seeds]:checked) .opt-seeds { display: inline; }

.confirm-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.confirm-row input { width: auto; flex: 1; min-width: 220px; max-width: 340px; }
.danger-zone { border-color: color-mix(in srgb, var(--red-dot) 45%, var(--border)); }
.danger-zone h2 { color: var(--red-fg); }

/* ---------- candidates ---------- */
.toolbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.toolbar-actions { display: flex; align-items: center; gap: 12px; }
.sel-count { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cand { display: grid; grid-template-columns: 20px 40px minmax(0, 1fr); gap: 12px; padding: 16px 20px; border-top: 1px solid var(--border); }
.cand:first-child { border-top: 0; }
.cand-pick { padding-top: 12px; }
.cand-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cand-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cand-id { min-width: 0; flex: 1; }
.cand-id .who { font-size: 15px; }
.cand-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.cand-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.cand-reason { color: var(--text); max-width: 80ch; }
.cand.is-low .cand-reason { color: var(--text-2); }
.cand:has(input:checked) { background: color-mix(in srgb, var(--green-bg) 35%, transparent); }

/* ---------- evidence ---------- */
.evidence { display: flex; flex-direction: column; gap: 6px; }
.ev { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: baseline; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); font-size: 13.5px; transition: background .12s, border-color .12s; }
.ev-kind { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }
.ev-kind b { color: var(--text); margin-right: 2px; }
.ev-text { color: var(--text); overflow-wrap: anywhere; }
.ev-foot { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-3); }
.ev-foot a { display: inline-flex; align-items: center; gap: 3px; }
.ev.cited { border-left-color: var(--green-dot); }
.ev-cited { display: inline-flex; align-items: center; gap: 4px; color: var(--green-fg); font-weight: 500; }
.ev.is-linked { background: var(--blue-bg); border-color: var(--blue-dot); }

/* ---------- review ---------- */
.review-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.two { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; }
.draft { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.draft-label { display: flex; justify-content: space-between; align-items: baseline; }
.char-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.char-count.near { color: var(--orange-fg); font-weight: 600; }
.draft textarea { min-height: 190px; font-size: 14.5px; }
.inline-msg { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.claims { display: flex; flex-direction: column; gap: 6px; }
.claims ul { display: flex; flex-direction: column; gap: 2px; }
.claims li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 8px; margin: 0 -8px; border-radius: 6px; font-size: 13.5px; cursor: default; }
.claims li:hover, .claims li.is-linked { background: var(--blue-bg); }
.ev-ref { flex: none; font-family: var(--mono); font-size: 11px; font-weight: 500; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); }
.draft-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.spacer { flex: 1; }
.proof { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.proof h3:not(:first-child) { margin-top: 10px; }

/* ---------- login ---------- */
.hero { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 36px 36px 32px; box-shadow: var(--shadow-pop); }
.hero-brand { padding: 0 0 22px; }
.hero h1 { font-size: 28px; line-height: 1.18; letter-spacing: -.025em; max-width: 22ch; }
.lead { color: var(--text-2); font-size: 15.5px; margin-top: 12px; max-width: 60ch; }
.steps { display: grid; gap: 12px; margin: 26px 0; padding: 18px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps li div { display: flex; flex-direction: column; }
.steps li span { color: var(--text-2); font-size: 13.5px; }
.step-n { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--ink-fg) !important; font-size: 12px !important; font-weight: 600; margin-top: 1px; }
.hero-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hero-cta .muted { max-width: 62ch; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; overflow: visible; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--border); }
  .side-top { display: contents; }
  .brand { padding: 4px 0; }
  .brand-name { display: none; }
  .nav { order: 3; flex-basis: 100%; flex-direction: row; overflow-x: auto; gap: 2px; margin: 0 -6px; scrollbar-width: none; }
  .nav a { white-space: nowrap; padding: 6px 10px; }
  .side-bottom { flex-direction: row; align-items: center; margin-left: auto; gap: 8px; }
  .side-live, .side-send-state { display: none; }
  .side-send { padding: 0; border: 0; background: none !important; }
  .side-handle { display: none; }
  .side-user { padding: 0; }
  main { padding: 18px 16px 56px; }
  html { scroll-padding-top: 110px; }
  .toolbar { top: 92px; }
  .two { grid-template-columns: 1fr; }
  .kv > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 16px; }
  .panel.flush { padding: 0; }
  .toolbar, .cand { padding-left: 16px; padding-right: 16px; }
  .cand { grid-template-columns: 20px minmax(0, 1fr); }
  .cand > .avatar { display: none; }
  .cand-head { flex-direction: column; }
  .cand-state { justify-content: flex-start; }
  .segmented { grid-template-columns: 1fr; }
  .review-head { flex-wrap: wrap; }
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 23px; }
  .banner { padding: 7px 14px; align-items: flex-start; }
  /* Tables become stacked cards. */
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 2px 4px; }
  .table td.num { text-align: left; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--text-3); font-size: 12px; }
  .table td[data-label="Person"]::before, .table td[data-label="Message"]::before { content: none; }
}

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

/* ---------- conversation thread (Sent list, Needs attention) ---------- */
.thread { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.turn { display: flex; flex-direction: column; gap: 3px; max-width: min(620px, 88%); }
.turn.out { align-self: flex-end; align-items: flex-end; }
.turn.in { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; }
.bubble p { margin: 0; }
.turn.out .bubble { background: var(--blue-bg); color: var(--text); border-bottom-right-radius: 4px; }
.turn.in .bubble { background: var(--surface); border: 1px solid var(--border-strong); border-bottom-left-radius: 4px; }
.turn.in .bubble.locked { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; background: var(--violet-bg); border: 1px dashed var(--violet-dot); color: var(--text); }
.bubble.locked p { font-size: 13px; color: var(--text-2); max-width: 46ch; }
.lock-head { display: inline-flex; align-items: center; gap: 6px; color: var(--violet-fg); font-size: 13.5px; }
.turn-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); padding: 0 4px; }
.turn-summary { font-size: 12.5px; color: var(--text-2); padding: 0 4px; }
.thread-note { display: flex; align-items: flex-start; justify-content: center; gap: 6px; margin: 0; font-size: 12.5px; color: var(--text-2); text-align: center; }
.thread-note .ico { flex: none; margin-top: 3px; }
.thread-note.muted-note { color: var(--text-3); }
time[data-ts] { white-space: nowrap; }

.sent-list { display: flex; flex-direction: column; }
.sent-item { border-top: 1px solid var(--border); }
.sent-item:first-child { border-top: 0; }
.sent-item > summary { display: flex; align-items: center; gap: 12px; width: auto; max-width: none; padding: 10px; margin: 0 -10px; border-radius: var(--radius-sm); list-style: none; color: var(--text); font-size: 13.5px; }
.sent-item > summary::-webkit-details-marker { display: none; }
.sent-item > summary:hover { background: var(--surface-2); color: var(--text); }
.sent-item[open] > summary { color: var(--text); }
.sent-who { flex: none; max-width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sent-excerpt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.sent-item[open] .sent-excerpt { visibility: hidden; }
.sent-time { flex: none; font-size: 12.5px; color: var(--text-3); }
.sent-item .chev { transition: transform .15s ease; }
.sent-item[open] .chev { transform: rotate(90deg); }
.sent-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 14px; }
.note-lines { display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .sent-item > summary { flex-wrap: wrap; row-gap: 4px; }
  .sent-who { max-width: none; flex: 1; }
  .sent-excerpt { order: 5; flex-basis: 100%; }
  .sent-item[open] .sent-excerpt { display: none; }
  .turn { max-width: 100%; }
}


/* ---- accent colour, required marks, search notes, compact candidate cards ---- */
:root { --accent: #4338ca; --accent-hover: #3730a3; --accent-fg: #ffffff; --accent-soft: #eef0ff; --accent-line: #c7cbf7; }
@media (prefers-color-scheme: dark) {
  :root { --accent: #8b8ff7; --accent-hover: #a5a8ff; --accent-fg: #11122b; --accent-soft: #1d1e3a; --accent-line: #3b3d7a; }
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.brand-mark { background: var(--accent); color: var(--accent-fg); }
.req { color: var(--danger); font-weight: 700; margin-left: 2px; }
@media (prefers-color-scheme: dark) { .req { color: #ff8a7d; } }
.form:has(input[name=mode][value=seeds]:checked) .req-segment { display: none; }
.form:has(input[name=mode][value=seeds]:checked) .f-depth { display: none; }
.form-actions { display: flex; align-items: center; gap: 14px; }
#new-campaign { border-top: 3px solid var(--accent); }
.tile { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); margin-right: 10px; vertical-align: -7px; }
.segmented label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.segmented input, input[type=checkbox] { accent-color: var(--accent); }

.search-notes { margin: 0 0 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13.5px; }
.search-notes > summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none; color: var(--text-2); }
.search-notes > summary::-webkit-details-marker { display: none; }
.search-notes > summary .more { margin-left: auto; color: var(--link); font-weight: 500; white-space: nowrap; }
.search-notes[open] > summary { border-bottom: 1px solid var(--border); }
.search-notes-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.search-notes h3 { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin: 4px 0 0; }
.queries { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.queries code { display: block; font-family: var(--mono); font-size: 12.5px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); overflow-wrap: anywhere; white-space: pre-wrap; }
.note-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); overflow-wrap: anywhere; }

.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.cand-reason { margin: 6px 0 0; }
.ev-more { margin-top: 8px; }
.ev-more > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--link); list-style: none; padding: 2px 0; }
.ev-more > summary::-webkit-details-marker { display: none; }
.ev-more > summary::before { content: "\25B8"; font-size: 11px; }
.ev-more[open] > summary::before { content: "\25BE"; }
.ev-more .count { font-size: 11.5px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.ev-more .evidence { margin: 8px 0 0; padding: 0; list-style: none; }
.ev-more .ev { grid-template-columns: auto minmax(0, 1fr) auto; }
a.ev-link { color: inherit; text-decoration: none; cursor: pointer; }
a.ev-link:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.ev-open { color: var(--text-3); align-self: center; }
a.ev-link:hover .ev-open { color: var(--accent); }


/* ---- coloured overview tiles, seed preview, assignment credit ---- */
.stat { border-top: 3px solid var(--tone-dot, var(--border)); }
.stat .stat-label .ico, .stat .stat-label svg { color: var(--tone-dot, currentColor); }
.stat .stat-num { color: var(--tone-fg, var(--text)); }
.stat.t-red    { --tone-dot: var(--red-dot);    --tone-fg: var(--red-fg);    --tone-bg: var(--red-bg); }
.stat.t-amber  { --tone-dot: var(--amber-dot);  --tone-fg: var(--amber-fg);  --tone-bg: var(--amber-bg); }
.stat.t-blue   { --tone-dot: var(--blue-dot);   --tone-fg: var(--blue-fg);   --tone-bg: var(--blue-bg); }
.stat.t-green  { --tone-dot: var(--green-dot);  --tone-fg: var(--green-fg);  --tone-bg: var(--green-bg); }
.stat.t-violet { --tone-dot: var(--violet-dot); --tone-fg: var(--violet-fg); --tone-bg: var(--violet-bg); }
.stat.hot { background: var(--tone-bg); border-color: transparent; border-top-color: var(--tone-dot); }
.stat.hot .stat-label, .stat.hot .stat-foot, .stat.hot .stat-num { color: var(--tone-fg); }
.limit b { color: var(--accent); }

.seed-preview { display: flex; flex-direction: column; gap: 6px; }
.seed-preview:empty { display: none; }
.seed-chip { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 12px; margin: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: inherit; font-size: 13.5px; }
a.seed-chip:hover { text-decoration: none; border-color: var(--accent-line); background: var(--accent-soft); }
.seed-chip.ok { border-left: 3px solid var(--green-dot); }
.seed-chip .avatar { grid-row: span 2; }
.seed-id { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
.seed-bio { grid-column: 2; color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seed-ok { grid-row: 1 / span 2; grid-column: 3; color: var(--green-dot); }
.seed-chip.miss { display: flex; gap: 8px; border-left: 3px solid var(--red-dot); color: var(--red-fg); background: var(--red-bg); }
.seed-msg { display: flex; gap: 6px; align-items: center; font-size: 12.5px; margin: 0; }
.seed-msg.bad { color: var(--red-fg); }
.htmx-indicator { opacity: 0; transition: opacity .15s; color: var(--accent); }
.htmx-request.htmx-indicator, .htmx-request .htmx-indicator { opacity: 1; }

.credit { font-size: 11.5px; line-height: 1.45; color: var(--text-3); margin: 8px 4px 0; }
.credit b { color: var(--text-2); font-weight: 600; }
.hero-credit { margin-top: 28px; font-size: 12.5px; max-width: 60ch; }

.segmented.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .segmented.three { grid-template-columns: 1fr; } }
.confirm-handle { font-family: var(--mono); padding: 1px 7px; border-radius: 5px; background: var(--red-bg); color: var(--red-fg); user-select: all; }
