/* ===========================================================================
   Saba design system
   ---------------------------------------------------------------------------
   One stylesheet, no build step. Token names and component anatomy follow the
   shadcn/ui convention deliberately, so that reference markup from the shadcn
   registry maps onto these classes without translation. shadcn itself ships
   React; this application is server-rendered Django templates, so the tokens
   and anatomy are adopted and the runtime is not. See docs/DESIGN_SYSTEM.md.

   Structure
     1  Tokens (light, dark)
     2  Reset and base elements
     3  Typography
     4  Layout primitives
     5  Application shell (sidebar, topbar, page header)
     6  Components
     7  Marketing surfaces
     8  Charts
     9  Responsive
    10  Print
   ======================================================================== */

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

:root {
  color-scheme: light;

  /* Surfaces. Warm neutral paper, not cold slate: it sits better under the
     photography and under a green brand, and it is the fastest way to tell
     this apart from every blue-grey admin tool. */
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1f0ea;
  --surface-3: #e6e4db;
  --overlay: rgba(20, 22, 16, .55);

  /* Ink. Every value below is measured against --surface, --bg or --surface-2;
     see tests/test_design_tokens.py, which fails the build if a pair used for
     text drops under WCAG AA. */
  --fg: #1b1d18;
  --fg-muted: #565a4f;
  --fg-subtle: #5f6458;
  --fg-inverse: #ffffff;

  /* Lines */
  --border: #e2e0d6;
  --border-strong: #b8b6a8;

  /* Brand. Taken from the Saba Center mark: three figures in green, blue and
     red. Green is the largest and the central one, so it leads. The mark's own
     green (#6da343) is 3.01:1 on white, which is fine for a large shape and
     not enough for text, so --primary is the text-safe step of the same hue
     and --brand-green is the mark's value for fills.
     The previous palette was navy and rust -- neither appears in the logo. */
  --brand-green: #6da343;
  --brand-blue: #227dc4;
  --brand-red: #fa2424;

  --primary: #3d6f28;
  --primary-hover: #325b21;
  --primary-fg: #ffffff;
  --primary-soft: #e8f1e0;
  --primary-soft-fg: #2d5320;
  --navy: #24301c;
  --warm: #8a5300;
  --warm-hover: #6f4200;
  --gold: #f0b429;

  /* Status. Foreground values are for text on the matching -soft fill. */
  --success: #3d6f28;
  --success-soft: #e8f1e0;
  --warning: #8a5300;
  --warning-soft: #fbf0d8;
  --danger: #b3261e;
  --danger-hover: #931e17;
  --danger-soft: #fbeae8;
  --info: #1a5f96;
  --info-soft: #e4eef7;

  /* Chart series. Green and violet, not green and orange: the intuitive
     brand pairing (green + warm) separates by only dE 2.4 for a deuteranope,
     which is to say not at all. Measured with the palette validator --
     deutan dE 22.4, tritan 12.0, normal 29.6, both >= 3:1 on the surface. */
  --chart-1: #4f8a33;
  --chart-2: #7c4bb0;
  /* Third and fourth series are separated by lightness rather than hue, which
     survives every colour-vision deficiency: deep navy and mid grey against
     the green/violet pair. Worst adjacent CVD dE 23.1, all >= 3.2:1 on white. */
  --chart-3: #1d3557;
  --chart-4: #8f8f8f;

  /* Focus */
  --ring: #3d6f28;

  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Elevation. Deliberately shallow: depth marks what floats above the page
     (menus, sheets), not every card. */
  --shadow-sm: 0 1px 2px rgba(24, 26, 18, .06);
  --shadow: 0 1px 3px rgba(24, 26, 18, .08), 0 1px 2px rgba(24, 26, 18, .04);
  --shadow-lg: 0 12px 32px rgba(24, 26, 18, .16), 0 2px 8px rgba(24, 26, 18, .08);

  /* Shell metrics */
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --page-max: 1320px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

/* Dark theme. Selected, not an inversion: the ramps are re-stepped against a
   dark ground so brand green stays legible and status colours keep their
   meaning.

   The two rules below are byte-for-byte identical on purpose -- one applies the
   viewer's system setting, the other an explicit choice, and CSS cannot share a
   body across a media query boundary. tests/test_design_tokens.py asserts they
   stay identical, because a token edited in one and not the other is exactly
   how a page ends up with light ink on a dark card. Edit both, or edit
   neither. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12140f;
    --surface: #1a1d16;
    --surface-2: #23271e;
    --surface-3: #2e3327;
    --overlay: rgba(6, 8, 4, .7);

    --fg: #eceee6;
    --fg-muted: #adb3a4;
    --fg-subtle: #9aa191;
    --fg-inverse: #12140f;

    --border: #2d3226;
    --border-strong: #4a5140;

    --brand-green: #6da343;
    --brand-blue: #227dc4;
    --brand-red: #fa2424;

    --primary: #8cc463;
    --primary-hover: #9fd177;
    --primary-fg: #12200a;
    --primary-soft: #22331a;
    --primary-soft-fg: #bfe0a4;
    --navy: #1f2a18;
    --warm: #e6b45c;
    --warm-hover: #edc478;
    --gold: #f0b429;

    --success: #8cc463;
    --success-soft: #22331a;
    --warning: #e6b45c;
    --warning-soft: #322510;
    --danger: #f08b80;
    --danger-hover: #f5a79e;
    --danger-soft: #361b18;
    --info: #7fb6e8;
    --info-soft: #16283c;

    --chart-1: #6da343;
    --chart-2: #9a72cc;
    --chart-3: #a9c9ec;
    --chart-4: #a3a79b;

    --ring: #9fd177;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 14px 38px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12140f;
  --surface: #1a1d16;
  --surface-2: #23271e;
  --surface-3: #2e3327;
  --overlay: rgba(6, 8, 4, .7);

  --fg: #eceee6;
  --fg-muted: #adb3a4;
  --fg-subtle: #9aa191;
  --fg-inverse: #12140f;

  --border: #2d3226;
  --border-strong: #4a5140;

  --brand-green: #6da343;
  --brand-blue: #227dc4;
  --brand-red: #fa2424;

  --primary: #8cc463;
  --primary-hover: #9fd177;
  --primary-fg: #12200a;
  --primary-soft: #22331a;
  --primary-soft-fg: #bfe0a4;
  --navy: #1f2a18;
  --warm: #e6b45c;
  --warm-hover: #edc478;
  --gold: #f0b429;

  --success: #8cc463;
  --success-soft: #22331a;
  --warning: #e6b45c;
  --warning-soft: #322510;
  --danger: #f08b80;
  --danger-hover: #f5a79e;
  --danger-soft: #361b18;
  --info: #7fb6e8;
  --info-soft: #16283c;

  --chart-1: #6da343;
  --chart-2: #9a72cc;
  --chart-3: #a9c9ec;
  --chart-4: #a3a79b;

  --ring: #9fd177;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 14px 38px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
}

/* -- 2  Reset and base --------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; }

a { color: inherit; text-underline-offset: 4px; }

button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }

/* One focus treatment everywhere. Two rings so it stays visible on both a
   light card and a dark band. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection { background: var(--primary-soft); color: var(--primary-soft-fg); }

hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

code, kbd, pre, samp { font-family: var(--font-mono); }

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  font-size: 13px;
}

code {
  font-size: .9em;
  background: var(--surface-2);
  border-radius: 4px;
  padding: 2px 5px;
}

details { margin: 16px 0; }
summary { cursor: pointer; font-weight: 600; }

/* Visually hidden but announced. */
.sr-only {
  position: absolute; inset-inline-start: 0; top: 0; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Hidden until focused. Positioned with a logical offset, not left: -10000px:
   under right-to-left that physical offset is off the *far* edge and extends
   the scrollable width of the document -- the Farsi page rendered 11,440px
   wide because of this one declaration. */
.skip {
  position: absolute; inset-inline-start: -10000px; top: 10px; z-index: 200;
  background: var(--surface); color: var(--fg);
  padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.skip:focus { inset-inline-start: 12px; }

/* -- 3  Typography ------------------------------------------------------- */

h1, h2, h3, h4, h5, p { margin-top: 0; }
h1, h2, h3, h4, h5 { line-height: 1.2; letter-spacing: -.02em; font-weight: 600; margin-bottom: .5em; }
p { margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }

.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
small { font-size: 13px; color: var(--fg-muted); }

/* Eyebrow: a small uppercase label above a heading. */
.eyebrow {
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--fg-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex: none; }

.text-link {
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}
.text-link:hover { color: var(--primary-hover); }

.num { font-variant-numeric: tabular-nums; }

/* -- 4  Layout primitives ------------------------------------------------ */

.container { max-width: var(--page-max); margin: 0 auto; padding: 32px 24px 72px; }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.two-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.three-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.cluster { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.spaced { margin-top: 24px; }

/* -- 5  Application shell ------------------------------------------------ */

/* The administration and member portals do not wear the marketing chrome.
   They get a sidebar, a working top bar, and no Donate button. */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  font-weight: 650;
  letter-spacing: -.02em;
  text-decoration: none;
  flex: none;
}
.sidebar-head img { height: 24px; width: auto; display: block; }
.sidebar-head .portal {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-muted); font-weight: 700; display: block; line-height: 1.3;
}
.sidebar-head .name { font-size: 14.5px; line-height: 1.2; display: block; }

.sidebar-nav { padding: 12px 10px 24px; flex: 1; }
.sidebar-group + .sidebar-group { margin-top: 18px; }
.sidebar-group > h2 {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-subtle); font-weight: 700; margin: 0 0 6px; padding: 0 10px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  text-decoration: none; font-size: 14px; font-weight: 500;
  color: var(--fg-muted); line-height: 1.3;
}
.sidebar-nav a:hover { background: var(--surface-2); color: var(--fg); }
.sidebar-nav a[aria-current="page"] {
  background: var(--primary-soft); color: var(--primary-soft-fg); font-weight: 600;
}
.sidebar-nav a svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.sidebar-nav .count {
  margin-inline-start: auto; font-size: 11.5px; font-variant-numeric: tabular-nums;
  color: var(--fg-subtle); background: var(--surface-2);
  border-radius: 20px; padding: 1px 7px;
}

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); flex: none; }

