:root {
  /* Brand — from the Trinity leaf logo */
  --brand-green:      #05800E; /* primary: buttons, footnote numerals, active */
  --brand-green-dark: #006A08; /* hover / pressed */
  --brand-green-mid:  #298D0C; /* thinking dots */
  --brand-lime:       #8CB006; /* quote rules, arrows, eyebrows — decorative */
  --brand-gold:       #DFCD08; /* "silent" accent only */
  --brand-gradient: linear-gradient(115deg, #05800E 0%, #8CB006 55%, #DFCD08 100%);

  /* Paper layer (the "answer sheet" redesign) */
  --paper:      #F6F4EE; /* page background */
  --paper-card: #FFFDF8; /* cards, header bar, input, footnote rows */
  --paper-rail: #F1EFE8; /* contents rail, table group headers */
  --rule:       #E3E0D5; /* every 1px border */
  --rule-soft:  #EFEDE4; /* internal dividers inside a card */
  --quote-bg:   #F4F6EC; /* quoted bylaw text background */
  --cite-bg:    #E9F1DE; /* superscript chip + "N sources" chip fill */
  --cite-border:#D3E3C0; /* border on those chips */
  --warn-bg:    #FBF6D6; /* "bylaws are silent" chip fill */
  --warn-border:#EDE2A4;
  --warn-ink:   #7A6A08;
  --warn-row:   #FDFBEF; /* admin row tint for silent questions */

  /* Ink scale */
  --ink:   #20271E; /* primary text */
  --ink-2: #3A4136; /* quoted text */
  --ink-3: #5E6B58; /* secondary text */
  --ink-4: #8A9081; /* eyebrow labels, metadata */
  --ink-5: #9AA093; /* placeholder text */

  /* Existing tokens repointed to the paper palette so all current
     components (chat, reading page, admin) adopt the new look at once. */
  --bg:           var(--paper);
  --surface:      var(--paper-card);
  --surface-tint: var(--paper-rail);
  --border:       var(--rule);
  --text:         var(--ink);
  --text-muted:   var(--ink-3);
  --link:         #1C7A0B;
  --link-hover:   #006A08;

  --danger:     #B3261E;

  /* Fonts */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:  ui-monospace, Menlo, Consolas, monospace;

  --radius: 4px; /* paper reads squarer than the old 12px chat look */
  --shadow:    0 1px 2px rgba(15, 35, 10, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 35, 10, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* Mono eyebrow label used across the redesign */
.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-4);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ========== Landing page ========== */

/* ========== Masthead (paper header bar) ========== */
.masthead {
  background: var(--paper-card);
  border-bottom: 1px solid var(--rule);
}
/* Full-width bar: logo anchored to the left edge, nav to the right — not
   floating in a narrow centered column. */
.masthead__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 32px;
}
.masthead__logo {
  width: 34px; height: 34px;
  object-fit: contain;
  border-radius: 8px;
  flex: 0 0 auto;
}
.masthead__title { display: flex; flex-direction: column; min-width: 0; }
.masthead__name {
  font-family: var(--serif);
  font-size: 15px; font-weight: 600; line-height: 1.2;
  color: var(--ink);
}
.masthead__sub { font-size: 11.5px; line-height: 1.3; color: var(--ink-4); }
.masthead__nav { margin-left: auto; display: flex; gap: 6px; }
.masthead__read-link {
  display: none; /* shown as a button on mobile (see media query) */
  margin-left: auto;
}
/* Nav pills read as buttons: outlined when inactive, filled when active. */
.nav-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper-card);
  font-size: 13px; font-weight: 600;
  line-height: 1;
  text-align: center; text-decoration: none;
  color: var(--ink-3);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.nav-pill:hover { border-color: var(--brand-green); color: var(--brand-green-dark); }
.nav-pill.is-active {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #fff;
}

/* ========== Content column ========== */
.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 22px 24px 40px; /* horizontal gutter so content never touches edges */
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Hero header bar */
.page__hero {
  position: relative;
  background: var(--brand-green);
  color: #fff;
  border-radius: 0 0 16px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 0.25rem;
}
.page__hero-accent {
  height: 5px;
  background: var(--brand-gradient);
  border-radius: 16px 16px 0 0;
}
.page__hero-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.4rem;
}
.page__logo {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 6px;
}
.page__title-block { min-width: 0; }
.page__title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: #fff;
}
.page__subtitle {
  margin: 0.2rem 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.95rem;
}

