/* Auden — the product stylesheet.
 *
 * Built to the Round 7 brand sheet, with the contrast adjustment in spec UI14 (SD2): the
 * mark keeps its red. Everything interactive is deep teal (SD21, 2026-10-03: the action red read
 * as warnings and over-budget; teal is calmer and sits opposite the mark's red).
 *
 * Softened 2026-10-03 at the sponsor's direction (SD17): "come across as a friendly CPA that
 * is here to help, a little less intimidating." Redrawn 2026-11-23 (SD33, round 2 of the
 * mockups): Inter, a side panel of conversations, a white page with cards, ink for the one
 * dark button per view, and bars that show how much of each budget is used. --line is for
 * dividers only (never text, never the edge of a control, which must stay at 3:1 and uses
 * --secondary).
 *
 * The colours below are the only ones in the product; tests/test_copy_rules.py fails on any
 * other, and checks every text/background pair in TEXT_PAIRS against WCAG AA.
 */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ground: #ffffff;       /* every page */
  --surface: #f3f2f2;      /* chips, table headers, tracks (the brand's ground) */
  --sidebar: #f8f8f7;      /* the side panel (SD33) */
  --line: #e5e2e2;         /* dividers only */
  --tint: #e6f1ef;         /* the reader's own messages: a light wash of the action teal */
  --ink: #201e1d;          /* type, the mark's record bars, the dark button */
  --mark: #26807a;         /* the mark's answer bar, and nothing else (SD22) */
  --action: #1f6b66;       /* links, within-budget bars, the brand's actions */
  --action-deep: #16524e;  /* links, hover */
  --alert: #ae1800;        /* over budget, and nothing else (SD22); always with words */
  --alert-tint: #fdecea;   /* behind an over-budget amount (SD33) */
  --secondary: #605d5d;    /* secondary text; the edges of controls */

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 46rem;
  --content: 56rem;
  --gutter: 1rem;
  --tap: 44px;
  --radius: 14px;
  --radius-sm: 10px;
  --pill: 999px;
  --divider: 1px solid var(--line);
  --edge: 1px solid var(--secondary);
  --shadow-sm: 0 1px 2px rgb(32 30 29 / 0.05);
  --shadow: 0 1px 2px rgb(32 30 29 / 0.04), 0 8px 24px rgb(32 30 29 / 0.07);
  --shadow-lg: 0 12px 40px rgb(32 30 29 / 0.18);
  --sidebar-w: 17rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "cv11" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------------------------------------------------------------- type */

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: 1.5rem; letter-spacing: -0.025em; }
h2 { font-size: 1.1875rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0 0 1em; max-width: var(--measure); }

/* Labels in sentence case: a quiet heading, not a stamp. */
.label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--secondary);
  margin-bottom: 0.25rem;
}

a { color: var(--action-deep); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }

code, kbd { font-family: ui-monospace, "SF Mono", monospace; font-size: 0.9em; }

:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: absolute; left: var(--gutter); top: -100px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--ground); padding: 0.5rem 0.75rem; z-index: 50;
}
.skip-link:focus { top: 0.5rem; }

.icon { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- the mark */

.mark { display: block; flex: none; }
.mark-ink { fill: var(--ink); }
.mark-ground { fill: var(--ground); }
.mark-accent { fill: var(--mark); }

.lockup { display: flex; align-items: center; gap: 0.7rem; }
.wordmark { font-weight: 650; font-size: 2.25rem; letter-spacing: -0.045em; line-height: 1; }
.brand-line { font-weight: 600; font-size: 1.125rem; letter-spacing: -0.015em; line-height: 1.35; margin: 0.75rem 0 0; }
.lockup-block { max-width: var(--measure); margin: 1rem auto 2.5rem; }

/* ---------------------------------------------------------------- the shell (UI38) */

/* Signed out: the mark alone. */
.masthead {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.6rem var(--gutter); border-bottom: var(--divider); background: var(--ground);
}
.masthead-mark { display: flex; align-items: center; min-height: var(--tap); min-width: var(--tap); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--tap); height: var(--tap); border-radius: 12px; border: 0;
  background: transparent; color: var(--ink); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); }

/* The side panel: brand, new question, search, the areas, then conversations by day. */
.sidebar {
  display: flex; flex-direction: column; gap: 0.25rem;
  background: var(--sidebar); border-right: var(--divider);
  padding: 0.75rem 0.75rem 0.75rem;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 0.25rem 0.5rem 0.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; min-height: var(--tap); color: var(--ink); text-decoration: none; }
.brand-name { font-weight: 650; font-size: 1.125rem; letter-spacing: -0.03em; }
.new-question {
  display: flex; align-items: center; gap: 0.5rem; min-height: 40px; padding: 0 0.85rem;
  border-radius: var(--radius-sm); background: var(--action); color: var(--ground);
  font-weight: 600; font-size: 0.9375rem; text-decoration: none; box-shadow: var(--shadow-sm);
}
.new-question:hover { background: var(--action-deep); color: var(--ground); }
.side-search {
  position: relative; display: flex; align-items: center; margin: 0.35rem 0 0.5rem;
}
.side-search .icon { position: absolute; left: 0.7rem; color: var(--secondary); pointer-events: none; }
.side-search input[type="search"] {
  width: 100%; min-height: 38px; padding: 0.4rem 2.6rem 0.4rem 2.2rem; font-size: 0.875rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--ground);
}
.side-search input[type="search"]:focus { border-color: var(--secondary); outline: none; box-shadow: 0 0 0 3px var(--tint); }
.shortcut {
  position: absolute; right: 0.55rem; font-size: 0.6875rem; color: var(--secondary);
  border: 1px solid var(--line); border-radius: 5px; padding: 0 0.3rem; background: var(--sidebar);
}
.topnav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.topnav a, .side-list a {
  display: flex; align-items: center; gap: 0.6rem; min-height: 36px; padding: 0.3rem 0.65rem;
  border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 0.9375rem;
}
.topnav a { font-weight: 500; }
.topnav a .icon { color: var(--secondary); }
.topnav a[aria-current="page"] { background: var(--ground); font-weight: 600; box-shadow: var(--shadow-sm); }
.topnav a:hover, .side-list a:hover { background: var(--surface); }
.side-lists { flex: 1; overflow-y: auto; margin: 0.5rem -0.25rem 0; padding: 0 0.25rem; min-height: 0; }
.side-label { margin: 0.9rem 0 0.2rem; padding: 0 0.65rem; font-size: 0.75rem; font-weight: 600; color: var(--secondary); }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list a { display: block; font-size: 0.875rem; min-height: 0; padding: 0.4rem 0.65rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-list a[aria-current="page"] { background: var(--ground); box-shadow: var(--shadow-sm); font-weight: 600; }
.side-empty, .side-more { font-size: 0.8125rem; color: var(--secondary); padding: 0 0.65rem; margin: 0.75rem 0 0; }

.account { position: relative; border-top: var(--divider); padding-top: 0.5rem; margin-top: 0.25rem; }
.account summary {
  display: flex; align-items: center; gap: 0.6rem; min-height: var(--tap); padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm); cursor: pointer; list-style: none;
}
.account summary:hover { background: var(--surface); }
.account summary::-webkit-details-marker { display: none; }
.account summary .icon { color: var(--secondary); margin-left: auto; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%; background: var(--tint); color: var(--action-deep);
  font-weight: 700; font-size: 0.8125rem;
}
.account-text { display: flex; flex-direction: column; min-width: 0; }
.account-school { font-weight: 600; font-size: 0.8125rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { font-size: 0.75rem; color: var(--secondary); line-height: 1.3; }
.account-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 0.4rem); z-index: 25;
  background: var(--ground); border: var(--divider); border-radius: var(--radius); padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.account-menu p { margin: 0 0 0.6rem; overflow-wrap: anywhere; font-size: 0.875rem; }
