/* The platform stylesheet, grown from the prototype in _dev/prototypes/.
 *
 * Components the platform doesn't render yet (the Horizon, the P&L, invoice
 * rows, the coding inbox, the command bar) are kept from the prototype so the
 * modules that need them start from the agreed design. Platform additions are
 * at the end.
 *
 * Mobile-first: the base rules ARE the phone. Wider layouts are added with
 * min-width media queries (the shell) and container queries (components), so
 * a component responds to the space it actually has, not to the screen.
 *
 * No inline styles anywhere: every visual comes from a class, so this can move
 * into the real platform under a strict CSP unchanged. Every colour resolves
 * through the tokens below, and the accent means "needs you" and nothing else.
 *
 * --action is what can be clicked: links, buttons, the current tab, selected
 * choices, focus. An operator sets it (Platform → Appearance); /theme.css,
 * linked after this file, carries the chosen colours. The values here are the
 * defaults, so the page is right even before that sheet arrives.
 */

/* ---------- Tokens ---------------------------------------------------- */

:root {
  --bg: #fafaf8;
  --ink: #111110;
  --muted: #62625e;
  --rule: #e2e2dc;
  --soft: #efefea;
  --accent: #d43a00;
  --on-accent: #ffffff;
  --action: #8a3a94;
  --on-action: #ffffff;
  /* Menus: a light wash of the action colour, so navigation never looks like
   * an information panel. Mixed from the tokens, so dark mode follows. */
  --action-tint: color-mix(in srgb, var(--action) 9%, var(--bg));
  --action-edge: color-mix(in srgb, var(--action) 24%, var(--bg));
  /* Buttons and menu items: square with rounded corners, never pills. */
  --radius-btn: .5rem;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  /* The product name (.logo) and page headings (h1), nothing else.
   * Self-hosted: the CSP allows no font origin but this one. Licence in
   * assets/fonts/OFL.txt. One weight only: 400. */
  --font-display: "Fredericka the Great", var(--font);

  color-scheme: light dark;
}

@font-face {
  font-family: "Fredericka the Great";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/fredericka-the-great-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fredericka the Great";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/fredericka-the-great-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;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0e;
    --ink: #f2f2ee;
    --muted: #a2a29b;
    --rule: #2b2b28;
    --soft: #1b1b19;
    --accent: #ff6b2c;
    --on-accent: #111110;
    --action: #dcb0e4;
    --on-action: #111110;
    --action-tint: color-mix(in srgb, var(--action) 14%, var(--bg));
    --action-edge: color-mix(in srgb, var(--action) 30%, var(--bg));
  }
}

/* ---------- Base ------------------------------------------------------ */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.5 var(--font);
}

[hidden] { display: none !important; }

a { color: var(--action); text-underline-offset: .2em; text-decoration-thickness: 1px; }

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

.sr {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 1rem; top: -5rem;
  z-index: 100;
  padding: .75rem 1rem;
  border-radius: .5rem;
  background: var(--ink);
  color: var(--bg);
}
.skip:focus { top: 1rem; }

.num { font-variant-numeric: tabular-nums; }
/* A colour sample beside its hex code: the colour on the page it's used on. */
.swatch { width: 1.25rem; height: 1.25rem; margin-right: .5rem; vertical-align: -.25rem; }

kbd {
  font: inherit;
  font-size: .75em;
  line-height: 1.4;
  padding: 0 .4em;
  border: 1px solid currentColor;
  border-radius: .3rem;
  opacity: .6;
}
@media (hover: none) { kbd { display: none; } }

.needs { color: var(--accent); }

/* ---------- Shell: top bar ------------------------------------------- */

.bar {
  position: sticky;
  top: 0;
  /* Above the navigation (20), so the organisation menu opens over it. */
  z-index: 30;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.org { position: relative; min-width: 0; }

.org summary {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 48px;
  padding-right: 1.25rem;
  cursor: pointer;
  list-style: none;
  line-height: 1.2;
}
.org summary::-webkit-details-marker { display: none; }
.org summary::after {
  content: "";
  position: absolute;
  right: .25rem;
  top: 50%;
  width: .4rem;
  height: .4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
}

.org__name {
  max-width: 58vw;
  overflow: hidden;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.role {
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.org__list {
  position: absolute;
  top: calc(100% + .25rem);
  left: 0;
  z-index: 30;
  min-width: min(20rem, 90vw);
  margin: 0;
  padding: .25rem 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: .75rem;
  box-shadow: 0 16px 40px rgb(0 0 0 / .12);
}
.org__list a {
  color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
  padding: .5rem 1rem;
  text-decoration: none;
}
.org__list a:hover { background: var(--soft); }
.org__list a[aria-current="true"] { font-weight: 650; }

.cmd {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  margin-left: auto;
  padding: 0 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-btn);
  color: var(--muted);
  font-size: .875rem;
  text-decoration: none;
}
.cmd:hover { color: var(--ink); border-color: var(--ink); }
.cmd__long { display: none; }

@media (min-width: 40rem) {
  .cmd__long { display: inline; }
  .org__name { max-width: 28rem; }
}

/* ---------- Shell: navigation --------------------------------------- */

/* Phone: a bottom bar within thumb reach. */
.rail {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  border-top: 1px solid var(--rule);
}

.rail a {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-height: 56px;
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .02em;
  text-decoration: none;
}
.rail a[aria-current="page"] { color: var(--action); font-weight: 650; }
.rail a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--action);
}