/* Primary tabs (Ask / Read) inside the hero */
.page__tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0 1.4rem 0.9rem;
}
.page__tab {
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.12);
  transition: background 120ms ease, color 120ms ease;
}
.page__tab:hover { background: rgba(255, 255, 255, 0.22); }
.page__tab.is-active {
  background: #fff;
  color: var(--brand-green-dark);
}

/* Card sections */
.page__section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.3rem;
  margin: 0 1rem;
}
.page__section-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.page__section-note {
  margin: 0 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Downloads */
.page__download-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.download-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.download-btn:hover {
  border-color: var(--brand-green);
  background: var(--surface-tint);
}
.download-btn:active { transform: translateY(1px); }
.download-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brand-green);
  color: #fff;
  font-size: 1.15rem;
  flex: 0 0 auto;
  transition: background 120ms ease;
}
.download-btn:hover .download-btn__icon { background: var(--brand-green-dark); }
.download-btn__label { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.download-btn__label strong { font-size: 0.96rem; }
.download-btn__label small { font-size: 0.78rem; color: var(--text-muted); }

/* Chat inside landing card */
.page__chat-wrap { padding: 0.85rem; }
.page__chat-wrap .chat { padding: 0; gap: 0.65rem; }
/* Bound the message list so its own scrollbar engages (the auto-follow logic
   scrolls THIS element). Without a max-height the card just grows and the
   whole page scrolls instead, so long answers wouldn't follow the reveal. */
.page__chat-wrap .chat__messages { min-height: 360px; max-height: min(62vh, 560px); }

/* AI info card */
.page__info p {
  margin: 0.55rem 0;
  font-size: 0.95rem;
}
.page__info a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.page__info a:hover { color: var(--link-hover); }

.page__read-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.page__read-link:hover { color: var(--link-hover); }

.page__footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.25rem 1rem;
  font-style: italic;
}
.page__footer p { margin: 0.15rem 0; }
.page__translation {
  margin-top: 0.6rem !important;
  padding-top: 0.6rem;
  border-top: 1px solid var(--rule);
  font-style: normal;
  font-size: 0.8rem;
  max-width: 60ch;
  margin-left: auto; margin-right: auto;
}
.page__translation strong { color: var(--ink-3); font-style: normal; }
.page__version { font-style: normal; font-size: 0.76rem; opacity: 0.85; margin-top: 0.6rem; }

/* ========== Chat (shared) ========== */

.chat {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chat__messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  /* Disable browser scroll anchoring: when bubble innerHTML is replaced
     each reveal tick, anchor jumps can pull the reader around. */
  overflow-anchor: none;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 320px;
}

.chat__intro {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: auto 0;
  text-align: center;
  padding: 1rem;
}
.chat__intro p { margin: 0 0 0.5rem; }
.chat__intro-label { font-size: 0.875rem; margin-top: 0.9rem; }
.chat__intro em { color: var(--text); font-style: italic; }

.chat__suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.chat__suggestion {
  font: inherit;
  font-size: 0.875rem;
  color: var(--brand-green-dark);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.chat__suggestion:hover {
  border-color: var(--brand-green);
  background: #E4EFD6;
}
.chat__suggestion:active { transform: translateY(1px); }

.bubble {
  max-width: 85%;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 0.95rem;
  animation: bubbleIn 180ms ease-out;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble--user {
  align-self: flex-end;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-right-radius: 4px;
}
.bubble--assistant {
  align-self: flex-start;
  background: var(--surface-tint);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.bubble--error {
  background: #FDECEA;
  color: var(--danger);
  border: 1px solid #F5C6C2;
}

/* Markdown inside assistant bubbles */
.bubble--markdown { max-width: 92%; white-space: normal; }
.bubble--markdown > *:first-child { margin-top: 0; }
.bubble--markdown > *:last-child  { margin-bottom: 0; }

.bubble--markdown h1,
.bubble--markdown h2,
.bubble--markdown h3,
.bubble--markdown h4 {
  margin: 0.9rem 0 0.4rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.bubble--markdown h1 { font-size: 1.18rem; color: var(--brand-green-mid); }
.bubble--markdown h2 { font-size: 1.06rem; color: var(--brand-green-mid); }
.bubble--markdown h3 { font-size: 0.98rem; }
.bubble--markdown h4 { font-size: 0.95rem; color: var(--text-muted); }
.bubble--markdown p { margin: 0.45rem 0; }
.bubble--markdown ul,
.bubble--markdown ol { margin: 0.45rem 0; padding-left: 1.4rem; }
.bubble--markdown li { margin: 0.2rem 0; }
.bubble--markdown li > p { margin: 0.15rem 0; }
.bubble--markdown strong { font-weight: 700; }
.bubble--markdown em { font-style: italic; }
.bubble--markdown a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bubble--markdown a:hover { color: var(--link-hover); }
.bubble--markdown blockquote {
  margin: 0.6rem 0;
  padding: 0.5rem 0.95rem;
  border-left: 3px solid var(--brand-green);
  background: rgba(5, 128, 14, 0.06);
  color: var(--text);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}
.bubble--markdown blockquote p { margin: 0.15rem 0; }
.bubble--markdown code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}
.bubble--markdown pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}
.bubble--markdown pre code {
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
  font-size: 0.85rem;
}
.bubble--markdown table {
  border-collapse: collapse;
  margin: 0.6rem 0;
  font-size: 0.9rem;
  width: 100%;
  display: block;
  overflow-x: auto;
}
.bubble--markdown th,
.bubble--markdown td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.bubble--markdown th {
  background: var(--surface-tint);
  font-weight: 700;
  color: var(--text);
}
.bubble--markdown hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0.9rem 0;
}

/* Thinking-dots indicator */
.bubble--thinking {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.9rem 1rem;
  min-width: 60px;
}
.bubble--thinking::before,
.bubble--thinking::after,
.bubble--thinking span {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-green-mid);
  opacity: 0.4;
  animation: dotPulse 1.2s infinite ease-in-out;
}
.bubble--thinking span { animation-delay: 0.15s; }
.bubble--thinking::after { animation-delay: 0.3s; }
@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40%            { opacity: 1;   transform: scale(1); }
}