.account-email { color: var(--secondary); }

.app-main { min-width: 0; }
.topbar { display: none; }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgb(32 30 29 / 0.32); }
.scrim[hidden] { display: none; }

@media (min-width: 60rem) {
  body.has-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; }
  .sidebar-close { display: none; }
}

/* Phone and small windows: a top bar; the side panel slides in over the page. */
@media (max-width: 59.99rem) {
  .topbar {
    display: flex; align-items: center; gap: 0.25rem; position: sticky; top: 0; z-index: 20;
    padding: 0.25rem 0.4rem; padding-top: calc(0.25rem + env(safe-area-inset-top));
    background: rgb(255 255 255 / 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: var(--divider);
  }
  .topbar-mark { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.45rem; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -0.03em; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(20rem, 86vw);
    transform: translateX(-102%); visibility: hidden; box-shadow: var(--shadow-lg);
    transition: transform 0.22s ease, visibility 0.22s;
    padding-top: calc(0.75rem + env(safe-area-inset-top));
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
  body.sidebar-open .sidebar { transform: none; visibility: visible; }
  .shortcut { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------------------------------------------------------------- page body */

main { display: block; padding: 1.75rem var(--gutter) 3rem; }
main:focus { outline: none; }
.panel { max-width: var(--measure); margin: 0 auto 1.5rem; }
.panel + .panel { padding-top: 1.5rem; border-top: var(--divider); }
@media (min-width: 60rem) { main { padding: 2rem 2.5rem 3rem; } }

.not-advice { font-size: 0.8125rem !important; line-height: 1.5;
  max-width: var(--content); margin: 2rem auto 0; padding-top: 0.75rem;
  border-top: var(--divider); color: var(--secondary);
}

/* ---------------------------------------------------------------- controls */

button, input, select, textarea { font: inherit; color: inherit; }

.button-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: var(--tap); padding: 0 1.25rem; border-radius: 12px;
  background: var(--action); color: var(--ground);
  border: 0; font-weight: 600; font-size: 1rem; cursor: pointer; text-decoration: none;
}
.button-primary:hover { background: var(--action-deep); color: var(--ground); }

/* The one dark button in a view: send, and export (SD33). */
.button-dark {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 38px; padding: 0 0.95rem; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--ground); border: 0;
  font-weight: 600; font-size: 0.875rem; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.button-dark:hover { background: var(--action-deep); color: var(--ground); }

.button-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 38px; padding: 0 0.95rem; border-radius: var(--radius-sm);
  background: var(--ground); color: var(--ink); border: var(--edge);
  font-weight: 600; font-size: 0.875rem; text-decoration: none; cursor: pointer;
}
.button-secondary:hover { background: var(--surface); color: var(--ink); }

.tool-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 36px; padding: 0 0.7rem;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--ground);
  color: var(--ink); font-size: 0.8125rem; font-weight: 500; cursor: pointer;
}
.tool-btn:hover { background: var(--surface); }
.tool-btn[hidden] { display: none; }
.tool-btn.is-on { background: var(--tint); border-color: var(--tint); color: var(--action-deep); font-weight: 600; }
.tool-btn.is-on .icon { fill: currentColor; }

.link-button {
  background: none; border: 0; padding: 0; min-height: var(--tap);
  color: var(--action-deep); text-decoration: underline; cursor: pointer;
}

.choice-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.5rem; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%;
  min-height: var(--tap); padding: 0.8rem 1rem; border-radius: var(--radius);
  background: var(--ground); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  text-align: left; cursor: pointer;
}
.choice:hover { border-color: var(--secondary); }
.choice-title { font-weight: 600; }
.choice-detail { color: var(--secondary); font-size: 0.875rem; overflow-wrap: anywhere; }
.signin-school h2 { margin-top: 1.5rem; }

/* ---------------------------------------------------------------- forms */

.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;
}
.field-label { display: block; font-weight: 600; margin: 1.25rem 0 0.35rem; }
.hint { color: var(--secondary); font-size: 0.875rem; margin: 0.35rem 0 0; }
.field-error { font-weight: 600; margin: 0.35rem 0 0; }
/* The edge of a control keeps 3:1 against the page (WCAG 1.4.11), so it uses --secondary. */
textarea, select, input[type="date"], input[type="search"] {
  width: 100%; min-height: var(--tap); padding: 0.6rem 0.85rem;
  background: var(--ground); border: var(--edge); border-radius: var(--radius-sm);
}
textarea { resize: vertical; line-height: 1.5; }
textarea[aria-invalid="true"] { border-width: 2px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.about-row { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; margin-top: 0.5rem; }
.about-row select { flex: 1 1 14rem; width: auto; }
.about-row input[type="date"] { flex: 1 1 10rem; width: auto; }
.about-or { color: var(--secondary); font-size: 0.875rem; }
.actions { margin-top: 1.25rem; display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.actions-split form { margin: 0; }
.radio { display: flex; align-items: center; gap: 0.6rem; min-height: var(--tap); }
.radio input { width: 1.25rem; height: 1.25rem; accent-color: var(--action); }

/* The warning against personal data sits beside the box from the first load (NF6, UI1). */
.data-warning {
  margin: 0 0 0.5rem; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm);
  background: var(--surface);
}

.dev-note { max-width: var(--content); margin: 1.25rem auto 0; color: var(--secondary); font-size: 0.8125rem; }
.dev-note summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; }
.matches { padding-left: 1.25rem; }

