/* ==========================================================================
   splitu — shared expenses
   Mobile first: the phone layout is the base and the desktop shell is layered
   on at 960px. Every colour, size, space, radius, shadow and state comes from a
   token below, so light and dark stay in step and no rule carries a raw value of
   its own beyond a component's fixed dimensions.

   The style is Material 3 Expressive: tonal surfaces instead of edges, pill
   controls, a pill indicator under the selected place in the navigation, state
   layers for hover and press, and large rounded containers.

   One rule runs through the palette: colour is reserved for money. Every control
   the interface owns — buttons, links, the nav mark, focus — is a navy ink, and its
   tonal container is a tint of that same ink, so a green or a red anywhere on a
   page is always an amount and never decoration.
   ========================================================================== */

/* Archivo, served from here rather than from a font host: the shell is precached for
   offline and a third-party request would be the one thing in it that is not. One
   variable file carries both axes the page uses — weight, and the width that sets
   every figure of money. */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 62.5% 125%;
  font-display: swap;
  src: url('archivo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* native controls — scrollbars, the date picker, a select's list — follow the theme */
  color-scheme: light;

  /* ---------- colour ---------- */

  --ink: #141b2d;
  --ink-2: #4f596d;
  /* the quietest text still has to read at 4.5:1 on the tinted ground and the nav bar */
  --ink-3: #5f6880;

  /* the two directions money goes, and the only two hues on the page */
  --up: #0a7a4a;
  --up-strong: #07633c;
  --up-soft: rgba(10, 122, 74, .1);
  --down: #c03a2b;
  --down-strong: #a12e21;
  --down-soft: rgba(192, 58, 43, .09);
  --on-down: #ffffff;

  /* Ink, under the names the rest of the sheet already asks for: what used to be the
     brand colour is now the colour of anything you can press. brand-soft is ink's tonal
     container — the pill behind a selected nav item, a switch that is on, a selected
     tab's count, the track of a bar. */
  --brand: var(--ink);
  --brand-strong: var(--ink);
  --brand-soft: #dde3f1;
  --focus: var(--ink);
  --rose: var(--down);
  --rose-strong: var(--down-strong);
  --rose-soft: var(--down-soft);

  /* Tonal surfaces: the ground is tinted, a sheet on it is white, and that step is what
     tells them apart — no hairline round a card, no shadow under it. Lines are kept for
     what divides the inside of a sheet. */
  --bg: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --line: #e3e7ef;
  --line-strong: #c6ccd9;
  /* a field's edge, which has to hold 3:1 against the sheet to say it is a field at all */
  --outline: #767f93;

  --on-brand: #ffffff;
  --scrim: rgba(13, 18, 28, .4);

  /* the nav sits on the ground itself; the bar along the bottom of a phone is one tone down */
  --nav: var(--bg);
  --nav-2: #e6eaf2;
  --nav-line: transparent;
  --nav-fg: var(--ink-2);
  --nav-fg-strong: var(--ink);
  --nav-fg-muted: var(--ink-3);
  --nav-hover: color-mix(in srgb, var(--ink) var(--state-hover), transparent);
  --nav-active: var(--brand-soft);
  --nav-card: var(--surface);

  /* Eight flat inks of about one darkness, so a row of faces reads as a set and none of
     them competes with an amount for attention. Each holds 5:1 under white initials. */
  --avatar-0: #46685a;
  --avatar-1: #8e5436;
  --avatar-2: #4c6484;
  --avatar-3: #665380;
  --avatar-4: #7d6830;
  --avatar-5: #8a4d60;
  --avatar-6: #3f7175;
  --avatar-7: #676c63;
  --on-avatar: #ffffff;

  /* the sign-in pitch panel is navy in both themes */
  --pitch: #141b2d;
  --on-pitch: #ffffff;

  /* ---------- states ----------
     A state layer is the colour drawn on a control, laid over its fill at this strength:
     ink over a plain button, white over an ink one. Rules mix it from --state, which a
     control sets to whatever it draws in. */
  --state-hover: 8%;
  --state-press: 12%;
  --dim: .5;

  /* ---------- elevation ----------
     Material's levels 1–3. Sheets are flat; a filled button lifts to 1 under the
     pointer, and only what genuinely floats — the add button, the sticky form footer,
     a dialog — sits at 3. */
  --sh-1: 0 1px 2px rgba(20, 27, 45, .12), 0 1px 3px 1px rgba(20, 27, 45, .06);
  --sh-2: 0 1px 2px rgba(20, 27, 45, .12), 0 2px 6px 2px rgba(20, 27, 45, .08);
  --sh-3: 0 4px 8px 3px rgba(20, 27, 45, .1), 0 1px 3px rgba(20, 27, 45, .14);

  /* ---------- shape ---------- */
  --r-xs: 4px;
  --r-sm: 12px;
  --r-md: 16px;
  --r: 20px;
  --r-lg: 28px;
  --r-pill: 999px;

  /* ---------- type ---------- */
  --font: 'Archivo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", "Noto Sans", Arial, sans-serif;

  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-base: 15px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 28px;
  --fs-display: 45px;
  --fs-display-lg: 57px;

  --fw-book: 500;
  --fw-medium: 550;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-body: 1.5;
  --lh-heading: 1.25;
  --lh-display: 1.05;

  --tracking-tight: -.02em;
  --tracking-snug: -.01em;
  --tracking-wide: .01em;

  /* the width axis: money is pulled in hardest, headings and the mark a little */
  --stretch-figure: 78%;
  --stretch-display: 88%;
  --stretch-heading: 94%;

  /* ---------- space, on a 4px grid ---------- */
  --sp-0: 2px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-14: 56px;
  --sp-16: 64px;

  /* ---------- sizes ---------- */
  --control-h: 40px;
  --control-h-sm: 36px;
  --field-h: 44px;

  --side: 240px;
  --tab: 64px;
  --wide: 1100px;

  /* ---------- motion: Material's emphasised curve ---------- */
  --ease: cubic-bezier(.2, 0, 0, 1);
  --dur: .2s;
  --dur-fast: .1s;
}

