/*
  Quits: shared costs app page (Screenery template)
  The page is a ruled cash book: black ink on cream, figures set in fixed cells like a board, brackets for what is owed, one green for square.
  Type does the work in four sizes: the figure, the heading, the body and the small print. Hairlines and double rules do the rest.

  Contents
   1. Tokens
   2. Base and browser surfaces
   3. Components: buttons, fields, select, modes, errors, figures and cells
   4. Header
   5. Hero and the board
   6. The book: groups, people, bill form, parts, ledger, empty state, side board, toast
   7. Fewest transfers drawing
   8. Rules, prices, changes
   9. Sign up: phone, form, states
  10. Footer
  11. Motion
  12. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
:root {
  /* Palette: ink, cream, one green */
  --cream: #f2ecdf;
  --paper: #f8f4eb;        /* raised panels */
  --well: #e8e0cd;         /* board cells, field wells */
  --ink: #151310;
  --ink-2: #4a443a;        /* secondary text: 8.4:1 on cream */
  --ink-3: #6b6355;        /* small muted text: 5.2:1 on cream */
  --rule: #cfc5b0;         /* hairlines */
  --rule-ink: #151310;     /* totals rules */
  --green: #1c6440;        /* settled, square: 6.5:1 on cream */
  --green-well: #d6e3d3;
  --error: #151310;        /* errors are ink with an icon, not a colour */
  --error-well: #ebdcc9;

  /* Type */
  --sans: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --serif: "Hedvig Letters Serif", Georgia, "Times New Roman", serif;
  --t-fig: clamp(2.6rem, 1rem + 4.6vw, 5.4rem);   /* the board */
  --t-h: clamp(1.9rem, 1.3rem + 2.2vw, 3.1rem);     /* headings */
  --t-body: 1.0625rem;                              /* 17 */
  --t-small: 0.8125rem;                             /* 13 */

  /* Space */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px; --s-9: 112px;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1320px;

  /* Shape and motion */
  --r: 3px;
  --hair: 1px solid var(--rule);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 160ms;
  --t-roll: 900ms;
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; scrollbar-color: var(--ink-3) var(--cream); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 var(--t-body)/1.55 var(--sans);
  font-variation-settings: "wdth" 100;
  font-variant-numeric: tabular-nums lining-nums;
  caret-color: var(--ink);
  accent-color: var(--ink);
}
::selection { background: var(--ink); color: var(--cream); }
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--ink-3); border: 3px solid var(--cream); border-radius: 8px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; line-height: 1.12; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-4); top: -60px; z-index: 50; background: var(--ink); color: var(--cream); padding: var(--s-2) var(--s-4); }
.skip:focus { top: var(--s-2); }
.small { font-size: var(--t-small); line-height: 1.45; letter-spacing: 0.01em; }
.muted { color: var(--ink-3); }
.r { text-align: right; }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
main > section { max-width: var(--max); margin: 0 auto; padding: var(--s-9) var(--gutter) 0; }

.sec-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s-6); align-items: end; padding-bottom: var(--s-5); border-bottom: 3px double var(--rule-ink); margin-bottom: var(--s-6); }
.sec-head h2 { font-size: var(--t-h); }
.sec-head p { max-width: 62ch; color: var(--ink-2); }