/* ---------------------------------------------------------------- answers */

.question-text { font-size: 1.0625rem; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.governing { color: var(--secondary); font-size: 0.875rem; }
.governing strong { color: var(--ink); font-weight: 600; }
/* Equal standing (UI3): every verdict is set the same way, so a refusal or a conflict
   reads as a result, not a failure. */
.verdict {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; font-weight: 600;
  color: var(--secondary); margin: 0 0 0.5rem;
}
.verdict::before {
  content: ""; width: 18px; height: 18px; flex: none; border-radius: 6px; background: var(--tint);
  box-shadow: inset 0 0 0 5px var(--tint), inset 0 0 0 9px var(--action);
}
/* UI39: the body is set as the blocks the model wrote it in — paragraphs, section
   labels, steps, quoted policy text. One slab of text with asterisks in it was the
   answer the demo showed; this is the same answer, read in a glance. */
.answer-body { font-size: 1.0625rem; line-height: 1.6; }
.answer-body > * { margin: 0 0 0.75rem; }
.answer-body > :last-child { margin-bottom: 0; }
.answer-body h3 {
  font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.01em; line-height: 1.35;
  color: var(--ink); margin: 1.5rem 0 0.4rem;
}
.answer-body h3:first-child { margin-top: 0; }
.answer-body ul, .answer-body ol { padding-left: 1.4rem; }
.answer-body li { margin-bottom: 0.4rem; }
.answer-body li:last-child { margin-bottom: 0; }
.answer-body li::marker { color: var(--secondary); font-weight: 600; }
.answer-body strong { font-weight: 650; }
/* Policy text quoted inside the answer, set apart from the sentences about it. */
.answer-body blockquote {
  padding: 0.1rem 0 0.1rem 0.9rem; border-left: 2px solid var(--line); color: var(--secondary);
}
.answer-body blockquote p { margin: 0; }
.needed, .rule {
  margin: 1rem 0 0; padding: 0.9rem 1rem; border-radius: var(--radius-sm); background: var(--surface);
}
.needed p:last-child, .rule p:last-child { margin-bottom: 0; }

/* F7, printed rather than blocking (2026-11-24): one line under the answer, marked in the
   colour that already means "money wants your attention" on this page. It used to be a
   card over the answer with a button on it, which is a notice a reader dismisses rather
   than reads. */
.obligates {
  display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.9rem 0 0.25rem;
  font-size: 0.9375rem; line-height: 1.5; color: var(--secondary);
}
.obligates svg { flex: none; margin-top: 0.2rem; }
.obligates strong { color: var(--ink); font-weight: 600; }

/* Sources: numbered cards (UI38.5). */
.source-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; counter-reset: source; }
.source {
  position: relative; padding: 0.9rem 1rem 0.9rem 3rem; background: var(--ground);
  border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 0; counter-increment: source;
}
.source::before {
  content: counter(source); position: absolute; left: 1rem; top: 0.95rem;
  display: inline-flex; align-items: center; justify-content: center; width: 1.375rem; height: 1.375rem;
  border-radius: 6px; background: var(--surface); font-size: 0.75rem; font-weight: 700; color: var(--ink);
}
.source .label { margin: 0 0 0.1rem; font-size: 0.75rem; }
.source-title { font-weight: 600; margin: 0; }
.source-where { color: var(--secondary); font-size: 0.875rem; margin: 0.15rem 0 0.6rem; }
.source blockquote {
  margin: 0 0 0.6rem; padding: 0 0 0 0.85rem; border-left: 3px solid var(--line);
  overflow-wrap: anywhere; font-size: 0.9375rem;
}
.source-date { font-size: 0.8125rem; margin: 0; color: var(--secondary); }
.state { display: block; margin-top: 0.25rem; color: var(--ink); }
.state-warn { font-weight: 700; }
@media (min-width: 48rem) {
  .side-by-side { grid-template-columns: 1fr 1fr; }
}