/* Input form */
.chat__form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  background: var(--surface);
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.chat__form textarea {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border: 0;
  background: transparent;
  resize: none;
  font: inherit;
  color: var(--text);
  min-height: 2.5rem;
  max-height: 12rem;
}
.chat__form textarea::placeholder { color: var(--text-muted); }
.chat__form textarea:focus { outline: none; }

.chat__send {
  padding: 0.65rem 1.15rem;
  background: var(--brand-green);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.chat__send:hover:not(:disabled) { background: var(--brand-green-dark); }
.chat__send:active:not(:disabled) { transform: translateY(1px); }
.chat__send:disabled,
.chat__form textarea:disabled { opacity: 0.5; cursor: not-allowed; }

.chat__privacy {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: center;
}
.chat__privacy strong { color: var(--text); }

.chat__noscript {
  margin: 0;
  padding: 0.75rem 1rem;
  background: #FDECEA;
  color: var(--danger);
  border-radius: 8px;
  text-align: center;
}

/* ========== Read the Bylaws ========== */

.bylaws {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.75rem;
  align-items: start;
}

/* Sticky table-of-contents sidebar */
.bylaws__toc {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding-right: 0.5rem;
  border-right: 1px solid var(--border);
}
.bylaws__toc-heading {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.bylaws__toc nav { display: flex; flex-direction: column; }
.bylaws__toc-link {
  display: block;
  padding: 0.18rem 0;
  font-size: 0.83rem;
  line-height: 1.35;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
  transition: color 120ms ease, border-color 120ms ease;
}
.bylaws__toc-link:hover { color: var(--brand-green-dark); border-left-color: var(--brand-green); }
.bylaws__toc-link--l1 { font-weight: 700; color: var(--text); margin-top: 0.5rem; }
.bylaws__toc-link--l2 { padding-left: 1rem; }
.bylaws__toc-link--l3 { padding-left: 1.6rem; font-size: 0.79rem; }

/* Toggle button — hidden on desktop, shown on mobile */
.bylaws__toc-toggle { display: none; }

/* The rendered document */
.bylaws__doc { min-width: 0; max-width: 68ch; }
.bylaws__note {
  margin: 0 0 1.5rem;
  padding: 0.7rem 0.95rem;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.bylaws__note a { color: var(--link); }
.bylaws__version {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
}

/* Document typography — headings get scroll-margin so deep-links land clear */
.bylaws__doc h1,
.bylaws__doc h2,
.bylaws__doc h3 { scroll-margin-top: 1rem; line-height: 1.25; }
.bylaws__doc h1 {
  font-size: 1.5rem;
  color: var(--brand-green-dark);
  margin: 2.4rem 0 0.9rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--surface-tint);
}
.bylaws__doc h1:first-child { margin-top: 0; }
.bylaws__doc h2 {
  font-size: 1.18rem;
  color: var(--brand-green-mid);
  margin: 1.9rem 0 0.6rem;
}
.bylaws__doc h3 {
  font-size: 1.02rem;
  color: var(--text);
  margin: 1.4rem 0 0.5rem;
}
.bylaws__doc p { margin: 0.7rem 0; }
.bylaws__doc ul,
.bylaws__doc ol { margin: 0.7rem 0; padding-left: 1.5rem; }
.bylaws__doc li { margin: 0.3rem 0; }
.bylaws__doc strong { font-weight: 700; color: var(--text); }
.bylaws__doc em { font-style: italic; }
.bylaws__doc a { color: var(--link); text-underline-offset: 2px; }
.bylaws__doc blockquote {
  margin: 1rem 0;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--brand-green);
  background: rgba(5, 128, 14, 0.05);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}
.bylaws__doc table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}
.bylaws__doc th,
.bylaws__doc td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.bylaws__doc th { background: var(--surface-tint); font-weight: 700; }
.bylaws__doc hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ========== Admin: question log ========== */

