/* KnowYourRights — a calm reading surface for a stressful subject.
   One accent (a legal green), a serif for headlines, generous line height, and colour used only
   where it carries meaning: the kind of source a citation points to, jurisdiction, and warnings.

   Sections: tokens · base · top bar · stage and sources drawer · welcome · messages · research
   timeline · notices and cards · source cards · composer · dialogs · responsive. */

/* ── tokens ─────────────────────────────────────────────────────────────────────────── */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --surface-3: #e8e5dd;
  --border: #e3dfd5;
  --border-strong: #cdc6b8;
  --text: #1c1a17;
  --text-dim: #57524a;
  --text-faint: #8b857a;
  --accent: #0e6b5a;
  --accent-hover: #0a5749;
  --accent-soft: #e1efea;
  --accent-ink: #ffffff;
  --statute: #0e6b5a;
  --official: #2b5ca6;
  --official-soft: #e6eef9;
  --web: #8a6a35;
  --web-soft: #f5ecdc;
  --portal: #6d4fa3;
  --warn: #a4520f;
  --danger: #b42318;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(28, 26, 23, .06);
  --shadow: 0 1px 2px rgba(28, 26, 23, .05), 0 8px 24px rgba(28, 26, 23, .07);
  --shadow-lg: 0 24px 60px rgba(28, 26, 23, .18);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans",
          "Noto Sans Devanagari", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --drawer: 380px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #111312;
  --surface: #181b1a;
  --surface-2: #202422;
  --surface-3: #2a2f2c;
  --border: #2c312e;
  --border-strong: #3d4540;
  --text: #ebe8e2;
  --text-dim: #aba69d;
  --text-faint: #7e796f;
  --accent: #5cc6ab;
  --accent-hover: #7cd4bd;
  --accent-soft: #163029;
  --accent-ink: #0b1512;
  --statute: #5cc6ab;
  --official: #8ab2f2;
  --official-soft: #1a2638;
  --web: #d4b47c;
  --web-soft: #2b2519;
  --portal: #b99ff0;
  --warn: #eda05f;
  --danger: #f07a6e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ── base ───────────────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.icon { width: 18px; height: 18px; flex: none; }
.icon.sm { width: 15px; height: 15px; }
:root:not([data-theme="dark"]) .only-dark,
:root[data-theme="dark"] .only-light { display: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  color: var(--text-dim); transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.pill-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-dim); font-size: 13.5px; font-weight: 550;
  transition: background .15s, color .15s, border-color .15s;
}
.pill-btn:hover { color: var(--text); border-color: var(--border-strong); }
.pill-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent);
  border-color: transparent; }
.pill-btn .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink);
}
.pill-btn .count.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.25); } }

.link-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px; border: 0;
  background: none; border-radius: 6px; font-size: 13px; color: var(--accent);
}
.link-btn:hover { background: var(--accent-soft); }

.primary {
  height: 38px; padding: 0 18px; border: 0; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.primary:hover { background: var(--accent-hover); }

/* ── top bar ────────────────────────────────────────────────────────────────────────── */
.app {
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  height: 100vh; height: 100dvh;
}
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(8px);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; min-width: 0;
  color: var(--text); }
.brand:hover { text-decoration: none; }
.logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
  color: var(--accent-ink); font: 700 20px/1 var(--serif);
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand .name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.brand .tag { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.actions { display: flex; align-items: center; gap: 4px; }
.actions .pill-btn { margin-right: 6px; }

/* ── stage and sources drawer ───────────────────────────────────────────────────────── */
/* The sources are a drawer: closed by default, opened by the Sources button, the "N sources"
   button under an answer, or any citation. Wide screens push the thread aside; narrow screens
   slide it over the thread with a scrim behind. */
.stage { position: relative; display: flex; min-height: 0; }
.column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.thread { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.thread-inner { max-width: 760px; margin: 0 auto; padding: 28px 22px 16px; }

.sources {
  width: var(--drawer); flex: none; display: none; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); min-height: 0;
}
.app[data-sources="open"] .sources { display: flex; }
.sources-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 8px 18px;
}
.sources-head h2 {
  margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-faint);
}
#sources { overflow-y: auto; padding: 4px 14px 24px; }
#sources .empty { margin: 4px 4px 0; color: var(--text-faint); font-size: 13.5px; line-height: 1.6; }
.scrim { display: none; }