.app-main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) { .topbar { background: var(--bg); } }

/* The title shrinks and truncates; the controls never do. Without this a
   long page name ("Recommendations") pushed the search box and the account
   menu past the right edge of a phone, taking the whole document with it. */
.topbar-title {
  font-size: 14px; font-weight: 600; margin: 0;
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; flex: none; }

.app-body { padding: 24px; max-width: var(--page-max); width: 100%; }

/* Page header: what this page is, and what you can do on it. */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.025em; }
.page-head p { margin: 0; color: var(--fg-muted); font-size: 14px; max-width: 70ch; }
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }



/* Theme toggle: shows the theme you would switch to, so the control describes
   its result rather than the current state. Hidden until app.js enables it --
   a control that cannot work without JavaScript should not be offered. */
.theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

.topbar-search { width: 240px; }
.topbar-search input { min-height: 34px; font-size: 13.5px; background: var(--surface); }
.app-messages { padding: 14px 24px 0; max-width: var(--page-max); }
.app-messages .message { margin: 0 0 10px; }
.menu-identity { padding: 2px 10px 6px; margin: 0; font-size: 13.5px; font-weight: 600; }
.account-menu > summary { border-radius: 50%; }
.sidebar-nav [role="list"] { display: flex; flex-direction: column; gap: 1px; }

@media (max-width: 760px) {
  .topbar-search { width: 150px; }
  .app-messages { padding: 12px 16px 0; }
}

/* -- 6  Components ------------------------------------------------------- */

/* Button ---------------------------------------------------------------- */
.button, button[type=submit], .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; min-height: 40px;
  background: var(--primary); color: var(--primary-fg);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.button:hover, button[type=submit]:hover, .btn:hover { background: var(--primary-hover); }

.button.secondary, .btn.secondary {
  background: var(--surface); color: var(--fg); border-color: var(--border-strong);
}
.button.secondary:hover, .btn.secondary:hover { background: var(--surface-2); }

.button.outline, .btn.outline {
  background: transparent; color: var(--fg); border-color: var(--border-strong);
}
.button.outline:hover, .btn.outline:hover { background: var(--surface-2); }

.button.ghost, .btn.ghost { background: transparent; color: var(--fg-muted); }
.button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); color: var(--fg); }