/* a finger needs more than a pointer does */
@media (pointer: coarse) {
  :root { --control-h: 44px; }
}

/* System preference sets the default, but an explicit choice (data-theme, set by the
   toggle before first paint — see the head script in layout.html) always wins. Only the
   raw values are restated here; every token defined in terms of another follows. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;

  --ink: #e7eaf1;
  --ink-2: #a5aec0;
  --ink-3: #8a93a6;

  --up: #4fc48b;
  --up-strong: #6fd6a2;
  --up-soft: rgba(79, 196, 139, .14);
  --down: #f07d6d;
  --down-strong: #ff978a;
  --down-soft: rgba(240, 125, 109, .14);
  /* a pale red fill wants dark type on it, as the ink button does */
  --on-down: #0d121c;

  --brand-soft: #2a3550;

  --bg: #0d121c;
  --surface: #161c28;
  --surface-2: #1d2432;
  --line: #283041;
  --line-strong: #3a4457;
  --outline: #848ea2;

  /* the ink button inverts: a pale fill wants dark type on it */
  --on-brand: #0d121c;
  --scrim: rgba(0, 0, 0, .55);

  --nav-2: #161c28;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px 1px rgba(0, 0, 0, .2);
  --sh-2: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 6px 2px rgba(0, 0, 0, .25);
  --sh-3: 0 4px 8px 3px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --ink: #e7eaf1;
  --ink-2: #a5aec0;
  --ink-3: #8a93a6;

  --up: #4fc48b;
  --up-strong: #6fd6a2;
  --up-soft: rgba(79, 196, 139, .14);
  --down: #f07d6d;
  --down-strong: #ff978a;
  --down-soft: rgba(240, 125, 109, .14);
  /* a pale red fill wants dark type on it, as the ink button does */
  --on-down: #0d121c;

  --brand-soft: #2a3550;

  --bg: #0d121c;
  --surface: #161c28;
  --surface-2: #1d2432;
  --line: #283041;
  --line-strong: #3a4457;
  --outline: #848ea2;

  /* the ink button inverts: a pale fill wants dark type on it */
  --on-brand: #0d121c;
  --scrim: rgba(0, 0, 0, .55);

  --nav-2: #161c28;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px 1px rgba(0, 0, 0, .2);
  --sh-2: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 6px 2px rgba(0, 0, 0, .25);
  --sh-3: 0 4px 8px 3px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Nothing is coloured to say it is a link, so the ones sitting inside a sentence carry a
   rule under them instead — the rest of the app's links are whole rows and buttons. */
.hint a, .auth-card .foot a, .empty p a, .banner a { text-decoration: underline;
  text-underline-offset: 2px; text-decoration-color: var(--line-strong); }
.hint a:hover, .auth-card .foot a:hover, .empty p a:hover, .banner a:hover {
  text-decoration-color: currentColor; }

h1, h2, h3 { margin: 0; font-weight: var(--fw-semibold); letter-spacing: var(--tracking-snug);
  line-height: var(--lh-heading); }
h1 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); font-stretch: var(--stretch-heading);
  letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--fs-base); }
h3 { font-size: var(--fs-base); }
p { margin: 0 0 var(--sp-3); }

/* Every amount in the app is set from one rule: the width axis pulled in to 78%, which
   is what makes a figure read as a printed total rather than as more of the sentence
   around it. Tabular so a column of them lines up digit under digit. */
.hero .value, .stat .v, .amt, .settle-plan .amt, .charge .amt, .more .count {
  font-stretch: var(--stretch-figure);
  font-variant-numeric: tabular-nums;
}

/* Material's focus indicator: a 3px ring held clear of the control. An outline rather
   than a shadow, so it survives forced-colours mode, where shadows are dropped. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: var(--brand-soft); }

/* The browser's own [hidden] rule is only display:none, which any class here that sets a
   display of its own quietly outranks — a hidden .banner is laid out as a flex row all the
   same. Scripts on these pages hide things by the attribute, so it has to mean it. */
[hidden] { display: none !important; }

/* named for a screen reader, where the placeholder already says it to the eye */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* ---------- icons ---------- */

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 1.2em;
  height: 1.2em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   Shell
   ========================================================================== */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 56px;
  padding: 0 var(--sp-3) 0 var(--sp-4);
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