/* ── welcome ────────────────────────────────────────────────────────────────────────── */
.welcome { padding: 18px 0 12px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.eyebrow {
  display: inline-block; margin: 0 0 14px; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.welcome h1 {
  margin: 0 0 12px; font: 600 clamp(26px, 3.6vw, 36px)/1.18 var(--serif);
  letter-spacing: -.01em; text-wrap: balance;
}
.welcome .lede { margin: 0 0 28px; color: var(--text-dim); font-size: 16px; max-width: 60ch; }

.suggest-head { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; }
.suggest-head h2 {
  margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-faint);
}
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.suggestion {
  display: flex; flex-direction: column; gap: 4px; padding: 13px 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.suggestion:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.s-topic { font-size: 11.5px; font-weight: 650; color: var(--accent); letter-spacing: .01em; }
.s-q { font-size: 14.5px; line-height: 1.45; color: var(--text); }

.features {
  list-style: none; margin: 30px 0 6px; padding: 18px 0 0; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
}
.features li { display: flex; flex-direction: column; gap: 3px; }
.f-icon {
  width: 30px; height: 30px; margin-bottom: 6px; border-radius: 9px;
  display: grid; place-items: center; font: 700 15px/1 var(--serif);
  background: var(--surface-2); color: var(--accent);
}
.features b { font-size: 13.5px; font-weight: 650; }
.features li > span:last-child { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }

/* ── messages ───────────────────────────────────────────────────────────────────────── */
.msg { margin-bottom: 30px; animation: rise .25s ease both; }
.msg.user {
  width: fit-content; max-width: 85%; margin-left: auto; padding: 11px 16px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 18px 18px 4px 18px; box-shadow: var(--shadow-sm);
}
.msg.user .body { font-weight: 520; }

.answer { font-size: 16px; line-height: 1.75; }
.answer p { margin: 0 0 14px; }
.answer p:last-child { margin-bottom: 0; }
.answer h3 {
  margin: 22px 0 8px; font-size: 16px; font-weight: 680;
  padding-left: 11px; border-left: 3px solid var(--accent);
}
.answer ol, .answer ul { margin: 0 0 14px; padding-left: 24px; }
.answer li { margin-bottom: 8px; padding-left: 2px; }
.answer li::marker { color: var(--accent); font-weight: 650; }
.answer strong { font-weight: 660; }
.answer code { font-family: var(--mono); font-size: .88em; background: var(--surface-2);
  padding: 1px 5px; border-radius: 5px; }
.answer a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* A citation chip. Its colour says what kind of source it points to. */
.cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 18px; padding: 0 5px; margin: 0 1px; vertical-align: 1px;
  border: 1px solid transparent; border-radius: 6px;
  font: 700 10.5px/1 var(--mono);
  background: var(--accent-soft); color: var(--statute);
  transition: border-color .15s, transform .15s;
}
button.cite:hover { border-color: currentColor; transform: translateY(-1px); }
.cite[data-cite^="G"] { background: var(--official-soft); color: var(--official); }
.cite[data-cite^="W"], .cite[data-cite^="E"] { background: var(--web-soft); color: var(--web); }

.cursor {
  display: inline-block; width: 7px; height: 16px; margin-left: 2px; vertical-align: -2px;
  background: var(--accent); border-radius: 1px; animation: blink 1.1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.answer.revising { opacity: .6; transition: opacity .25s ease; }
.answer.revising::after {
  content: "Updating with confirmed details…"; display: block; margin-top: 10px;
  font-size: 13px; color: var(--text-dim);
}

.verdict {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 12.5px; color: var(--text-faint);
}
.verdict .checked { display: inline-flex; align-items: center; gap: 5px; margin-right: auto; }
.verdict .checked:not(:empty)::before { content: "✓"; color: var(--accent); font-weight: 700; }
.verdict button {
  height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-dim); font-size: 12.5px;
}
.verdict button:hover, .verdict button[aria-pressed="true"] { color: var(--accent);
  border-color: var(--accent); }
.verdict .open-sources { color: var(--accent); font-weight: 600; }
.verdict .rate { display: flex; gap: 6px; }

/* ── research timeline ──────────────────────────────────────────────────────────────── */
.timeline {
  margin-bottom: 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.timeline > summary {
  display: flex; align-items: center; gap: 9px; padding: 10px 15px; list-style: none;
  cursor: pointer; user-select: none; font-size: 13.5px; color: var(--text-dim);
}
.timeline > summary::-webkit-details-marker { display: none; }
.timeline > summary::before {
  content: "›"; display: inline-block; font-size: 16px; color: var(--text-faint);
  transition: transform .15s;
}
.timeline[open] > summary::before { transform: rotate(90deg); }
.timeline .steps { padding: 0 15px 12px 32px; }
.step { display: flex; align-items: baseline; gap: 9px; padding: 3px 0; font-size: 13px; }
.step .dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--text-faint);
  transform: translateY(-1px); }