.button.danger, .btn.danger { background: var(--danger); color: #fff; }
.button.danger:hover, .btn.danger:hover { background: var(--danger-hover); }

/* Giving. Gold with dark ink (8.76:1), deliberately neither the brand green
   nor the destructive red -- a donate button must not read as "primary action"
   or as "danger". */
.button.warm { background: var(--gold); color: #2a1e05; border-color: transparent; }
.button.warm:hover { background: #e0a51e; }

.button.navy { background: var(--navy); color: #fff; }
.button.navy:hover { filter: brightness(1.2); }

.button.light { background: var(--surface); color: var(--fg); border-color: transparent; }
.button.light:hover { background: var(--surface-2); }

.button.small, .btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.button.large { min-height: 46px; padding: 0 22px; font-size: 15px; }
.button.block { width: 100%; }
.button[disabled], button[disabled] { opacity: .5; cursor: not-allowed; }
button[data-busy] { opacity: .7; cursor: progress; }

/* Icon-only control. */
.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  color: var(--fg-muted); background: transparent; border: 1px solid transparent;
}
.icon-button:hover { background: var(--surface-2); color: var(--fg); }
.icon-button svg { width: 17px; height: 17px; }

/* The sidebar is permanent at desktop width, so the control that opens it does
   not exist there. Declared after .icon-button, which also sets display. */
.sidebar-toggle { display: none; }

/* Card ------------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card > h3, .card > .card-head h3 { font-size: 16px; margin: 0 0 4px; }
.card > h2 { font-size: 18px; margin: 0 0 4px; }
.card .eyebrow { margin-bottom: 10px; }
.card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.card-head p { font-size: 13.5px; color: var(--fg-muted); margin: 0; }
.card-foot {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 13.5px; flex-wrap: wrap;
}
a.card, .card-link { text-decoration: none; display: block; }
a.card:hover, .card-link:hover { border-color: var(--border-strong); }

/* Metric: one number, labelled, with optional context underneath. */
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.metric .label {
  font-size: 12.5px; color: var(--fg-muted); font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.metric .value {
  font-size: 28px; font-weight: 600; letter-spacing: -.03em; line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.metric .value.small { font-size: 22px; }
.metric .foot { font-size: 12.5px; color: var(--fg-subtle); }
.metric.attention { border-color: var(--warning); background: var(--warning-soft); }
.metric.attention .label, .metric.attention .foot { color: var(--warning); }

/* Badge ----------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 20px; padding: 2px 9px;
  font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--surface-2); color: var(--fg-muted);
  border: 1px solid var(--border);
}
.badge.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.danger  { background: var(--danger-soft);  color: var(--danger);  border-color: transparent; }
.badge.info    { background: var(--info-soft);    color: var(--info);    border-color: transparent; }
.badge.solid   { background: var(--primary); color: var(--primary-fg); border-color: transparent; }
/* Status is never colour alone: a dot shape plus the written word. */
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }

/* Alert / messages ------------------------------------------------------ */
.messages { max-width: var(--page-max); margin: 16px auto 0; padding: 0 24px; }
.message, .notice, .alert {
  border: 1px solid var(--border); border-inline-start: 3px solid var(--primary);
  background: var(--surface); border-radius: var(--radius);
  padding: 13px 16px; margin: 12px 0; font-size: 14px;
}
.message.success, .notice { border-inline-start-color: var(--success); }
.message.error, .alert.error { border-inline-start-color: var(--danger); background: var(--danger-soft); }
.message.warning { border-inline-start-color: var(--warning); background: var(--warning-soft); }

.form-alert {
  border: 1px solid var(--danger); border-inline-start-width: 3px;
  background: var(--danger-soft); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 22px;
}
.form-alert strong { display: block; color: var(--danger); font-size: 14.5px; }
.form-alert p { margin: 6px 0 0; font-size: 13.5px; }

/* Forms ----------------------------------------------------------------- */
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }

input:not([type=checkbox]):not([type=radio]), textarea, select {
  display: block; width: 100%;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; min-height: 40px;
}
input::placeholder, textarea::placeholder { color: var(--fg-subtle); }
input:hover:not([disabled]), textarea:hover, select:hover { border-color: var(--fg-subtle); }
textarea { resize: vertical; min-height: 96px; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-inline-end: 34px;
}
input[type=checkbox], input[type=radio] {
  width: 17px; height: 17px; accent-color: var(--primary);
  vertical-align: middle; margin: 0;
}

.field { margin-bottom: 20px; }
.field > label { display: block; }
.field input:not([type=checkbox]):not([type=radio]), .field textarea, .field select { margin: 0; }
.helptext, .field .helptext { font-size: 12.5px; color: var(--fg-muted); display: block; margin: 6px 0 0; }
.helptext ul { padding-inline-start: 18px; margin: 4px 0 0; }
.field-message { margin: 6px 0 0; font-size: 13px; color: var(--danger); font-weight: 500; }
.has-error > label { color: var(--danger); }
.has-error input:not([type=checkbox]), .has-error textarea, .has-error select { border-color: var(--danger); }
.errorlist { color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); padding: 10px 24px; font-size: 13.5px; }
abbr.req { color: var(--danger); text-decoration: none; font-weight: 700; border: 0; }
.required-note { font-size: 12.5px; color: var(--fg-muted); margin: 0 0 12px; }
.is-required::after { content: " *"; color: var(--danger); font-weight: 700; }

.check-row { display: flex; gap: 10px; align-items: flex-start; }
.check-row input { margin-top: 3px; flex: 0 0 auto; }
.check-row label { font-weight: 400; font-size: 14px; margin: 0; line-height: 1.45; }

.choice-set {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px 14px; margin: 0; min-width: 0;
}
.choice-set legend { font-size: 13.5px; font-weight: 600; padding: 0 6px; }
.choice-set > div > div, .choice-set li { margin-top: 8px; list-style: none; }
.choice-set ul { padding: 0; margin: 0; }
.choice-set label { font-weight: 400; font-size: 14px; margin: 0; display: flex; gap: 10px; align-items: center; }

.form-shell, .account-shell {
  max-width: 640px; margin: 40px auto 72px; padding: 28px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.form-shell h1, .account-shell h1 { font-size: 24px; }
.form-shell > p, .account-shell > p { color: var(--fg-muted); font-size: 14.5px; }
.account-shell nav { display: none; }
form p { margin-bottom: 20px; }

/* Toolbar: filters and search above a table. */
.toolbar {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 16px;
}
.toolbar > div { flex: 1 1 150px; min-width: 130px; }
.toolbar label { font-size: 12px; color: var(--fg-muted); }
.toolbar .actions, .toolbar button { flex: 0 0 auto; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 20px 0; }
.filters > div { flex: 1; min-width: 130px; }
.filters label { font-size: 12px; color: var(--fg-muted); }

/* Search box with a leading icon. */
.search { position: relative; }
.search svg { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--fg-subtle); pointer-events: none; }
.search input:not([type=checkbox]) { padding-inline-start: 33px; }

/* Table ----------------------------------------------------------------- */
/* position:relative matters: a visually hidden <caption> is position:absolute,
   and without a positioned ancestor its containing block is the page, so it
   escapes this scroll container and widens the document. */
.table-wrap {
  position: relative; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface);
}
.table-wrap:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; text-align: start; }
/* Column headers only. A row header (<th scope="row">) is a person's name or a
   plan, not a label -- an earlier version styled both alike and rendered every
   member's name in small uppercase. */
thead th {
  background: var(--surface-2); color: var(--fg-muted);
  font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  padding: 10px 16px; white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--border);
}
td, tbody th { padding: 11px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody th { font-weight: 600; text-align: start; }
tbody tr:first-child td, tbody tr:first-child th { border-top: 0; }
tbody tr:hover { background: var(--surface-2); }
td a { font-weight: 500; color: var(--primary); text-decoration: none; }
td a:hover { text-decoration: underline; }
/* A row header holds the link and a sub-line of plain text, so the link sits
   inside a text block: axe's link-in-text-block rule, and it is right --
   colour alone would not distinguish it. Underlined, not restyled away. */
tbody th a { font-weight: 600; color: var(--primary); text-underline-offset: 3px; }
td.right, th.right { text-align: end; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
/* A timestamp is one thing; wrapping it into three lines triples every row. */
td.when, th.when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-wrap + .table-foot, .table-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; padding: 12px 2px; font-size: 13px; color: var(--fg-muted);
}
.cell-strong { font-weight: 600; color: var(--fg); }
.cell-sub { display: block; font-size: 12px; color: var(--fg-subtle); }
td code, th code { font-size: 12px; }

/* A column marked optional is dropped at phone width. Tables still scroll,
   but the first thing on screen should be the column someone came for. */
@media (max-width: 760px) { .col-optional { display: none; } }

/* Row actions live at the end of a row and stay quiet until hover/focus. */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Tabs ------------------------------------------------------------------ */
.tabs {
  display: flex; gap: 2px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.tabs a {
  padding: 9px 14px; text-decoration: none; font-size: 14px; font-weight: 500;
  color: var(--fg-muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Empty state ----------------------------------------------------------- */
.empty {
  padding: 40px 28px; text-align: center; color: var(--fg-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty h3 { font-size: 15px; color: var(--fg); margin-bottom: 6px; }
.empty p { font-size: 13.5px; margin: 0 auto 14px; max-width: 46ch; }
td .empty, td.empty { border: 0; background: none; padding: 28px; }

/* List row -------------------------------------------------------------- */
.list-row {
  padding: 12px 0; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  font-size: 14px;
}
.list-row:last-child { border-bottom: 0; }
.list-row p { margin: 2px 0; font-size: 13.5px; }

/* Pagination ------------------------------------------------------------ */
.pagination {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 18px; font-size: 13.5px;
}
.pagination a { text-decoration: none; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.pagination a:hover { background: var(--surface-2); }

/* Progress -------------------------------------------------------------- */
progress {
  width: 100%; height: 8px; display: block; margin: 18px 0 8px;
  border: 0; border-radius: 4px; accent-color: var(--primary); background: var(--surface-3);
}
progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--primary); border-radius: 4px; }
.progress-info { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; flex-wrap: wrap; }

/* Dropdown menu. Native <details>, so it works without JavaScript. */
.menu { position: relative; }
.menu > summary { list-style: none; display: inline-flex; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; text-decoration: none; color: var(--fg); text-align: start;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); }
.menu-panel hr { margin: 6px 0; }
.menu-panel .label { padding: 6px 10px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-subtle); font-weight: 700; }

/* Avatar ---------------------------------------------------------------- */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-soft-fg);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}

/* Environment ribbon ---------------------------------------------------- */
.environment {
  padding: 6px 16px; text-align: center; font-size: 11.5px; letter-spacing: .04em;
  background: var(--warning-soft); color: var(--warning); font-weight: 600;
}
.environment span { padding: 0 8px; }

/* Definition list used on detail pages. */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 24px; margin: 0; }
.facts > div { min-width: 0; }
.facts dt { font-size: 12px; color: var(--fg-muted); font-weight: 500; margin-bottom: 2px; }
.facts dd { margin: 0; font-size: 14.5px; font-weight: 500; }