/* an installed app has no browser chrome, so the bar takes over the status area */
@media (display-mode: standalone) {
  .appbar { height: calc(56px + env(safe-area-inset-top)); }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  font-stretch: var(--stretch-display);
  letter-spacing: var(--tracking-snug);
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; flex: 0 0 28px; }

.appbar .spacer { flex: 1; }

.sidebar { display: none; }

/* ---------- theme toggle ---------- */

/* the icon shown is the theme a click switches *to* — moon while light, sun while dark */
.theme-toggle-icon.icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-icon.icon-sun { display: inline-flex; }
  :root:not([data-theme="light"]) .theme-toggle-icon.icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle-icon.icon-sun { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle-icon.icon-moon { display: none; }

.sidebar .me .out.theme-toggle { background: none; border: 0; cursor: pointer; font: inherit; }

.content {
  max-width: var(--wide);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) calc(var(--tab) + var(--sp-8) + env(safe-area-inset-bottom));
}

/* a page with one short card on it — an error, the offline notice — holds it up the middle */
.lone { max-width: 480px; margin: 10vh auto 0; }

/* ---------- bottom navigation bar (phones) ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: center;
  height: calc(var(--tab) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--nav-2) 94%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  height: 100%;
  color: var(--ink-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  -webkit-tap-highlight-color: transparent;
}
.tabbar a:hover { text-decoration: none; }
/* the icon carries the active indicator, so it is padded out into a pill of its own */
.tabbar a .ico {
  box-sizing: content-box;
  width: 22px;
  height: 22px;
  padding: var(--sp-1) 14px;
  border-radius: var(--r-pill);
  transition: background-color var(--dur) var(--ease);
}
.tabbar a.active { color: var(--ink); font-weight: var(--fw-bold); }
.tabbar a.active .ico { background: var(--nav-active); }

/* Material's FAB: a rounded square rather than a circle */
.tabbar .fab {
  justify-self: center;
  margin-top: -22px;
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--on-brand);
  box-shadow: var(--sh-3);
  gap: 0;
  font-size: 0;
  transition: transform var(--dur-fast) var(--ease);
}
.tabbar .fab .ico { width: 25px; height: 25px; padding: 0; stroke-width: 2.1; }
.tabbar .fab:active { transform: scale(.94); }

/* ==========================================================================
   Page furniture
   ========================================================================== */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.page-head .sub { color: var(--ink-2); font-size: var(--fs-md); margin-top: var(--sp-1); }
.page-head .titles { min-width: 0; }
.page-head .with-avatar { display: flex; align-items: center; gap: var(--sp-3); }

.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

.crumb {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  margin-bottom: var(--sp-2);
  text-decoration: none;
}
.crumb:hover { color: var(--ink); text-decoration: none; }
/* the sprite only carries a right chevron, so the back arrow is the same one turned round */
.crumb .ico { width: 15px; height: 15px; transform: rotate(180deg); }

/* ---------- cards ---------- */

/* A sheet of the ledger: white stock on the tinted ground, told from it by tone alone.
   The border is there but clear, so a card that has to warn can colour it. */
.card {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: var(--sp-5);
}

.card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 56px;
  padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.card > header .ico { color: var(--ink-3); }

.card-body { padding: var(--sp-5); }
.card-body.flush { padding: 0; }
.card-body + .card-body { border-top: 1px solid var(--line); }

.grid { display: grid; grid-template-columns: 1fr; gap: 0 var(--sp-5); align-items: start; }

/* ---------- the balance, and the seam under it ----------

   The figure, and under it one bar that carries the whole standing: what is owed to you
   runs in from the left, what you owe runs back from the right, and they meet. The tick
   is the middle. Seam left of the tick and you are owed more than you owe; right of it
   and you are behind. The two figures underneath stand under their own side of the bar. */

.hero {
  position: relative;
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
  background: var(--surface);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
}

.hero .label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--ink-2); }

.hero .value {
  margin-top: var(--sp-2);
  font-size: var(--fs-display);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-display);
}

.hero .note { margin-top: var(--sp-2); font-size: var(--fs-md); color: var(--ink-2); max-width: 44ch; }

/* the seam is lifted above the pair of figures it explains */
.hero .meter {
  order: 1;
  position: relative;
  display: flex;
  height: 8px;
  width: 100%;
  max-width: 560px;
  margin-top: var(--sp-6);
  background: var(--brand-soft);
  border-radius: var(--r-pill);
}
.hero .meter i { display: block; height: 100%; }
.hero .meter .a { background: var(--up); border-radius: var(--r-pill) 0 0 var(--r-pill); }
/* the two run at each other and meet; where they meet is the reading */
.hero .meter .b { background: var(--down); margin-left: auto; border-radius: 0 var(--r-pill) var(--r-pill) 0; }

/* The middle. The seam falling short of it means you owe more than is owed to you,
   past it means the other way — which is the same thing the figure above says, in the
   one form you can take in without reading it. */
.hero .meter::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -6px;
  bottom: -6px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--ink);
}