/* ---------- 3. Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 var(--s-5);
  font: 600 0.9375rem/1 var(--sans); letter-spacing: 0.005em;
  border: 1.5px solid var(--ink); border-radius: var(--r);
  background: transparent; color: var(--ink); text-decoration: none; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--ink { background: var(--ink); color: var(--cream); }
.btn--ink:hover { background: #2c2822; }
.btn--line:hover { background: var(--ink); color: var(--cream); }
.btn--quiet { border-color: transparent; text-decoration: underline; text-underline-offset: 0.25em; padding: 0 var(--s-3); }
.btn--quiet:hover { background: var(--well); }
.btn--sm { min-height: 40px; padding: 0 var(--s-4); font-size: 0.875rem; }
.btn--wide { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

.f { display: grid; gap: 6px; align-content: start; }
label, legend { font-size: var(--t-small); font-weight: 600; letter-spacing: 0.02em; color: var(--ink); }
.field {
  width: 100%; min-height: 46px; padding: 0 var(--s-3);
  font: 400 1rem/1.2 var(--sans); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--ink-3); border-radius: var(--r);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field::placeholder { color: var(--ink-3); opacity: 1; }
.field:hover { border-color: var(--ink); }
.field:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--well); }
.field:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.field[aria-invalid="true"] { border-color: var(--ink); border-width: 2px; background: var(--error-well); }
.field--fig { font-weight: 600; font-variation-settings: "wdth" 85; text-align: right; font-size: 1.125rem; }
.money-in { position: relative; }
.money-in > span { position: absolute; left: var(--s-3); top: 50%; transform: translateY(-50%); color: var(--ink-2); font-weight: 600; }
.money-in .field { padding-left: 28px; }
.select { position: relative; }
.select select { appearance: none; padding-right: 36px; cursor: pointer; }
.select .ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }

.err { display: flex; gap: 6px; align-items: flex-start; font-size: var(--t-small); font-weight: 600; line-height: 1.4; color: var(--error); }
.err::before { content: ""; flex: none; width: 14px; height: 14px; margin-top: 2px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(currentColor, currentColor) center 3px / 1.5px 5px no-repeat, linear-gradient(currentColor, currentColor) center 9.5px / 1.5px 1.5px no-repeat; }
.err[hidden] { display: none; }
.err--block { padding: var(--s-3); background: var(--error-well); border: 1.5px solid var(--ink); border-radius: var(--r); }

.modes { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.modes legend { float: left; margin-right: var(--s-3); padding: 0; }
.mode { position: relative; display: inline-flex; cursor: pointer; }
.mode input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mode span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s-4); border: 1.5px solid var(--ink-3); border-radius: 999px; font-weight: 500; font-size: 0.9375rem; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.mode:hover span { border-color: var(--ink); }
.mode input:checked + span { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.mode input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }

/* The figure: the whole look of the page. Each character sits in a fixed cell so columns line up whatever the font does. */
.fig {
  font-family: var(--sans); font-weight: 560; font-variation-settings: "wdth" 78, "opsz" 96;
  font-size: var(--t-fig); line-height: 1; letter-spacing: 0;
  font-variant-numeric: tabular-nums lining-nums; white-space: nowrap;
  display: inline-flex; justify-content: flex-end;
}
.fig--md { font-size: clamp(2.2rem, 1.4rem + 2.4vw, 3.6rem); }
.fig--sm { font-size: 2.25rem; }
.c { display: inline-block; text-align: center; width: 0.56em; height: 1.08em; line-height: 1.08em; position: relative; }
.c--p { width: 0.24em; }               /* point and comma */
.c--b { width: 0.32em; }               /* brackets */
.c--d { overflow: hidden; }
.c--blank { width: 0.56em; }
.strip { display: block; transition: transform var(--t-roll) var(--ease); will-change: transform; }
.strip > span { display: block; height: 1.08em; }