.status-list { display: grid; gap: 8px; padding: 0; margin: 0; }
.status-list li { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); list-style: none; font-size: 13.5px; }

.inline-form { display: inline; }
.inline-form button { padding: 0 10px; min-height: 30px; font-size: 12.5px; }

.receipt { max-width: 820px; }
.content-text { white-space: pre-line; font-size: 17px; line-height: 1.8; max-width: 72ch; }

/* -- 7  Marketing surfaces ----------------------------------------------- */

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.nav-wrap {
  max-width: var(--page-max); margin: auto; min-height: 72px;
  padding: 14px 24px; display: flex; align-items: center; gap: 28px;
}
.brand {
  display: flex; gap: 10px; align-items: center; font-weight: 650; font-size: 17px;
  text-decoration: none; letter-spacing: -.025em; white-space: nowrap;
}
.brand-logo { height: 26px; width: auto; display: block; }
.site-nav { display: flex; gap: 24px; margin: auto; }
.site-nav a, .nav-actions > a:not(.button) { text-decoration: none; font-size: 14px; font-weight: 500; color: var(--fg-muted); }
.site-nav a:hover, .nav-actions > a:not(.button):hover { color: var(--fg); }
.nav-actions { display: flex; gap: 16px; align-items: center; }

.hero {
  max-width: var(--page-max); margin: auto;
  padding: 64px 24px 56px;
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center;
}
.hero h1 { font-size: clamp(2.6rem, 5.2vw, 4.4rem); font-weight: 600; letter-spacing: -.035em; margin-bottom: 20px; }
.hero em { font-family: var(--font-serif); font-style: italic; font-weight: 400; }
.lead { font-size: 17px; line-height: 1.65; max-width: 48ch; color: var(--fg-muted); }
.actions { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.hero-note { display: flex; gap: 12px; align-items: center; margin-top: 36px; font-size: 13px; }
.hero-note p { margin: 0; }
.note-mark { font-size: 30px; color: var(--warm); line-height: 1; }

.hero-figure {
  position: relative; border-radius: var(--radius-xl); overflow: hidden;
  min-height: 460px; background: var(--navy); display: flex; flex-direction: column;
}
.hero-figure img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-figure figcaption {
  position: relative; z-index: 1; margin-top: auto; padding: 26px; color: #fff;
  background: linear-gradient(to top, rgba(8, 18, 36, .94), rgba(8, 18, 36, .5) 60%, rgba(8, 18, 36, 0));
  display: flex; flex-direction: column; gap: 5px;
}
.hero-figure figcaption strong { font-size: 18px; letter-spacing: -.02em; }
.hero-figure figcaption span { font-size: 13px; color: #d7e3f2; }

.photo { display: block; width: 100%; height: 100%; object-fit: cover; }

.section { max-width: var(--page-max); margin: auto; padding: 56px 24px; }
.section-heading, .page-heading {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 28px; margin-bottom: 28px; flex-wrap: wrap;
}
.section-heading h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin: 0; letter-spacing: -.03em; }
.section-heading > p { font-size: 15px; color: var(--fg-muted); max-width: 42ch; margin: 0; }
.page-heading h1 { font-size: 30px; margin: 0; }

.impact-band {
  background: var(--primary-soft); border-radius: var(--radius-xl); padding: 32px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px;
}
.impact-band div { display: flex; flex-direction: column; gap: 3px; }
.impact-band .figure { font-size: 36px; line-height: 1.1; letter-spacing: -.04em; font-weight: 600; color: var(--primary-soft-fg); }
.impact-band .caption { font-size: 13px; color: var(--fg-muted); }

.program-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column; text-decoration: none;
}
.program-card .shot { aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-3); }
.program-card .body { padding: 20px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.program-card h3 { font-size: 18px; margin: 0; }
.program-card p { font-size: 14px; color: var(--fg-muted); margin: 0; }
.program-card .meta { margin-top: auto; padding-top: 12px; font-size: 13px; font-weight: 600; color: var(--primary); }
a.program-card:hover { border-color: var(--primary); }
a.program-card:hover .meta { text-decoration: underline; }

.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 44px; align-items: center; }
/* Not .hero-figure's image: that one is absolutely positioned to fill its
   frame, and a max-height left a strip of the frame's background showing
   below it. */
.split > img { border-radius: var(--radius-xl); width: 100%; height: 100%; max-height: 420px; object-fit: cover; }

.benefits { padding: 0; list-style: none; margin: 20px 0; }
.benefits li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; display: flex; gap: 10px; }
.benefits li::before { content: '✓'; color: var(--success); font-weight: 700; }