.badge {
  min-width: 1.25rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .6875rem;
  font-weight: 650;
  line-height: 1.25rem;
  text-align: center;
}

main { padding: 1.5rem 1rem 7rem; }

/* Desktop: a quiet left rail, and the whole width for the work. */
@media (min-width: 60rem) {
  body {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  .bar { grid-column: 1 / -1; padding: .5rem 1.5rem; }

  .rail {
    position: sticky;
    top: 4.5rem;
    align-self: start;
    flex-direction: column;
    padding: 2rem 0 0 .75rem;
    background: none;
    border-top: 0;
  }
  .rail a {
    flex: none;
    justify-content: flex-start;
    min-height: 44px;
    padding: 0 1rem;
    font-size: .9375rem;
  }
  .rail a[aria-current="page"]::before {
    top: .75rem; bottom: .75rem; left: 0; right: auto;
    width: 2px; height: auto;
  }

  main { padding: 2.5rem 3rem 4rem 2rem; }
}

/* ---------- Type patterns ------------------------------------------- */

.eyebrow {
  margin: 0 0 .75rem;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Numbers in sentences: the headline of every screen. */
.say {
  max-width: 32ch;
  margin: 0 0 2.5rem;
  font-size: clamp(1.375rem, 1rem + 1.8vw, 2.375rem);
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: -.012em;
  text-wrap: pretty;
}
.say--sm {
  max-width: 44ch;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
}
/* Page headings and the sentence headlines (.say) share the logo's face,
 * in normal case. The face reads light, so no negative tracking. */
h1, .say {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
}
.say a, .say strong { font-weight: 650; }
.say a {
  text-decoration-line: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: .09em;
  text-underline-offset: .18em;
}
.say a:hover { text-decoration-color: currentColor; }

/* ---------- Controls ------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 48px;
  padding: 0 1.25rem;
  border: 1px solid var(--action);
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--action);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--soft); }
.btn--primary { background: var(--action); color: var(--on-action); }
.btn--primary:hover { background: var(--action); opacity: .88; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 2rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  margin: 0 0 2rem;
  font-size: .9375rem;
}
.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
}
.tabs a[aria-current="page"] {
  color: var(--action);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .5em;
}
.tag--due { border-color: var(--accent); color: var(--accent); }
.tabs .badge { display: inline-block; margin-left: .35rem; text-decoration: none; }
/* A module's menu (views/section-nav.php): sections in a tinted band, the
   current one filled with the action colour; the current section's pages
   beside it on a phone, beneath it when there's room. Rows that don't fit
   scroll sideways rather than wrapping. */
.secnav-wrap { container: secnav / inline-size; margin: 0 0 2rem; }
.secnav__band {
  position: relative;
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem;
  border-radius: .75rem;
  background: var(--action-tint);
  box-shadow: inset 0 0 0 1px var(--action-edge);
}
.secnav ul { display: flex; gap: .125rem; margin: 0; padding: 0; list-style: none; }
.secnav__top, .secnav__sub {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.secnav__top::-webkit-scrollbar, .secnav__sub::-webkit-scrollbar { display: none; }
/* A row that runs past the edge fades there, so it reads as "more this way". */
.secnav__top.is-cut, .secnav__sub.is-cut {
  padding-right: 1.5rem;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
}
.secnav--has-sub .secnav__top { display: none; }
.secnav a, .secnav summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .9rem;
  border-radius: var(--radius-btn);
  color: var(--ink);
  font-size: .9375rem;
  text-decoration: none;
  white-space: nowrap;
}
.secnav a:hover { background: var(--bg); }
.secnav__top a[aria-current="page"], .secnav summary {
  background: var(--action);
  color: var(--on-action);
  font-weight: 650;
}
.secnav__sub a[aria-current="page"] {
  background: var(--bg);
  color: var(--action);
  font-weight: 650;
  box-shadow: 0 1px 2px rgb(0 0 0 / .12);
}
.secnav .badge { margin-left: .4rem; }
.secnav__pick { flex: none; }
.secnav summary { cursor: pointer; list-style: none; gap: .45rem; }
.secnav summary::-webkit-details-marker { display: none; }
.secnav summary::after {
  content: "";
  width: .38rem;
  height: .38rem;
  margin-top: -.2rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.secnav__pick[open] summary::after { margin-top: .2rem; transform: rotate(-135deg); }
.secnav__pick > ul {
  position: absolute;
  top: calc(100% + .375rem);
  left: 0;
  z-index: 25;
  flex-direction: column;
  min-width: min(16rem, 90vw);
  padding: .375rem;
  border: 1px solid var(--rule);
  border-radius: .75rem;
  background: var(--bg);
  box-shadow: 0 8px 24px rgb(0 0 0 / .14);
}
.secnav__pick > ul a { display: flex; border-radius: .5rem; }
.secnav__pick > ul a:hover { background: var(--soft); }
.secnav__pick > ul a[aria-current="page"] { background: var(--soft); color: var(--action); font-weight: 650; }

@container secnav (min-width: 40rem) {
  .secnav__band { display: block; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .secnav__pick { display: none; }
  .secnav__top, .secnav--has-sub .secnav__top {
    display: inline-flex;
    flex-wrap: wrap;
    max-width: 100%;
    padding: .25rem;
    border-radius: .75rem;
    background: var(--action-tint);
    box-shadow: inset 0 0 0 1px var(--action-edge);
  }
  .secnav .secnav__sub { flex-wrap: wrap; margin-top: .875rem; padding-left: .25rem; }
  .secnav__sub a { min-height: 40px; font-size: .875rem; color: var(--muted); }
  .secnav__sub a[aria-current="page"] { background: var(--soft); box-shadow: none; }
}

/* A filter under the tabs: which bank account, which lines. */
.tabs--sub { margin: -1.25rem 0 1.5rem; font-size: .875rem; }
/* A filter too long for tabs (the bank accounts): a select that goes as soon
   as one is picked; the button is only there without script. */
.pick { display: flex; align-items: end; gap: .75rem; margin: -.5rem 0 1.5rem; }
.pick .field { flex: 1; min-width: 0; max-width: 22rem; margin: 0; }
.js .pick__go { display: none; }

/* ---------- Forms ---------------------------------------------------
 *
 * ONE system for every form control, so a module's forms look like the
 * core's without styling anything. Every text-like input, select, textarea
 * and file input gets the same font, height, padding, border and states from
 * the tokens below. Controls fill their .field; outside one (an inline
 * select in a list row) they size to their content and use the compact
 * height.
 *
 *   <label class="field">
 *     <span>Label</span>
 *     <input type="text" name="…">
 *   </label>
 *   <p class="help">Optional help under a field.</p>
 */

:root {
  --control-h: 48px;          /* full-size control */
  --control-h-sm: 44px;       /* inline control — still a 44px touch target */
  --control-pad-x: .75rem;
  --control-radius: .6rem;
  --control-border: var(--rule);
  --control-border-hover: var(--muted);
  --control-border-focus: var(--action);
}

.field { display: grid; gap: .35rem; margin: 0 0 1.25rem; }
.field > span {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

:where(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="range"], [type="color"]), select, textarea) {
  box-sizing: border-box;
  min-height: var(--control-h-sm);
  max-width: 100%;
  padding: 0 var(--control-pad-x);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;            /* ≥16px: iOS doesn't zoom on focus */
  line-height: 1.4;
}

.field :where(input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea) {
  width: 100%;
  min-height: var(--control-h);
}

:where(input, select, textarea):hover { border-color: var(--control-border-hover); }
:where(input, select, textarea):focus { border-color: var(--control-border-focus); }
:where(input, select, textarea)::placeholder { color: var(--muted); opacity: .8; }
:where(input, select, textarea, button):disabled { opacity: .55; cursor: not-allowed; }
:where(input, select, textarea)[aria-invalid="true"] { border-color: var(--accent); }

textarea,
.field textarea {
  min-height: 7rem;
  padding-block: .65rem;
  resize: vertical;
}

/* Select: the browser's arrow replaced by one drawn in CSS — no image, so the
   strict CSP holds, and it follows the text colour in dark mode. */
select {
  appearance: none;
  padding-right: 2.5rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.2rem) 55%, calc(100% - .85rem) 55%;
  background-size: .35rem .35rem;
  background-repeat: no-repeat;
  cursor: pointer;
}

/* File: the picker button styled like the app's own buttons, the chosen file's
   name beside it in the muted text colour. */
input[type="file"] {
  display: flex;
  align-items: center;
  padding: .35rem .35rem .35rem .35rem;
  color: var(--muted);
  font-size: .9375rem;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: .85rem;
  padding: 0 1rem;
  border: 1px solid var(--action);
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--action);
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
}
input[type="file"]:hover::file-selector-button { background: var(--soft); }

input[type="checkbox"],
input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--action);
  cursor: pointer;
}