/* ---------- 4. Header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: var(--cream); border-bottom: var(--hair); }
.top__in { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); height: 64px; display: flex; align-items: center; gap: var(--s-6); }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.375rem/1 var(--sans); font-variation-settings: "wdth" 80; letter-spacing: -0.01em; }
.mark span { padding-bottom: 3px; border-bottom: 4px double currentColor; }
.nav { display: flex; gap: var(--s-5); margin-left: auto; font-size: 0.9375rem; }
.nav a { text-decoration: none; padding: var(--s-2) 0; }
.nav a:hover { text-decoration: underline; }

/* ---------- 5. Hero and the board ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(var(--s-6), 5vw, var(--s-8)); align-items: start; padding-top: clamp(var(--s-6), 5vw, var(--s-8)) !important; }
.hero__copy { display: grid; gap: var(--s-5); padding-top: var(--s-3); }
.hero h1 { font-size: clamp(2.3rem, 1.4rem + 2.9vw, 4rem); line-height: 1.06; letter-spacing: -0.02em; }
.lede { font-size: 1.1875rem; line-height: 1.5; color: var(--ink-2); max-width: 44ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--s-3); }

.board { background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--r); padding: var(--s-5) clamp(var(--s-4), 2.4vw, var(--s-6)) var(--s-5); }
.board__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); padding-bottom: var(--s-3); border-bottom: 1.5px solid var(--ink); }
.board__cap { font-family: var(--serif); font-size: 1.25rem; line-height: 1.25; }
.board__date { color: var(--ink-3); white-space: nowrap; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); padding: clamp(8px, 0.9vw, 12px) 0; border-bottom: var(--hair); transition: color 400ms; }
.row__who { display: grid; gap: 2px; min-width: 0; }
.row__name { font-family: var(--serif); font-size: clamp(1.25rem, 1rem + 0.8vw, 1.75rem); line-height: 1.1; }
.row__state { color: var(--ink-3); }
.row .fig { flex: none; }
.board .row .c--d, .board .row .c--blank { background: var(--well); box-shadow: inset 0 -1px 0 rgba(21, 19, 16, 0.08); border-radius: 2px; margin-left: 2px; }
.board:not(.board--side) .row .c--d::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(242, 236, 223, 0.65); }
.row.is-square { color: var(--green); }
.row.is-square .row__state { color: var(--green); font-weight: 600; }
.board .row.is-square .c--d, .board .row.is-square .c--blank { background: var(--green-well); }
.row.is-flash { animation: flash 1.2s var(--ease); }

.net { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); padding: var(--s-3) 0 var(--s-2); border-bottom: 3px double var(--rule-ink); font-size: var(--t-small); font-weight: 600; letter-spacing: 0.02em; }
.net__fig { font-size: 1.375rem; font-weight: 600; font-variation-settings: "wdth" 78; }

.square { margin-top: var(--s-5); display: grid; gap: var(--s-3); }
.square__h { font-family: var(--sans); font-weight: 600; letter-spacing: 0.02em; }
.transfers, .paid__list { list-style: none; margin: 0; padding: 0; display: grid; }
.transfer { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--s-3); padding: var(--s-2) 0; border-top: var(--hair); min-height: 56px; }
.transfer__text { font-weight: 500; }
.transfer__amt { font-weight: 650; font-variation-settings: "wdth" 80; font-size: 1.25rem; }
.transfer .btn { min-height: 40px; padding: 0 var(--s-3); font-size: 0.8125rem; }
.transfer.is-going { opacity: 0.4; }
.quits { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4); background: var(--green-well); color: var(--green); border-radius: var(--r); font-weight: 600; }
.quits--none { background: var(--well); color: var(--ink-2); font-weight: 500; }
.quits .ic { width: 20px; height: 20px; stroke-width: 1.75; }
.paid { margin-top: var(--s-5); display: grid; gap: var(--s-2); }
.paid[hidden], .square__h[hidden] { display: none; }
.paid__list li { display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--s-3); align-items: center; padding: 6px 0; border-top: var(--hair); color: var(--green); font-size: 0.9375rem; }
.paid__list .ic { width: 16px; height: 16px; }
.paid__list b { font-weight: 650; font-variation-settings: "wdth" 80; }
.link-btn { background: none; border: 0; padding: 4px 6px; margin: -4px -6px; font: 600 var(--t-small)/1 var(--sans); color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { background: var(--well); border-radius: 2px; }

/* ---------- 6. The book ---------- */
.groups { display: flex; flex-wrap: wrap; gap: 0; border: 1.5px solid var(--ink); border-radius: var(--r); width: fit-content; max-width: 100%; margin-bottom: var(--s-6); overflow: hidden; }
.group-tab { display: grid; gap: 2px; text-align: left; padding: 10px var(--s-5); min-height: 56px; background: transparent; border: 0; border-right: 1.5px solid var(--ink); font: 600 1rem/1.2 var(--sans); color: var(--ink); cursor: pointer; }
.group-tab:last-child { border-right: 0; }
.group-tab .small { font-weight: 400; color: var(--ink-3); }
.group-tab:hover { background: var(--well); }
.group-tab[aria-selected="true"] { background: var(--ink); color: var(--cream); }
.group-tab[aria-selected="true"] .small { color: #cfc6b4; }
.group-tab:focus-visible { outline-offset: -5px; outline-color: currentColor; }

.book__body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(var(--s-5), 3.5vw, var(--s-7)); align-items: start; }
.book__main { display: grid; gap: var(--s-7); min-width: 0; }
.book__side { position: sticky; top: 88px; min-width: 0; }
.board--side { --t-fig: clamp(2rem, 1.2rem + 2.2vw, 3.1rem); }
.board--side .row { padding: 8px 0; }
.board--side .row__name { font-size: 1.25rem; }