.feature-card { padding: 32px; text-decoration: none; position: relative; border-radius: var(--radius-xl); min-height: 300px; }
.feature-card h3 { font-size: 30px; font-weight: 500; margin-bottom: 14px; }
.feature-card p { font-size: 14.5px; }
.mint { background: var(--primary-soft); }
.yellow { background: var(--gold); color: #2a1e05; }
.circle-arrow { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid currentColor; position: absolute; inset-inline-end: 26px; bottom: 26px; }

.join-band {
  background: var(--navy); color: #fff;
  padding: 52px max(24px, calc((100vw - var(--page-max)) / 2 + 24px));
  display: flex; justify-content: space-between; align-items: center; gap: 28px; flex-wrap: wrap;
}
.join-band h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.4rem); }
.join-band .eyebrow { color: #a9c4e2; }

.plan-card { display: flex; flex-direction: column; }
.plan-card.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.plan-card .plan-prices { margin-top: auto; }
.plan-prices form { padding: 14px 0 0; border-top: 1px solid var(--border); }
.plan-badge {
  display: inline-flex; align-self: flex-start; background: var(--gold); color: #2a1e05;
  border-radius: 20px; padding: 3px 11px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .03em; margin-bottom: 10px;
}
.price { font-size: 32px; letter-spacing: -.035em; margin: 8px 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.price span { font-size: 13px; color: var(--fg-muted); letter-spacing: 0; font-weight: 400; }

.campaign-art { height: 150px; border-radius: var(--radius); overflow: hidden; background: var(--surface-3); margin-bottom: 18px; }
.campaign-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.campaign-card { display: flex; flex-direction: column; }
.campaign-card .progress-info { margin-top: auto; }

/* Membership highlight card in the member portal. */
.membership-card { background: var(--navy); color: #fff; border: 0; padding: 26px; }
.membership-card p { color: #cfdcec; }
.membership-card h2 { font-size: 26px; margin: 14px 0 10px; color: #fff; }
.membership-card .badge { background: var(--gold); color: #2a1e05; border: 0; }
.membership-card .button.light { color: var(--navy); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }

/* Programme enrolment --------------------------------------------------- */
.rate-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
.rate {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  background: var(--surface); display: flex; flex-direction: column; gap: 3px;
}
.rate.chosen { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-soft); }
.rate .label { font-size: 11.5px; letter-spacing: .06em; font-weight: 700; text-transform: uppercase; color: var(--fg-muted); }
.rate.chosen .label { color: var(--primary-soft-fg); }
.rate .figure { font-size: 30px; letter-spacing: -.035em; line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; }
.rate .unit { font-size: 12.5px; color: var(--fg-muted); }
.child-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin-top: 10px; }
.child-row input { margin: 0; }
.consent { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--primary-soft); margin: 22px 0; }
.consent h3 { margin-bottom: 6px; font-size: 16px; }
.enrollment-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; background: var(--surface); margin-top: 12px; }
.enrollment-card .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }

/* Roles ----------------------------------------------------------------- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-top: 20px; }
.role-grid .card p { font-size: 13.5px; }
.grant { text-align: center; }
.grant .yes { color: var(--success); font-weight: 700; }
.grant .no { color: var(--fg-subtle); }

/* Footer ---------------------------------------------------------------- */
.site-footer {
  padding: 44px max(24px, calc((100vw - var(--page-max)) / 2 + 24px));
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px;
  border-top: 1px solid var(--border); font-size: 13px; background: var(--surface);
}
.site-footer > div { display: flex; flex-direction: column; gap: 8px; }
.site-footer strong { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg); }
.site-footer p { margin: 8px 0; color: var(--fg-muted); }
.site-footer a:not(.brand) { color: var(--fg-muted); text-decoration: none; }
.site-footer a:not(.brand):hover { color: var(--fg); text-decoration: underline; }
.site-footer .brand-logo { height: 24px; }


/* Public navigation drawer. A native <details>, open in the markup so the
   links render inline at desktop width (a closed <details> renders nothing,
   whatever CSS says). app.js closes it on a phone; without JavaScript a phone
   simply shows the links as a list, which is the right fallback. */
.nav-drawer { display: contents; }
.nav-drawer > summary { display: none; list-style: none; }
.nav-drawer > summary::-webkit-details-marker { display: none; }
.nav-drawer-actions { display: none; }
.site-nav a[aria-current="page"] { color: var(--fg); font-weight: 600; }
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); }
@supports not (backdrop-filter: blur(1px)) { .site-header { background: var(--surface); } }
.public main { min-height: 50vh; }

.button.large { min-height: 46px; padding: 0 22px; font-size: 15px; }
.hero-copy h1 { max-width: 12ch; }
.impact-band.compact { padding: 22px; margin-bottom: 28px; }
.plan-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.plan-mini { display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
.plan-mini h3 { font-size: 20px; margin: 0; }
.plan-mini .price { margin: 4px 0; }
.plan-mini .meta { margin-top: auto; padding-top: 12px; font-size: 13px; font-weight: 600; color: var(--primary); }
.plan-mini.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.plan-mini.soft { background: var(--primary-soft); border-color: transparent; }
.plan-mini.soft .benefits { margin: 8px 0 0; }
.plan-mini.soft .benefits li { border-bottom-color: color-mix(in srgb, var(--primary) 20%, transparent); }
a.plan-mini:hover { border-color: var(--primary); }
.program-card .body .eyebrow { margin-bottom: 2px; }

.volunteer-band {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 40px;
}
.volunteer-band img { width: 100%; height: 100%; max-height: 380px; object-fit: cover; border-radius: var(--radius-lg); }
.volunteer-band h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }

