/* All styling lives in this file. No style="" anywhere: the CSP has no 'unsafe-inline'
   for styles, and tests/guards.test.mjs keeps it that way.

   Tokens: spec section 7, look C (the P1 prototype). Navy ink and an amber light on a pale
   warm grey; in dark mode the amber becomes the primary colour. Orange-red marks "above
   usual", blue marks "arrived / verified": orange vs blue, never red vs green.
   The B12 accessibility pass re-checks every pair at 4.5:1. */

/* Self-hosted (SIL Open Font License; the license files sit next to them in fonts/), the
   Latin subset, each one variable file. Both carry tabular figures (tnum), so amounts line up
   digit under digit. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F3F3EE;
  --surface: #FFFFFF;
  --sunk: #EAEBE4;
  --ink: #161D33;
  --ink-2: #434C61;
  --ink-3: #586073;
  --line: #DCDDD5;
  --primary: #1E3558;
  --on-primary: #FFFFFF;
  --amber: #F2B544;
  --amber-soft: #FBECC8;
  --amber-ink: #7A4F00;
  --warm: #AF4614;
  --warm-soft: #F8E2D5;
  --cool: #285F8F;
  --cool-soft: #DDE8F2;
  --liz-ink: #1E3558;
  /* Home's calendar (look C): a past day filled by what went out, in four steps, and the
     day number's colour on each. tests/contrast.test.mjs checks every pair at 4.5:1. */
  --fill-1: #DDE3EC;
  --fill-2: #B8C5D8;
  --fill-3: #4F6788;
  --fill-4: #1E3558;
  --on-fill-1: #161D33;
  --on-fill-2: #161D33;
  --on-fill-3: #FFFFFF;
  --on-fill-4: #FFFFFF;
  /* The gate screens' backdrop (decoration, never under text that needs it): the light
     behind Liz and the month-ahead motif's two shades. */
  --glow: #FBECC8;
  --motif-1: #DDE3EC;
  --motif-2: #B8C5D8;

  /* Figures and headings in Bricolage Grotesque (tabular), text in Atkinson Hyperlegible Next. */
  --font-figures: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  --font-text: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 16px;
  --radius-sm: 10px;
  --pad: 16px;
  --gap: 12px;
  --tap: 48px;
  --col: 640px;
  --tabbar-h: 64px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1220;
    --surface: #161C2B;
    --sunk: #1E2537;
    --ink: #EEF0F5;
    --ink-2: #BCC2CF;
    --ink-3: #A0A7B6;
    --line: #2A3245;
    --primary: #F2B544;
    --on-primary: #161D33;
    --amber: #F2B544;
    --amber-soft: #3B311C;
    --amber-ink: #F5C969;
    --warm: #F2925F;
    --warm-soft: #3A251D;
    --cool: #93C2EA;
    --cool-soft: #1C2C40;
    --liz-ink: #DCE4F2;
    --fill-1: #3B311C;
    --fill-2: #6B5424;
    --fill-3: #C2903A;
    --fill-4: #F2B544;
    --on-fill-1: #EEF0F5;
    --on-fill-2: #EEF0F5;
    --on-fill-3: #161D33;
    --on-fill-4: #161D33;
    --glow: #1C2440;
    --motif-1: #1E2537;
    --motif-2: #2E3954;
    color-scheme: dark;
  }
}

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

html, body { margin: 0; }

/* The page ground reaches every edge in both modes, html included: with viewport-fit=cover
   Android draws the page behind its gesture bar and status area, and anything not painted
   there shows as a pale strip in dark mode. */