.hero .split {
  order: 2;
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  width: 100%;
  max-width: 560px;
  margin-top: var(--sp-3);
}
/* square with nothing owed either way: no seam is drawn, so the pair needs its own air */
.hero:not(:has(.meter)) .split { margin-top: var(--sp-5); }
.hero .split > *:last-child { text-align: right; }
.hero .split .k {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}
.hero .split > *:last-child .k { justify-content: flex-end; }
.hero .split .k .ico { width: 15px; height: 15px; }
.hero .split .v {
  margin-top: var(--sp-0);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-snug);
}
.hero .up { color: var(--up); }
.hero .down { color: var(--down); }
/* money leaving you points the other way */
.hero .out .ico, .stat.out .ico { transform: rotate(180deg); }

/* ---------- the figures along the top of a page ----------
   One strip rather than a row of little cards: the 1px gap lets a line show through
   as the rule between them. */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-bottom: var(--sp-5);
  background: var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

/* three tiles in two columns would leave the last one stranded, so the headline figure
   takes the full width and the two supporting ones share the row below it */
.stats.three { grid-template-columns: 1fr 1fr; }
.stats.three > :first-child { grid-column: 1 / -1; }

.stat {
  background: var(--surface);
  padding: var(--sp-4) var(--sp-5);
}
.stat .k {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.stat .k .ico { width: 15px; height: 15px; color: var(--ink-3); }
.stat .v {
  margin-top: var(--sp-1);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-snug);
}

/* ---------- amounts ---------- */

.amt { font-weight: var(--fw-bold); letter-spacing: var(--tracking-snug); }
.pos { color: var(--up); }
.neg { color: var(--down); }
.zero { color: var(--ink-3); font-weight: var(--fw-medium); }

/* ==========================================================================
   Lists
   ========================================================================== */

.list { list-style: none; margin: 0; padding: 0; }

.list > li {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  transition: background-color var(--dur) var(--ease);
}
.list > li:last-child { border-bottom: none; }
@media (hover: hover) {
  .list > li:hover { background-color: color-mix(in srgb, var(--ink) var(--state-hover), transparent); }
}

.list .main { flex: 1 1 auto; min-width: 0; }
.list .title { font-weight: var(--fw-semibold); }
.list .title a { color: inherit; }
.list .title a:hover { color: var(--brand-strong); text-decoration: none; }
.list .meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-0);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

/* The separator trails the item before it, so a wrapped line opens with words rather than
   with a stray mark — and it is a rule rather than a middot, the same hairline that
   divides everything else here. */
.list .meta > *:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: .85em;
  margin-left: var(--sp-1);
  vertical-align: -.1em;
  background: var(--line-strong);
}

/* detail that is worth the width on a laptop but not on a phone */
.hide-sm { display: none; }

/* ...and once it is hidden, whatever precedes it must not trail a separator into thin air */
.list .meta > *:has(+ .hide-sm)::after { content: none; }
@media (min-width: 960px) {
  .list .meta > *:has(+ .hide-sm)::after { content: ""; }
}

.list .trailing { flex: 0 0 auto; text-align: right; white-space: nowrap; }
.list .trailing .caption { font-size: var(--fs-2xs); color: var(--ink-3); margin-top: 1px;
  font-weight: var(--fw-book); }

.list .row-actions { display: flex; gap: var(--sp-2); flex: 0 0 auto; position: relative; z-index: 2; }
.list .chev { color: var(--ink-3); }

/* a whole row becomes the tap target without nesting the buttons inside a link */
.stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }

/* Rows carrying both an amount and a pair of buttons have nothing left for the title on a
   phone, so the buttons move to a line of their own. This is a grid rather than a wrapping
   flex row: a wrapped flex item keeps its content width and drags the amount out of
   alignment, while a grid track can be told to shrink. */
@media (max-width: 560px) {
  .list-actions > li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "tile main amount"
      ".    acts acts";
    column-gap: var(--sp-3);
    row-gap: var(--sp-1);
    align-items: center;
  }
  .list-actions > li > :first-child { grid-area: tile; }
  .list-actions .main { grid-area: main; }
  .list-actions .trailing { grid-area: amount; }
  .list-actions .row-actions { grid-area: acts; justify-content: flex-end; }
}

/* ---------- tiles and avatars ---------- */

.tile {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--ink-2);
}
.tile .ico { width: 19px; height: 19px; }
.tile.brand { background: var(--brand-soft); border-color: transparent; color: var(--ink); }
.tile.rose { background: var(--down-soft); border-color: transparent; color: var(--down); }

.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-stretch: var(--stretch-display);
  letter-spacing: var(--tracking-wide);
  color: var(--on-avatar);
  user-select: none;
}
.avatar.sm { width: 28px; height: 28px; flex-basis: 28px; font-size: var(--fs-2xs); }
.avatar.lg { width: 56px; height: 56px; flex-basis: 56px; font-size: var(--fs-xl); }

.avatar.c0 { background: var(--avatar-0); }
.avatar.c1 { background: var(--avatar-1); }
.avatar.c2 { background: var(--avatar-2); }
.avatar.c3 { background: var(--avatar-3); }
.avatar.c4 { background: var(--avatar-4); }
.avatar.c5 { background: var(--avatar-5); }
.avatar.c6 { background: var(--avatar-6); }
.avatar.c7 { background: var(--avatar-7); }