.admin {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
.admin__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin__title { margin: 0; font-size: 1.5rem; color: var(--brand-green-dark); }
.admin__sub { margin: 0.3rem 0 0; color: var(--text-muted); font-size: 0.92rem; max-width: 48ch; }
.admin__csv {
  flex: 0 0 auto;
  padding: 0.5rem 0.9rem;
  background: var(--brand-green);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}
.admin__csv:hover { background: var(--brand-green-dark); }
.admin__count { color: var(--text-muted); font-size: 0.9rem; margin: 1.25rem 0 0.5rem; }
.admin__empty {
  margin-top: 1.5rem;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.admin__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin__table th,
.admin__table td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.admin__table th {
  background: var(--surface-tint);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.admin__table tr:last-child td { border-bottom: 0; }
.admin__table tbody tr:hover { background: var(--surface-tint); }
.admin__col-when { white-space: nowrap; color: var(--text-muted); width: 1%; }
.admin__col-turn { text-align: center; color: var(--text-muted); width: 1%; }

@media (max-width: 560px) {
  .admin__col-when { white-space: normal; }
  .admin__table { font-size: 0.86rem; }
}

/* ========== Mobile ========== */

@media (max-width: 640px) {
  .page { gap: 0.75rem; padding: 0 0 1.25rem; }
  .page__hero-inner { padding: 1rem 1.1rem; gap: 0.85rem; }
  .page__logo { width: 52px; height: 52px; border-radius: 10px; }
  .page__title { font-size: 1.3rem; }
  .page__subtitle { font-size: 0.88rem; }
  .page__section { margin: 0 0.75rem; padding: 0.95rem 1.05rem; }
  .page__download-row { grid-template-columns: 1fr; gap: 0.5rem; }
  /* Taller chat on phones — it's the primary content, and there's no
     downloads block above it competing for the fold anymore. */
  .page__chat-wrap .chat__messages { min-height: 340px; max-height: min(58dvh, 520px); }
  .bubble { max-width: 92%; font-size: 0.93rem; }

  /* Touch targets: 44px minimum (Apple HIG / Material). */
  .page__tab { padding: 0.6rem 1rem; min-height: 44px; display: inline-flex; align-items: center; }
  .chat__suggestion { min-height: 44px; padding: 0.6rem 0.95rem; }
  .chat__send { min-height: 44px; }
  .download-btn { padding: 0.6rem 0.85rem; min-height: 44px; }
  .download-btn__icon { width: 32px; height: 32px; font-size: 1rem; }
}

@media (max-width: 760px) {
  /* Stack the reading layout; TOC becomes a collapsible panel */
  .bylaws { grid-template-columns: 1fr; gap: 0.75rem; }
  .bylaws__toc-toggle {
    display: block;
    width: 100%;
    padding: 0.6rem 0.9rem;
    font: inherit;
    font-weight: 600;
    text-align: left;
    color: var(--brand-green-dark);
    background: var(--surface-tint);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
  }
  .bylaws__toc {
    display: none;
    position: static;
    max-height: 50vh;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
  }
  .bylaws__toc.is-open { display: block; }
  .bylaws__toc-heading { display: none; }
  .bylaws__doc { max-width: none; }
}

@media (max-width: 420px) {
  .page__hero-inner { flex-direction: column; text-align: left; align-items: flex-start; }
  .page__title { font-size: 1.2rem; }
  .page__tabs { padding: 0 1.1rem 0.8rem; }
}

/* ========== Paper redesign: answer prose + mobile header ========== */

/* Assistant answers read as a document, not a chat bubble */
.bubble--markdown {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.62;
}
.bubble--markdown h1, .bubble--markdown h2, .bubble--markdown h3 { font-family: var(--serif); }

@media (max-width: 640px) {
  .masthead__inner { padding: 12px 18px; gap: 10px; }
  .masthead__nav { display: none; }
  .masthead__read-link {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 14px; min-height: 40px;
    border: 1px solid var(--rule); border-radius: 999px;
    background: var(--paper-card);
    color: var(--brand-green-dark); font-size: 13px; font-weight: 600;
    line-height: 1; text-align: center; text-decoration: none;
  }
  .bubble--markdown { font-size: 16px; line-height: 1.6; }
}

/* ============================================================
   Answer Sheet redesign — chat, answers, footnotes, drawer
   ============================================================ */

:focus-visible { outline: 2px solid var(--brand-green); outline-offset: 2px; }

.page__chat-wrap { padding: 0; margin: 0; background: none; border: 0; box-shadow: none; }
.chat { display: block; }
.chat__stream { display: flex; flex-direction: column; gap: 30px; }

/* --- Empty state --- */
.chat__empty-headline {
  font-family: var(--serif);
  font-size: 30px; font-weight: 400; line-height: 1.3;
  margin: 6px 0 10px; color: var(--ink);
}
.chat__empty-sub {
  font-size: 16px; line-height: 1.6; color: var(--ink-3);
  max-width: 52ch; margin: 0 0 24px;
}
.chat__empty-eyebrow { margin: 0 0 10px; }

.ask-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.ask-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  text-align: left; font: inherit; cursor: pointer;
  background: var(--paper-card); border: 1px solid var(--rule);
  border-radius: 4px; padding: 15px 18px;
  transition: border-color 120ms ease, background 120ms ease;
}
.ask-row:hover { border-color: var(--brand-green); background: #FBFAF4; }
.ask-row__q { flex: 1; font-family: var(--serif); font-size: 17px; color: var(--ink); }
.ask-row__hint { font-size: 11px; font-weight: 500; color: var(--ink-4); }
.ask-row__arrow { color: var(--brand-lime); font-size: 16px; }

.downloads-row { display: flex; gap: 10px; padding-top: 20px; border-top: 1px solid var(--rule); }
.downloads-row .download-btn { flex: 1; }

/* --- Composer --- */
.composer {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--paper-card); border: 1px solid #D8D4C6;
  border-radius: 6px; padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow-sm); margin-top: 22px;
}
.composer textarea {
  flex: 1; border: 0; background: transparent; resize: none;
  font: inherit; font-family: var(--sans); font-size: 15px; line-height: 1.5;
  color: var(--ink); min-height: 24px; max-height: 200px; padding: 9px 0;
}
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--ink-5); }
.composer__send {
  flex: 0 0 auto; background: var(--brand-green); color: #fff; border: 0;
  border-radius: 5px; font: inherit; font-size: 14px; font-weight: 600;
  padding: 13px 20px; cursor: pointer; transition: background 120ms ease;
}
.composer__send:hover:not(:disabled) { background: var(--brand-green-dark); }
.composer__send:disabled { opacity: .5; cursor: not-allowed; }