html { background-color: var(--bg); min-height: 100%; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.5;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

a { color: var(--cool); }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* Feel native, not like a web page (owner, 2026-11-02): no browser tap flash anywhere (Android
   paints a blue block on every tapped control), no double-tap zoom delay, no text selection on
   controls. A press shows as a quick dim + slight press-in instead. Keyboard focus keeps the
   amber ring above. */
html, * { -webkit-tap-highlight-color: transparent; }
a, button, summary, label, select, [role="button"], [role="tab"], input[type="checkbox"], input[type="radio"] {
  touch-action: manipulation;
}
button, summary, [role="button"], [role="tab"] {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button, summary, [role="button"], [role="tab"] {
  transition: transform 90ms ease-out, opacity 90ms ease-out;
}
button:active:not(:disabled), summary:active, [role="button"]:active, [role="tab"]:active {
  opacity: 0.72;
  transform: scale(0.98);
}
@media (prefers-reduced-motion: reduce) {
  button, summary, [role="button"], [role="tab"] { transition: none; }
  button:active:not(:disabled), summary:active, [role="button"]:active, [role="tab"]:active { transform: none; }
}

.skip {
  position: absolute;
  left: var(--pad);
  top: -100px;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.skip:focus { top: var(--pad); }

/* Top bar: the name, and Settings behind the person button (spec 6). */
.head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: calc(8px + env(safe-area-inset-top)) var(--pad) 8px;
  background: var(--bg);
}
.head__brand {
  color: var(--ink);
  font-family: var(--font-figures);
  font-weight: 700;
  text-decoration: none;
}
.head__settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  color: var(--ink-2);
}
.head__icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* Screens */
.view { display: block; max-width: var(--col); margin: 0 auto; padding: 0 var(--pad) var(--pad); }
.view:focus { outline: none; }
.screen__title { font-family: var(--font-figures); font-size: 1.75rem; margin: 8px 0 var(--gap); }
.empty { color: var(--ink-2); margin: 0 0 var(--gap); }
.build { color: var(--ink-3); font-size: 0.875rem; font-variant-numeric: tabular-nums; }

.block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: var(--gap);
}
.number__label { margin: 0 0 4px; color: var(--ink-2); font-weight: 700; }

/* Liz beside her line (spec 4 and 8): small, never in the way of the number. */
.liz-line { display: flex; align-items: center; gap: var(--gap); margin-bottom: var(--gap); }
.liz-line__text { margin: 0; color: var(--ink-2); }
.liz-mark { flex: none; width: 40px; height: 40px; }
.liz-mark__stroke { fill: none; stroke: var(--liz-ink); stroke-width: 3.2; stroke-linecap: round; transition: stroke 300ms ease; }
.liz-mark__dot {
  fill: var(--amber);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 450ms cubic-bezier(0.3, 0.7, 0.2, 1), fill 300ms ease;
}
.liz-mark--big { width: 64px; height: 64px; }

/* Her moods (liz/mood.js): only the dot moves, and only because the app's state changed.
   The art is swappable: screens ask for "Liz in mood X" (data-mood), nothing else.
   Reduced motion: the global rule below stops every transition and the thinking loop, so
   each mood is a still position. */