.stack { display: flex; flex: 0 0 auto; }
.stack .avatar { margin-left: -9px; box-shadow: 0 0 0 2px var(--surface); }
.stack .avatar:first-child { margin-left: 0; }
.stack .more {
  margin-left: -9px;
  background: var(--surface-2);
  color: var(--ink-2);
  box-shadow: 0 0 0 2px var(--surface);
  text-shadow: none;
}

/* ---------- tabs across the top of a card ---------- */

/* Three lists sharing one card. On a phone the strip scrolls sideways rather than
   wrapping, so the tabs keep their row and the panel below always starts in the same
   place. */
.tabs {
  display: flex;
  gap: var(--sp-1);
  padding: 0 var(--sp-2);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 0 auto;
  padding: var(--sp-4) var(--sp-3);
  color: var(--ink-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tab:hover {
  background-color: color-mix(in srgb, var(--ink) var(--state-hover), transparent);
  color: var(--ink);
  text-decoration: none;
}
.tab .ico { width: 17px; height: 17px; color: var(--ink-3); }
.tab .pill { font-variant-numeric: tabular-nums; }

.tab[aria-selected="true"] { color: var(--ink); }
/* Material's indicator: a 3px bar with its top corners rounded, as wide as the label */
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}
.tab[aria-selected="true"] .ico { color: var(--ink); }
.tab[aria-selected="true"] .pill { background: var(--brand-soft); border-color: transparent; color: var(--ink); }

/* ---------- empty states ---------- */

.empty { padding: var(--sp-10) var(--sp-5); text-align: center; color: var(--ink-2); }
.empty .mark {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--sp-3);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--ink-2);
}
.empty .mark .ico { width: 22px; height: 22px; }
.empty h3 { margin-bottom: var(--sp-4); color: var(--ink); font-weight: var(--fw-semibold); }
.empty h3:last-child { margin-bottom: 0; }
.empty h3:has(+ p) { margin-bottom: var(--sp-1); }
.empty p { font-size: var(--fs-md); max-width: 34ch; margin: 0 auto var(--sp-4); }
.empty p:last-child { margin-bottom: 0; }

/* ---------- the end of a growing list ---------- */

/* Sits under the last row that has been read. Scrolling onto it is what asks for the page
   below, so it keeps its height either way — landing on a count that then grows a button
   would move the list under the reader. */
.more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  min-height: 64px;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
}
.more .count { color: var(--ink-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.more .ico { transform: rotate(90deg); }

/* the fetch is usually over before this is seen; it is here for the time it is not */
.more .btn.busy { color: var(--ink-3); pointer-events: none; }

/* a list being replaced by a search stays put and steps back rather than blinking out */
[data-ledger] { transition: opacity var(--dur-fast) var(--ease); }
[data-ledger][aria-busy="true"] { opacity: var(--dim); }

/* ==========================================================================
   Buttons
   ========================================================================== */

/* Pills. The default is Material's outlined button; hover and press lay a state layer
   of --state over whatever the button is filled with, so one pair of rules serves the
   plain, the ink and the red button alike. */
.btn {
  --state: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--control-h);
  padding: var(--sp-2) var(--sp-5);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background-color: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover {
  background-image: linear-gradient(color-mix(in srgb, var(--state) var(--state-hover), transparent),
                                    color-mix(in srgb, var(--state) var(--state-hover), transparent));
  text-decoration: none;
}
.btn:active {
  background-image: linear-gradient(color-mix(in srgb, var(--state) var(--state-press), transparent),
                                    color-mix(in srgb, var(--state) var(--state-press), transparent));
}
.btn .ico { width: 18px; height: 18px; }

/* the one solid ink shape on a page, so it is the one thing that reads as the next step */
.btn.primary {
  --state: var(--on-brand);
  background-color: var(--ink);
  border-color: var(--ink);
  color: var(--on-brand);
}
.btn.primary:hover { box-shadow: var(--sh-1); }

.btn.danger {
  --state: var(--on-down);
  background-color: var(--down);
  border-color: var(--down);
  color: var(--on-down);
}
.btn.danger:hover { box-shadow: var(--sh-1); }

/* Material's text button */
.btn.quiet { border-color: transparent; color: var(--ink-2); padding: var(--sp-2) var(--sp-3); }
.btn.quiet:hover { color: var(--ink); }
.btn.quiet.warn:hover { --state: var(--down); color: var(--rose-strong); }

.btn.sm { min-height: var(--control-h-sm); padding: var(--sp-1) var(--sp-4); font-size: var(--fs-sm); }
.btn.sm .ico { width: 16px; height: 16px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: var(--control-h); min-height: var(--control-h); }
.btn.icon .ico { width: 20px; height: 20px; }
.btn[disabled] { opacity: var(--dim); pointer-events: none; }
/* A switch that is on has to look on, not merely hovered: an icon with no word beside it
   is the only thing saying which way it is set. */
.btn[aria-pressed="true"] { background-color: var(--brand-soft); border-color: transparent; color: var(--ink); }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { margin-bottom: var(--sp-4); }
.field:last-child { margin-bottom: 0; }

label { display: block; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--ink);
  margin-bottom: var(--sp-2); }

/* marks a field that can be left blank, without the label shouting about it */
label .opt { font-weight: var(--fw-book); color: var(--ink-3); }

/* Material's outlined field: an edge that holds 3:1, thickening to 2px of ink on focus */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%;
  min-height: var(--field-h);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--outline);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  /* 16px keeps iOS Safari from zooming in when a field takes focus */
  font-size: var(--fs-lg);
  transition: border-color var(--dur) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder { color: var(--ink-3); }