.sources-wrap { margin-top: 1rem; }
.sources-wrap > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.4rem; min-height: var(--tap); }
.sources-wrap > summary::-webkit-details-marker { display: none; }
.sources-wrap > summary::before {
  content: "›"; display: inline-block; width: 1rem; font-weight: 600; transition: transform 0.15s;
}
.sources-wrap[open] > summary::before { transform: rotate(90deg); }
.sources-heading { margin: 0; font-size: 0.9375rem; font-weight: 600; }
.lines-heading { margin: 1.25rem 0 0.5rem; font-size: 1rem; }
/* UI36, UI38.3: Spent and On order open their lines beside the answer. */
.figure-link {
  color: inherit; text-decoration: underline dotted; text-decoration-color: var(--action);
  text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.figure-link:hover { color: var(--action-deep); text-decoration-style: solid; }
.record { margin-top: 0.75rem; font-size: 0.75rem; }

/* The figures' exports, as small cards. */
.export-cards { list-style: none; margin: 0.75rem 0; padding: 0; display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.export-card { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.7rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.export-kind { font-size: 0.75rem; font-weight: 600; color: var(--secondary); }
.export-file { font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.export-date { font-size: 0.8125rem; color: var(--secondary); }

/* ---------------------------------------------------------------- the chat (UI28) */

.chat { max-width: var(--content); margin: 0 auto; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1rem;
  flex-wrap: wrap; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: var(--divider);
}
.chat-title { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; min-width: 0; flex: 1 1 18rem; overflow-wrap: anywhere; }
.chat-actions { display: flex; align-items: center; gap: 0.5rem 0.9rem; flex-wrap: wrap; font-size: 0.875rem; }
.as-of-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 30px; padding: 0 0.7rem;
  border-radius: var(--pill); background: var(--surface); font-size: 0.8125rem; font-weight: 500;
}
.thread { display: flex; flex-direction: column; gap: 1.25rem; padding-bottom: 1rem; }
.msg { min-width: 0; }
.msg p:last-child { margin-bottom: 0; }

/* The reader's messages: soft, on the right. */
.msg-user {
  align-self: flex-end; max-width: 80%; padding: 0.65rem 1rem;
  background: var(--tint); color: var(--ink);
  border-radius: 18px 18px 6px 18px;
}
.msg-user .question-text { font-size: 1rem; font-weight: 500; margin: 0; }
.msg-who { margin: 0 0 0.1rem; font-size: 0.75rem; font-weight: 600; color: var(--secondary); }

/* Answers: open on the page, with room to read (SD33: no box around them). */
.msg-answer { align-self: stretch; padding: 0.25rem 0 0.5rem; }
.msg-answer .governing { margin-bottom: 0.2rem; }

/* Messages from the product itself: a quiet note in the middle. */
.msg-product {
  align-self: center; max-width: 92%; padding: 0.8rem 1.1rem;
  background: var(--surface); border-radius: var(--radius);
}

.chip-list { list-style: none; margin: 0.25rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip-list form { margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: var(--tap); padding: 0.45rem 1rem;
  background: var(--ground); color: var(--ink); border: var(--edge); border-radius: var(--pill);
  font-weight: 500; text-align: left; cursor: pointer;
}
.chip:hover { background: var(--surface); }
.simpler-form { margin: 0; }
.permalink { margin-left: 0.25rem; }
.pending { border: 1px dashed var(--secondary); border-radius: var(--radius); padding: 1rem 1.15rem; }

/* UI38.6: while an answer is on its way — one block, the same before and after the
   server replies: the steps stack up, the current one shimmering, each ticked when done. */
.typing { display: none; }
.typing.htmx-request, .htmx-request .typing { display: block; animation: rise 0.28s cubic-bezier(.2,.7,.2,1) both; }
.think { align-self: stretch; overflow: hidden; padding: 0.15rem 0; cursor: pointer; }
.typing { margin-bottom: 1rem; }
.think-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.think-steps li { display: flex; align-items: center; gap: 0.6rem; font-size: 0.875rem; color: var(--secondary); }
.think-steps li.is-now { animation: rise 0.28s cubic-bezier(.2,.7,.2,1) both; }
.think-icon { position: relative; flex: none; width: 16px; height: 16px; border-radius: 50%; }
.is-now .think-icon { border: 2px solid var(--line); border-top-color: var(--action); animation: spin 0.8s linear infinite; }
.is-done .think-icon { background: var(--tint); }
.is-done .think-icon::after {
  content: ""; position: absolute; left: 5px; top: 3px; width: 4px; height: 7px;
  border: solid var(--action); border-width: 0 1.75px 1.75px 0; transform: rotate(45deg);
}
.is-done .think-text { color: var(--secondary); }
.shimmer {
  color: var(--ink);
  background: linear-gradient(90deg, var(--secondary) 0%, var(--secondary) 35%, var(--ink) 50%, var(--secondary) 65%, var(--secondary) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; animation: shimmer 1.8s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* The answer filling in: parts fade up one after another; the words a few at a time. */
.rise-in { animation: rise 0.34s cubic-bezier(.2,.7,.2,1) both; }
.word-in { animation: fade-in 0.22s ease-out both; }
.filling > :not(.governing):not(.verdict):not(.headline):not(.answer-body) { visibility: hidden; }
.msg-user.enter { animation: rise 0.24s cubic-bezier(.2,.7,.2,1) both; }
@media (prefers-reduced-motion: reduce) {
  .typing.htmx-request, .htmx-request .typing, .think-steps li.is-now, .rise-in, .word-in, .msg-user.enter { animation: none; }
  .is-now .think-icon, .shimmer { animation: none; }
}

/* The message box: a floating card at the bottom of the conversation. */
.composer {
  position: sticky; bottom: 0; z-index: 10; padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgb(255 255 255 / 0), var(--ground) 1.25rem);
}
.composer-warning { font-size: 0.875rem; padding: 0.45rem 0.8rem; margin-bottom: 0.5rem; }
.composer-row {
  display: flex; gap: 0.25rem; align-items: flex-end; position: relative;
  background: var(--ground); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 0.35rem;
}
.composer-row:focus-within { border-color: var(--secondary); }
.composer-row textarea {
  flex: 1; min-height: var(--tap); max-height: 12rem; border: 0; border-radius: 12px;
  padding: 0.65rem 0.6rem; background: transparent;
}
.composer-row textarea:focus { outline: none; }
/* UI35: the microphone. While listening it fills, and its label says how to stop. The ring
   round it follows the voice (--level, 0 to 1, set by the script), so it is plain whether it
   hears you; it used to pulse on a timer, which looked the same whether or not it did. */
.mic {
  flex: none; width: var(--tap); height: var(--tap); border-radius: 12px; border: 0;
  background: transparent; color: var(--ink); display: inline-flex; align-items: center;
  justify-content: center; cursor: pointer;
}
.mic .icon, .change-date .icon { width: 20px; height: 20px; }
.mic:hover { background: var(--surface); }
.mic.listening { background: var(--action); color: var(--ground);
  box-shadow: 0 0 0 calc(2px + var(--level, 0) * 10px) rgb(31 107 102 / 0.18);
  transition: box-shadow 90ms linear; }
.mic:disabled { cursor: progress; opacity: 0.6; }
@media (prefers-reduced-motion: reduce) { .mic.listening { transition: none; } }
.mic-status:empty, .char-count:empty { display: none; }
.mic-status, .char-count { margin: 0.35rem 0 0; }
.composer-send {
  flex: none; width: var(--tap); height: var(--tap); min-height: 0; padding: 0; border-radius: 12px;
  background: var(--ink);
}
.composer-send:hover { background: var(--action-deep); }
.composer-send .icon { width: 18px; height: 18px; stroke-width: 2.2; }
/* UI34.4: the date choice is a calendar button in the box; its panel opens above. */
.change-date { flex: none; position: static; }
.change-date summary {
  list-style: none; cursor: pointer; min-width: var(--tap); height: var(--tap); padding: 0 0.6rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; border-radius: 12px;
  color: var(--ink); font-size: 0.8125rem; font-weight: 600;
}
.change-date summary::-webkit-details-marker { display: none; }
.change-date summary:hover, .change-date[open] summary { background: var(--surface); }
.date-chosen:empty { display: none; }
.date-panel {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 0.5rem); z-index: 12;
  background: var(--ground); border: var(--divider); border-radius: var(--radius);
  padding: 0.9rem 1rem; box-shadow: var(--shadow);
}
.date-panel .label { margin: 0; }
.date-panel .hint { margin: 0.2rem 0 0.5rem; }
@media (max-width: 47.99rem) {
  .composer-row {
    display: grid; grid-template-columns: auto auto 1fr auto; gap: 0.25rem;
    grid-template-areas: "box box box box" "date mic . send"; align-items: center;
  }
  .composer-row textarea { grid-area: box; min-height: calc(3em + 1.3rem); }
  .composer-row .change-date { grid-area: date; }
  .composer-row .mic { grid-area: mic; }
  .composer-row .composer-send { grid-area: send; }
  .composer .hint:not(.mic-status):not(.char-count) { display: none; }
  .msg-user { max-width: 92%; }
}

/* ---------------------------------------------------------------- home (UI38.1) */

.is-home { display: flex; flex-direction: column; padding-top: clamp(0rem, 6vh, 4rem); }
.is-home .composer { position: static; background: none; padding-top: 0.5rem; }
.home-hero { max-width: 40rem; }
.status-pill {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 28px; padding: 0 0.75rem;
  border-radius: var(--pill); background: var(--tint); color: var(--action-deep);
  font-size: 0.8125rem; font-weight: 600; margin: 0 0 1.1rem;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--action); }
.greeting { font-size: clamp(1.75rem, 4.2vw, 2.375rem); font-weight: 650; letter-spacing: -0.035em; line-height: 1.12; margin: 0 0 0.6rem; }
.greeting-ask { color: var(--secondary); font-weight: 600; }
.home-intro { color: var(--secondary); margin: 0 0 1.25rem; max-width: 36rem; }
.home-below { display: grid; gap: 2rem; margin-top: 1.75rem; }
.home-heading { font-size: 0.875rem; font-weight: 600; color: var(--secondary); letter-spacing: 0; margin: 0 0 0.65rem; }
.continue {
  display: block; padding: 0.75rem 1rem; border-radius: var(--radius);
  background: var(--ground); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.continue:hover { border-color: var(--secondary); color: var(--ink); }
.continue .label { display: block; margin: 0; color: var(--action-deep); }
.continue-question { display: block; font-weight: 600; overflow-wrap: anywhere; }

.pin-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.pin-card {
  display: flex; flex-direction: column; gap: 0.4rem; height: 100%; padding: 0.95rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--ground);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.pin-card:hover { color: var(--ink); border-color: var(--secondary); box-shadow: var(--shadow); }
.pin-question { font-size: 0.875rem; font-weight: 500; color: var(--secondary); line-height: 1.35; }
.pin-figure { font-size: 1.375rem; font-weight: 650; letter-spacing: -0.025em; }
.pin-meta { font-size: 0.8125rem; color: var(--secondary); }

.ask-rows { list-style: none; margin: 0; padding: 0; border-top: var(--divider); }
.ask-rows li { border-bottom: var(--divider); }
.ask-rows form { margin: 0; }
.ask-row.chip {
  width: 100%; justify-content: space-between; border: 0; border-radius: 0; background: none;
  padding: 0.7rem 0.25rem; min-height: 48px; font-weight: 500;
}
.ask-row.chip:hover { background: none; color: var(--action-deep); }
.ask-row .icon { color: var(--secondary); transition: transform 0.15s; }
.ask-row:hover .icon { transform: translateX(3px); color: var(--action-deep); }

/* ---------------------------------------------------------------- history */

.tabs { display: flex; gap: 0.25rem; margin: 0 0 1.5rem; flex-wrap: wrap; padding: 3px; border-radius: 12px; background: var(--surface); width: fit-content; }
.tabs a {
  display: flex; align-items: center; min-height: 36px; padding: 0 1rem; border-radius: 9px;
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.875rem;
}
.tabs a[aria-current="page"] { background: var(--ground); font-weight: 600; box-shadow: var(--shadow-sm); }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: var(--divider); }
.history-item, .transfer {
  display: block; padding: 0.8rem 0.5rem; min-height: var(--tap);
  color: var(--ink); text-decoration: none; border-bottom: var(--divider);
}
a.history-item:hover { background: var(--sidebar); color: var(--ink); }
.history-question { display: block; font-weight: 600; overflow-wrap: anywhere; }
.history-meta { display: block; color: var(--secondary); font-size: 0.8125rem; margin-top: 0.2rem; }
.history-verdict { color: var(--ink); font-weight: 600; }
.tag { font-weight: 600; color: var(--ink); }
.empty { color: var(--secondary); }
.filter-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.filter-wide { grid-column: 1 / -1; }
.log-filters { margin-bottom: 1.5rem; }
.history-search { margin: 0 0 1rem; }
.history-search input { border-radius: 12px; padding-left: 1rem; }
.history-group { font-size: 0.8125rem; font-weight: 600; color: var(--secondary); margin: 1.5rem 0 0.4rem; }
.history-latest { display: block; font-size: 0.875rem; color: var(--ink); margin-top: 0.15rem; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- the totals card (UI38.4) */

.metric-card {
  margin: 0.75rem 0 1rem; padding: 0.35rem 0.4rem 0.9rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--ground); box-shadow: var(--shadow-sm);
}
.summary-frame { margin: 0; border: 0; }
.summary { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.summary th { font-size: 0.8125rem; font-weight: 500; color: var(--secondary); text-align: left; padding: 0.6rem 0.75rem 0.1rem; }
.summary td { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.025em; padding: 0.05rem 0.75rem 0.6rem; white-space: nowrap; }
.summary .over, .figures .over, .over-text, .used-pct.over-text { color: var(--alert); }
.summary .forecast { font-style: italic; }
.metric-bar { padding: 0 0.75rem; }
.stacked { display: block; width: 100%; height: 10px; border-radius: var(--pill); overflow: hidden; }
.metric-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; align-items: center; margin: 0.6rem 0 0; max-width: none; font-size: 0.8125rem; color: var(--secondary); }
.key { display: inline-flex; align-items: center; gap: 0.4rem; }
.key::before { content: ""; width: 10px; height: 10px; border-radius: 3px; }
.key-in::before { background: var(--action); }
.key-over::before { background: var(--alert); }
.key-order::before { background: repeating-linear-gradient(45deg, var(--action) 0 1.5px, var(--tint) 1.5px 4px); }
.metric-used { margin-left: auto; font-weight: 600; color: var(--ink); }
@media (max-width: 47.99rem) {
  /* A 2 x 2 grid of labelled totals; the header row's labels move onto each figure. */
  .summary thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .summary tbody tr { display: grid; grid-template-columns: 1fr 1fr; }
  .summary td { display: block; padding: 0.5rem 0.75rem; font-size: 1.125rem; white-space: normal; }
  .summary td::before { content: attr(data-label); display: block; font-size: 0.75rem; font-weight: 500; letter-spacing: 0; color: var(--secondary); }
  .metric-used { margin-left: 0; }
}

/* Bars. */
.usage { display: block; width: 100%; height: 7px; border-radius: var(--pill); overflow: hidden; }
.usage-track { fill: var(--surface); }
.usage-in, .bar-in { fill: var(--action); }
.usage-over, .bar-over { fill: var(--alert); }
.hatch-ground { fill: var(--tint); }
.hatch-line { fill: var(--action); }

/* ---------------------------------------------------------------- figure tables */

/* The filter, the search and the sort (scripts only). */
.figures-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0 0.25rem; }
.figures-tools[hidden] { display: none; }
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface); gap: 2px; }
.segmented button {
  min-height: 32px; padding: 0 0.8rem; border: 0; border-radius: 8px; background: transparent;
  font-size: 0.8125rem; font-weight: 500; color: var(--ink); cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--ground); font-weight: 600; box-shadow: var(--shadow-sm); }