.liz-mark[data-mood="pleased"] .liz-mark__dot { transform: translate(0, -6px); }
.liz-mark[data-mood="concerned"] .liz-mark__dot { transform: translate(0, 3px); fill: var(--warm); }
.liz-mark[data-mood="heads-up"] .liz-mark__dot { transform: translate(-1px, -19px); animation: liz-pop 600ms ease-out 1; }
.liz-mark[data-mood="listening"] .liz-mark__dot { transform: translate(0, -12px) scale(1.25); }
.liz-mark[data-mood="thinking"] .liz-mark__dot { transform: translate(0, -5px); animation: liz-think 1.4s ease-in-out infinite alternate; }
.liz-mark[data-mood="offline"] .liz-mark__dot { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
.liz-mark[data-mood="offline"] .liz-mark__stroke { stroke: var(--ink-3); }
@keyframes liz-think { from { transform: translate(0, 0); } to { transform: translate(0, -10px); } }
@keyframes liz-pop { 0% { transform: translate(-1px, -19px) scale(0.6); } 60% { transform: translate(-1px, -19px) scale(1.2); } 100% { transform: translate(-1px, -19px) scale(1); } }

/* The Liz tab (ui/liz-screen.js): her mood and its reason, the chat, the box to ask in. */
.liz-head { display: flex; align-items: center; gap: var(--gap); margin: 8px 0 var(--gap); }
.liz-head .screen__title { margin: 0; }
.liz-head__mood { margin: 0; color: var(--ink-2); }
.chat { list-style: none; margin: 0 0 var(--gap); padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: var(--radius); overflow-wrap: anywhere; }
.bubble--me { align-self: flex-end; background: var(--surface); border: 1px solid var(--line); }
.bubble--liz { align-self: flex-start; background: var(--amber-soft); color: var(--ink); }
.bubble--error { background: var(--warm-soft); }
.bubble--liz a, .bubble--liz button.link { color: var(--cool); }
.bubble__headline { margin: 0 0 4px; font-weight: 700; }
.bubble__answer { margin: 0; white-space: pre-line; }
.bubble__rows { list-style: none; margin: 8px 0 0; padding: 0; }
.bubble__row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; padding: 4px 0; border-top: 1px solid var(--line); }
.bubble__row-date, .bubble__more, .bubble__working { color: var(--ink-2); }
.bubble__row-amount { font-family: var(--font-figures); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bubble__more, .bubble__working { margin: 6px 0 0; font-size: 0.9375rem; }
.bubble__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bubble__action { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.bubble__done { margin: 0; font-weight: 700; }
.bubble--thinking .bubble__answer { color: var(--ink-2); }
.chip { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; margin: 6px 0 0; font-size: 0.9375rem; color: var(--ink-2); }
.why { margin-top: 8px; font-size: 0.8125rem; color: var(--ink-2); }
.why__summary { cursor: pointer; }
.why__line { margin: 4px 0 0; }
.starters { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--gap); }
.starters__title { margin: 0; color: var(--ink-2); font-weight: 700; }
.starter {
  min-height: var(--tap); padding: 8px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font: inherit; cursor: pointer;
}
.composer { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 8px; }
.composer__box {
  flex: 1 1 auto; min-width: 0; min-height: var(--tap); padding: 10px 12px; resize: vertical;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit;
}
.composer .composer__send { flex: none; width: auto; padding: 0 18px; }
.liz__links { margin-bottom: 4px; }
.liz-facts { list-style: none; margin: 0 0 var(--gap); padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fact {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--gap);
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.fact__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.fact__subject { font-weight: 700; }
.fact__text { margin: 4px 0 0; }
.fact__by { margin: 4px 0 0; color: var(--ink-3); font-size: 0.875rem; }

/* Add: one button on every screen (spec 6). */
.add {
  position: fixed;
  right: var(--pad);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--pad));
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 26px;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.add__icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* Tabs */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-decoration: none;
}
.tabbar__item[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabbar__icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar__dot { fill: var(--amber); stroke: none; }

/* The Add sheet */
.sheet {
  width: min(100%, var(--col));
  margin: auto auto 0;
  border: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: var(--pad) var(--pad) calc(var(--pad) + env(safe-area-inset-bottom));
  background: var(--surface);
  color: var(--ink);
}
.sheet::backdrop { background: rgb(14 18 32 / 0.45); }
.sheet__title { font-family: var(--font-figures); font-size: 1.25rem; margin: 0 0 var(--gap); }
.sheet__choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.choice {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--sunk);
  color: var(--ink-2);
  font: inherit;
}
.button {
  width: 100%;
  min-height: var(--tap);
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── B3: sign-in, first run, household, invite ─────────────────────────────────────────── */

/* Before the app (ui/gate.js): no tabs, no Add, no Settings button. */
body[data-gate="on"] { padding-bottom: 0; }
body[data-gate="on"] .tabbar,
body[data-gate="on"] .add,
body[data-gate="on"] .head { display: none; }
body[data-gate="on"] .view { max-width: none; padding: 0; }

/* One shape for every gate screen, a phone held in one hand: Liz hosts at the top, the
   actions sit in the lower half (margin-top: auto), the screen's full height is used. */
.gate {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
  overflow: clip;
}
/* A warm light behind Liz. */
.gate::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background: radial-gradient(120% 55% at 12% 4%, var(--glow) 0%, transparent 62%);
}
/* The month ahead, quiet, top right, fading out before the words. */
.gate__backdrop {
  position: absolute;
  z-index: -1;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  width: 380px;
  height: auto;
  margin-left: -190px;
  opacity: 0.5;
  -webkit-mask-image: linear-gradient(to bottom, #000 15%, transparent 80%);
  mask-image: linear-gradient(to bottom, #000 15%, transparent 80%);
  animation: gate-in 900ms ease-out both;
}
@media (prefers-color-scheme: dark) { .gate__backdrop { opacity: 0.9; } }
.gate__day { fill: none; stroke: var(--line); stroke-width: 1.5; }
.gate__day--l0 { fill: var(--sunk); stroke: none; }
.gate__day--l1 { fill: var(--motif-1); stroke: none; }
.gate__day--l2 { fill: var(--motif-2); stroke: none; }
.gate__day--today { fill: var(--amber-soft); stroke: var(--amber); stroke-width: 3; }
.gate__day--ahead { stroke-dasharray: 5 4; }
@keyframes gate-in { from { opacity: 0; } }

.gate__host { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-top: auto; padding-top: 96px; }
.gate__avatar {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px -14px rgb(22 29 51 / 0.35);
}
.liz-mark--host { width: 68px; height: 68px; }
.liz-mark--host .liz-mark__stroke { stroke-width: 2.8; }
.gate__title {
  font-family: var(--font-figures);
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
.gate__hi, .gate__then { display: block; }
.gate__then { color: var(--ink-2); font-weight: 600; }
.gate__text { margin: 0; max-width: 34ch; color: var(--ink-2); font-size: 1.0625rem; }
.gate__text--ink { color: var(--ink); }

.gate__actions { display: flex; flex-direction: column; gap: var(--gap); margin-top: auto; }
.gate__foot { display: flex; justify-content: center; margin: -12px 0 -8px; }

/* Liz arrives once: her stroke is drawn, then her dot lands. Reduced motion: she is simply there. */
.liz-mark.is-arriving .liz-mark__stroke { stroke-dasharray: 1; animation: liz-draw 700ms cubic-bezier(0.4, 0, 0.2, 1) both; }
.liz-mark.is-arriving .liz-mark__dot { animation: liz-land 650ms 520ms cubic-bezier(0.3, 1.4, 0.5, 1) both; }
@keyframes liz-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes liz-land { from { opacity: 0; transform: translate(0, -16px) scale(0.5); } to { opacity: 1; transform: none; } }

/* "I have an invite code": a quiet line that opens its field. */
.gate__more { border-top: 1px solid var(--line); padding-top: 4px; }
.gate__more-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
  color: var(--ink-2);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.gate__more-toggle::-webkit-details-marker { display: none; }
.gate__more-toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 200ms ease;
}
.gate__more[open] > .gate__more-toggle::after { transform: rotate(-135deg); }
.gate__more-toggle:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
.gate__more-body { padding: 4px 0 8px; }

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.note { margin: 0; color: var(--ink-3); font-size: 0.9375rem; }
.note--center { text-align: center; }
.links--center { justify-content: center; }
.button--big { min-height: 56px; border-radius: 14px; font-size: 1.0625rem; }
.gate button.link--quiet { color: var(--ink-3); font-size: 0.9375rem; text-decoration: none; padding: 0 12px; }
@media (hover: hover) { .gate button.link--quiet:hover { text-decoration: underline; } }
.link--small { min-height: 32px; font-size: 0.875rem; }
.notice {
  margin: 0;
  padding: 12px var(--pad);
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: var(--ink);
}
.message { margin: 0; min-height: 1.5em; color: var(--warm); font-weight: 700; }
.message:empty { min-height: 0; }
.or { display: flex; align-items: center; gap: 12px; margin: 2px 0; color: var(--ink-3); font-size: 0.9375rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; }

/* The agreement (spec 12): a real checkbox, big enough to hit; the documents and the leaving
   rule in small print under it, so it reads as one light line, not a wall. */
.agree { display: flex; flex-direction: column; gap: 2px; }
.agree__label { display: flex; align-items: flex-start; gap: var(--gap); min-height: var(--tap); padding: 4px 0; cursor: pointer; color: var(--ink); }
.agree__label input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--primary); }
.agree__small { padding-left: calc(24px + var(--gap)); }
.agree__links { display: flex; flex-wrap: wrap; gap: 0 16px; margin: -8px 0 0; }
.agree__note { margin: 0; color: var(--ink-3); font-size: 0.875rem; line-height: 1.45; }
.email { display: flex; flex-direction: column; gap: 8px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-weight: 700; color: var(--ink-2); }
.field__input {
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
}
.field__input:focus-visible { outline: 3px solid var(--amber); outline-offset: 1px; }