.testimonial {
  margin: 0; padding: 44px 48px; text-align: center;
  background: var(--navy); color: #fff; border-radius: var(--radius-xl);
}
.testimonial p { font-family: var(--font-serif); font-size: clamp(1.3rem, 2.4vw, 1.9rem); line-height: 1.45; max-width: 30ch; margin: 0 auto 14px; }
.testimonial footer { color: #cfe0cc; font-size: 14px; }

.join-band p { color: #cfe0cc; margin: 10px 0 0; max-width: 60ch; }
.join-band .actions { margin: 0; }
.footer-brand .social { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.footer-brand .social a { font-weight: 600; color: var(--fg); }
.footer-language { margin-top: 10px; }
.site-footer { grid-template-columns: 1.4fr 1fr 1fr 1fr; }

/* Article pages: terms, privacy, about, contact. Measure for reading. */
.article-page { padding-top: 40px; }
.article-head { max-width: 72ch; margin-bottom: 28px; }
.article-head h1 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); letter-spacing: -.03em; }
.article-meta { font-size: 13px; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
.article-body { max-width: 72ch; font-size: 16.5px; line-height: 1.75; }
.article-body h2 { font-size: 22px; margin: 32px 0 10px; }
.article-body h2:first-child { margin-top: 0; }
.article-body h3 { font-size: 17px; margin: 22px 0 8px; }
.article-body ul { padding-inline-start: 22px; }
.article-body li { margin-bottom: 6px; }
.article-aside { position: sticky; top: 90px; }
.article-aside .card h3 { font-size: 15px; margin-bottom: 8px; }
.facts.stacked { grid-template-columns: 1fr; gap: 10px; }
.social.spaced { display: flex; gap: 8px; flex-wrap: wrap; }
.form-shell.wide { max-width: 760px; margin-inline: 0; }

/* Provider chips on the integrations page and the dashboard. */
.provider-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.provider-strip.compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.provider-chip {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; font-weight: 600; min-width: 0;
}
.provider-chip:hover { border-color: var(--border-strong); }
.provider-chip.current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.provider-chip .cell-sub { font-weight: 500; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-bottom: 4px; background: var(--border-strong); }
.status-dot.ok { background: var(--success); }
.status-dot.bad { background: var(--danger); }
.status-dot.untested { background: var(--warning); }
.integration-layout { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
a.badge { text-decoration: none; }

/* Cohort table: lightness carries the level, the number carries the value. */
.cohort th, .cohort td { padding: 7px 10px; font-size: 13px; }
.cohort-cell[data-level="5"] { background: color-mix(in srgb, var(--chart-1) 60%, var(--surface)); }
.cohort-cell[data-level="4"] { background: color-mix(in srgb, var(--chart-1) 45%, var(--surface)); }
.cohort-cell[data-level="3"] { background: color-mix(in srgb, var(--chart-1) 30%, var(--surface)); }
.cohort-cell[data-level="2"] { background: color-mix(in srgb, var(--chart-1) 18%, var(--surface)); }
.cohort-cell[data-level="1"] { background: color-mix(in srgb, var(--chart-1) 8%, var(--surface)); }
.metric .value small { font-size: 14px; font-weight: 500; color: var(--fg-muted); letter-spacing: 0; }


/* -- 7b  Membership: applying, leaving, belonging ------------------------ */

/* Facts inside the dark membership panel. */
.card-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 20px; margin: 16px 0; }
.card-facts dt { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; opacity: .72; margin-bottom: 2px; }
.card-facts dd { margin: 0; font-size: 15px; font-weight: 600; }
.membership-card .card-facts dt { color: #cfdcec; }
.member-number { font-size: 12px; letter-spacing: .08em; opacity: .8; font-variant-numeric: tabular-nums; }
.fine { font-size: 12.5px; opacity: .8; }

/* What is left to set up. A list that disappears when it is done. */
.checklist { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.checklist li { counter-increment: step; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist a {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 11px 0; text-decoration: none; color: var(--fg);
}
.checklist a::before {
  content: counter(step); grid-row: span 2; align-self: center;
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-soft-fg); font-size: 12px; font-weight: 700;
}
.checklist a:hover strong { color: var(--primary); text-decoration: underline; }
.checklist .cell-sub { grid-column: 2; }

.list-row.unread { border-inline-start: 3px solid var(--primary); padding-inline-start: 12px; }
.recommend-card { background: var(--primary-soft); border-color: transparent; }
.recommend-card h3, .recommend-card p { color: var(--primary-soft-fg); }

/* Application progress. Four states, in order, no cleverness. */
.progress-steps { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 2px; }
.progress-steps li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.progress-steps li:last-child { border-bottom: 0; }
.progress-steps li::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border-strong); justify-self: center;
}
.progress-steps li.done::before { background: var(--success); border-color: var(--success); }
.progress-steps li.failed::before { background: var(--danger); border-color: var(--danger); }
.progress-steps li span { color: var(--fg-muted); font-size: 13px; }
.notice.success { border-inline-start-color: var(--success); background: var(--success-soft); }

blockquote.sample { margin: 0; padding: 16px 18px; background: var(--surface-2); border-radius: var(--radius); font-size: 13.5px; }
blockquote.sample p { margin: 0 0 8px; }
blockquote.sample p:last-child { margin-bottom: 0; }
code.copyable { user-select: all; word-break: break-all; font-size: 11.5px; }

/* Member directory */
.directory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.person-card { display: flex; gap: 14px; align-items: flex-start; }
.person-card p { margin: 6px 0 0; font-size: 13.5px; }
.avatar.large { width: 44px; height: 44px; font-size: 15px; }
.contact-lines { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }

/* The membership card itself. Printable, and readable at arm's length. */
.member-card-wrap { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.member-card {
  background: linear-gradient(145deg, var(--navy), color-mix(in srgb, var(--navy) 70%, var(--primary)));
  color: #fff; border-radius: var(--radius-xl); padding: 24px; box-shadow: var(--shadow-lg);
  aspect-ratio: 1.586; display: flex; flex-direction: column;
}
.member-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.member-card-top .badge { background: var(--gold); color: #2a1e05; border: 0; }
.member-card-name { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin: 18px 0 2px; }
.member-card-plan { margin: 0; color: #cfe0cc; font-size: 14px; }
.member-card-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: auto 0 0; }
.member-card-facts dt { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #a9c4a5; margin-bottom: 2px; }
.member-card-facts dd { margin: 0; font-size: 13.5px; font-weight: 600; }
.member-card-foot { margin: 14px 0 0; font-size: 11.5px; color: #a9c4a5; }

/* A recommended visitor's landing page */
.referral-hero { padding-top: 40px; }
.referral-note {
  margin: 0 0 20px; padding: 14px 18px; border-inline-start: 3px solid var(--primary);
  background: var(--primary-soft); border-radius: var(--radius); font-family: var(--font-serif);
}
.referral-note p { margin: 0 0 6px; font-size: 17px; font-style: italic; color: var(--primary-soft-fg); }
.referral-note footer { font-size: 13px; font-style: normal; color: var(--fg-muted); }

/* Approvals queue */
.approval-row + .approval-row { margin-top: 14px; }
.approval-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.approval-head h3 { margin: 6px 0 2px; font-size: 18px; }
.approval-head h3 a { text-decoration: none; color: var(--fg); }
.approval-head h3 a:hover { color: var(--primary); text-decoration: underline; }
.approval-head p { margin: 0; font-size: 13.5px; }
.approval-meta { text-align: end; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.quote-block { margin: 14px 0; padding: 12px 16px; background: var(--surface-2); border-radius: var(--radius); }
.quote-block .label { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--fg-subtle); font-weight: 700; margin: 0 0 4px; }
.quote-block p:last-child { margin: 0; font-size: 14px; }
.decision { margin: 16px 0 0; }
.decision > summary { display: inline-flex; list-style: none; }
.decision > summary::-webkit-details-marker { display: none; }
.decision-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.card.quiet { background: var(--surface-2); }

/* Door check */
.verify-result { display: flex; gap: 20px; align-items: flex-start; margin-top: 18px; border-width: 2px; }
.verify-result.good { border-color: var(--success); }
.verify-result.bad { border-color: var(--danger); }
.verify-mark { font-size: 40px; line-height: 1; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.verify-result.good .verify-mark { background: var(--success-soft); color: var(--success); }
.verify-result.bad .verify-mark { background: var(--danger-soft); color: var(--danger); }
.verify-result h2 { margin: 0 0 4px; font-size: 22px; }
.verify-state { font-weight: 600; margin: 0 0 14px; }


/* -- 7c  Editable prose, and the editor that produces it ----------------- */

/* Rendered markup. Everything here is produced by core/richtext.py, so the
   selectors are element-level on purpose: the writer picks the words, the
   stylesheet picks how they look, and neither can reach into the other. */
.rich-body > :first-child { margin-top: 0; }
.rich-body > :last-child { margin-bottom: 0; }
.rich-body p { font-size: 14.5px; line-height: 1.65; }
.rich-body h2 { font-size: 20px; margin: 26px 0 10px; }
.rich-body h3 { font-size: 16px; margin: 20px 0 8px; }
.rich-body ul, .rich-body ol { padding-inline-start: 0; margin: 0 0 14px; list-style: none; }
.rich-body li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; display: flex; gap: 10px; }
.rich-body li:last-child { border-bottom: 0; }
.rich-body ul > li::before { content: '✓'; color: var(--success); font-weight: 700; flex: none; }
.rich-body ol { counter-reset: rich; }
.rich-body ol > li { counter-increment: rich; }
.rich-body ol > li::before { content: counter(rich) '.'; color: var(--fg-muted); font-weight: 700; flex: none; }
.rich-body blockquote { margin: 0 0 16px; padding-inline-start: 14px; border-inline-start: 3px solid var(--primary); color: var(--fg-muted); }
.rich-body .notice { margin: 0 0 16px; }
.rich-image { display: block; width: 100%; height: auto; border-radius: var(--radius); margin: 0 0 16px; }
.rich-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 0 0 16px; }
.article-body.rich-body p { font-size: 16.5px; line-height: 1.75; }
.article-body.rich-body li { font-size: 16px; }
blockquote.sample .rich-body, blockquote.sample p { font-size: 13.5px; }
blockquote.sample h2, blockquote.sample h3 { font-size: 15px; margin: 12px 0 6px; }
blockquote.sample .button { pointer-events: none; }

/* The editing screen: an index of what can be changed, and one editor. */
.content-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.content-index { position: sticky; top: 88px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 10px; max-height: calc(100vh - 120px); overflow-y: auto; }
.content-index .sidebar-group + .sidebar-group { margin-top: 14px; }
.content-index a {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 7px 10px; border-radius: var(--radius-sm); text-decoration: none;
  font-size: 13.5px; color: var(--fg-muted); line-height: 1.35;
}
.content-index a:hover { background: var(--surface-2); color: var(--fg); }
.content-index a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-soft-fg); font-weight: 600; }
.content-index .badge { font-size: 10px; padding: 1px 6px; }

.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px; background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.editor-toolbar button {
  min-height: 30px; padding: 0 10px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--fg);
  font-size: 12.5px; font-weight: 600;
}
.editor-toolbar button:hover { background: var(--primary-soft); color: var(--primary-soft-fg); border-color: var(--primary); }
.editor-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 4px; }
.editor-area {
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7;
  border-radius: 0 0 var(--radius) var(--radius); min-height: 280px;
}
.editor-card .field { margin-bottom: 14px; }
.rich-preview { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 20px; background: var(--bg); }

/* What happened to one invitation. */
.journey { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.journey li {
  display: flex; flex-direction: column; gap: 1px; padding: 7px 12px;
  background: var(--surface-2); border-radius: var(--radius-sm); font-size: 12.5px;
}
.journey li strong { font-size: 12.5px; }
.journey li span { color: var(--fg-subtle); font-size: 11.5px; }
.journey li.joined { background: var(--success-soft); color: var(--success); }
.journey li.declined { background: var(--surface-3); color: var(--fg-muted); }
.journey li.failed, .journey li.unconfigured { background: var(--warning-soft); color: var(--warning); }
.referral-row + .referral-row { margin-top: 12px; }
.referral-row h3 { font-size: 16px; margin: 0 0 2px; }
.referral-row code.copyable { display: inline-block; margin-top: 4px; }

/* -- 8  Charts ----------------------------------------------------------- */
/* Server-rendered inline SVG. Colour is never the only carrier of meaning:
   every chart ships a legend, direct labels and a table view. */
.chart { margin: 0; }
.chart figcaption h3 { margin: 0 0 4px; font-size: 15px; }
.chart figcaption p { font-size: 13px; margin: 0 0 14px; max-width: 62ch; color: var(--fg-muted); }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.gridline { stroke: var(--border); stroke-width: 1; }
.axisline { stroke: var(--border-strong); stroke-width: 1; }
.axis-label { font-size: 11px; fill: var(--fg-muted); }
.bar-value { font-size: 11px; fill: var(--fg); font-weight: 600; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 12px; font-size: 13px; color: var(--fg-muted); }
.legend .key { display: inline-flex; align-items: center; gap: 7px; }
.legend .swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: none; }
.chart-data { margin-top: 14px; }
.chart-data summary { font-size: 13.5px; font-weight: 600; color: var(--fg-muted); }
.chart-data .table-wrap { margin-top: 10px; }
.bar-table { width: 100%; font-size: 13.5px; min-width: 0; }
.bar-table td, .bar-table th { padding: 9px 14px; }
.bar-cell { display: flex; align-items: center; gap: 12px; min-width: 160px; }
.bar-cell .bar { height: 10px; border-radius: 3px; background: var(--primary); min-width: 4px; max-width: 100%; flex: 0 1 auto; }
.chart-bar { height: 12px; border-radius: 3px; background: var(--primary); max-width: 100%; min-width: 4px; }

/* -- 9  Responsive ------------------------------------------------------- */

@media (max-width: 1100px) {
  .content-layout { grid-template-columns: minmax(0, 1fr); }
  .content-index { position: static; max-height: none; }
  .member-card-wrap { grid-template-columns: minmax(0, 1fr); }
  .provider-strip, .provider-strip.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .plan-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .article-aside { position: static; }
  .volunteer-band { grid-template-columns: minmax(0, 1fr); padding: 28px; }
  .integration-layout { grid-template-columns: minmax(0, 1fr); }
  .site-footer { grid-template-columns: 1fr 1fr; }
  .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .impact-band { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 24px; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .three-grid, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  /* Shell collapses: the sidebar becomes a panel the top bar opens. */
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60; width: 280px;
    transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: var(--shadow-lg);
  }
  .app[data-nav="open"] .sidebar { transform: none; }
  .app[data-nav="open"]::after {
    content: ''; position: fixed; inset: 0; z-index: 55; background: var(--overlay);
  }
  .sidebar-toggle { display: inline-flex; }
  .app-body { padding: 18px 16px 56px; }
  .topbar { padding: 8px 16px; }
}

@media (max-width: 760px) {
  .nav-wrap { gap: 10px; padding: 10px 16px; min-height: 0; }
  .nav-drawer { display: block; order: 3; margin-inline-start: auto; position: static; }
  .nav-drawer > summary {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: var(--radius-sm); border: 1px solid var(--border-strong); cursor: pointer;
  }
  .nav-drawer > summary svg { width: 20px; height: 20px; }
  .nav-drawer > summary .close { display: none; }
  .nav-drawer[open] > summary .close { display: block; }
  .nav-drawer[open] > summary svg:not(.close) { display: none; }
  .nav-drawer .site-nav {
    position: absolute; inset-inline: 0; top: 100%; display: flex; flex-direction: column; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
    padding: 8px 16px 16px; margin: 0;
  }
  .nav-drawer .site-nav a { padding: 12px 4px; border-bottom: 1px solid var(--border); font-size: 16px; color: var(--fg); }
  .nav-drawer-actions { display: flex; flex-direction: column; margin-top: 6px; }
  .nav-actions { gap: 10px; }
  .nav-actions > a:not(.button) { display: none; }
  .site-header { position: relative; }
  .plan-strip, .provider-strip, .provider-strip.compact { grid-template-columns: minmax(0, 1fr); }
  .provider-strip.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .testimonial { padding: 28px 20px; }
  .article-page { padding-top: 24px; }
  .form-shell.wide { margin-inline: 0; }
  .site-footer { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding: 32px 16px; gap: 28px; }
  .hero-figure { min-height: 300px; }
  .section { padding: 36px 16px; }
  .container { padding: 24px 16px 56px; }
  .section-heading, .page-heading { flex-direction: column; align-items: flex-start; gap: 14px; }
  .two-grid, .three-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric { padding: 13px 14px; }
  .metric .value { font-size: 23px; }
  .impact-band { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 20px; }
  .impact-band .figure { font-size: 28px; }
  .join-band { padding: 36px 16px; align-items: flex-start; }
  .site-footer { grid-template-columns: 1fr; padding: 32px 16px; gap: 24px; }
  .form-shell, .account-shell { margin: 24px 16px 48px; padding: 20px; }
  .messages { padding: 0 16px; }
  .rate-compare { grid-template-columns: minmax(0, 1fr); }
  .child-row { grid-template-columns: 1fr; }
  .feature-card { padding: 24px; min-height: 260px; }
  .feature-card h3 { font-size: 26px; }
  .page-head h1 { font-size: 22px; }
  .list-row { flex-wrap: wrap; }
  .member-card { aspect-ratio: auto; padding: 20px; }
  .rich-columns { grid-template-columns: minmax(0, 1fr); }
  .editor-toolbar { gap: 3px; padding: 6px; }
  .editor-toolbar button { padding: 0 8px; font-size: 12px; }
  .member-card-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .approval-meta { text-align: start; align-items: flex-start; }
  .verify-result { flex-direction: column; gap: 14px; }
  .directory-grid { grid-template-columns: minmax(0, 1fr); }
  .progress-steps li { grid-template-columns: 22px minmax(0, 1fr); }
  .progress-steps li span { grid-column: 2; }
  .bar-cell { min-width: 90px; }
  .bar-table td, .bar-table th { padding: 8px 10px; }
  th, td { padding-inline-start: 12px; padding-inline-end: 12px; }
}

/* -- 10  Print ----------------------------------------------------------- */

@media print {
  .member-card { box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .environment, .site-header, .sidebar, .topbar, .site-footer,
  .actions, .filters, .toolbar, .page-head-actions, .row-actions { display: none !important; }
  body { background: #fff; }
  .app { display: block; }
  .app-body, .container { padding: 0; max-width: none; }
  .card, .metric { break-inside: avoid; border-color: #ccc; }
  .chart-data[open] summary { display: none; }
  .chart-data { display: block; }
}

/* Development-phase version banner. Public, deliberately: during development
   the owner needs to confirm at a glance which build is live without signing
   in. Removed before launch by one setting -- see SHOW_VERSION_BANNER. */
.version-banner {
  background: var(--navy);
  color: #fff;
  font-size: 12.5px;
  padding: 8px max(16px, calc((100vw - var(--page-max)) / 2 + 24px));
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.version-banner strong { font-weight: 650; }
.version-banner span { color: #cfe0cc; }
.version-banner code {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11.5px;
}
.version-banner details { margin: 0; margin-inline-start: auto; }
.version-banner summary { font-size: 12.5px; font-weight: 600; color: #fff; }
.version-banner details[open] { flex: 1 1 100%; margin-inline-start: 0; }
.version-banner ul { margin: 10px 0 0; padding-inline-start: 20px; color: #dbe8d8; }
.version-banner li { margin-bottom: 5px; }
.version-banner details p { margin: 10px 0 0; color: #a9c4a5; font-size: 12px; }

/* Schedule: a month-grouped agenda rather than a calendar grid.
   A grid is what people picture and an agenda is what they can actually read
   on a phone -- a seven-column month view either overflows or shrinks each day
   to a dot. Logical properties throughout so it mirrors under right-to-left. */
.schedule-month {
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 28px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.schedule { list-style: none; margin: 0; padding: 0; }
.schedule-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.schedule-row:last-child { border-bottom: 0; }
.schedule-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
  border-radius: var(--radius);
  padding: 8px 4px;
  min-height: 58px;
}
.schedule-date .day { font-size: 22px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.schedule-date .weekday { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.schedule-body h4 { font-size: 16px; margin: 0 0 4px; }
.schedule-body h4 a { text-decoration: none; color: var(--fg); }
.schedule-body h4 a:hover { color: var(--primary); text-decoration: underline; }
.schedule-body p { font-size: 13.5px; margin: 0; }
.schedule-body p + p { margin-top: 4px; }
.schedule-status { justify-self: end; }

@media (max-width: 760px) {
  .schedule-row { grid-template-columns: 52px minmax(0, 1fr); gap: 14px; }
  .schedule-status { grid-column: 2; justify-self: start; margin-top: 6px; }
}

/* -- 11  Right to left ---------------------------------------------------- */
/*
   Almost nothing is needed here, and that is the point. The layout above uses
   logical properties (margin-inline-start rather than margin-left, inset-inline
   -end rather than right, text-align: start rather than left), so setting
   dir="rtl" on <html> mirrors the whole interface without a parallel
   stylesheet. This section covers only the things logical properties cannot:

     1. Type. Persian needs a font stack that actually has the glyphs, and a
        little more line height -- Arabic-script letterforms have taller
        ascenders and deeper descenders than Latin ones, so the default leading
        reads cramped.
     2. Characters whose meaning is directional. An arrow pointing "forward"
        points left in a right-to-left interface.
     3. Anything positioned with a transform, which is geometry, not layout, and
        does not mirror.
*/

:root[dir="rtl"] {
  /* Vazirmatn and IRANSans are the common Persian web faces; Tahoma is the one
     almost every machine already has and renders Persian acceptably. No web
     font is fetched: the Content-Security-Policy permits no external origins,
     and a family on a slow connection should not wait for a typeface. */
  --font: 'Vazirmatn', 'IRANSans', 'Segoe UI', Tahoma, 'Noto Naskh Arabic', 'Geeza Pro', Arial, sans-serif;
}

:root[dir="rtl"] body { line-height: 1.85; }
:root[dir="rtl"] h1,
:root[dir="rtl"] h2,
:root[dir="rtl"] h3,
:root[dir="rtl"] h4 { line-height: 1.5; letter-spacing: 0; }

/* Latin letter-spacing on Persian text separates letters that must join. */
:root[dir="rtl"] .eyebrow,
:root[dir="rtl"] thead th,
:root[dir="rtl"] .sidebar-group > h2,
:root[dir="rtl"] .schedule-month,
:root[dir="rtl"] .rate .label,
:root[dir="rtl"] .site-footer strong { letter-spacing: 0; }

/* A decorative arrow points the way the reader is going. */
:root[dir="rtl"] .arrow { display: inline-block; transform: scaleX(-1); }

/* Transforms are geometry and do not mirror on their own. */
:root[dir="rtl"] .search svg { transform: translateY(-50%) scaleX(-1); }
:root[dir="rtl"] .sidebar { transform: translateX(100%); }
:root[dir="rtl"] .app[data-nav="open"] .sidebar { transform: none; }

/* Numbers, money, dates and identifiers stay left-to-right inside Persian text.
   Without this a price renders as 00.25 and a commit hash reverses. */
:root[dir="rtl"] .num,
:root[dir="rtl"] .price,
:root[dir="rtl"] .metric .value,
:root[dir="rtl"] .schedule-date .day,
:root[dir="rtl"] .rate .figure,
:root[dir="rtl"] code,
:root[dir="rtl"] time { direction: ltr; unicode-bidi: isolate; }

/* A table of numbers reads right-aligned in both directions; `end` would flip
   it to the wrong side of the column under RTL. */
:root[dir="rtl"] td.num,
:root[dir="rtl"] th.num { text-align: left; }

.language-switch { display: flex; gap: 4px; align-items: center; }
.language-switch button {
  /* Explicitly not a submit button's fill. These are submit buttons -- the
     switcher posts -- so without this they inherit the primary background and
     the muted label becomes dark green on dark green. */
  background: transparent;
  border: 1px solid transparent;
  min-height: 0;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
}
.language-switch button:hover { background: var(--surface-2); color: var(--fg); }
.language-switch button[aria-current="true"] { background: var(--primary-soft); color: var(--primary-soft-fg); }