.segmented .count { color: var(--secondary); font-weight: 500; margin-left: 0.15rem; }
.tool-search { position: relative; display: inline-flex; align-items: center; flex: 1 1 12rem; max-width: 20rem; }
.tool-search .icon { position: absolute; left: 0.65rem; color: var(--secondary); pointer-events: none; }
.tool-search input[type="search"] { min-height: 38px; padding: 0.35rem 0.75rem 0.35rem 2.1rem; font-size: 0.875rem; border-radius: var(--radius-sm); }
.tool-sort select { min-height: 38px; padding: 0.35rem 2rem 0.35rem 0.75rem; font-size: 0.875rem; width: auto; border-radius: var(--radius-sm); }
.figures-none[hidden] { display: none; }

/* Wide tables scroll inside their own frame, never the page (UI12). */
.table-frame { overflow-x: auto; margin: 0.75rem 0 1rem; border-radius: var(--radius-sm); }
.figures { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
.figures th, .figures td { padding: 0.65rem 0.65rem; border-bottom: var(--divider); vertical-align: middle; text-align: left; }
.figures thead th {
  background: none; font-size: 0.75rem; font-weight: 600; color: var(--secondary);
  line-height: 1.25; border-bottom: var(--divider); vertical-align: bottom; padding-top: 0.25rem;
}
.figures .group { text-align: center; }
.figures .num { text-align: right; white-space: nowrap; }
.figures tbody th { font-weight: 600; min-width: 15rem; }
.figures tbody tr:not(.group-row):hover { background: var(--sidebar); }
.figures tbody tr.row-selected { background: var(--tint); }
.figures tfoot th, .figures tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--secondary); }
/* A forecast is never set like an actual: own column group, italic, ruled off. */
.figures .forecast, .figures .group-forecast { font-style: italic; border-left: 1px solid var(--secondary); }
.figures .over {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: var(--pill);
  background: var(--alert-tint); font-weight: 600;
}
.group-row th {
  padding: 1.1rem 0.65rem 0.45rem; font-size: 0.8125rem; font-weight: 500; color: var(--secondary);
  background: var(--ground); border-bottom: var(--divider);
}
.group-name { font-weight: 650; color: var(--ink); }
.group-name.over-text { color: var(--alert); }
.figures .col-used { width: 9.5rem; min-width: 8rem; }
.used { display: flex; align-items: center; gap: 0.5rem; }
.used .usage { flex: 1; }
.used-pct { font-size: 0.75rem; font-weight: 600; min-width: 2.6rem; text-align: right; color: var(--secondary); white-space: nowrap; }
.col-phone { display: none; }
.row-name { display: block; }
.row-key { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--secondary); }
.row-flag { display: block; font-size: 0.8125rem; font-weight: 600; margin-top: 0.2rem; }
.provenance { font-size: 0.875rem; padding-left: 1.25rem; }
.provenance li { margin-bottom: 0.35rem; overflow-wrap: anywhere; }
.narrow { display: none; }