button { font: inherit; }

/* Two fields side by side (code + name, month + day). The second takes the
   room; on the narrowest phones they still sit together because the first is
   short. */
.field-row {
  display: grid;
  grid-template-columns: minmax(6rem, 1fr) minmax(0, 2fr);
  gap: 0 .75rem;
}
.field-row .field { min-width: 0; }
/* Two fields of equal weight, either of which may be a date: a date picker
   won't shrink below its own width, so the pair stacks when there isn't
   room for both side by side. */
.field-row--even { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }

/* Help text under a field (after the .field label, not inside it). */
.help {
  margin: -.75rem 0 1.25rem;
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.45;
}

/* ---------- 1. The Horizon ------------------------------------------ */

.hz { container: hz / inline-size; margin: 0 0 3rem; }

.hz__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  margin: 0 0 .5rem;
}
.hz__head .eyebrow { margin: 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem 1rem;
  margin: 0;
  color: var(--muted);
  font-size: .8125rem;
}
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend span::before {
  content: "";
  width: .9rem;
  height: .55rem;
  border-radius: 1px;
}
.legend .sw-act::before { background: var(--ink); }
.legend .sw-fc::before {
  background: repeating-linear-gradient(135deg, var(--ink) 0 1.5px, transparent 1.5px 5px);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.legend .sw-needs::before { background: var(--accent); }

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

/* Bar length is a class, not a style attribute, so the CSP holds and the
   chart renders with no JavaScript. The server picks lvl-0 … lvl-20. */
.lvl-0  { --lvl: 0;   } .lvl-1  { --lvl: .05; } .lvl-2  { --lvl: .10; }
.lvl-3  { --lvl: .15; } .lvl-4  { --lvl: .20; } .lvl-5  { --lvl: .25; }
.lvl-6  { --lvl: .30; } .lvl-7  { --lvl: .35; } .lvl-8  { --lvl: .40; }
.lvl-9  { --lvl: .45; } .lvl-10 { --lvl: .50; } .lvl-11 { --lvl: .55; }
.lvl-12 { --lvl: .60; } .lvl-13 { --lvl: .65; } .lvl-14 { --lvl: .70; }
.lvl-15 { --lvl: .75; } .lvl-16 { --lvl: .80; } .lvl-17 { --lvl: .85; }
.lvl-18 { --lvl: .90; } .lvl-19 { --lvl: .95; } .lvl-20 { --lvl: 1;   }

/* Phone: time runs DOWN the screen. One row per month. */
.p {
  position: relative;
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) 4.25rem;
  grid-template-areas:
    "m  bar amt"
    ".  ev  ev";
  align-items: center;
  column-gap: .75rem;
  padding: .45rem 0;
}