.panel { display: grid; gap: var(--s-4); }
.panel__h { font-size: 1.625rem; display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); padding-bottom: var(--s-2); border-bottom: 1.5px solid var(--ink); }
.panel__h .small { font-family: var(--sans); }

.people { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.person { display: inline-flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 4px 0 var(--s-4); border: 1.5px solid var(--ink); border-radius: 999px; font-weight: 500; }
.person:only-child, .person.no-x { padding-right: var(--s-4); }
.person button { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: none; border-radius: 50%; color: var(--ink); cursor: pointer; }
.person button:hover { background: var(--well); }
.add-person { display: grid; grid-template-columns: minmax(0, 320px) auto; justify-content: start; gap: var(--s-2); align-items: center; }
.add-person .err { grid-column: 1 / -1; }

.bill { display: grid; gap: var(--s-5); padding: var(--s-5); background: var(--paper); border: var(--hair); border-radius: var(--r); }
.bill__top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr) minmax(0, 0.9fr); gap: var(--s-4); }
.bill__foot { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }

.parts { display: grid; gap: 0; border-top: var(--hair); }
.part { display: grid; grid-template-columns: minmax(0, 1fr) 140px 96px; align-items: center; gap: var(--s-3); min-height: 54px; padding: 4px 0; border-bottom: var(--hair); }
.part__who { display: inline-flex; align-items: center; gap: var(--s-3); font-size: 1rem; font-weight: 500; letter-spacing: 0; cursor: pointer; min-height: 44px; }
.part__who input { width: 20px; height: 20px; margin: 0; }
.part__share { text-align: right; font-weight: 600; font-variation-settings: "wdth" 80; font-size: 1.0625rem; color: var(--ink-2); }
.part.is-out .part__share { color: var(--ink-3); font-weight: 400; }
.part .field { min-height: 40px; }
.step { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; border: 1.5px solid var(--ink-3); border-radius: var(--r); background: var(--cream); height: 40px; }
.step button { height: 100%; border: 0; background: none; cursor: pointer; color: var(--ink); display: grid; place-items: center; }
.step button:hover { background: var(--well); }
.step input { width: 100%; border: 0; background: none; text-align: center; font: 600 1rem/1 var(--sans); color: var(--ink); min-width: 0; }
.step input:focus { outline: none; }
.step:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--well); }
.tally { font-size: 0.9375rem; color: var(--ink-2); min-height: 1.5em; }
.tally b { color: var(--ink); font-weight: 650; }
.tally.is-short b, .tally.is-over b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.tally.is-even { color: var(--green); }
.tally.is-even b { color: var(--green); }