.step.running .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.step.done .dot { background: var(--statute); }
.step.error .dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }
.step .label { color: var(--text); white-space: nowrap; }
.step .detail { color: var(--text-faint); font-size: 12px; }
.step .q { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); overflow-wrap: anywhere; }

/* ── notices and cards ──────────────────────────────────────────────────────────────── */
.notice {
  display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; padding: 10px 14px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-faint);
  font-size: 13.5px; line-height: 1.55; color: var(--text-dim);
}
.notice.warn { border-left-color: var(--warn); color: var(--text);
  background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.notice.pause { border-left-color: var(--accent); color: var(--text); }
.notice .count, .queue-banner b { font-variant-numeric: tabular-nums; font-weight: 650;
  color: var(--accent); }

.safety {
  margin-bottom: 14px; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--danger); border-left-width: 4px;
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}
.safety h3 { margin: 0 0 6px; font-size: 14.5px; font-weight: 700; color: var(--danger); }
.safety p { margin: 0 0 10px; font-size: 14px; }
.helplines { display: flex; flex-wrap: wrap; gap: 6px; }
.helpline { padding: 4px 11px; border-radius: 999px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border); }
.helpline b { font-family: var(--mono); color: var(--danger); }

.procedure {
  margin-bottom: 16px; padding: 14px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--portal); box-shadow: var(--shadow-sm);
}
.procedure h3 { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--portal); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0;
  font-size: 14px; }
.facts dt { color: var(--text-faint); }
.facts dd { margin: 0; font-weight: 550; }
.procedure .portal { margin: 12px 0 0; font-weight: 600; }

/* ── source cards ───────────────────────────────────────────────────────────────────── */
.src {
  margin-bottom: 10px; padding: 12px 14px; scroll-margin-top: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .2s, box-shadow .2s;
}
.src.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.src .top { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.src .tier { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); }
.src[data-kind="statute"] .tier { color: var(--statute); }
.src[data-kind="official"] .tier { color: var(--official); }
.src[data-kind="web"] .tier { color: var(--web); }
.src .title { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 4px;
  overflow-wrap: anywhere; }
.src .domain { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono);
  overflow-wrap: anywhere; }
.src .snippet {
  font-size: 13px; line-height: 1.55; color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.src .meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 11px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-dim); }
.badge.force { background: var(--accent-soft); color: var(--statute); }
.badge.omitted { color: var(--warn); }
/* Jurisdiction is the loudest badge: it decides whether a provision applies to the reader at all,
   and a mismatch with the reader's own state reads as a warning, not a footnote. */
.badge.juris { font-weight: 650; }
.badge.juris.central { background: var(--accent-soft); color: var(--statute); }
.badge.juris.state { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.badge.juris.mismatch { background: var(--danger); color: var(--surface); }
.src.mismatch { border-color: var(--danger); }
.src .warn-line {
  margin-top: 8px; padding: 7px 10px; border-radius: 7px; font-size: 12.5px; line-height: 1.45;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent);
}

/* ── composer ───────────────────────────────────────────────────────────────────────── */
.composer { padding: 6px 22px 12px; }
.composer-inner { max-width: 760px; margin: 0 auto; }
.composer-box {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.composer-box:focus-within { border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft); }
textarea {
  display: block; width: 100%; min-height: 52px; max-height: 180px; padding: 15px 18px 4px;
  border: 0; background: transparent; resize: none; outline: none; line-height: 1.5;
  font-size: 15.5px;
}
textarea::placeholder { color: var(--text-faint); }
textarea:focus-visible { outline: none; }       /* the box around it shows focus instead */
textarea:disabled { opacity: .6; cursor: not-allowed; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px 10px; }

.segmented { display: flex; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.segmented button {
  height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent;
  color: var(--text-dim); font-size: 13px; font-weight: 550; transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm); }