/* Phone (SD33): each account is a card — its name and what's over or left, the bar, then
   spent, budget and on order on one line. */
@media (max-width: 47.99rem) {
  .answer-figures thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .answer-figures tbody tr:not(.group-row) {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.45rem 0.75rem;
    padding: 0.85rem 0.1rem; border-bottom: var(--divider);
  }
  .answer-figures tbody tr:not(.group-row):hover { background: none; }
  .answer-figures tbody tr > * { border: 0; padding: 0; }
  .answer-figures tbody th { min-width: 0; overflow-wrap: anywhere; }
  .answer-figures td.col-budget, .answer-figures td.col-spent, .answer-figures td.col-order,
  .answer-figures td.col-fc, .answer-figures td.col-give { display: none; }
  .answer-figures td[class="num"] { grid-column: 2; grid-row: 1; align-self: start; font-weight: 600; }
  .answer-figures td.col-used { grid-column: 1 / -1; width: auto; }
  .answer-figures td.col-phone {
    display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; grid-column: 1 / -1;
    font-size: 0.8125rem; color: var(--secondary);
  }
  .col-phone a, .col-phone b { color: var(--ink); font-weight: 600; }
  .answer-figures .group-row { display: block; }
  .answer-figures .group-row th { display: block; padding: 1rem 0.1rem 0.35rem; }
  .figures .row-key { font-size: 0.75rem; }
  .wide { display: none; }
  .narrow { display: inline; }
  .tool-search { max-width: none; }
}