.ledger { display: grid; }
.ledger__head, .entry { display: grid; grid-template-columns: 64px minmax(0, 1fr) 120px 96px 32px; gap: var(--s-3); align-items: baseline; }
.ledger__head { font-size: var(--t-small); font-weight: 600; color: var(--ink-3); padding-bottom: 6px; border-bottom: var(--hair); }
.ledger__head::after { content: ""; }
.ledger__rows { list-style: none; margin: 0; padding: 0; }
.entry { padding: 10px 0; border-bottom: var(--hair); }
.entry__date { color: var(--ink-3); font-size: 0.9375rem; }
.entry__what { display: grid; gap: 1px; min-width: 0; }
.entry__by { color: var(--ink-3); }
.entry__split { color: var(--ink-2); }
.entry__amt { text-align: right; font-weight: 600; font-variation-settings: "wdth" 80; font-size: 1.0625rem; }
.entry__x { align-self: center; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--ink-2); cursor: pointer; }
.entry__x:hover { background: var(--well); color: var(--ink); }
.entry.is-new { animation: flash 1.6s var(--ease); }
.entry--paid { color: var(--green); }
.entry--paid .entry__date, .entry--paid .entry__by, .entry--paid .entry__split { color: var(--green); }
.ledger__total { display: flex; justify-content: space-between; padding: var(--s-3) 44px var(--s-2) 0; border-bottom: 3px double var(--rule-ink); font-weight: 600; font-size: 0.9375rem; }
.empty { display: grid; grid-template-columns: 120px 1fr; gap: var(--s-5); align-items: center; padding: var(--s-5); border: 1.5px dashed var(--ink-3); border-radius: var(--r); }
.empty svg { width: 120px; fill: none; stroke: var(--ink-3); stroke-width: 1; }
.empty[hidden] { display: none; }
.ledger[hidden] { display: none; }

.toast { position: fixed; left: 50%; bottom: var(--s-5); z-index: 40; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: var(--s-3); max-width: calc(100vw - 32px); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); background: var(--ink); color: var(--cream); border-radius: var(--r); box-shadow: 0 10px 30px -10px rgba(21, 19, 16, 0.45); transition: opacity 240ms var(--ease), transform 240ms var(--ease); font-size: 0.9375rem; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast .link-btn { color: var(--cream); }
.toast .link-btn:hover { background: #2c2822; }

/* ---------- 7. Fewest transfers ---------- */
.nets { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(var(--s-5), 4vw, var(--s-8)); }
.net-fig { margin: 0; display: grid; gap: var(--s-4); padding: var(--s-5); border: var(--hair); background: var(--paper); border-radius: var(--r); }
.net-fig svg { width: 100%; height: auto; max-width: 460px; justify-self: center; color: var(--ink); overflow: visible; }
.edges path { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.net-fig:first-child .edges path { stroke: var(--ink-3); stroke-dasharray: 4 4; }
.net-fig:first-child svg { color: var(--ink-3); }
.lab text { font: 600 15px var(--sans); font-variation-settings: "wdth" 80; fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 5px; stroke-linejoin: round; }
.nodes circle { fill: var(--cream); stroke: var(--ink); stroke-width: 1.5; }
.nodes text { font: 13px var(--serif); fill: var(--ink); }
.nodes .hub { fill: var(--ink); }
.nodes .hub-t { fill: var(--cream); }
.net-fig figcaption { display: flex; align-items: baseline; gap: var(--s-3); border-top: var(--hair); padding-top: var(--s-3); color: var(--ink-2); }
.net-fig figcaption .fig { color: var(--ink); }
.fewest__note { max-width: 70ch; margin-top: var(--s-6); color: var(--ink-2); }

/* ---------- 8. Rules, prices, changes ---------- */
.spec { margin: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(var(--s-5), 4vw, var(--s-8)); }
.spec > div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4) 0; border-bottom: var(--hair); }
.spec dt { font-family: var(--serif); font-size: 1.1875rem; line-height: 1.3; }
.spec dd { margin: 0; color: var(--ink-2); max-width: 52ch; }