.state-pick {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 4px 0 9px;
  border-radius: 10px; background: var(--surface-2); color: var(--text-dim);
}
.state-pick select {
  max-width: 190px; height: 32px; padding: 0 4px; border: 0; background: transparent;
  font-size: 13px; color: var(--text); cursor: pointer; outline: none;
}
.state-pick:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.hint { margin-left: auto; font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.send {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 0;
  border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  transition: background .15s, transform .1s;
}
.send:hover { background: var(--accent-hover); }
.send:active { transform: scale(.95); }
.send.stop { background: var(--danger); }
.send.stop svg { display: none; }
.send.stop::after { content: ""; width: 11px; height: 11px; border-radius: 2px; background: currentColor; }

.footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 8px;
  padding: 0 4px; font-size: 11.5px; color: var(--text-faint);
}
.footer .disclaimer { flex: 1; min-width: 220px; }
.footer .stat { font-variant-numeric: tabular-nums; white-space: nowrap; }
.footer .quota { font-size: 11.5px; padding: 2px 6px; }

/* ── dialogs ────────────────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: start center;
  padding: 6vh 16px; overflow-y: auto;
  background: rgba(20, 18, 15, .45); backdrop-filter: blur(2px);
  animation: fade .15s ease both;
}
@keyframes fade { from { opacity: 0; } }
.dialog {
  width: 100%; max-width: 460px; padding: 20px 24px 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-lg); animation: rise .2s ease both;
}
.dialog.wide { max-width: 880px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 8px; }
.dialog-head h2 { margin: 0; font: 600 22px/1.25 var(--serif); }
.dialog p { margin: 0 0 12px; }
.dim { color: var(--text-dim); font-size: 14px; }
.small { font-size: 13px; }

.step-title { display: flex; align-items: center; gap: 10px; margin: 22px 0 8px;
  font-size: 15.5px; font-weight: 680; }
.step-title .n {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 12.5px; font-weight: 700;
}
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode {
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2);
  border-top: 3px solid var(--accent);
}
.mode-standard { border-top-color: var(--official); }
.mode-deep { border-top-color: var(--portal); }
.mode h4 { margin: 0 0 4px; font-size: 15px; }
.mode h4 em { font-style: normal; font-weight: 500; font-size: 12px; color: var(--text-faint);
  margin-left: 4px; }
.mode p { margin: 0 0 10px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.mode dl { margin: 0; display: grid; gap: 4px; font-size: 12.5px; }
.mode dl div { display: flex; justify-content: space-between; gap: 8px; padding-top: 4px;
  border-top: 1px solid var(--border); }
.mode dt { color: var(--text-faint); }
.mode dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.always { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 14px;
  color: var(--text-dim); }
.always b { color: var(--text); }
.legend { margin: 0 0 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 22px; font-size: 13.5px; }
.legend div { display: flex; align-items: center; gap: 10px; }
.legend dt { flex: none; width: 92px; }
.legend dd { margin: 0; color: var(--text-dim); }
.legend-box { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); }
.legend-box.glance { border-left: 3px solid var(--portal); }

.reset-form { margin: 4px 0 14px; padding: 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); }
.reset-form label { display: block; margin-bottom: 8px; font-size: 13.5px; font-weight: 600; }
.reset-row { display: flex; gap: 8px; }
.reset-row input {
  flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.reset-row input:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.reset-msg { margin: 8px 0 0 !important; font-size: 13px; min-height: 1em; }
.reset-msg.bad { color: var(--danger); }
.reset-msg.good { color: var(--accent); }

/* ── responsive ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  /* The drawer slides over the thread instead of pushing it. */
  .sources {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 30;
    width: min(var(--drawer), 92vw); box-shadow: var(--shadow-lg);
  }
  .app[data-sources="open"] .scrim {
    display: block; position: absolute; inset: 0; z-index: 25;
    background: rgba(20, 18, 15, .3);
  }
}
@media (max-width: 820px) {
  .modes { grid-template-columns: 1fr; }
  .legend { grid-template-columns: 1fr; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hint { display: none; }
  .toolbar .send { margin-left: auto; }
}
@media (max-width: 600px) {
  .topbar { padding: 8px 10px; gap: 6px; }
  .brand .tag { display: none; }
  .actions .pill-btn .label { display: none; }
  .actions .pill-btn { padding: 0 10px; margin-right: 0; }
  .thread-inner { padding: 18px 14px 10px; }
  .suggestions { grid-template-columns: 1fr; }
  .features { display: none; }
  .composer { padding: 8px 10px 10px; }
  .state-pick select { max-width: 110px; }
  .segmented button { padding: 0 9px; }
  .footer .disclaimer { font-size: 11px; }
  .dialog { padding: 18px 16px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .thread { scroll-behavior: auto; }
}