/* ---------------------------------------------------------------- the side panel (UI38.3) */

.side-panel {
  position: fixed; z-index: 35; top: 0; right: 0; bottom: 0; width: min(36rem, 100vw);
  background: var(--ground); box-shadow: var(--shadow-lg); border-left: var(--divider);
  display: flex; flex-direction: column; animation: panel-in 0.22s ease;
}
.side-panel[hidden] { display: none; }
.side-panel-body { flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem 2rem; outline: none; }
@keyframes panel-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .side-panel { animation: none; } }
@media (max-width: 47.99rem) {
  /* On a phone, a sheet from the bottom. */
  .side-panel {
    top: auto; left: 0; width: auto; height: 90vh; height: 90dvh; border-left: 0;
    border-radius: 22px 22px 0 0; animation-name: sheet-in;
  }
  .side-panel::before {
    content: ""; display: block; width: 38px; height: 5px; border-radius: var(--pill);
    background: var(--line); margin: 8px auto 0; flex: none;
  }
  .side-panel-body { padding: 0.75rem 1.15rem calc(1.5rem + env(safe-area-inset-bottom)); }
}
.side-panel-body.is-loading { opacity: 0.5; }

.panel-head { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.75rem; }
.panel-titles { flex: 1; min-width: 0; }
.panel-tools { display: flex; gap: 0.15rem; margin: -0.35rem -0.6rem 0 0; }
.panel-kicker { margin: 0 0 0.2rem; font-size: 0.75rem; font-weight: 650; color: var(--action-deep); letter-spacing: 0.02em; text-transform: uppercase; }
.panel-title { margin: 0; font-size: 1.1875rem; letter-spacing: -0.02em; }
.panel-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.25rem 0.6rem; margin: 0.25rem 0 0.25rem; }
.panel-amount { font-size: 2rem; font-weight: 650; letter-spacing: -0.035em; line-height: 1.15; }
.panel-of { font-size: 0.875rem; color: var(--secondary); }
.panel-check { margin: 0.25rem 0 1rem; font-size: 0.8125rem; }
.panel-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 0 0 1.25rem; }
.panel-find { max-width: none; }
.panel-section { padding: 1rem 0 0.25rem; border-top: var(--divider); }
.panel-heading { font-size: 0.875rem; font-weight: 650; margin: 0 0 0.35rem; }
.panel-section > .hint { margin: 0 0 0.75rem; font-size: 0.8125rem; }
.month-chart { margin: 0.25rem 0 0.75rem; }
.month-bars { display: block; width: 100%; height: 110px; overflow: visible; }
.month-bars rect { rx: 1; }
.pace-line { stroke: var(--secondary); stroke-width: 1; stroke-dasharray: 3 2.5; vector-effect: non-scaling-stroke; }
.month-labels { display: grid; grid-template-columns: repeat(12, 1fr); list-style: none; margin: 0.3rem 0 0; padding: 0; }
.month-labels li { text-align: center; font-size: 0.6875rem; color: var(--secondary); }
.vendor-list { list-style: none; margin: 0.25rem 0 0.75rem; padding: 0; display: grid; gap: 0.6rem; }
.vendor-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; align-items: baseline; }
.vendor-name { font-size: 0.875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vendor-amount { font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.vendor-count { color: var(--secondary); font-weight: 400; }
.vendor-bar { grid-column: 1 / -1; display: block; width: 100%; height: 6px; border-radius: var(--pill); overflow: hidden; }
.month-group { margin-bottom: 0.25rem; }
.month-head {
  display: flex; justify-content: space-between; align-items: baseline; max-width: none;
  margin: 0.75rem 0 0; padding: 0.35rem 0; border-bottom: var(--divider);
  font-size: 0.8125rem; font-weight: 650;
}
.month-head span:last-child { color: var(--secondary); font-weight: 600; }
.panel-lines .line-item:first-child { border-top: 0; }
.lines-none[hidden] { display: none; }
.figure-lines { max-width: 40rem; }

/* ---------------------------------------------------------------- print */

@media print {
  .sidebar, .topbar, .scrim, .side-panel, .skip-link, .composer, .chat-actions, .simpler-form,
  .next-steps, .next-label, .answer-actions, .figures-tools, .home-below { display: none !important; }
  body, body.has-shell { background: none; display: block; }
  main { padding: 0; }
  /* SD28: printing one answer prints that question and answer only. */
  body.print-one .thread > :not(.print-target), body.print-one .chat-head,
  body.print-one .dev-note, body.print-one .show-all, body.print-one .typing { display: none !important; }
  .metric-card { box-shadow: none; }
}

/* ---------------------------------------------------------------- cleaner answers (UI34) */

.headline { font-size: clamp(1.375rem, 2.6vw, 1.75rem); font-weight: 650; line-height: 1.22; letter-spacing: -0.03em; margin: 0 0 0.6rem; max-width: 44rem; }
.worked { margin: 0.25rem 0 0.5rem; font-size: 0.9375rem; }
.worked summary, .figures-wrap > summary {
  cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--secondary); font-weight: 500; font-size: 0.875rem; list-style: none;
}
.worked summary:hover, .figures-wrap > summary:hover { color: var(--ink); }
.worked summary::-webkit-details-marker, .figures-wrap > summary::-webkit-details-marker { display: none; }
.worked summary::before, .figures-wrap > summary::before { content: "›"; display: inline-block; width: 0.8rem; transition: transform 0.15s; }
.worked[open] summary::before, .figures-wrap[open] > summary::before { transform: rotate(90deg); }
.worked ul { margin: 0 0 0.5rem; padding-left: 1.2rem; color: var(--ink); }
.worked li { margin-bottom: 0.3rem; }
.figures-wrap { margin-top: 0.25rem; }

.line-list { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.line-item { padding: 0.6rem 0; border-top: 1px solid var(--line); }
.line-item[hidden] { display: none; }
.line-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; margin: 0; font-weight: 600; font-size: 0.9375rem; max-width: none; }
.line-who { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.line-amount { white-space: nowrap; }
.line-tag {
  font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.55rem; border-radius: var(--pill);
  background: var(--surface); color: var(--secondary); white-space: nowrap;
}
.tag-open { color: var(--action-deep); }
.line-meta { margin: 0.1rem 0 0; font-size: 0.8125rem; color: var(--secondary); overflow-wrap: anywhere; max-width: none; }
.show-all { margin: 0.25rem 0 0.75rem; min-height: 36px; font-size: 0.875rem; }

/* SD28, UI38: next steps under the newest answer, as a list to pick from. */
.next-label { margin: 1.25rem 0 0.25rem; }
.next-steps { margin-top: 0.75rem; flex-direction: column; gap: 0; border-top: var(--divider); }
.next-steps li { border-bottom: var(--divider); }
.next-steps .chip {
  width: 100%; justify-content: space-between; min-height: 44px; padding: 0.55rem 0.25rem;
  border: 0; border-radius: 0; background: none; font-size: 0.9375rem; font-weight: 500;
}
.next-steps .chip .icon { color: var(--secondary); transition: transform 0.15s; }
.next-steps .chip:hover { background: none; color: var(--action-deep); }
.next-steps .chip:hover .icon { transform: translateX(3px); color: var(--action-deep); }
.next-label + .next-steps { margin-top: 0; }

.answer-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 1rem 0 0; font-size: 0.875rem; }
.answer-actions form { margin: 0; }
.answer-actions .export-link { margin-left: auto; }
@media (max-width: 47.99rem) { .answer-actions .export-link { margin-left: 0; } }

/* Rows the filter or "show all" hides stay hidden whatever their layout. */
.answer-figures tr[hidden], .month-group[hidden] { display: none !important; }
.home-hero[hidden], .home-below[hidden] { display: none; }

/* ---------------------------------------------------------------- signed out (UI38) */

body.public { background: var(--sidebar); min-height: 100vh; min-height: 100dvh; }
body.public .masthead { border-bottom: 0; background: transparent; padding: 0.75rem 1.25rem; }
.public-main { padding: 1.5rem var(--gutter) 3rem; }
body.public .panel {
  max-width: 34rem; margin: 2rem auto; padding: 1.75rem; background: var(--ground);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}

/* Sign in: the brand on the left, the choice on the right; stacked on a phone. */
.signin {
  display: grid; gap: 2rem; max-width: 64rem; margin: 0 auto;
  min-height: calc(100vh - 4.5rem); min-height: calc(100dvh - 4.5rem); align-content: center;
}
@media (min-width: 60rem) {
  .signin { grid-template-columns: minmax(0, 1fr) minmax(0, 30rem); gap: 4rem; align-items: start; padding-top: 6vh; }
  .signin-brand { position: sticky; top: 14vh; }
}
.signin-brand .lockup { gap: 0.8rem; }
.signin-brand .brand-line { font-size: clamp(1.5rem, 3vw, 2.125rem); font-weight: 650; letter-spacing: -0.035em; line-height: 1.15; margin: 1.5rem 0 0; max-width: 24rem; }
.signin-points { list-style: none; margin: 1.75rem 0 0; padding: 0; display: grid; gap: 0.9rem; max-width: 26rem; }
.signin-points li { display: flex; gap: 0.75rem; align-items: flex-start; color: var(--secondary); font-size: 0.9375rem; line-height: 1.45; }
.signin-points .icon {
  flex: none; width: 34px; height: 34px; padding: 8px; border-radius: 10px;
  background: var(--ground); border: 1px solid var(--line); color: var(--action-deep);
}
.signin-card {
  background: var(--ground); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 1.75rem 1.5rem 1.25rem;
}
.signin-card h1 { font-size: 1.625rem; letter-spacing: -0.03em; margin: 0 0 0.4rem; }
.signin-card .status-pill { margin-bottom: 0.9rem; }
.signin-intro { color: var(--secondary); font-size: 0.9375rem; margin: 0 0 0.5rem; }
.signin-card .code-input { margin-bottom: 0.25rem; width: 100%; }
/* Step one of the demo sign-in: the code, on its own page. The button is full width and
   under the field because it is the only thing to do here — beside the input it read as
   an afterthought on a form rather than the door it is. */
.code-continue {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; min-height: 48px; margin-top: 0.9rem; padding: 0.7rem 1rem;
  border: 1px solid transparent; border-radius: 12px; cursor: pointer;
  background: var(--action-deep); color: var(--ground);
  font: inherit; font-weight: 600; letter-spacing: -0.01em;
  transition: filter 0.15s, box-shadow 0.15s;
}
.code-continue:hover { filter: brightness(1.08); box-shadow: var(--shadow-sm); }
.code-continue .icon { transition: transform 0.15s; }
.code-continue:hover .icon { transform: translateX(3px); }
.signin-school { margin-top: 1.25rem; }
.signin-school h2 { font-size: 0.8125rem; font-weight: 600; color: var(--secondary); letter-spacing: 0; margin: 0 0 0.4rem; }
.role-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.role-choice {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; min-height: 60px;
  padding: 0.65rem 0.85rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--ground); text-align: left; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.role-choice:hover { border-color: var(--secondary); box-shadow: var(--shadow-sm); }
.role-choice:hover .icon { transform: translateX(3px); color: var(--action-deep); }
.role-choice .avatar { width: 36px; height: 36px; font-size: 0.875rem; }
.role-choice > .icon { color: var(--secondary); transition: transform 0.15s; }
.role-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.role-name { font-weight: 600; font-size: 0.9375rem; }
.role-sees { font-size: 0.8125rem; color: var(--ink); line-height: 1.35; }
.role-email { font-size: 0.75rem; color: var(--secondary); overflow-wrap: anywhere; }
@media (max-width: 47.99rem) {
  .signin { min-height: 0; gap: 1.5rem; padding-top: 0.5rem; }
  .signin-points { display: none; }
  .signin-brand .brand-line { margin-top: 0.75rem; }
  .signin-card { padding: 1.25rem 1rem 1rem; }
}

/* A transfer answer's tiles are the listed source accounts, not the transferable total.
   Quiet, directly under the bar, where someone comparing two figures is looking. */
.metric-footnote {
  margin: 0.6rem 0 0; color: var(--secondary); font-size: 0.8125rem; line-height: 1.45;
}