.chat__privacy { margin: 14px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--ink-4); text-align: center; }
.chat__privacy strong { color: var(--ink-3); }

/* --- Answer --- */
.answer { display: flex; flex-direction: column; }
.answer__eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.answer__eyebrow .hairline { flex: 1; height: 1px; background: var(--rule); }
.answer__q {
  font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1.25;
  margin: 0 0 12px; color: var(--ink); text-wrap: pretty;
}
.answer__meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.answer__spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 7px 12px; }
.chip--sources { color: var(--brand-green); background: var(--cite-bg); border: 1px solid var(--cite-border); }
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-green); }
.chip--corpus { color: var(--ink-4); background: var(--paper-card); border: 1px solid var(--rule); }
.chip--silent { color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-border); }
.chip--silent .chip__dot { background: var(--brand-gold); }

.btn { font: inherit; cursor: pointer; }
.btn--ghost {
  font-size: 12px; font-weight: 500; color: var(--ink-3);
  background: var(--paper-card); border: 1px solid var(--rule);
  border-radius: 6px; padding: 8px 12px; transition: border-color 120ms ease;
}
.btn--ghost:hover { border-color: var(--brand-green); }
.btn--outline, .btn--green {
  display: inline-block; font-size: 13px; font-weight: 600; text-align: center;
  text-decoration: none; border-radius: 6px; padding: 11px 14px;
}
.btn--outline { color: var(--ink); background: var(--paper-card); border: 1px solid var(--rule); }
.btn--outline:hover { border-color: var(--brand-green); }
.btn--green { color: #fff; background: var(--brand-green); border: 1px solid var(--brand-green); }
.btn--green:hover { background: var(--brand-green-dark); }

.answer__card {
  background: var(--paper-card); border: 1px solid var(--rule); border-radius: 4px;
  padding: 24px 30px 20px; box-shadow: var(--shadow);
  font-family: var(--serif); font-size: 17px; line-height: 1.62; color: var(--ink);
}
.answer__card > *:first-child { margin-top: 0; }
.answer__card > *:last-child { margin-bottom: 0; }

.cite-chip {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  color: var(--brand-green); background: var(--cite-bg);
  border-radius: 3px; padding: 2px 4px; margin-left: 3px;
  vertical-align: super; line-height: 1; cursor: pointer;
}
.cite-chip:hover { background: #DDEBCB; }

/* --- Footnotes --- */
.footnotes { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.footnotes .eyebrow { margin-bottom: 2px; }
.fn { background: var(--paper-card); border: 1px solid var(--rule); border-radius: 4px; transition: border-color 200ms ease; }
.fn--scripture { border-style: dashed; }
.fn--flash { border-color: var(--brand-lime); }
.fn__head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; user-select: none; }
.fn__head:hover { background: #FBF9F2; }
.fn__num {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-green); color: #fff;
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.fn--scripture .fn__num { background: #EAE7DB; color: var(--ink-3); }
.fn__title { flex: 1; font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--ink); }
.fn--scripture .fn__title { color: var(--ink-3); }
.fn__sign { width: 14px; text-align: center; font-size: 18px; color: var(--ink-4); }
.fn__body { display: none; padding: 0 16px 16px 50px; }
.fn.is-open .fn__body { display: block; }
.fn__quote {
  margin: 0 0 8px; background: var(--quote-bg);
  border-left: 3px solid var(--brand-lime); border-radius: 0 4px 4px 0;
  padding: 12px 16px; font-family: var(--serif); font-style: italic;
  font-size: 15px; line-height: 1.62; color: var(--ink-2);
}
.fn__foot { display: flex; gap: 16px; align-items: center; }
.fn__open { font: inherit; font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; }
.fn__ref { font-size: 12.5px; color: var(--ink-4); }

/* --- Thinking / error / wait states --- */
.thinking { background: var(--paper-card); border: 1px solid var(--rule); border-radius: 4px; padding: 18px 22px; }
.thinking__dots { display: flex; gap: 4px; margin-bottom: 12px; }
.thinking__dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-green-mid); animation: dotPulse 1.2s infinite ease-in-out; }
.thinking__dots span:nth-child(2) { animation-delay: .15s; }
.thinking__dots span:nth-child(3) { animation-delay: .3s; }
.thinking__status { font-size: 13px; font-weight: 500; color: var(--ink-3); margin: 0 0 12px; }
.thinking__skeleton { display: flex; flex-direction: column; gap: 9px; }
.thinking__skeleton i { display: block; height: 13px; border-radius: 2px; background: var(--rule-soft); }

.state { display: flex; gap: 12px; align-items: flex-start; border-radius: 4px; padding: 16px 20px; }
.state__title { font-size: 14px; font-weight: 700; margin: 0 0 2px; }
.state__body { font-size: 14px; line-height: 1.55; margin: 0; }
.state--error { background: #FDECEA; border: 1px solid #F5C6C2; }
.state--error .state__title { color: var(--danger); }
.state--error .state__body { color: #7A3A35; }
.state__icon { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.state--wait { background: var(--paper-card); border: 1px solid var(--rule); }
.state--wait .state__title { color: var(--ink); }
.state--wait .state__body { color: var(--ink-3); }
.state__ring { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--rule); border-top-color: var(--brand-lime); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Full-article drawer --- */
.drawer[hidden] { display: none; }
.drawer__scrim[hidden] { display: none; }
.drawer__scrim { position: fixed; inset: 0; background: transparent; z-index: 40; }
.drawer__panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 470px; max-width: 92vw;
  background: var(--paper-card); border-left: 1px solid #D8D4C6;
  box-shadow: -14px 0 34px rgba(15, 35, 10, .10);
  z-index: 41; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 220ms ease-out;
}
.drawer.is-open .drawer__panel { transform: translateX(0); }
.drawer__head { position: relative; padding: 20px 24px 14px; border-bottom: 1px solid var(--rule); }
.drawer__title { font-family: var(--serif); font-size: 17px; font-weight: 600; margin: 4px 0 0; color: var(--ink); }
.drawer__close { position: absolute; top: 16px; right: 18px; background: none; border: 0; font-size: 20px; color: var(--ink-4); cursor: pointer; }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px 24px; font-family: var(--serif); font-size: 15px; line-height: 1.66; color: var(--ink); }
.drawer__body h1 { font-size: 20px; }
.drawer__body h2, .drawer__body h3 { font-size: 15px; }
.drawer__dim { color: #9AA093; }
.drawer__cited { background: var(--quote-bg); border-left: 3px solid var(--brand-lime); border-radius: 0 4px 4px 0; padding: 10px 14px; color: var(--ink); }
.drawer__foot { display: flex; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--rule); }
.drawer__foot .btn { flex: 1; }
.drawer__loading { color: var(--ink-3); font-family: var(--sans); }

/* --- Phone --- */
@media (max-width: 640px) {
  .page { padding: 16px 18px 34px; gap: 0.85rem; }
  .answer__q { font-size: 21px; }
  .answer__card { padding: 18px 16px 14px; font-size: 16px; }
  .fn__body { padding: 0 14px 14px 44px; }
  .chat__empty-headline { font-size: 25px; }
  .ask-row { min-height: 44px; }
  .ask-row__q { font-size: 16px; }
  .downloads-row { flex-direction: column; }
  .composer { position: sticky; bottom: 8px; }
  .composer__send { min-height: 44px; }
  .drawer__panel {
    width: 100%; max-width: 100%; height: 72vh; top: auto; bottom: 0;
    border-left: 0; border-top: 1px solid #D8D4C6; border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  .drawer.is-open .drawer__panel { transform: translateY(0); }
}

/* --- Admin question log --- */
.admin__title { font-family: var(--serif); font-size: 27px; font-weight: 400; margin: 4px 0 8px; color: var(--ink); }
.admin__sub { font-size: 15px; line-height: 1.6; color: var(--ink-3); max-width: 62ch; margin: 0 0 22px; }
.admin__count { font-size: 12px; color: var(--ink-4); margin: 0 0 12px; }
.admin__empty { color: var(--ink-3); }

.stat-cards { display: flex; gap: 10px; margin-bottom: 26px; }
.stat-card { flex: 1; background: var(--paper-card); border: 1px solid var(--rule); border-radius: 4px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat-card--warn { background: var(--warn-bg); border-color: var(--warn-border); }
.stat-card__num { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--ink); }
.stat-card--warn .stat-card__num { color: var(--warn-ink); }
.stat-card__label { font-size: 12px; font-weight: 500; color: var(--ink-4); }
.stat-card--warn .stat-card__label { color: var(--warn-ink); }

.qgroups { display: flex; flex-direction: column; gap: 16px; }
.qgroup { background: var(--paper-card); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.qgroup__head { display: flex; align-items: center; gap: 12px; background: var(--paper-rail); border-bottom: 1px solid var(--rule-soft); padding: 14px 18px; }
.qgroup__name { font-size: 13px; font-weight: 600; color: var(--ink); flex: 1; }
.qgroup__count { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.qgroup__bar { width: 120px; height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.qgroup__bar i { display: block; height: 100%; background: var(--brand-green); border-radius: 3px; }
.qrow { display: flex; align-items: baseline; gap: 16px; padding: 12px 18px; border-top: 1px solid var(--rule-soft); }
.qrow:first-of-type { border-top: 0; }
.qrow--silent { background: var(--warn-row); }
.qrow__q { flex: 1; font-size: 15px; line-height: 1.5; color: var(--ink); }
.qrow__badge { display: inline-block; margin-left: 8px; font-size: 10.5px; font-weight: 600; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 3px; padding: 3px 6px; }
.qrow__meta { font-size: 12px; font-weight: 500; color: var(--ink-4); white-space: nowrap; }
.qrow__votes { display: inline-flex; gap: 8px; white-space: nowrap; }
.qrow__vote { font-size: 12px; font-weight: 600; color: var(--brand-green-dark); }
.qrow__vote--down { color: var(--danger); }
.qrow__badge--flag { color: var(--danger); background: #FDECEA; border-color: #F5C6C2; }
.qrow--flagged { background: var(--warn-row); }

/* Admin dashboard */
.admin__headrow { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.admin-cards { display: flex; gap: 12px; margin: 6px 0; flex-wrap: wrap; }
.admin-card {
  flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 20px; background: var(--paper-card); border: 1px solid var(--rule);
  border-radius: 4px; text-decoration: none; transition: border-color 120ms ease;
}
.admin-card:hover { border-color: var(--brand-green); }
.admin-card--attention { border-left: 3px solid var(--danger); }
.admin-card__title { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); }
.admin-card__desc { font-size: 13px; color: var(--ink-3); line-height: 1.5; }

@media (max-width: 640px) {
  .stat-cards { flex-direction: column; }
  .qrow { flex-wrap: wrap; gap: 4px 14px; }
  .qgroup__bar { display: none; }
}

/* --- Silent-state gap note --- */
.gap-note {
  margin-top: 14px; padding: 13px 16px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  font-size: 14px; line-height: 1.55; color: var(--ink-3);
}

/* --- Follow-up suggestion chips --- */
.followups { margin-top: 20px; }
.followups__label {
  display: block; margin-bottom: 8px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4);
}
.followups__row { display: flex; flex-wrap: wrap; gap: 8px; }
.followup {
  font: inherit; font-size: 13px; font-weight: 500; text-align: left;
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--paper-card); color: var(--ink);
  cursor: pointer; transition: border-color 120ms ease, color 120ms ease;
}
.followup:hover { border-color: var(--brand-green); color: var(--brand-green-dark); }

/* --- Was this helpful? --- */
.helpful { margin-top: 16px; display: flex; align-items: center; gap: 8px; }
.helpful__label { font-size: 13px; color: var(--ink-4); }
.helpful__btn {
  font-size: 16px; line-height: 1; padding: 6px 10px; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--paper-card);
}
.helpful__btn:hover { border-color: var(--brand-green); }
.helpful__thanks { font-size: 13px; font-weight: 600; color: var(--brand-green-dark); }

/* --- Flag for review (in an answer) --- */
.flagbox { margin-top: 14px; padding: 12px 14px; background: var(--paper-rail); border: 1px solid var(--rule); border-radius: 4px; }
.flagbox__label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 8px; }
.flagbox__reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.flagbox__reason, .flagbox__cancel {
  font: inherit; font-size: 12.5px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--paper-card); color: var(--ink); cursor: pointer;
}
.flagbox__reason:hover { border-color: var(--brand-green); color: var(--brand-green-dark); }
.flagbox__cancel { color: var(--ink-4); }
.flagbox__thanks { font-size: 13px; font-weight: 600; color: var(--brand-green-dark); }

/* --- Admin: flagged answers --- */
.flags { display: flex; flex-direction: column; gap: 12px; }
.flagcard { background: var(--paper-card); border: 1px solid var(--rule); border-left: 3px solid var(--ink-4); border-radius: 4px; padding: 14px 18px; }
.flagcard--needs_more { border-left-color: var(--brand-lime); }
.flagcard--incorrect, .flagcard--not_sound { border-left-color: var(--danger); }
.flagcard__head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.flagcard__reason { font-size: 12px; font-weight: 700; color: var(--ink); }
.flagcard--incorrect .flagcard__reason, .flagcard--not_sound .flagcard__reason { color: var(--danger); }
.flagcard__when { font-size: 12px; color: var(--ink-4); }
.flagcard__resolve { margin-left: auto; }
.flagcard__resolve button {
  font: inherit; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--paper-card); color: var(--ink-3); cursor: pointer;
}
.flagcard__resolve button:hover { border-color: var(--brand-green); color: var(--brand-green-dark); }
.flagcard__q { font-family: var(--serif); font-size: 16px; color: var(--ink); margin: 0 0 8px; }
.flagcard__reply summary { font-size: 12px; color: var(--link); cursor: pointer; }
.flagcard__reply-body { margin-top: 8px; font-size: 14px; line-height: 1.55; color: var(--ink-3); white-space: pre-wrap; }

/* --- Reading page: highlight the section you deep-linked to --- */
.bylaws__doc :target {
  background: var(--quote-bg);
  border-left: 3px solid var(--brand-lime);
  border-radius: 0 4px 4px 0;
  padding: 10px 14px;
  margin-left: -14px;
  scroll-margin-top: 1rem;
}
/* Current TOC entry (set by hash) */
.bylaws__toc-link.is-current { color: var(--brand-green-dark); border-left-color: var(--brand-green); font-weight: 600; }

/* --- Print --- */
@media print {
  .masthead, .composer, .chat__privacy, .page__footer,
  .chat__empty, .answer__meta, .drawer, .drawer__scrim { display: none !important; }
  .fn__body { display: block !important; }
  .answer__card, .fn { box-shadow: none; }
}