/* a search field otherwise keeps the browser's own clear button and inset
   decoration, which sit at odds with every other field on the page */
input[type=search]::-webkit-search-decoration,
input[type=search]::-webkit-search-results-button,
input[type=search]::-webkit-search-results-decoration,
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }

/* Material's drop-down arrow, a small solid triangle, drawn from two gradients in the
   muted ink so it follows the theme without an image per mode. */
select {
  padding-right: var(--sp-10);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position: calc(100% - 21px) 50%, calc(100% - 16px) 50%;
  background-size: 5px 5px;
}

/* The second pixel of the focused edge is an outline laid just inside the border rather
   than a shadow, so it is still drawn in forced-colours mode. Checkboxes and file pickers
   have no such edge and keep the ring. */
:is(input[type=text], input[type=email], input[type=password], input[type=number],
    input[type=date], input[type=search], select, textarea):focus {
  border-color: var(--focus);
  outline: 1px solid var(--focus);
  outline-offset: -2px;
}

.row { display: flex; flex-direction: column; gap: 0; }
.row > * { flex: 1; }
/* stacked on a phone, the last field of a row still needs its gap above whatever follows;
   only a row that ends the form gives it up */
.row > .field:last-child { margin-bottom: var(--sp-4); }
.row:last-child > .field:last-child { margin-bottom: 0; }

.hint { font-size: var(--fs-xs); color: var(--ink-2); margin-top: var(--sp-2); }
/* a hint under a whole row of fields belongs to the row, not to the field below it */
.row + .hint { margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); }
.row + .hint:last-child { margin-bottom: 0; }

/* wraps rather than squeezes: these forms carry two fields and a button on a phone */
.inline-form { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: flex-end; }
.inline-form .field { flex: 1 1 190px; margin-bottom: 0; }
.inline-form .btn { flex: 0 0 auto; }
.inline-form + .inline-form { margin-top: var(--sp-4); }

/* The submit row on a long form stays within thumb reach while scrolling.
   It has to live outside .card: a card clips its overflow, and a clipped ancestor
   stops position:sticky from ever sticking. */
.form-foot {
  position: sticky;
  bottom: calc(var(--tab) + var(--sp-2) + env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--sh-3);
}
.form-foot .btn { flex: 1; }
.form-foot .btn.primary { flex: 2; }
/* cards carry their gap underneath them, so one that follows a form has none above it */
form + .card { margin-top: var(--sp-4); }

/* the plain version, for short forms that sit inside a card */
/* The filter and the switches that go with it: the input takes whatever room is left and
   the icons keep their size, wrapping under it on a narrow phone rather than shrinking. */
.filter-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: flex-end; }
.filter-row .field { flex: 1 1 190px; margin-bottom: 0; }
.filter-row .tools { display: flex; align-items: center; gap: var(--sp-1); flex: 0 0 auto; }
.filter-row .tools .sep { width: 1px; align-self: stretch; margin: var(--sp-1); background: var(--line); }

.btn-row { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.btn-row .btn { flex: 1; }

/* a question with more than OK and Cancel for an answer, opened by a button's popovertarget:
   Material's dialog, the largest corner on the page and the one thing lifted to level 3 */
.choice[popover] {
  width: min(420px, calc(100vw - var(--sp-8)));
  padding: var(--sp-6);
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-3);
}
.choice[popover]::backdrop { background: var(--scrim); }
.choice h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-xl); }
.choice p { margin: 0; color: var(--ink-2); }
.choice .btn-row { flex-direction: column; margin-top: var(--sp-6); }

/* ---------- participant picker ---------- */

.people { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }

.people .person {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  min-height: 56px;
  border-bottom: 1px solid var(--line);
}
.people .person:last-child { border-bottom: none; }
.people .person input[type=checkbox] {
  width: 21px;
  height: 21px;
  min-height: 0;
  flex: 0 0 21px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.people .person .who {
  flex: 1;
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  cursor: pointer;
}
.people .person .weight { width: 112px; flex: 0 0 112px; }
.people .person .weight input { min-height: var(--control-h-sm); padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-base); text-align: right; }
.people .person .unit { color: var(--ink-3); font-size: var(--fs-sm); width: 18px; flex: 0 0 18px; }

/* ---------- statement charges ----------
   A couple of hundred rows on one page, so they are set tighter than a .list and the
   whole row is the label for its own checkbox — on a phone there is no room for a
   separate tap target, and the shop name is the thing worth pressing. */

.charge-card + .charge-card { border-top: 1px solid var(--line); }

.charge-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  font-size: var(--fs-sm);
  position: sticky;
  top: 0;
  z-index: 1;
}
.charge-head .who { display: flex; align-items: center; gap: var(--sp-2); flex: 1; margin: 0; cursor: pointer;
  font-weight: var(--fw-semibold); }