.price-book { display: grid; }
.price-book__head, .price-line { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 6fr) minmax(0, 4fr); gap: var(--s-5); }
.price-book__head { font-size: var(--t-small); font-weight: 600; color: var(--ink-3); padding-bottom: 6px; border-bottom: var(--hair); }
.price-line { padding: var(--s-5) 0; border-bottom: var(--hair); align-items: start; }
.price-line h3 { font-size: 1.75rem; }
.price-line > p { color: var(--ink-2); max-width: 54ch; }
.price-line__fig { display: grid; justify-items: end; gap: 4px; text-align: right; color: var(--ink); }
.price-line__fig .small { color: var(--ink-3); }
.price-book__note { padding-top: var(--s-3); border-top: 2px solid var(--ink); margin-top: -1px; color: var(--ink-2); }

.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 9rem 4rem minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4) 0; border-bottom: var(--hair); align-items: baseline; }
.log time { color: var(--ink-3); font-size: 0.9375rem; }
.log__v { font-weight: 650; font-variation-settings: "wdth" 80; font-size: 1.25rem; }
.log p { max-width: 70ch; }

/* ---------- 9. Sign up ---------- */
.signup { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(var(--s-6), 6vw, var(--s-9)); align-items: center; padding-bottom: var(--s-9) !important; }
.phone { justify-self: center; width: min(300px, 100%); aspect-ratio: 300 / 610; padding: 12px; background: var(--ink); border-radius: 44px; box-shadow: 0 30px 60px -30px rgba(21, 19, 16, 0.5), inset 0 0 0 2px #3a352e; }
.phone__screen { height: 100%; border-radius: 34px; background: var(--cream); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; font-size: 13px; }
.ph-bar { display: flex; justify-content: space-between; font-weight: 600; font-size: 12px; padding: 0 6px 6px; }
.ph-dots { display: inline-flex; gap: 3px; align-items: center; }
.ph-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }
.ph-title { font-family: var(--serif); font-size: 22px; line-height: 1.1; margin-top: 6px; }
.ph-sub { color: var(--ink-3); font-size: 12px; padding-bottom: 8px; border-bottom: 1.5px solid var(--ink); }
.ph-rows { list-style: none; margin: 0; padding: 0; }
.ph-rows li { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: var(--hair); }
.ph-rows span { font-family: var(--serif); font-size: 15px; }
.ph-rows b { font-size: 26px; line-height: 1; font-weight: 560; font-variation-settings: "wdth" 78; }
.ph-sq { margin-top: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.ph-tr { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.ph-tr li { display: flex; justify-content: space-between; padding: 4px 0; border-top: var(--hair); }
.ph-tr b { font-weight: 650; font-variation-settings: "wdth" 80; }
.ph-note { margin-top: auto; padding: 10px; background: var(--green-well); color: var(--green); border-radius: 8px; font-size: 12px; font-weight: 600; line-height: 1.35; }
.ph-btn { display: grid; place-items: center; height: 40px; background: var(--ink); color: var(--cream); border-radius: 8px; font-weight: 600; font-size: 13px; }

.signup__form { display: grid; gap: var(--s-5); max-width: 560px; }
.signup__form > h2 { font-size: var(--t-h); }
.signup__form > p { color: var(--ink-2); max-width: 54ch; }
.join { display: grid; gap: var(--s-4); padding-top: var(--s-5); border-top: 3px double var(--rule-ink); }
.join[hidden] { display: none; }
.spin { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 800ms linear infinite; }
.is-loading .spin { display: inline-block; }
.done { display: grid; gap: var(--s-4); padding: var(--s-5); border: 1.5px solid var(--green); border-radius: var(--r); background: var(--paper); }
.done[hidden] { display: none; }
.done:focus { outline: none; }
.done__stamp { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--green); font-weight: 650; }
.done h3 { font-size: 2rem; }
.done .btn { justify-self: start; }
.net--done { color: var(--green); border-bottom-color: var(--green); }

/* ---------- 10. Footer ---------- */
.foot { border-top: 1.5px solid var(--ink); background: var(--cream); }
.foot > * { max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.net--foot { padding-top: var(--s-4); }
.foot__in { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s-6); padding-top: var(--s-6); padding-bottom: var(--s-8); color: var(--ink-2); }
.foot__in p + p { margin-top: var(--s-3); }
.foot__mark { font: 700 1.75rem/1 var(--sans); font-variation-settings: "wdth" 80; color: var(--ink); margin-bottom: var(--s-3); }
.foot__nav { display: grid; gap: var(--s-2); justify-items: start; }
.foot__nav a { padding: 2px 0; }

/* ---------- 11. Motion ---------- */
@keyframes flash { 0% { background-color: var(--green-well); } 100% { background-color: transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .strip { transition: none; }
  .row.is-flash, .entry.is-new { animation: none; }
  .spin { animation-duration: 2.4s; }
  .toast { transition: none; }
}

/* ---------- 12. Narrow screens ---------- */
@media (max-width: 1100px) {
  .nav { gap: var(--s-4); }
  .book__body { grid-template-columns: minmax(0, 1fr) minmax(0, 380px); }
  .bill__top { grid-template-columns: 1fr 1fr; }
  .f--what { grid-column: 1 / -1; }
  .part { grid-template-columns: minmax(0, 1fr) 120px 84px; }
  .spec { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero__copy { max-width: 640px; }
  .book__body { grid-template-columns: 1fr; }
  .book__side { position: static; order: -1; }
  .sec-head { grid-template-columns: 1fr; gap: var(--s-3); }
  .signup { grid-template-columns: 1fr; }
  .phone { width: 260px; }
  .signup__form { max-width: none; }
  .nav { display: none; }
  .top__in { justify-content: space-between; }
  .foot__in { grid-template-columns: 1fr 1fr; }
  .foot__in > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  main > section { padding-top: var(--s-8); }
  .nets { grid-template-columns: 1fr; }
  .net-fig { padding: var(--s-4); }
  .groups { width: 100%; flex-direction: column; }
  .group-tab { border-right: 0; border-bottom: 1.5px solid var(--ink); }
  .group-tab:last-child { border-bottom: 0; }
  .bill { padding: var(--s-4); }
  .bill__top { grid-template-columns: 1fr; }
  .part { grid-template-columns: minmax(0, 1fr) 112px; row-gap: 0; }
  .part__share { grid-column: 2; grid-row: 1; }
  .part.has-input .part__share { grid-column: 1 / -1; grid-row: 2; text-align: left; font-size: 0.875rem; padding: 0 0 6px 32px; }
  .add-person { grid-template-columns: 1fr auto; }
  .ledger__head { display: none; }
  .entry { grid-template-columns: minmax(0, 1fr) auto 32px; grid-template-areas: "what amt x" "meta meta meta"; row-gap: 2px; }
  .entry__what { grid-area: what; }
  .entry__amt { grid-area: amt; }
  .entry__x { grid-area: x; }
  .entry__date, .entry__split { grid-area: meta; font-size: var(--t-small); }
  .entry__date { justify-self: start; }
  .entry__split { justify-self: end; margin-right: 44px; }
  .spec > div { grid-template-columns: 1fr; gap: var(--s-1); }
  .price-book__head { display: none; }
  .price-line { grid-template-columns: 1fr auto; row-gap: var(--s-2); }
  .price-line > p:not(.price-line__fig) { grid-column: 1 / -1; grid-row: 2; }
  .log li { grid-template-columns: 1fr auto; row-gap: 4px; }
  .log p { grid-column: 1 / -1; }
  .empty { grid-template-columns: 1fr; }
  .foot__in { grid-template-columns: 1fr; }
  .board__head { flex-direction: column; gap: 2px; }
}
.nowrap { white-space: nowrap; }
@media (max-width: 640px) {
  .transfer { gap: var(--s-2); }
  .transfer .btn { padding: 0 10px; }
}