.p__m {
  grid-area: m;
  color: var(--muted);
  font-size: .8125rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.p__bar { grid-area: bar; display: flex; height: .625rem; }
.p__bar::before {
  content: "";
  width: calc(var(--lvl) * 100%);
  height: 100%;
  border-radius: 1px;
  background: var(--ink);
}
.p--fc .p__bar::before {
  background: repeating-linear-gradient(135deg, var(--ink) 0 1.5px, transparent 1.5px 5px);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.p--low .p__bar::before {
  background: repeating-linear-gradient(135deg, var(--accent) 0 1.5px, transparent 1.5px 5px);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.p__amt {
  grid-area: amt;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.p--low .p__amt { color: var(--accent); font-weight: 650; }

.p__ev {
  grid-area: ev;
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .9rem;
  margin: .3rem 0 0;
  padding: 0;
  list-style: none;
  font-size: .8125rem;
}

.ev { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); }
.ev::before {
  content: "";
  flex: none;
  width: .4rem;
  height: .4rem;
  border-radius: 50%;
  background: currentColor;
}
.ev--in { color: var(--ink); }
.ev--needs { color: var(--accent); font-weight: 650; }
.ev a { color: inherit; }

/* Today: a rule across the flow of time, labelled from the markup. */
.p--today { margin-top: 1.75rem; border-top: 2px solid var(--ink); padding-top: .75rem; }
.p--today::before {
  content: attr(data-today);
  position: absolute;
  top: -1.5rem;
  left: 0;
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Wide: the same list turns on its side and time runs ACROSS. */
@container hz (min-width: 46rem) {
  .hz__list {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
  }

  .p {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 12rem auto auto 1fr;
    grid-template-areas: "bar" "m" "amt" "ev";
    align-items: start;
    padding: 0 .3rem;
  }

  .p__bar { height: 100%; align-items: flex-end; }
  .p__bar::before { width: 100%; height: calc(var(--lvl) * 100%); }

  .p__m {
    padding-top: .5rem;
    border-top: 1px solid var(--rule);
    text-align: center;
  }
  .p__amt { font-size: .8125rem; text-align: center; }

  .p__ev {
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    margin-top: .6rem;
    font-size: .75rem;
    line-height: 1.3;
    text-align: center;
  }
  .ev { flex-direction: column; gap: .2rem; }

  .p--today {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    border-left: 2px solid var(--ink);
  }
  .p--today::before { top: -1.6rem; left: .4rem; white-space: nowrap; }
}

/* ---------- The P&L: one number per row on a phone ------------------ */

.rep {
  container: rep / inline-size;
  max-width: 64rem;

  /* Which figure columns show. On a phone, the lens below chooses one. */
  --show-a: table-cell;
  --show-b: none;
  --show-l: none;
  --show-v: none;
}
.rep:has(#lens-b:checked) { --show-a: none; --show-b: table-cell; }
.rep:has(#lens-l:checked) { --show-a: none; --show-l: table-cell; }
.rep:has(#lens-v:checked) { --show-a: none; --show-v: table-cell; }

.rep__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  margin: 0 0 1rem;
}
.rep__period { margin: 0; color: var(--muted); font-size: .875rem; }

/* Full width with equal segments, so four choices fit a 320px phone. */
.lens {
  display: flex;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: .25rem;
  border: 1px solid var(--rule);
  border-radius: .75rem;
}
.lens input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.lens label {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 .4rem;
  border-radius: var(--radius-btn);
  font-size: .8125rem;
  cursor: pointer;
  white-space: nowrap;
}
.lens input:checked + label { background: var(--action); color: var(--on-action); font-weight: 600; }
.lens input:focus-visible + label { outline: 2px solid var(--action); outline-offset: 2px; }

.pl {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.pl th, .pl td {
  padding: .7rem 0;
  border-bottom: 1px solid var(--rule);
  font-weight: 400;
  text-align: left;
  vertical-align: baseline;
}
.pl .c-a, .pl .c-b, .pl .c-l, .pl .c-v { padding-left: 1rem; text-align: right; white-space: nowrap; }
.pl .c-a { display: var(--show-a); }
.pl .c-b { display: var(--show-b); }
.pl .c-l { display: var(--show-l); }
.pl .c-v { display: var(--show-v); }

.pl thead th {
  padding-top: 0;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pl .grp th {
  padding-top: 2rem;
  border-bottom-color: var(--ink);
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.pl .sub th, .pl .sub td { font-weight: 650; }
.pl .net th, .pl .net td {
  padding-top: 1.25rem;
  border-bottom: 2px solid var(--ink);
  font-size: 1.125rem;
  font-weight: 700;
}
.pl .neg { color: var(--accent); font-weight: 650; }
.rep + .help, .rep + .actions { margin-top: 1.25rem; }
.pl a { text-decoration-color: var(--rule); text-underline-offset: .18em; }
.pl a:hover { text-decoration-color: currentColor; }
/* A figure per row to type into (opening balances, last year's figures). */
.pl--entry td { padding: .35rem 0 .35rem 1rem; }
.pl--entry input { width: 10rem; max-width: 100%; text-align: right; }

/* The budget: on a phone each account is a block — its name, the year, then
   the months three across, every box labelled. On a wide screen the same
   markup becomes one grid: a single heading row, and every row on the same
   columns, so headings and boxes always line up. */
.bgrid { container: bgrid / inline-size; margin: 0 0 1.5rem; }
.bgrid__head { display: none; }
.bgrid__group { margin: 2rem 0 .25rem; padding-bottom: .5rem; border-bottom: 1px solid var(--ink); }
.bgrid__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem .75rem;
  min-width: 0;
  margin: 0;
  padding: 1rem 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
}
.bgrid__name { grid-column: 1 / -1; float: left; width: 100%; padding: 0; font-weight: 600; }
.bgrid__cell { display: grid; gap: .2rem; min-width: 0; }
.bgrid__cell--year { grid-column: 1 / -1; }
.bgrid__label { color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.bgrid input { width: 100%; min-width: 0; text-align: right; }
/* Phone: an evenly spread row is just its year; "By month" opens the rest. */
.bgrid__row:not(.bgrid__row--monthly) .bgrid__cell:not(.bgrid__cell--year) { display: none; }
.bgrid__more { grid-column: 1 / -1; justify-self: end; font-size: .875rem; }

@container bgrid (min-width: 58rem) {
  .bgrid__head, .bgrid__row {
    /* Room for the account name on one line; the year a little wider than a month. */
    grid-template-columns: minmax(11rem, 2.4fr) minmax(0, 1.2fr) repeat(12, minmax(0, 1fr));
    gap: .35rem;
    align-items: center;
  }
  .bgrid__head { display: grid; padding-bottom: .5rem; }
  .bgrid__head span {
    color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .08em;
    text-align: right; text-transform: uppercase;
  }
  .bgrid__head span:first-child { text-align: left; }
  .bgrid__row { padding: .3rem 0; }
  .bgrid__name { grid-column: auto; font-weight: 400; font-size: .9375rem; }
  .bgrid__cell--year { grid-column: auto; }
  .bgrid__cell--year input { font-weight: 600; }
  /* Wide: every month always shows; nothing to open. */
  .bgrid__row:not(.bgrid__row--monthly) .bgrid__cell:not(.bgrid__cell--year) { display: grid; }
  .bgrid__more { display: none; }

  /* With a mouse or trackpad, the grid is set at the page's body size — 15px
     figures in 32px boxes — so more of the year fits on screen. Touch screens
     keep full-size boxes (a finger needs 44px, and phones zoom on small text). */
  @media (hover: hover) and (pointer: fine) {
    .bgrid__row { padding: .1rem 0; }
    .bgrid__name { font-size: .9375rem; line-height: 1.3; }
    .bgrid input {
      min-height: 2rem;
      height: 2rem;
      padding: 0 .35rem;
      border-radius: .35rem;
      font-size: .9375rem;
    }
  }
  /* The heading row says which month; the label stays for screen readers. */
  .bgrid__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bgrid input { padding-left: .35rem; padding-right: .35rem; }
}

/* A report's period or date: fields and buttons on one line when there's room. */
.period { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 .75rem; margin: 0 0 1.5rem; }
.period .field { flex: 0 1 11rem; margin-bottom: 0; }
.period .btn { margin-bottom: .1rem; }

/* A small form inside a list row: a reason, then the button. */
.inline-field { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.inline-field input { width: 12rem; }

/* Printing a report: the report, not the app around it. */
@media print {
  .bar, .rail, .tabs, .period, .lens, .actions, .skip, .flash, .notice { display: none !important; }
  body { display: block; background: #fff; color: #000; }
  main { padding: 0; }
  .rep { --show-a: table-cell; --show-l: table-cell; max-width: none; }
  .pl a { text-decoration: none; }
}

/* Wide: every column at once — the comparison is the point. The lens goes.
   Custom properties set on .pl override the ones .rep set, by inheritance. */
@container rep (min-width: 38rem) {
  .pl { --show-a: table-cell; --show-b: table-cell; --show-l: table-cell; --show-v: table-cell; }
  .lens { display: none; }
}

/* ---------- Lists: rows that reflow (invoices) ---------------------- */

.rows { container: rows / inline-size; max-width: 72rem; }

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

/* Phone: two lines. Who and how much; then the quiet details. */
.row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: .15rem .75rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.row:hover .f-who { text-decoration: underline; }

.f-who { grid-column: 1 / 4; grid-row: 1; overflow: hidden; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.f-amt { grid-column: 4; grid-row: 1; font-variant-numeric: tabular-nums; text-align: right; }
.f-num, .f-due, .f-st { grid-row: 2; color: var(--muted); font-size: .8125rem; }
.f-num { grid-column: 1; }
.f-due { grid-column: 2; }
.f-st  { grid-column: 3; }
.f-iss { display: none; }
.st--overdue { color: var(--accent); font-weight: 650; }

/* Wide: the same rows line up into columns through subgrid. */
@container rows (min-width: 44rem) {
  .rows__list {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) 6rem 6rem 9.5rem 7.5rem;
    column-gap: 1.25rem;
  }
  .rows__list > li {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
  }
  .row { grid-column: 1 / -1; grid-template-columns: subgrid; padding: .8rem 0; }

  .rows__head {
    display: grid;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--ink);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .rows__head span:last-child { text-align: right; }

  .f-num, .f-who, .f-iss, .f-due, .f-st, .f-amt { grid-row: 1; font-size: 1rem; }
  .f-num { grid-column: 1; }
  .f-who { grid-column: 2; }
  .f-iss { grid-column: 3; display: block; color: var(--muted); }
  .f-due { grid-column: 4; }
  .f-st  { grid-column: 5; }
  .f-amt { grid-column: 6; }
  .f-due .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ---------- 3. Coding as an inbox ----------------------------------- */

.inbox { container: inbox / inline-size; max-width: 72rem; }

.meter {
  height: 3px;
  margin: 0 0 2rem;
  overflow: hidden;
  border-radius: 3px;
  background: var(--soft);
}
.meter span {
  display: block;
  width: calc(var(--done, 0) * 100%);
  height: 100%;
  background: var(--ink);
  transition: width .3s ease;
}

.inbox__grid { display: grid; gap: 3rem; }
.inbox__head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; margin: 0 0 1.5rem; }
.inbox__head .eyebrow { margin: 0; }
.focus__note { margin: 0 0 1.25rem; color: var(--muted); font-size: .8125rem; line-height: 1.45; }
.focus__note .tag { margin: 0 .4rem 0 0; }

.focus__meta { margin: 0; color: var(--muted); font-size: .875rem; }
.focus__who {
  margin: .25rem 0 .1rem;
  font-size: clamp(1.5rem, 1.1rem + 2vw, 2.5rem);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.focus__amt {
  margin: 0 0 1.5rem;
  font-size: clamp(2.25rem, 1.5rem + 3.5vw, 3.75rem);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.why {
  margin: 0 0 1.25rem;
  padding-left: .75rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-size: .875rem;
}

.gst {
  margin: -.25rem 0 1rem;
  color: var(--muted);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

.split {
  margin: 0 0 1rem;
  padding: 1rem 0 0;
  border-top: 1px dashed var(--rule);
}

.focus .actions { margin: 1.5rem 0 0; }
.focus .actions .btn--primary { flex: 1 1 100%; }

.queue { margin: 0; padding: 0; list-style: none; }
.q {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .1rem 1rem;
  width: 100%;
  min-height: 56px;
  padding: .7rem .75rem;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
a.q { color: var(--ink); text-decoration: none; }
.queue + .help, .queue-wrap .help { margin-top: 1rem; }
.q:hover { background: var(--soft); }
.q[aria-current="true"] { background: var(--soft); box-shadow: inset 2px 0 0 var(--action); }
.q__who { overflow: hidden; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.q__amt { font-variant-numeric: tabular-nums; text-align: right; }
.q__meta { grid-column: 1 / -1; color: var(--muted); font-size: .8125rem; }
.q.is-done .q__who, .q.is-done .q__amt { color: var(--muted); }

.keys {
  display: none;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: .8125rem;
}
@media (hover: hover) and (pointer: fine) {
  .keys { display: block; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  z-index: 40;
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: .75rem 1.1rem;
  border-radius: .75rem;
  background: var(--ink);
  color: var(--bg);
  font-size: .9375rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, .5rem);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 60rem) { .toast { bottom: 2rem; } }

/* Wide: queue on the left, the one line that matters on the right. */
@container inbox (min-width: 52rem) {
  .inbox__grid {
    grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
    align-items: start;
    gap: 4rem;
  }
  .queue-wrap { grid-column: 1; grid-row: 1; }
  .focus { grid-column: 2; grid-row: 1; max-width: 36rem; }
  .focus .actions .btn--primary { flex: none; }
  .q { padding-left: 1rem; }
  /* Desktop: a smaller amount, and Accept / Split / Skip pinned to the bottom
     of the window, so a long line never pushes them out of reach. */
  .focus__amt { margin-bottom: 1rem; font-size: clamp(2rem, 1.5rem + 1.5vw, 2.75rem); }
  .focus .actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin-top: 1rem;
    padding: .75rem 0 1rem;
    border-top: 1px solid var(--rule);
    background: var(--bg);
  }
}

/* ---------- 4. Command bar ------------------------------------------ */

.palette {
  width: min(40rem, calc(100% - 2rem));
  margin: 12vh auto auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 1rem;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 24px 64px rgb(0 0 0 / .2);
}
.palette::backdrop { background: rgb(0 0 0 / .28); backdrop-filter: blur(2px); }

.palette__q {
  width: 100%;
  padding: 1.1rem 1.25rem;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.125rem;
}
.palette__q:focus { outline: none; border-bottom-color: var(--ink); }

.palette__list {
  max-height: min(60vh, 26rem);
  margin: 0;
  padding: .35rem 0;
  overflow-y: auto;
  list-style: none;
}
.palette__list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 48px;
  padding: .5rem 1.25rem;
  text-decoration: none;
}
.palette__list [aria-selected="true"] a { background: var(--soft); }
.palette__hint { flex: none; color: var(--muted); font-size: .8125rem; }
.palette__empty { padding: 1rem 1.25rem; color: var(--muted); }

/* ---------- Motion --------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .focus.enter { animation: rise .28s ease-out; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
}

/* =====================================================================
 * Platform additions
 * ===================================================================== */

/* ---------- Shell ---------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-weight: 650;
  text-decoration: none;
}
/* The product name, wherever it's shown as a mark. The face has one weight;
 * 400 stops the browser faking a bold from the surrounding 650. */
.logo {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.brand--stacked { flex: 0 1 auto; flex-direction: column; align-items: flex-start; justify-content: center; min-width: 0; color: var(--ink); }
.brand--stacked .role,
.org summary .role {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Marks every page of a non-live copy, so TEST is never mistaken for live. */
.env {
  flex: none;
  padding: .1rem .5rem;
  border: 1px solid currentColor;
  border-radius: .3rem;
  color: var(--muted);
  font-size: .6875rem;
  font-weight: 650;
  letter-spacing: .1em;
}

.bar__who {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  font-size: .875rem;
}
.bar__name { display: none; color: var(--muted); }
@media (min-width: 40rem) { .bar__name { display: inline; } }

.inline { display: inline; margin: 0; }

/* A button that reads as a link: sign out is a POST, never a GET link. */
.linkish {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--action);
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  white-space: nowrap;
  cursor: pointer;
}

/* ---------- Plain pages (sign-in, setup, errors) -------------------- */

/* No navigation, so none of the shell's desktop grid. */
body.plain { display: block; }

.solo {
  width: min(26rem, 100%);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}
@media (min-width: 40rem) { .solo { padding-top: 12vh; } }

.solo__brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0 0 2rem;
  font-weight: 650;
}
/* Signed out, the name is the page's mark: twice the size it is in the bar. */
.solo__brand .logo { font-size: 2.75rem; line-height: 1.1; }

.solo .say { margin-bottom: 1.5rem; }

/* ---------- Notices -------------------------------------------------- */

.notice {
  margin: 0 0 1.5rem;
  padding: .75rem 1rem;
  border-left: 3px solid var(--ink);
  background: var(--soft);
}
/* Accent means "needs you" — an error does; a confirmation doesn't. */
.notice--error, .notice--warn { border-left-color: var(--accent); }

/* ---------- Forms and bits ------------------------------------------ */

.btn--wide { width: 100%; }


.narrow { max-width: 26rem; }

/* A secondary way to do the same thing, folded away until asked for. Works
   with no JavaScript: it's a <details>. */
.alt { margin: 1.5rem 0 2rem; }
.alt > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--muted);
  font-size: .9375rem;
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
.alt > summary::-webkit-details-marker { display: none; }
.alt > summary:hover { color: var(--ink); }
.alt[open] > summary { margin-bottom: 1.25rem; }

.section { margin: 0 0 3rem; }

/* The organisation's Overview: one short paragraph per module, close together. */
.overview { margin: 0 0 2rem; }
.overview .say { margin-bottom: 0; }
.overview .eyebrow { margin-bottom: .5rem; }
.list__meta.needs { color: var(--accent); }

.facts { display: grid; gap: 0; margin: 0 0 2rem; max-width: 40rem; }
.facts > div {
  display: grid;
  gap: .15rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--rule);
}
.facts dt { color: var(--muted); font-size: .8125rem; }
.facts dd { margin: 0; }
@media (min-width: 40rem) { .facts > div { grid-template-columns: 12rem 1fr; } }

.plainlist { margin: 0 0 1.5rem; padding: 0; list-style: none; }
.plainlist li { padding: .35rem 0; border-bottom: 1px solid var(--rule); }

.small { font-size: .8125rem; }
.muted { color: var(--muted); }

code { font-size: .875em; }

/* ---------- Lists (organisations, members, audit) -------------------- */

/* Phone: name above, detail below. Wide: detail moves to the right. */
.list { container: list / inline-size; max-width: 56rem; margin: 0 0 2rem; padding: 0; list-style: none; }

.list__row {
  display: grid;
  gap: .2rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
a.list__row { min-height: 56px; }
a.list__row:hover .list__main { text-decoration: underline; }

.list__main { min-width: 0; font-weight: 550; overflow-wrap: anywhere; }
.list__sub  { display: block; color: var(--muted); font-size: .8125rem; font-weight: 400; }
.list__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .75rem;
  color: var(--muted);
  font-size: .875rem;
}
.list__meta a { color: var(--action); }

@container list (min-width: 40rem) {
  /* The name always keeps room (12rem at least); the details take what's left and wrap,
     however many there are — a long organisation name never collapses to a letter a line. */
  .list__row { grid-template-columns: minmax(12rem, 1fr) minmax(0, max-content); align-items: center; column-gap: 1.5rem; }
  .list__meta { justify-content: flex-end; text-align: right; }
}

.tag {
  display: inline-block;
  margin-left: .4rem;
  padding: 0 .45rem;
  border: 1px solid var(--rule);
  border-radius: .3rem;
  color: var(--muted);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  vertical-align: .1em;
}

.member__role { display: inline-flex; align-items: center; gap: .4rem; }

.btn--small { min-height: var(--control-h-sm); padding: 0 .9rem; font-size: .875rem; }

/* ---------- Break-glass banner --------------------------------------- */

/* The accent means "needs you" — and borrowed access does, on every page. */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  margin: 0 0 2rem;
  padding: .9rem 1rem;
  border: 2px solid var(--accent);
  border-radius: .75rem;
}
.banner p { margin: 0; max-width: 60ch; }

/* ---------- Choices and text areas ---------------------------------- */

.choices { margin: 0 0 1.5rem; padding: 0; border: 0; }
.choices legend {
  margin-bottom: .5rem;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.choice {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  min-height: 44px;
  padding: .6rem 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.choice input { margin-top: .15rem; flex: none; }
.choice .muted { display: block; font-size: .875rem; }

/* Colour tiles (Platform → Appearance): the radio is the whole tile. */
.colours { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: .5rem; }
.colour {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: .4rem .75rem;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  cursor: pointer;
}
.colour input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.colour:has(input:checked) { border-color: var(--action); box-shadow: inset 0 0 0 1px var(--action); font-weight: 600; }
.colour:has(input:focus-visible) { outline: 2px solid var(--action); outline-offset: 2px; }
.colours__picker { width: 100%; min-height: 44px; }


.bar__name { text-decoration: none; }
.bar__name:hover { text-decoration: underline; }

/* A member's access to each switched-on module, under their name. */
.modrole {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 400;
}
.modrole .member__role label { margin-right: .25rem; }

.copy { display: inline-block; max-width: 100%; padding: .4rem .6rem; border: 1px solid var(--rule); border-radius: .4rem; overflow-wrap: anywhere; }

/* ---------- Phone navigation overflow -------------------------------
 * The bottom bar holds four links; the rest sit under "More", which opens
 * upward. On a desktop the rail shows every link and "More" is hidden.
 */
.rail__extra { display: none !important; }

.rail__more { position: relative; flex: 1; display: flex; }
.rail__more > summary {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .02em;
  list-style: none;
  cursor: pointer;
}
.rail__more > summary::-webkit-details-marker { display: none; }
.rail__more > summary[aria-current="page"],
.rail__more[open] > summary { color: var(--ink); font-weight: 650; }
.rail__more ul {
  position: absolute;
  right: .5rem;
  bottom: calc(100% + .5rem);
  z-index: 30;
  min-width: 12rem;
  margin: 0;
  padding: .25rem 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: .75rem;
  box-shadow: 0 16px 40px rgb(0 0 0 / .12);
}
.rail__more li a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 48px;
  padding: 0 1rem;
  color: var(--ink);
  font-size: .9375rem;
}
.rail__more li a[aria-current="page"] { font-weight: 650; }
.rail__more li a[aria-current="page"]::before { display: none; }

@media (min-width: 60rem) {
  .rail__extra { display: flex !important; }
  .rail__more { display: none; }
}

/* ---------------------------------------------------------------------------
   Expenses: the receipt button, and a claim beside its receipt.
   --------------------------------------------------------------------------- */
.snap { margin: 0 0 1rem; }
.snap__btn { position: relative; display: inline-block; }
.snap__btn input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.snap__btn:focus-within .btn { outline: 2px solid var(--action); outline-offset: 2px; }
.snap__btn .btn { min-width: 16rem; }
.js .snap__send { display: none; }
/* While a receipt goes up and is read: the button gives way to a panel with
 * the photo, a spinner, a moving bar and words that change as time passes. */
.snap__busy { display: none; }
.snap.is-sending .snap__btn,
.snap.is-sending .help { display: none; }
.snap.is-sending .snap__busy {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 32rem;
  padding: 1rem 1.25rem 1.25rem;
  overflow: hidden;
  border: 1px solid var(--action-edge);
  border-radius: 12px;
  background: var(--action-tint);
}
.snap__thumb {
  flex: none;
  width: 4rem;
  height: 5rem;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.snap__thumb[hidden] { display: none; }
.snap__words { flex: 1; min-width: 0; }
.snap__title {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0;
  font-weight: 600;
}
.snap__stage { margin: .3rem 0 0; font-size: .875rem; }
.spin {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid var(--action-edge);
  border-top-color: var(--action);
  border-radius: 50%;
}
.snap__bar {
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: var(--action-edge);
}
.snap__bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 35%;
  background: var(--action);
}
@media (prefers-reduced-motion: no-preference) {
  .spin { animation: spin .8s linear infinite; }
  .snap__bar::after { animation: slide 1.4s ease-in-out infinite; }
}
.snap__clock { margin-left: auto; padding-left: .5rem; white-space: nowrap; font-weight: 400; color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide {
  from { transform: translateX(-100%); }
  to   { transform: translateX(290%); }
}

.snap .help { margin-top: .75rem; }
.claim-wrap { container: claim / inline-size; }
.claim { display: grid; gap: 2rem; }
.claim__receipt { margin: 0; }
.claim__receipt img {
  display: block; max-width: 100%; max-height: 70vh;
  border: 1px solid var(--rule); border-radius: .25rem;
}
@container claim (min-width: 50rem) {
  .claim:has(.claim__receipt) { grid-template-columns: minmax(0, 1fr) minmax(0, 28rem); align-items: start; }
  .claim__receipt { position: sticky; top: 5rem; }
}

.catrow {
  display: grid; gap: 0 1rem; margin: 0; padding: 1rem 0 .25rem;
  border: 0; border-bottom: 1px solid var(--rule);
}
@media (min-width: 50rem) {
  .catrow { grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) minmax(0, 10rem) auto; align-items: end; }
  .catrow .choice { margin-bottom: 1.5rem; }
}