.charge-head .amt { color: var(--ink-2); font-size: var(--fs-sm); }

.charge {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
@media (hover: hover) {
  .charge:hover { background-color: color-mix(in srgb, var(--ink) var(--state-hover), transparent); }
}
.charge input[type=checkbox] {
  width: 20px;
  height: 20px;
  min-height: 0;
  flex: 0 0 20px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.charge .when {
  flex: 0 0 52px;
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.charge .what { flex: 1 1 auto; min-width: 0; }
.charge .what .title {
  display: block;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.charge .what .meta { display: block; color: var(--ink-3); font-size: var(--fs-2xs); }
.charge .amt { flex: 0 0 auto; font-size: var(--fs-md); }

/* a charge already split stays on the page as its own receipt, but is not on offer again */
.charge.done { opacity: .55; cursor: default; }

/* ==========================================================================
   Bits and pieces
   ========================================================================== */

/* filled tonal boxes rather than outlined ones: ink's container for news, red's for trouble */
.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
}
.banner .ico { width: 18px; height: 18px; margin-top: var(--sp-0); }
.banner.info { background: var(--brand-soft); color: var(--ink); }
.banner.error { background: var(--down-soft); color: var(--down-strong); }
/* answering the form right above it, rather than the page as a whole */
.inline-form + .banner { margin: var(--sp-4) 0 0; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-0) var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--ink-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.pill.brand { background: var(--brand-soft); border-color: transparent; color: var(--ink); }
.pill.gone { background: var(--down-soft); border-color: transparent; color: var(--down); }
.pill .ico { width: 13px; height: 13px; }

/* ---------- the audit feed ---------- */

/* A history line names the thing and then what became of it, so the two sit on one line
   with the badge kept out of the way of a long description. */
.list .title .what { margin-right: var(--sp-2); }

/* An entry that is no longer there is still worth reading, just not worth the ink of one
   that is: struck through and dimmed, tile and all. */
.list > li.gone .title .what { text-decoration: line-through; color: var(--ink-3); }
.list > li.gone .tile { opacity: .55; }

.settle-plan { list-style: none; margin: 0; padding: 0; }
.settle-plan li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-md);
}
.settle-plan li:last-child { border-bottom: none; }
.settle-plan .who { font-weight: var(--fw-semibold); }
.settle-plan .arrow { color: var(--ink-3); display: inline-flex; }
.settle-plan .arrow .ico { width: 16px; height: 16px; }
.settle-plan .push { flex: 1 1 auto; }
.settle-plan .amt { font-size: var(--fs-base); }

/* Material's linear indicator: a rounded track in ink's container, the share in muted ink */
.bar { height: 6px; border-radius: var(--r-pill); background: var(--brand-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--ink-2); }

/* a report row's share of the total, under the name it belongs to. Capped so that on a
   wide screen the bars stay a column to compare down rather than a stripe to read across */
.list .bar { margin-top: var(--sp-2); max-width: 340px; }

/* forms read better in a column narrower than the full page */
.narrow { max-width: 640px; }

/* ==========================================================================
   Auth screens
   ========================================================================== */

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
}

.auth-pitch { display: none; }

.auth-theme-toggle {
  position: fixed;
  top: calc(var(--sp-3) + env(safe-area-inset-top));
  right: var(--sp-3);
  z-index: 10;
}
.auth-theme-toggle .ico { color: var(--ink-2); }

/* Language switch on the signed-out pages, tucked in beside the theme toggle. Plain
   submit buttons rather than a select, so it works with no script at all — this is the
   one control on the page somebody may need before they can read anything else on it. */
.auth-lang {
  position: fixed;
  top: calc(var(--sp-3) + env(safe-area-inset-top));
  right: calc(var(--control-h) + var(--sp-4));
  z-index: 10;
  display: flex;
  gap: var(--sp-1);
  align-items: center;
  height: var(--control-h);
}
.auth-lang .lang {
  border: 0;
  background: none;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-pill);
  font: inherit;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.auth-lang .lang:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) var(--state-hover), transparent); }
.auth-lang .lang.current { color: var(--ink); font-weight: var(--fw-semibold); }

.auth-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-8) var(--sp-5) calc(var(--sp-8) + env(safe-area-inset-bottom));
}

.auth-card { width: 100%; max-width: 400px; margin: 0 auto; }

.auth-card .mark {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-8);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  font-stretch: var(--stretch-display);
  letter-spacing: var(--tracking-snug);
}
.auth-card .mark .logo { width: 34px; height: 34px; flex: 0 0 34px; }

.auth-card h1 { font-size: var(--fs-3xl); margin-bottom: var(--sp-6); }
.auth-card .lede { color: var(--ink-2); font-size: var(--fs-md); margin-bottom: var(--sp-6); }
.auth-card form { margin-top: var(--sp-1); }
.auth-card .foot { margin-top: var(--sp-5); font-size: var(--fs-md); color: var(--ink-2); text-align: center; }

.auth-card .demo {
  margin-top: var(--sp-5);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  text-align: center;
}
.auth-card .demo code { color: var(--ink); font-size: var(--fs-xs); }