/* Google and Apple: each in its own house style (their guidelines), same size as the rest. */
.provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.provider__icon { width: 20px; height: 20px; flex: none; }
.provider--google { border: 1px solid #747775; background: #FFFFFF; color: #1F1F1F; }
.provider--apple { border: 1px solid #000000; background: #000000; color: #FFFFFF; }
@media (prefers-color-scheme: dark) {
  .provider--google { border-color: #8E918F; background: #131314; color: #E3E3E3; }
  .provider--apple { border-color: #FFFFFF; background: #FFFFFF; color: #000000; }
}

/* Buttons */
.button:disabled, .provider:disabled { opacity: 0.6; cursor: default; }
.button--quiet { background: var(--sunk); color: var(--ink); border: 1px solid var(--line); }
.button--link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
button.link {
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: var(--cool);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.link { display: inline-flex; align-items: center; min-height: var(--tap); }
.link--inline { display: inline; min-height: 0; }

/* Settings blocks */
.block__title { font-family: var(--font-figures); font-size: 1.125rem; margin: 0 0 8px; }
.block__text { margin: 0 0 8px; color: var(--ink-2); }
.block > .button { margin-top: 4px; }

/* The invite code: big, spaced, easy to read out over the phone. */
.code-box { padding: 20px var(--pad); border: 2px dashed var(--amber); border-radius: var(--radius); background: var(--amber-soft); text-align: center; }
.invite-joined { display: flex; flex-direction: column; gap: 4px; }
.invite-joined .liz-line__text { color: var(--ink); font-weight: 700; }
.code-box__label { margin: 0; color: var(--amber-ink); font-weight: 700; }
.code-box__code {
  margin: 4px 0;
  font-family: var(--font-figures);
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--ink);
  user-select: all;
}
.code-box__until { margin: 0; color: var(--ink-2); }

.points { margin: 0 0 var(--gap); padding-left: 1.25em; color: var(--ink-2); }
.points li { margin-bottom: 8px; }

/* ── B4: the Add sheet's pickers, the import preview, Activity ─────────────────────────── */

/* A file input inside its label: the label is the button; the input stays reachable. */
label.choice { display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; color: var(--ink); font-weight: 700; }
label.choice:focus-within { outline: 3px solid var(--amber); outline-offset: 1px; }
.file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.source { display: flex; flex-direction: column; gap: var(--gap); }
.source__head { display: flex; align-items: center; gap: var(--gap); }
.source__thumb { width: 56px; height: 56px; flex: none; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.source__badge {
  display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; flex: none;
  border-radius: var(--radius-sm); background: var(--sunk); color: var(--ink-2); font-weight: 700; font-size: 0.875rem;
}
.source__name { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.source__status { margin: 0; color: var(--ink-3); }

.select {
  min-height: var(--tap); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit;
}
.select:focus-visible { outline: 3px solid var(--amber); outline-offset: 1px; }

.check { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--sunk); color: var(--ink-2); }
.check--ok { background: var(--cool-soft); color: var(--ink); }
.check--gap { background: var(--warm-soft); color: var(--ink); }

.lines { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.line {
  display: grid; grid-template-columns: 4.5em 1fr auto; gap: 8px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.line--known { color: var(--ink-3); }
.line__date { color: var(--ink-3); font-size: 0.875rem; }
.line__what { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; overflow-wrap: anywhere; }
.line__amount { font-family: var(--font-figures); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.line__amount--credit { color: var(--cool); }
.mark { padding: 1px 8px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); font-size: 0.8125rem; }
.mark--seen, .mark--dup { background: var(--cool-soft); color: var(--ink); }
.mark--ask { background: var(--warm-soft); color: var(--ink); }
.subtotal {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin: 0;
  font-family: var(--font-figures); font-variant-numeric: tabular-nums; font-weight: 700;
}
.note--problem { color: var(--warm); }
.actions { display: flex; flex-direction: column; gap: var(--gap); margin: var(--gap) 0; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity__row { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity__row--undone .activity__text { text-decoration: line-through; color: var(--ink-3); }
.activity__text { margin: 0; }
.activity__sub { margin: 0; color: var(--ink-3); font-size: 0.875rem; }
.button--small { width: auto; align-self: flex-start; min-height: 40px; padding: 0 16px; }
.waiting { background: var(--amber-soft); }

/* ── B5: Home's number, bank lines with their question, the Moves list ─────────────────── */

.number__value {
  margin: 0; font-family: var(--font-figures); font-variant-numeric: tabular-nums;
  font-size: 2.5rem; font-weight: 700; line-height: 1.1; color: var(--ink);
}
.number__value--below { color: var(--warm); }
.number__parts { margin: 6px 0 0; font-family: var(--font-figures); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.number__line { margin: 6px 0 0; color: var(--ink-2); }
.number__none { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

.line--question { background: var(--amber-soft); }
.line__ask { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 4px; }
.mark--meaning { background: var(--cool-soft); color: var(--ink); }
.field--inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.select--small { min-height: 40px; }
.field__input--small { min-height: 40px; font-size: 1rem; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row__what { overflow-wrap: anywhere; font-weight: 700; }
.moves__open { color: var(--ink); font-weight: 700; }
.actions--wrap { flex-direction: row; flex-wrap: wrap; align-items: center; margin: 4px 0 var(--gap); }

/* ── B6: Home (look C, the month ahead), the Month, Activity, Cards, the edit sheet ──────── */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.screen__title:focus { outline: none; }
.screen__title:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.screen__title { letter-spacing: -0.015em; }
.loading { padding: var(--pad) 0; }
.back {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap);
  color: var(--ink-2); font-weight: 700; text-decoration: none;
}
.back::before { content: ""; width: 8px; height: 8px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }

.section { margin: 28px 0 var(--gap); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--gap); }
.section__title { font-family: var(--font-figures); font-size: 1.125rem; font-weight: 700; margin: 0 0 10px; letter-spacing: -0.01em; }
.welcome { display: flex; flex-direction: column; gap: var(--gap); }
.welcome .liz-line { margin: 0; }
.welcome .liz-line__text { color: var(--ink); font-weight: 700; }
.welcome .block__text { margin: 0; }

/* The number: big, tabular, a link to the month. It moves once, only when it changed. */
a.number__value { display: inline-block; text-decoration: none; border-radius: var(--radius-sm); }
@media (hover: hover) { a.number__value:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; } }
.number__value { font-variation-settings: "opsz" 96; letter-spacing: -0.02em; }
.number__more { font-weight: 700; }
.number__value.is-arrived { animation: arrive 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes arrive {
  from { opacity: 0.2; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* The calendar: seven columns, Sunday first; a past day filled by what went out. */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.cal__head, .cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal__head { margin-bottom: 6px; }
.cal__wd { text-align: center; color: var(--ink-3); font-size: 0.8125rem; font-weight: 700; }
.cal__day {
  position: relative; display: flex; align-items: flex-start; justify-content: flex-start;
  aspect-ratio: 1 / 1; min-height: 40px; padding: 5px 6px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--sunk); color: var(--ink-2);
  font: inherit; font-family: var(--font-figures); font-variant-numeric: tabular-nums; font-size: 0.875rem; font-weight: 600; line-height: 1;
}
button.cal__day { cursor: pointer; }
@media (hover: hover) { button.cal__day:hover { border-color: var(--ink-3); } }
.cal__day--blank { background: none; }
.cal__day--later { background: none; border: 1px solid var(--line); color: var(--ink-3); }
.cal__day--l1 { background: var(--fill-1); color: var(--on-fill-1); }
.cal__day--l2 { background: var(--fill-2); color: var(--on-fill-2); }
.cal__day--l3 { background: var(--fill-3); color: var(--on-fill-3); }
.cal__day--l4 { background: var(--fill-4); color: var(--on-fill-4); }
.cal__day--ahead { border: 2px dashed var(--ink-3); color: var(--ink); }
.cal__day--payAhead { border-color: var(--cool); }
.cal__day--today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--amber); }
.cal__day--picked { outline: 3px solid var(--ink); outline-offset: 1px; }
.cal__dot { position: absolute; right: 5px; bottom: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.cal__day--pay .cal__dot { background: var(--cool); box-shadow: 0 0 0 2px var(--surface); }
.cal__day--payAhead .cal__dot { background: none; border: 2px solid var(--cool); }
.cal--empty .cal__day:not(.cal__day--blank) { background: none; border: 1px solid var(--line); }
.cal--empty .cal__day--today { background: var(--amber-soft); color: var(--ink); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; list-style: none; margin: 10px 0 0; padding: 0; color: var(--ink-2); font-size: 0.875rem; }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__item::before { content: ""; width: 14px; height: 14px; border-radius: 4px; }
.legend__item--out::before { background: var(--fill-3); }
.legend__item--pay::before { width: 10px; height: 10px; margin: 2px; border-radius: 50%; background: var(--cool); }
.legend__item--ahead::before { border: 2px dashed var(--ink-3); }

.day-panel { margin-top: var(--gap); padding: var(--pad); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.day-panel__title { font-family: var(--font-figures); font-size: 1rem; margin: 0 0 6px; }
.day-panel__title:focus { outline: none; }
.ahead__line { margin: 6px 0 0; color: var(--ink-2); }

/* Where it went: category, amount, and a quiet bar under each. */
.cats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cat {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; width: 100%; min-height: var(--tap);
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
@media (hover: hover) { .cat:hover { background: var(--sunk); } }
.cat__name { overflow-wrap: anywhere; }
.cat__amount, .cats__sum, .people__amount, .ahead__amount, .mini-tile__amount, .tile__amount, .row-item__amount, .stepper__now {
  font-family: var(--font-figures); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cat__amount { font-weight: 600; text-align: right; }
.bar { grid-column: 1 / -1; display: block; width: 100%; height: 6px; }
.bar__track { fill: var(--sunk); }
.bar__fill { fill: var(--fill-3); }
@media (hover: hover) { .cat:hover .bar__track { fill: var(--line); } }
.cats__total { display: flex; justify-content: space-between; margin: 6px 0 0; padding: 10px 10px 0; border-top: 1px solid var(--line); font-weight: 700; }

/* Still ahead: dated, dashed like the days they sit on. */
.ahead { list-style: none; margin: 0 0 8px; padding: 0; }
.ahead__item { display: grid; grid-template-columns: 4.5em 1fr auto; gap: 8px; align-items: baseline; padding: 10px 12px; margin-bottom: 6px; border: 2px dashed var(--line); border-radius: var(--radius-sm); }
.ahead__item--pay { border-color: var(--cool-soft); }
.ahead__date { color: var(--ink-2); font-size: 0.875rem; font-weight: 700; }
.ahead__what { overflow-wrap: anywhere; }
.ahead__amount { color: var(--ink-2); }

/* Cards this cycle (Home) and the Cards tiles. */
.mini-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--gap); }
.mini-tile, .tile {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px var(--pad);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none;
}
@media (hover: hover) { a.mini-tile:hover, a.tile:hover { border-color: var(--ink-3); } }
.mini-tile__name, .tile__name { font-weight: 700; overflow-wrap: anywhere; }
.mini-tile__amount { font-size: 1.375rem; font-weight: 700; }
.mini-tile__label, .tile__label { color: var(--ink-2); font-size: 0.875rem; }
.tile__owner { color: var(--ink-2); font-size: 0.875rem; }
.tiles { list-style: none; margin: 0 0 var(--gap); padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); }
.tile--card { border-top: 4px solid var(--fill-4); }
.tile--bank { border-top: 4px solid var(--cool); }
.tile__amount { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variation-settings: "opsz" 72; }
.tile__line { color: var(--ink-2); }
.tile__line--figures { font-family: var(--font-figures); font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.tile__line--warm { color: var(--warm); font-weight: 700; }
.tile__line--quiet { color: var(--ink-3); }
.tile .mark { align-self: flex-start; }
.tile--wide { margin-top: 4px; }
/* The last row scrolls clear of the Add button. */
.view { padding-bottom: calc(var(--pad) + 72px); }
.tile--wide .tile__name { display: none; }   /* the screen title already names it */

.status { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 0; color: var(--ink); }
.status__mark { flex: none; width: 10px; height: 10px; margin-top: 0.45em; border-radius: 50%; background: var(--ink-3); }
.status--ok .status__mark { background: var(--cool); }
.status--gap .status__mark { background: var(--warm); border-radius: 2px; transform: rotate(45deg); }

.statements { list-style: none; margin: 0; padding: 0; }
.statement { padding: 12px 0; border-bottom: 1px solid var(--line); }
.statement__when { margin: 0; font-weight: 700; }
.statement__figure { margin: 2px 0 0; font-family: var(--font-figures); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.statement__paid { margin: 4px 0 0; color: var(--ink-2); }

/* Waiting for you */
.waiting__item {
  display: flex; align-items: center; width: 100%; min-height: var(--tap); margin-bottom: 6px; padding: 10px var(--pad);
  border: 0; border-left: 4px solid var(--amber); border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--ink);
  font: inherit; font-weight: 700; text-align: left; cursor: pointer;
}

/* Rows: one button each, the amount lined up digit under digit on the right. */
.day-head { margin: 18px 0 4px; color: var(--ink-2); font-family: var(--font-text); font-size: 0.875rem; font-weight: 700; letter-spacing: 0.02em; }
.row-list { list-style: none; margin: 0; padding: 0; }
.row-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; min-height: var(--tap);
  padding: 10px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
@media (hover: hover) { .row-item:hover { background: var(--sunk); } }
.row-item__what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-item__name { overflow-wrap: anywhere; }
.row-item__sub { color: var(--ink-2); font-size: 0.875rem; overflow-wrap: anywhere; }
.row-item__note { color: var(--ink-2); font-size: 0.875rem; font-style: italic; overflow-wrap: anywhere; }
.row-item__marks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.row-item__amount { font-weight: 600; text-align: right; }
.row-item--in .row-item__amount { color: var(--cool); }
.row-item--move .row-item__amount { color: var(--ink-2); }
.mark--who { background: var(--sunk); color: var(--ink); }

/* Activity's filters: they wrap, each with its own label. */
.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 8px; }
.filter { display: flex; flex-direction: column; gap: 2px; min-width: 9.5em; flex: 1 1 9.5em; }
.filter__label { color: var(--ink-2); font-size: 0.8125rem; font-weight: 700; }
.filter .select { width: 100%; }

/* The Month: earlier and later at the top. */
.stepper { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin: 0 0 var(--gap); }
.stepper__now { text-align: center; font-weight: 700; }
.stepper__btn {
  min-height: var(--tap); min-width: var(--tap); padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
}
.stepper__btn:disabled { color: var(--ink-3); background: none; cursor: default; }
.people__side { margin-bottom: var(--gap); }
.people__title { margin: 0 0 6px; color: var(--ink-2); font-size: 0.875rem; }
.people__list { list-style: none; margin: 0; padding: 0; }
.people__row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 6px 10px; }

/* The edit sheet */
.sheet--edit { max-height: 92dvh; overflow: auto; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; padding: 12px var(--pad); border-radius: var(--radius-sm); background: var(--sunk); }
.facts__row { display: contents; }
.facts dt { color: var(--ink-2); font-size: 0.875rem; font-weight: 700; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.field__input--area { min-height: 88px; padding: 10px 14px; resize: vertical; }
.actions--row { flex-direction: row; }
.actions--row .button { flex: 1; }

/* ── B8: Liz's notes (Home and the Liz tab) and What Liz watches ─────────────────────────── */
.liz-note { display: flex; align-items: flex-start; gap: var(--gap); background: var(--amber-soft); border-color: var(--amber); }
.liz-note__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.notes { margin-bottom: var(--gap); }
.notecards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notecard { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.notecard--new { border-left: 4px solid var(--amber); }
.notecards--home .notecard { padding: 0; border: 0; background: none; }
.notecard__body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.notecard__text { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.notecard__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mark--new { background: var(--amber-soft); color: var(--amber-ink); font-weight: 700; }
.mark--heads-up { align-self: flex-start; background: var(--amber-soft); color: var(--amber-ink); }
.watch { list-style: none; margin: 0 0 var(--gap); padding: 0; display: flex; flex-direction: column; gap: 10px; }
.watch__item { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.watch__label { display: flex; align-items: center; gap: var(--gap); min-height: var(--tap); cursor: pointer; font-weight: 700; }
.watch__box { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--primary); }
.watch__help { margin: 0 0 0 calc(24px + var(--gap)); color: var(--ink-2); font-size: 0.9375rem; }
.watch__muted { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 6px 0 0 calc(24px + var(--gap)); color: var(--ink-2); font-size: 0.9375rem; }

@media (min-width: 560px) {
  .cal__day { font-size: 1rem; padding: 7px 8px; }
}