/* ==========================================================================
   Desktop shell
   ========================================================================== */

@media (min-width: 960px) {
  body.app { padding-left: var(--side); }

  .appbar, .tabbar { display: none; }

  /* Material's navigation drawer: on the ground itself, items as pills */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--side);
    z-index: 30;
    display: flex;
    flex-direction: column;
    padding: var(--sp-5) var(--sp-3);
    background: var(--nav);
    color: var(--nav-fg);
    border-right: 1px solid var(--nav-line);
    overflow-y: auto;
  }

  .sidebar .brand { color: var(--nav-fg-strong); margin: 0 var(--sp-4) var(--sp-6); }

  .sidebar nav { display: flex; flex-direction: column; gap: var(--sp-0); }

  .sidebar nav a {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 48px;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-pill);
    color: var(--nav-fg);
    font-size: var(--fs-md);
    font-weight: var(--fw-medium);
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .sidebar nav a:hover { background: var(--nav-hover); color: var(--nav-fg-strong); text-decoration: none; }
  .sidebar nav a .ico { width: 20px; height: 20px; opacity: .85; }
  .sidebar nav a.active {
    background: var(--nav-active);
    color: var(--nav-fg-strong);
    font-weight: var(--fw-semibold);
  }
  .sidebar nav a.active .ico { color: var(--ink); opacity: 1; }

  .sidebar .cta { margin: var(--sp-5) 0 0; }
  .sidebar .cta + .cta { margin-top: var(--sp-2); }
  .sidebar .grow { flex: 1; }

  .sidebar .me {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
    border-radius: var(--r-md);
    background: var(--nav-card);
  }
  .sidebar .me .who { flex: 1; min-width: 0; }
  .sidebar .me .who a { color: var(--nav-fg-strong); font-size: var(--fs-md); font-weight: var(--fw-semibold); display: block; }
  .sidebar .me .who span {
    display: block;
    font-size: var(--fs-xs);
    color: var(--nav-fg-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sidebar .me .out { color: var(--nav-fg-muted); padding: var(--sp-1); display: inline-flex; }
  .sidebar .me .out:hover { color: var(--nav-fg-strong); }

  .content { padding: var(--sp-8) var(--sp-10) var(--sp-16); }

  h1 { font-size: var(--fs-3xl); }

  .grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats.three { grid-template-columns: repeat(3, 1fr); }
  .stats.three > :first-child { grid-column: auto; }
  .stats.four { grid-template-columns: repeat(4, 1fr); }

  .hide-sm { display: initial; }

  /* The figure on the left, the seam and its two halves on the right, so the panel is
     read across in one line rather than down a column with nothing beside it. */
  .hero {
    display: grid;
    grid-template-columns: auto minmax(300px, 480px);
    justify-content: space-between;
    column-gap: var(--sp-12);
    padding: var(--sp-8);
  }
  .hero .label { grid-area: 1 / 1; }
  .hero .value { grid-area: 2 / 1; font-size: var(--fs-display-lg); }
  .hero .note { grid-area: 3 / 1; }
  .hero .meter { grid-area: 1 / 2 / 3 / 3; align-self: end; margin: 0 0 var(--sp-2); }
  .hero .split { grid-area: 3 / 2; margin-top: var(--sp-3); }
  .hero:not(:has(.meter)) .split { grid-area: 1 / 2 / 4 / 3; align-self: center; margin-top: 0; }

  .row { flex-direction: row; gap: var(--sp-3); }
  .row:last-child > .field { margin-bottom: 0; }

  .form-foot {
    position: static;
    margin: var(--sp-5) 0 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }
  .form-foot .btn, .form-foot .btn.primary, .btn-row .btn { flex: 0 0 auto; }

  .auth { grid-template-columns: 1.05fr .95fr; }
  .auth-pitch {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--sp-6);
    padding: var(--sp-14);
    color: var(--on-pitch);
    background: var(--pitch);
  }
  .auth-pitch .mark { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-2xl);
    font-weight: var(--fw-bold); font-stretch: var(--stretch-display); letter-spacing: var(--tracking-snug); }
  .auth-pitch .mark .logo { width: 36px; height: 36px; }
  .auth-pitch h2 { font-size: var(--fs-display-lg); font-weight: var(--fw-bold); font-stretch: var(--stretch-figure);
    letter-spacing: var(--tracking-tight); max-width: 14ch; line-height: var(--lh-display); }
  .auth-form { padding: var(--sp-12); }
  /* the pitch panel already carries the mark */
  .auth-card .mark { display: none; }
}

/* Removing a person from the admin pages is a whole card of consequences rather than the
   single button every other delete on the site is, so the card itself carries the warning —
   the list inside it is what will be lost, and it should not read as an ordinary section. */
.card.danger-zone { border-color: color-mix(in srgb, var(--down) 35%, transparent); }
.card.danger-zone > header h2 { color: var(--down-strong); }
.card.danger-zone .list .title { font-weight: var(--fw-semibold); }

/* a little more air on very wide screens */
@media (min-width: 1400px) {
  .content { padding: var(--sp-10) var(--sp-12) var(--sp-16); }
}
