/* ============================================================
   ECM Light Theme — mobile-first redesign
   Palette 3 (teal + amber on paper — no purple):
     ink #0F172A · slate body #475569 · muted #5B6779
     paper #EDF0F6 · card #FFFFFF · line #E5E7F0
     teal #0D9488 · teal-deep #0F766E · teal-soft #F0FDFA
     amber #B45309 · amber-soft #FEF3E2
   Loads AFTER custom.css/globals.css; wins on the dark remaps.
   Light wins are pinned with `body` / `body.light` prefixes.

   NEVER write a comment-closing sequence inside a comment in this file -- not
   even to talk about it. A CSS comment ends at the first closing marker
   wherever it appears, so a stray one silently ends the comment early and the
   rest of those lines becomes the SELECTOR PRELUDE of the next rule, which the
   parser then throws away whole. That is not a specificity fight and no amount
   of prefixing recovers it: the rule is simply not in the CSSOM, so
   getComputedStyle reports the other stylesheet's value and
   `document.styleSheets` never lists the selector. This file has already been
   bitten by exactly that (see the note above `body .bg-white`), twice, once by
   a stray marker in prose and once by an explanatory comment ABOUT the stray
   marker that repeated it. Write `hover:bg-stone-X` and `hover:text-stone-Y`,
   or put a space around the slash.
    ============================================================ */
 
/* Skip-to-content link (WCAG 2.4.1) */
.skip-link {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden; z-index: 9999;
}
.skip-link:focus {
  position: fixed; top: 0; left: 0;
  width: auto; height: auto;
  padding: 0.75rem 1.5rem;
  background: var(--teal, #0D9488); color: #fff;
  font-weight: 600; text-decoration: none; z-index: 9999;
}

/* ============================================================
   Z-INDEX LADDER (consolidated)
   Documented stacking order for the app. Values are compared within their
   stacking context unless noted.
 
     0: bg layers
     1: page-wrap
     2: nav-scope
     3: page-wrap with modal
     40/80: toasts
     50: tabbar + modals + incidents notice
     70: club-menu + account-dropdown
     80: JS toast container (#toast-container, inside .page-wrap)
     90: confirm backdrop
    100: incidents-notice overlay (root-level, base.html)
   ============================================================ */
 
html {
  background-color: #EDF0F6;
  /* The page-transition duration, and the only token in this file that cannot
     live on `body` with the other --motion-* ones: the ::view-transition
     pseudo-elements are children of the document root and inherit from html,
     not from body. A body-scoped custom property is simply not visible to
     them, and `animation-duration: var(--motion-2)` would be invalid at
     computed-value time -- the declaration is dropped and the fade runs at
     the initial 0s, i.e. no transition at all, with nothing in the console.
     That is the same silent var() failure documented further down this file. */
  --vt-duration: 300ms;
}

body {
  /* The paper was #FAFAFD, and the cards are #FFFFFF -- a 1.2% difference.
     Measured on the clubs index, the page and the cards on it were the
     same value, so a white card on the sheet had no edge to it: the page
     read as one flat wash and the eye had nothing to land on. That is
     what "designed to be invisible" looks like from the other side.
     #EDF0F6 is the sheet the cards sit ON: still a light, cool paper,
     and every white card on the site now has a figure/ground edge
     against it. --muted measures 5.03:1 on it (it was 5.36:1 on the old
     paper), so the AA floor still holds. */
  --paper: #EDF0F6;
  --card: #FFFFFF;
  --line: #E5E7F0;
  --ink: #0F172A;
  --slate: #475569;
  /* Was #64748B. Measured on the lightest surface any muted token actually
     lands on -- .seat-open-badge's own #F1F5F9 fill -- that is 4.34:1, and
     4.45:1 on the homepage canvas (#FAFAFD). Both are below the 4.5:1 that
     11-12px metadata needs, so every --muted user failed, not just one.
     #5B6779 measures 5.24:1 on #F1F5F9, 5.36:1 on #FAFAFD and 5.74:1 on
     white. It also absorbs the old #94A3B8 (slate-400) step: on these
     backgrounds there is no room for two distinct muted greys that both
     clear AA, so both are now --muted. */
  --muted: #5B6779;
  --brand: #0D9488;
  --brand-deep: #0F766E;
  --brand-soft: #F0FDFA;
  --teal: #0D9488;
  --teal-soft: #E6F7F4;
  /* The dashboard family (.dash-*, 41 templates' worth of ecm/ pages) reads
     --ecm-* tokens and the motion/radius set below. docs/design-system.md has
     declared all of them since the beginning, and no stylesheet ever defined
     one: 48 var() references, 0 definitions. The failure is quiet -- an
     undefined var() makes the whole declaration invalid at computed-value
     time, so `transition: all var(--motion-2)` does not fall back to a default
     duration, it drops the transition entirely, and `color: var(--ecm-muted)`
     is `unset`. Measured consequence: every .dash-op, .dash-pill and
     .dash-card hover on the ECM pages animates in 0s and the KPI borders
     render as currentColor (rgb(15,23,42)) instead of a line grey.
     Defined here, in the same scope as the tokens they alias, so --ecm-* always
     resolves to the value it names rather than to a second copy that can drift. */
  --ecm-bg: var(--paper);
  --ecm-stage: var(--card);
  --ecm-raised: var(--brand-soft);
  --ecm-line: var(--line);
  --ecm-ink: var(--ink);
  --ecm-muted: var(--muted);
  --ecm-brand: var(--brand);
  /* The four remaining --ecm-* names the dashboard family reads. They were left
     undefined by the pass above, and the failure is even quieter than a dropped
     transition: `color: var(--ecm-warn)` is invalid at computed-value time, so
     the declaration is dropped and the property falls back to INHERIT. Measured
     on /ecm/dashboard/ as ECM staff: .dash--warn/.dash--hot .dash-num, both
     .dash-alert variants and .dash-chip--green|--amber|--red all computed to the
     panel's inherited ink instead of amber/red/green -- the warn and hot KPIs
     were pixel-identical to the calm ones -- and .dash-input's
     `border-radius: var(--radius-6)` computed to 0px, so the filter input and
     every .dash-pill/.dash-chip lost their rounding entirely.
     Values are the light-theme inks for their own washes, not the dark-stage
     values design-system.md declares: #F1C40F amber on its own rgba(180,83,9,.1)
     wash measures 1.4:1 and is not shippable. Measured on the washes the template
     actually paints (templates/ecm/dashboard.html): warn #B45309 = 5.02:1 on white
     and 4.76:1 on the wash; danger #B91C1C = 6.47:1 / 5.79:1; success #15803D =
     5.02:1 / 4.65:1. --ecm-dim is the third grey step, and --muted already
     absorbed that step (see its own note above): 5.74:1 on white. */
  --ecm-warn: #B45309;
  --ecm-danger: #B91C1C;
  --ecm-success: #15803D;
  --ecm-dim: var(--muted);
  /* The last two --ecm-* names from the design doc: the 6px radius the input
     family names, and the pill the filter chips and status chips name.

     These are in PX, not rem, and that is deliberate. custom.css raises the
     root font-size to 1.125rem at >=900px, so a radius written in rem is
     multiplied by 18/16 and lands off the shape system at exactly the
     widths people design at: .375rem measured 6.75px on every button,
     .5rem measured 9px on every card, .75rem measured 13.5px on every
     panel, against a rulebook that says 6 / 8 / 12. The type scale is a
     decision (a bigger desktop type scale); the SHAPE language must not
     drift with it, so the radii are absolute.

     test_rendered_design_invariants.py asserts the computed radius of a
     card, a button and a panel is one of the four, in a real browser, so
     this cannot silently go back to being rem. */
  --radius-6: 6px;
  --radius-pill: 9999px;
  /* Named durations, so "how fast is the app" is one edit and not forty. */
  --motion-1: 120ms;
  --motion-2: 180ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --radius-8: 8px;
  --radius-12: 12px;
  /* Tailwind's own radius scale, in px for the same reason. tailwind.css
     is a generated build, so its scale is overridden here rather than
     edited there. custom.css (which loads earlier) already redefines
     --radius-sm/md/lg/xl in px, and its :root is unlayered, so those four
     are already absolute; the one step nothing else defines is --radius-2xl,
     which tailwind declares as 1rem -- 16px, and 18px on a desktop root.
     The rulebook has no 16px radius, and the pages that carry their own
     .rounded-2xl (clubs/club_detail.html) already said 12px, so the same
     utility was rendering at two different radii on two pages. It is 12px
     everywhere now. */
  --radius-2xl: 12px;
  /* The teal for text that has to sit ON a teal-washed chip. --brand-deep
     (#0F766E) is the teal for text on a plain surface, and it clears AA there --
     5.47:1 on white, 5.25:1 on --paper, 5.00:1 on #F1F5F9. On the chips the wash
     itself lifts the background: .role-chip.staff's rgba(13,148,136,.14) over
     #F1F5F9 leaves --brand-deep at 4.27:1, so the chip text takes the darker of
     the two brand teals the app already ships (profile.html's avatar gradient is
     #0F766E -> #115E59). Measured here: 5.91:1 on that wash, 7.06:1 on #E6F7F4. */
  --brand-ink: #115E59;
  /* The amber for TEXT, and the one amber the site has.

     The app's amber used to be #D97706, and as a text colour it failed AA
     everywhere it was painted on a light surface: measured 3.06:1 on
     --paper, 3.19:1 on white, 2.89:1 on the timetable's busy wash and
     3.08:1 on the amber wash. The palette already carried the answer -- the
     filled warning button on event_detail.html had been moved to #B45309 --
     so this is that value promoted to a token, and every amber in the site
     is now this one. Measured: 4.52:1 on --paper, 4.52:1 on white,
     4.54:1 on the busy wash. There is no second amber: the shapes that
     used to use the old one (legend dots, week dots, breaks, borders) use
     this one too, and the 3:1 graphics floor is cleared at 4.52:1. */
  --amber-ink: #B45309;
  background-color: var(--paper);
  color: var(--ink);
  background-image:
    radial-gradient(ellipse 90% 30% at 50% -8%, rgba(13, 148, 136, 0.10), transparent 70%),
    radial-gradient(circle, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
  background-size: auto, 26px 26px;
  background-attachment: fixed;
}

/* Headings / links back to light values */
body h1, body h2, body h3, body h4 { color: var(--ink); }
body a { color: var(--brand-deep); }
body a:hover { color: var(--brand); }

/* ---------- Surfaces: cards, shells, panels ---------- */
body .card,
body .aside-card,
body .info-card,
body .form-card,
body .table-card,
body .club-card,
body .event-card,
body .respond-card,
body .q-card,
body .d-card {
  background: var(--card);
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px -12px rgba(15, 23, 42, 0.18);
}
body .card:hover,
body .club-card:hover,
body .aside-card:hover { box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06), 0 16px 32px -16px rgba(15, 23, 42, 0.25); }

/* Dark remaps in custom.css section 14 flipped back to light.
   .bg-stone-200 / .border-stone-100 / .text-stone-800 and the three
   hover:bg-stone-50 / hover:bg-stone-100 / hover:text-stone-900 pairs were
   dropped from BOTH layers: no template references any of them, so each
   existed twice to style nothing.

   This comment used to quote a class-name pair containing a comment-closing
   marker, and that marker ended the comment on the second line of it. The
   parser then read the rest of the sentence as a selector attached to the
   block below and dropped the pair, so `body .bg-white` never reached the
   CSSOM at all: 149 top-level rules parsed instead of 150,
   `body .bg-white` absent from [...styleSheets].cssRules, and every .bg-white
   element on /events/create/ computed to custom.css's dark #1F2937 -- 1.18:1
   against its own #0F172A text. Same shape, no specificity: (0,1,1) had
   already been out-specifying custom.css's (0,1,0) the whole time. */
body .bg-white { background-color: #FFFFFF; }
body .bg-stone-50 { background-color: #F8FAFC; }
body .bg-stone-100 { background-color: #F1F5F9; }
body .text-stone-100, body .text-stone-300,
body .text-stone-700, body .text-stone-900 { color: var(--ink); }
body .text-stone-400, body .text-stone-500 { color: var(--muted); }
body .text-stone-600 { color: var(--slate); }
body .border-stone-200, body .border-stone-300 { border-color: var(--line); }

/* Accent utilities for the club-head pages. These were written as Tailwind
   arbitrary values (text-[#0D9488], border-t-[#B45309], bg-[#0D9488]/10 ...),
   none of which exist in the compiled tailwind.css, so they silently fell
   back to currentColor and drew dark-ink accents on a light page. */
.accent-teal { color: #0F766E; }
.accent-amber { color: #B45309; }
.accent-teal-wash { background-color: rgba(13, 148, 136, 0.10); }
.accent-amber-wash { background-color: rgba(180, 83, 9, 0.10); }
.accent-top-teal { border-top-color: #0D9488; }
.accent-top-amber { border-top-color: #B45309; }

/* Template-local dark backgrounds → transparent, so the ambient backdrop
   (body's dot grid + teal glow) flows through instead of being sliced by a
   full-viewport flat slab. Measured on /ecm/incidents/log/: the old
   `var(--paper)` remap painted a flat near-white 100vh block behind the
   centred form card -- a white card on a white void, on a site whose real
   background is the patterned paper. Same principle the top bar uses. */
body .page-dark { background: transparent; color-scheme: light; }
body .err-card,
body .banned-card,
body .link-card { background: var(--card); border-color: var(--line); color: var(--ink); }
/* ---------- Text helpers (custom.css §17.3) ---------- */
body .text-strong { color: var(--ink); }
body .text-muted, body .d-sub { color: var(--muted); }
/* Was #94A3B8, which measures 2.56:1 on white -- and these are the 11-12px
   metadata labels on every ECM and club-head table, i.e. the smallest text on
   the page at the worst contrast. --muted is now 5.24:1 on the darkest fill
   these land on. */
body .text-faint, body .d-muted { color: var(--muted); }

/* ---------- The audience chip: ONE look, every page ---------- */
/* An event's audience (Girls only / Boys only / Everyone) is shown in four
   places: the event card, the details dialog, the event detail page's "Side"
   row, and the club page. They disagreed. Measured before this rule, the card
   rendered blue-100/blue-700 for Boys, pink-100/pink-700 for Girls and
   purple-100/purple-700 for Everyone, while the dialog rendered amber for all
   three -- so the same event was pink on a card and amber in the popup opened
   from that card.

   One colour for all three, because the DISTINCTION does not come from colour:
   each chip carries its own icon and its own word ("Girls only", not a bare
   hue), so a colour-blind reader gets the same information. Colour here is
   decoration, and decoration that disagrees between two views of one event is
   worse than decoration that is simply consistent.

   #B45309 on #FEF3E2 measures 5.82:1, over the 4.5:1 AA asks of bold text at
   this size. Unlayered, so it wins over the palette utilities it replaces.

   ONE geometry, shared with .poster-date, the date label beside it on the
   card. Measured before this rule, the two pills on one poster rendered at
   10px/23px (the date, written as an absolute `text-[10px]` utility) and
   12-13.5px/25-27.9px (this chip, at 0.75rem) -- a matched pair of labels at
   two sizes, and because the date's padding came from rem utilities while its
   text did not, the two grew at different rates with the viewport. 0.8125rem
   is 13px on a phone and 14.6px on desktop, one step up from the 0.75rem this
   chip carried; min-height fixes a single height for both.

   max-width keeps a long room name -- "Girls · Library Annexe" is the longest
   the model can produce -- wrapping inside the pill rather than being clipped
   by the poster's overflow:hidden. */
.poster-date,
.audience-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  max-width: 100%;
  min-height: 1.75rem;
  padding: 0.3125rem 0.6875rem;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.15;
  border-radius: 9999px;
  box-sizing: border-box;
}

/* The chip's default family is the ACCENT's, not amber's.

   It was amber -- #FEF3E2 on #B45309 -- because the page that grew it was
   written against the old warm-dark palette, and the amber was the accent
   there. The site is teal now, and the amber is left for caution and
   danger, which is what the design system says it is for ("One accent.
   Teal, and nothing else carries a hue. Amber is caution").

   The visible cost of leaving it: a co-ed event's POSTER is teal (the
   poster is generated in the accent) and its chip beside it was amber,
   so the one card on the board that said "everyone" was the one card
   whose two labels disagreed with each other. */
.audience-chip {
  border: 1px solid #CCFBF1;
  background: #E6F7F4;
  color: #0F766E;
}

/* The date label on the card. Geometry comes from the rule above; this adds
   only its own palette, so the pair reads as one set. #334155 on white is
   9.9:1, and the 95% white fill keeps the label legible over dark artwork. */
.poster-date {
  border: 1.5px solid #E2E8F0;
  background: rgba(255, 255, 255, 0.95);
  color: #334155;
}

/* Per-audience colours. Girls and Boys each get their own hue so a reader can
   tell them apart at a glance across a board of cards; the "Everyone" chip is
   gone entirely, because a co-ed event is now shown as TWO chips -- Girls and
   Boys -- or, when it is only in one room, a single "Co-ed" chip. Either
   states the same thing the old purple chip did without inventing a third
   colour that meant "both".

   Contrast, measured on the rendered chip: #9D174D on #FDF2F8 is 7.9:1 and
   #1E40AF on #EFF6FF is 8.6:1. Both clear AA with room to spare, which a
   lighter step (pink-600, blue-600) would not at 12px bold. */
.audience-chip--girls {
  border-color: #F9A8D4;
  background: #FDF2F8;
  color: #9D174D;
}
.audience-chip--boys {
  border-color: #93C5FD;
  background: #EFF6FF;
  color: #1E40AF;
}

/* The Boys/Girls toggles on the event form. Same three colours as the chips
   above, because they say the same thing: this room is for the girls, this one
   for the boys. Written here rather than inline in the template so the pink
   and the blue have exactly one definition -- the design check refuses
   hexes in templates, and it is right to: two copies drift. */
.ef-side.is-on[data-side="Girls"] {
  background: #FDF2F8; border-color: #F9A8D4; color: #9D174D;
}
.ef-side.is-on[data-side="Boys"] {
  background: #EFF6FF; border-color: #93C5FD; color: #1E40AF;
}

/* The four volunteer-lead cards on /ecm/volunteers/ -- Head and Deputy, Boys
   and Girls. Same three colours as the chips and the toggles directly above,
   because they say the same thing: this lead works the boys' side, this one
   the girls'. Written here rather than inline in the template for the same
   reason those are: one definition of the pink and the blue, and the design
   check refuses hexes in templates.

   Colour is NOT the only signal. Each card's own label already ends in
   "— Boys" / "— Girls", so a reader who cannot tell the two hues apart still
   knows which side they are looking at (WCAG 1.4.1). The wash is the card's
   background and the border is the same hue's 300 step, so the pair reads as
   one card and not as a stripe.

   Contrast: #9D174D on #FDF2F8 is 7.9:1 and #1E40AF on #EFF6FF is 8.6:1 --
   the same measurements the chips above carry, and the ink stays the dark
   step of each for that reason. The card's holder name keeps #0F172A (16.9:1
   on either wash), so the value that matters is not tinted at all.

   TWO CLASSES in the selector, deliberately. The base `.lead-card` rule lives
   in templates/ecm/volunteers.html's <style> block, which is parsed AFTER
   this file, so a single-class rule here would lose the tie on order -- and
   the base rule sets `border: 1px solid #E2E8F0` as a shorthand, which
   resets border-color. `.lead-card.lead-card--girls` out-ranks it on
   specificity instead, so the side colour holds wherever the two files are
   loaded in either order. */
.lead-card.lead-card--girls {
  border-color: #F9A8D4;
  background: #FDF2F8;
}
.lead-card.lead-card--boys {
  border-color: #93C5FD;
  background: #EFF6FF;
}

/* There is deliberately no side COLOUR-and-nothing-else rule here. The card's
   own label already reads "Head of Volunteers — Boys", so the side survives a
   monochrome screen and is read out in one phrase by a screen reader; the
   wash is the shortcut on top of that, never the only signal (WCAG 1.4.1). */

/* Co-ed is TEAL, and it carries its own outline.

   It used to be the site accent exactly -- #0F766E on #E6F7F4 with a
   #CCFBF1 border -- which is fine on a white card and invisible on the
   generated poster, because the poster is painted in the same teal. The one
   chip that says "everyone" was the one chip you could not read, and it was
   moved to violet (#5B21B6 on #F5F3FF) to get an outline.

   Violet is not a colour this palette has. The rulebook is the design doc --
   "Co-ed is TEAL", and pink = girls, blue = boys, teal = the accent, with no
   third hue joining them -- so the chip is back on the accent family. What
   keeps it legible against the teal poster is the OUTLINE the violet move
   was really after: the border is the accent itself at 1.5px rather than
   the pale #CCFBF1, so the pill holds its edge on artwork, and the label is
   the darker of the two brand teals.

   Measured: #0F766E on #E6F7F4 is 7.06:1, and the border is 2.3:1 against
   the wash -- the edge reads even where the wash does not. */
.audience-chip--coed {
  border: 1.5px solid #0D9488;
  background: #E6F7F4;
  color: #0F766E;
}

/* Tailwind's text-slate-400 is 2.56:1 on white and 2.63:1 on the modal
   panel's own #FFFFFF, which fails AA at every size it is used for -- it is
   the "Date"/"Time"/"Location" label row in the event dialog, the "Event
   contact" heading, and the ISO-A4 caption. --muted is the same role one step
   darker and measures 5.24:1 on #F1F5F9 / 5.74:1 on white. Unlayered, so it
   beats the utility rather than losing to build order. */
body .text-slate-400 { color: var(--muted); }
body .page-title,
body .d-title,
body .d-h2,
body .form-title,
body .builder-title,
body .respond-title,
body .resp-title,
body .questions-title,
body .card-title,
body .contact-title,
body .tt-title,
body .profile-name,
body .err-title,
body .empty-title { color: var(--ink); }
body .page-sub,
body .form-sub,
body .builder-sub,
body .respond-sub,
body .resp-sub,
body .contact-sub,
body .empty-desc,
body .empty-sub,
body .q-label { color: var(--slate); }
body .d-label,
body .info-value,
body .detail-value,
body .cell-strong,
body .contact-name,
body .profile-username,
body .q-input { color: var(--ink); }
body .info-label,
body .detail-label,
body .cell-muted,
body .lbl,
body .progress-text,
body .legend,
body .d-fact-label,
body .aside-label,
body .questions-meta { color: var(--muted); }
body .detail-row,
body .info-row { border-color: var(--line); }
/* The label/value pair of the review card (custom.css 11.14) was the one
   member of this family still on the dark theme's inks, and it is the worst
   miss in the file: .value read --color-text, which was #F5F5F4 -- the
   DARK theme's light ink, on a white card. Measured on /events/<pk>/review/
   as ECM staff, on custom.css's own white .info-card: 1.09:1, so every
   fact in the table (club, side, date, coordinator, room, time, year
   groups) rendered invisible; .label read --color-text-muted (#A8A29E) at
   2.52:1. Both declarations are (0,2,0), so
   the light win has to carry the `body` prefix like its neighbours here.
   Same root cause and same fix as .empty-state .empty-title (custom.css:1245). */
body .info-row .label { color: var(--muted); }
body .info-row .value { color: var(--ink); }
/* ---------- Buttons: flat ink/brand, no gradients (anti-slop rule 6) ---------- */
body .btn {
  background-color: #FFFFFF;
  border-color: #CBD5E1;
  color: var(--ink);
  border-radius: 6px;
}
body .btn:hover:not(:disabled) { background-color: #F1F5F9; }
body .btn-primary,
body .submit-btn {
  background: var(--brand-deep);
  border: 1px solid var(--brand-deep);
  color: #fff;
  border-radius: 6px;
}
body .btn-primary:hover:not(:disabled),
body .submit-btn:hover { background: #115E59; border-color: #115E59; box-shadow: none; color: #fff; }
/* The event dialog's Join CTA is an <a>, so it inherits `body a { color:
   var(--brand-deep) }` -- which is UNLAYERED, and therefore wins over the
   utility `text-white` on the element itself. Measured: the label rendered
   rgb(15,118,110) on the button's rgb(79,57,246) = 1.18:1, i.e. teal on
   indigo, at 16px. This restores white without touching any other link. */
body #modal-rsvp-btn,
body #modal-rsvp-btn:hover {
  color: #FFFFFF;
  text-decoration: none;
}
/* Register CTAs must not inherit the site link colour (body a/body a:hover are
   unlayered and outrank the layered text-white utility) or take an underline
   on hover. Same root cause as the modal rule above, applied to the other
   three surfaces. */
body .event-card .event-card-actions a[href*="form/respond"],
body .event-card .event-card-actions a[href*="form/respond"]:hover {
  color: #FFFFFF;
  text-decoration: none;
}
body .btn-cta,
body .btn-cta:hover {
  color: #FFFFFF;
  text-decoration: none;
}
/* 44px tap-target floor for the Register CTAs on every breakpoint, not just
   the phone media queries in the templates' own <style> blocks. min-height only. */
body #modal-rsvp-btn,
body .btn-cta,
body .submit-btn {
  min-height: 44px;
}
body .event-card .event-card-actions a,
body .event-card .event-card-actions button {
  min-height: 44px;
}
/* The 44px floor, on every breakpoint.

   The rulebook: "Tap target floor 44x44, everywhere, including a chip
   that looks small. A visible label may be smaller; the target may not."

   This floor used to live ONLY inside `@media (max-width: 639px)`, on
   the reasoning that a desktop has a mouse. A desktop has a
   touchscreen too, and more to the point the rule never said "on
   phones" -- it said "everywhere". Measured on the desktop at 1280
   before this: every .btn was 38.3-39.7px tall, and the audit's item
   #16 was recorded as closed on the strength of the phone sweep.

   So the floor is now unconditional, and the phone query below only
   adds what the phone needs on top of it (a full-width button).

   min-height only: the width stays content-driven, because a 44px
   minimum on the WIDTH would turn a two-word button into a 44px-wide
   slab and break every row of a table. */
body .btn,
body .btn-secondary,
body .btn-primary,
body .btn-ghost,
body .btn-danger {
  min-height: 44px;
}

body .btn:active:not(:disabled),
body .btn-primary:active:not(:disabled),
body .submit-btn:active:not(:disabled) { transform: translateY(1px); }
/* Secondary is a rank below primary, not a second teal. It used to be
   var(--teal) with a hover border byte-identical to the primary fill, so the
   two read as one undifferentiated button family. */
body .btn-secondary { background: #FFFFFF; border-color: #CBD5E1; color: var(--brand-deep); }
body .btn-secondary:hover:not(:disabled) { background: #F1F5F9; border-color: var(--brand); color: var(--brand-deep); }

/* 44px tap-target floor for .btn on phone. The house .btn is 35.5px tall at
   390px (8px pad + 14px text * 1.25 line-height + 2px borders), under the
   WCAG 2.2 2.5.8 floor, so enforce min-height only (width stays content-driven).
   Page-scoped overrides at higher specificity still take precedence.

   The floor itself is now unconditional, above; this query only adds the
   full-width button the phone needs. */
@media (max-width: 639px) {
  .btn { min-height: 44px; }
}

/* The club-staff page's inline Remove / Cancel buttons carry no geometry at
   all -- they are a bare 12px text run -- so they measured 51x18 as ECM staff
   and 46x16 at 390px, i.e. under WCAG 2.2 2.5.8's 24x24 floor at every
   breakpoint and under this file's own 44px phone floor. They sit in a flex
   row next to a .badge, which is why the extra height is padding rather than a
   block box: the row keeps its alignment and only the target grows. */
body .staff-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-6);
}

/* .btn-danger was MISSING from this theme, and that omission silently disabled
   it: the base `body .btn` above is (0,1,1) while every .btn-* variant in
   custom.css is (0,1,0), so custom.css's .btn-danger was out-specified and
   Reject rendered as a neutral ghost, identical to every other button. */
body .btn-danger { background: #B91C1C; border: 1px solid #B91C1C; color: #FFFFFF; }
body .btn-danger:hover:not(:disabled) { background: #B91C1C; border-color: #B91C1C; color: #FFFFFF; }

/* Split: .d-btn is the primary-weight action on the ECM club pages (its amber
   intent is declared in ecm_club_*.html) and .d-btn-ghost is the neutral
   variant. Declared together, the primary had no visual weight and the two
   were pixel-identical. */
body .d-btn { background: var(--brand-deep); border: 1px solid var(--brand-deep); color: #FFFFFF; border-radius: 8px; }
body .d-btn:hover:not(:disabled) { background: #115E59; border-color: #115E59; color: #FFFFFF; }
body .d-btn-ghost { background: #FFFFFF; border-color: #CBD5E1; color: var(--ink); border-radius: 8px; }
body .d-btn-ghost:hover:not(:disabled) { background: #F1F5F9; color: var(--ink); }

/* The dark theme sets .action-link to amber-400 (#FBBF24), which is 1.67:1 on
   white. These are destructive and acknowledgement links, so they need to be
   legible, not merely colourful. */
body .action-link { color: var(--brand-deep); }
body .action-link:hover { color: var(--brand); }

/* ---------- Chips / badges / pills ----------
   custom.css §5 is the single base; these are its light-theme values. The
   former dark white/5 + white/10 pills are unreadable on paper, so every alias
   needs a light fill, not just .chip. The dark fills are 15%-alpha tints of a
   saturated colour; the light ones are the same idea over a light base, with a
   saturated 700/900 text step that clears 4.5:1 -- the dark tints did not
   (.badge-success was #15803D on a 15%-green wash, 1.6:1).
   Only fill/colour are set here: .d-chip and .badge are borderless by design,
   so a border-color would be inert. */
body .chip,
body .status-pill,
body .seat-open-badge { background: #F1F5F9; border-color: #E2E8F0; color: var(--slate); }
body .d-chip { background: #F1F5F9; color: var(--slate); }
body .chip-teal, body .chip-secondary { background: var(--teal-soft); border-color: #99F6E4; color: #0F766E; }
body .chip-amber { background: #FEF3E2; border-color: #FCD9A8; color: #B45309; }
body .chip-primary { background: var(--teal-soft); border-color: #99F6E4; color: #0F766E; }
body .chip-red, body .chip-danger { background: #FEE2E2; border-color: #FECACA; color: #B91C1C; }
body .chip-stone, body .chip-dark { background: #F1F5F9; border-color: #E2E8F0; color: var(--slate); }
body .chip-orange { background: #FEF3E2; border-color: #FCD9A8; color: #B45309; }
body .chip-success,
body .chip-green { background: #DCFCE7; border-color: #BBF7D0; color: #15803D; }
body .d-chip-orange { background: #FEF3E2; color: #B45309; }
body .d-chip-amber { background: #FEF3E2; color: #B45309; }
body .d-chip-stone { background: #F1F5F9; color: var(--slate); }
body .d-chip-teal { background: var(--teal-soft); color: #0F766E; }
body .d-chip-red { background: #FEE2E2; color: #B91C1C; }
body .d-chip-green { background: #DCFCE7; color: #15803D; }
body .badge-success { background: #DCFCE7; color: #15803D; }
body .badge-danger { background: #FEE2E2; color: #B91C1C; }
body .badge-primary { background: #FEF3E2; color: #B45309; }
body .badge-secondary { background: var(--teal-soft); color: #0F766E; }
/* .seat-open-badge is the muted/disabled read: the template's copy used
   #94A3B8, which is 2.56:1 on white. */
body .seat-open-badge { color: var(--muted); }
body .status-pill:hover { color: var(--ink); border-color: #CBD5E1; }
body .status-pill.active { background: var(--brand-deep); border-color: var(--brand-deep); color: #FFFFFF; }

/* ---------- Tables ---------- */
body .table-rich thead, body thead th { background: #F8FAFC; color: var(--slate); }
body .table-rich tbody tr:nth-child(even) { background-color: #F8FAFC; }
body .table-rich tbody tr:hover, body tbody tr:hover { background-color: #F0FDFA; }
body .table-rich th, body .table-rich td, body tbody td { border-color: var(--line); color: var(--ink); }
body .table-scroll { border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* ---------- Forms ---------- */
body .field-label { color: var(--ink); }
body .field-input, body .q-input, body .auto-input,
body input[type="text"], body input[type="email"], body input[type="password"],
body input[type="number"], body input[type="url"], body input[type="date"],
body input[type="search"], body textarea, body select {
  background-color: #FFFFFF;
  border-color: #CBD5E1;
  color: var(--ink);
}
body .field-input:focus, body .q-input:focus,
body input:focus, body textarea:focus, body select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}
/* Was #94A3B8, which is 2.56:1 on white -- measured on every ECM form
   (/ecm/audit/ #f-user, /ecm/contacts/create/ #role_name, /ecm/incidents/log/
   #reason, ...) and on /ecm/accounts/ #q. The placeholder carries real
   example content ("+971...", "@handle", "e.g. Events Lead"), so it is a
   label in a lighter coat, not decoration: --muted measures 5.74:1 on white
   and 5.36:1 on paper. */
body input::placeholder, body textarea::placeholder,
body .field-input::placeholder, body .q-input::placeholder { color: var(--muted); }
body .check-label { color: var(--slate); }
body .check-label:hover { background: #F0FDFA; }

/* KYC / KPI / stat tiles */
body .kpi-card, body .stat-tile, body .d-kpi {
  background: #FFFFFF;
  border-color: var(--line);
  border-top-color: var(--brand);
}
body .kpi-label, body .stat-label { color: var(--ink); }
body .kpi-sub, body .stat-sub { color: var(--muted); }
body .kpi-num, body .d-kpi-num { color: var(--ink); }

/* Misc panels carried from dark templates */
body .cover-banner,
body .cover {
  background: linear-gradient(135deg, #F0FDFA 0%, #FFFFFF 60%, #FEF3E2 100%);
  border-color: #99F6E4;
  color: var(--ink);
  box-shadow: 0 12px 32px -16px rgba(13, 148, 136, 0.35);
}
body .skeleton { background-color: #E2E8F0; }
body .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); }
body .empty-state { color: var(--muted); }
body .empty { color: var(--muted); }
body .msg { background: #FFFFFF; border-color: var(--line); color: var(--slate); }
/* Was var(--brand) (#0D9488): the initial in a filled avatar measured 3.74:1
   against its own fill (white on #0D9488), i.e. the one glyph in the tile failed
   AA while every other filled control in the app had already moved to
   --brand-deep. White on #0F766E is 5.47:1, and the same move keeps .avatar
   consistent with the Register CTA's fill. */
body .avatar { background: var(--brand-deep); color: #fff; }
body .avatar-tile { background: var(--brand-soft); color: var(--brand-deep); }
body .live-dot { background: #15803D; }
body ::selection { background: rgba(13, 148, 136, 0.18); color: var(--ink); }
body :focus-visible { outline-color: var(--brand); }

/* ---------- Editorial type pairing (anti-slop rule 1) ----------
   Fraunces for display, Inter for body, JetBrains Mono for
   dates/counts/metadata. Display weight 600 max. */
body {
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
}
body h1, body .display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
body h2, body h3 { font-weight: 600; }
body .toggle-count,
body .kpi-num,
body .d-kpi-num { font-family: var(--font-mono); }
/* ---------- Radius discipline: 6px buttons/chips, 8px cards.
   Kills the uniform rounded-2xl-everywhere tell.
   The chip half moved into custom.css §5: now that the pill family has one
   base, pinning the radius in two layers meant editing one silently did
   nothing. Cards stay here because their radius is theme-specific. ---------- */
body .card,
body .club-card,
body .event-card,
body .form-card,
body .table-card,
body .aside-card,
body .info-card,
body .respond-card,
body .q-card,
body .d-card { border-radius: 8px; }
/* ---------- Top app bar: floating glass pill so the ambient backdrop
   flows around it instead of being sliced by a full-width white bar ---------- */
/* The desktop nav row must not depend on Tailwind's responsive utilities.
   The compiled tailwind.css (v4) puts utilities inside @layer, and an
   unlayered rule outranks a layered one regardless of specificity or
   source order - so "hidden md:flex" collapsed to display:none on pages
   without the Tailwind Play CDN (the media pages), producing a header
   with no page links at all. These unlayered rules are CDN-proof.

   ONE element is the primary nav in both shapes: a horizontal row on a
   desktop, a drawer under the bar on a phone. It used to be display:none
   below 768px, so a phone had NO primary navigation at all - the bottom
   tab bar was the only nav it had, and the club picker could not be
   reached from one at all. The drawer is the same markup, so the two
   shapes can never list different things. */
body .topbar .topnav { display: none; }
@media (min-width: 768px) {
  body .topbar .topnav { display: flex; align-items: center; gap: 0.25rem; }
  /* "My Club" is the far-right item of the inner group: push it right
     without leaving the group. margin-left:auto on a flex child eats
     every free pixel, so the cluster (Events / Clubs) stays left and
     My Club lands at the right end of the 0.25rem rhythm. */
  body .topbar .topnav .nav-split { margin-left: auto; }
}
@media (max-width: 767.5px) {
  body .topbar .topnav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0.125rem;
    padding: 0.5rem 0.625rem 0.75rem;
    max-height: calc(100dvh - 5rem); overflow-y: auto;
    /* Opaque, not the bar's 0.94 glass. A drawer is a panel the reader
       reads THROUGH: at 0.97 the page's own heading showed through it
       (measured: the H1's pixel went from #0F172A to #F1F5F9 behind the
       open drawer), and a menu you can see the page through is a menu
       you cannot read. The bar stays glass; the panel does not. */
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-12);
    box-shadow: 0 24px 48px -20px rgba(15, 23, 42, 0.35);
  }
  body .topbar .topnav.is-open { display: flex; }
  /* The drawer is a phone-sized surface, so its items are full-width rows
     at the 44px tap-target floor the design system sets for every
     control. The desktop row is 43px tall, which is under it, but a
     desktop pointer does not need the floor. */
  body .topbar .topnav .toplink,
  body .topbar .topnav .nav-split { min-height: 2.75rem; }
  body .topbar .topnav .toplink { justify-content: flex-start; }
  body .topbar .topnav .nav-caret { width: 2.75rem; }
  /* The picker takes a line of its own on a phone. Beside the label it
     was 222px wide and the club's name was cut to "Robotics Soci...". */
  body .topbar .topnav .nav-split { flex-wrap: wrap; }
  body .topbar .topnav .nav-split .club-menu { width: 100%; }
}
body .topbar {
  position: sticky; top: 0.75rem; z-index: 50;
  width: calc(100% - 1.5rem); max-width: 76rem; margin-inline: auto;
  margin-top: 0.75rem;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  box-shadow: 0 8px 24px -16px rgba(15, 23, 42, 0.25);
}
body .nav-scope { position: sticky; top: 0; z-index: 50; }
body .nav-scope .topbar { position: relative; top: auto; }
@media (max-width: 1023.5px) {
  body .nav-scope {
    transition: transform 0.25s ease-out, opacity 0.25s ease-out;
  }
  body .nav-scope.is-hidden {
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
  }
  body .nav-scope:not(.is-hidden) {
    transform: translateY(0);
    opacity: 1;
  }
  /* WCAG 2.2 2.4.11 Focus Not Obscured (Minimum). The scroll-away header is
     fine to animate out from under nobody, but hideHeader() in base.html
     cannot know whether the thing the user just tabbed to is inside it, and
     it keys purely off scroll position. Measured at 360 / 390 / 820 / 1023
     with scrollY=700: .nav-scope came back transform
     matrix(1,0,0,1,0,-69.6) opacity 0 and every header link sat entirely off
     screen (A "E ECM" at y=-43, bottom=-15) while still holding focus. So
     :focus-within pins the header back in place for as long as focus is
     anywhere inside it -- which is the same behaviour as not hiding it at
     all for that user, and is undone the moment focus leaves.
     Deliberately after :not(.is-hidden) above and equal specificity, so it
     wins on source order; it does not need to out-specify anything. */
  body .nav-scope:focus-within {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  body .nav-scope { transition: none; }
}
/* ---------- There is no footer ----------
   Removed with the markup in base.html. The band restated the header's
   own routes on every page; the header and the bottom bar already carry
   them, so the rules that drew it are gone rather than left behind. */

body .topbar .brandmark {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 800; letter-spacing: -0.02em; color: var(--ink); text-decoration: none;
  /* The 44px floor. The mark itself is 1.75rem (28px) and the link measured
     32px tall, which is the one control on every page that is a link to
     nowhere else -- it is the way home. A visible label may be smaller;
     the target may not. */
  min-height: 44px;
}
body .topbar .brandmark .mark {
  /* The mark is an <img> of static/img/favicon.svg now. It used to be a dark
     tile, a radius and a white house glyph all written here and in _nav.html,
     which is how the header came to show a different brand from the tab: this
     rule said #0F172A on a 6px radius with a house in it, while the favicon
     said teal with three bars. The shape belongs to the one file now, so only
     the box is set here. */
  width: 1.75rem; height: 1.75rem;
  display: block;
}
/* ---------- One type style for every item in the bar ----------
   Every item - a link, the "My Club" label, its caret, the account button
   - is the same font, the same size, the same weight and the same colour
   at rest. The active state is the only thing that changes.

   The button rule used to read `font: inherit`, which is a SHORTHAND: it
   resets font-size and font-weight to the inherited values, so the one
   dropdown trigger in the bar computed to 18px/400 while every link
   beside it computed to 16.875px/600 (measured, 2026-10-21). The trigger
   was the odd one out in the row it sat in. `font-family: inherit` is
   what the rule actually needed: the UA's button font, not the UA's
   button size. */
body .topbar .toplink {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 0.8rem; border-radius: var(--radius-6);
  font-size: 0.9375rem; font-weight: 600; line-height: 1.25;
  color: var(--slate); text-decoration: none; white-space: nowrap;
  /* The 44px tap-target floor, at EVERY width. The phone breakpoint
     below already set it there, and the desktop had none: measured at
     1280px, "Events", "Clubs", "Media" and "Contact" were 39px tall --
     five pixels under the floor the design system asks for "everywhere,
     including a chip that looks small". The bar is 65px tall, so the
     items can be 44px inside it and the bar does not move. */
  min-height: 2.75rem;
}
body .topbar button.toplink {
  background: none; border: none; cursor: pointer;
  font-family: inherit;
}
body .topbar .toplink:hover { background: #F0FDFA; color: var(--ink); }
body .topbar .toplink.is-active { background: var(--brand-soft); color: var(--brand-deep); }

/* The club selector: a link and a caret that are ONE item, side by side.
   The caret is a sibling of the label rather than a child of it, because
   a button inside a link is not valid and the two do different things -
   the label opens the club's page, the caret opens the picker.

   The arrow is a flex item of a flex row, so it sits ON the label's line
   instead of under it. It used to be an inline <svg> inside a
   non-flex button, and custom.css's unlayered `svg { display: block }`
   (which outranks Tailwind's layered `.inline-block` utility whatever its
   specificity) forced it onto a second line: the item measured 58.5px
   tall against its neighbours' 43px, and the bar read double-spaced. */
body .topbar .nav-split { position: relative; display: inline-flex; align-items: stretch; }
body .topbar .nav-split .toplink { border-top-right-radius: 0; border-bottom-right-radius: 0; }
/* The caret is a MARK, not a control: it sits inside the label's button
   and says "there is a list here". It used to be a second button beside
   the label -- two targets for one decision, and on a phone the second
   one was the easier to miss. */
body .topbar .nav-caret {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.125rem; margin-left: 0.125rem;
  color: inherit;
}
body .topbar .nav-caret svg { display: block; width: 0.875rem; height: 0.875rem; }
body .topbar .nav-split.is-open .toplink { background: var(--brand-soft); color: var(--brand-deep); }
/* The label that opens a list looks like a link, not a button: same type,
   same colour, and the caret is the only thing that differs from the
   plain link it becomes when there is one club. */
body .topbar .nav-split-btn {
  display: inline-flex; align-items: center; gap: 0.25rem;
  border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 0.9375rem; font-weight: 600;
  color: var(--slate); text-decoration: none;
}
body .topbar .nav-split-btn:hover { color: var(--ink); }

/* The account button: the same type as the nav items, so the bar is one
   row of one style. The avatar tile is a class now, not an inline style,
   so it takes --brand-deep like everything else. */
body .topbar .nav-account { position: relative; display: inline-flex; align-items: center; gap: 0.25rem; }
/* The button and its menu, and nothing else, so that "right: 0" on the
   menu is the BUTTON's right edge. A wrapper that also held the phone's
   menu button put the menu 47px past the button it belongs to. */
body .topbar .nav-account-menu { position: relative; display: inline-flex; align-items: center; }
/* The header's "Submit event" button was here, and the owner removed it
   ("remove this form nav bar"). Filing an event now starts from the club
   page, so the top bar has no primary action and no .nav-cta rules at all:
   a filled teal button in a row of navigation was the loudest control on
   every page, including the pages that have nothing to do with events. */

body .topbar .nav-account-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.5rem; border: none; border-radius: var(--radius-6);
  background: none; cursor: pointer; color: var(--slate);
  font-family: inherit; font-size: 0.9375rem; font-weight: 600; line-height: 1.25;
  /* The 44px floor, like every other control in the bar. It measured
     39px. */
  min-height: 44px;
}
body .topbar .nav-account-btn:hover { background: #F0FDFA; color: var(--ink); }
/* No .nav-avatar rule: there is no avatar. The owner's instruction was no
   profile pictures anywhere, and the account chip is a name and a caret. */
body .topbar .nav-account-btn .nav-caret-icon { display: block; width: 1rem; height: 1rem; color: var(--muted); }

/* The phone's menu button. It is the only way into the drawer, so it
   carries the 44px tap target the design system asks for. */
body .topbar .nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; margin-left: 0.25rem;
  border: none; border-radius: var(--radius-6); background: none;
  color: var(--slate); cursor: pointer;
}
body .topbar .nav-toggle:hover { background: #F0FDFA; color: var(--ink); }
body .topbar .nav-toggle svg { display: block; width: 1.25rem; height: 1.25rem; }
@media (max-width: 767.5px) {
  body .topbar .nav-toggle { display: inline-flex; }
}

/* ---------- The header is above the page, and a modal is above the header ----------
   The phone's nav drawer and the account menu both hang OUT of the
   header, over the page. ambient.css puts `body > div.nav-scope` and
   `body > div.page-wrap` at the same z-index (1), and it is loaded AFTER
   this file, so the page -- which comes later in the document -- painted
   over both: measured, a hit test at the centre of the account menu
   returned a page image, not the menu.

   The `!important` is not decoration: it is the only way this beats the
   later sheet, which wins on source order at the same specificity. */
body > div.nav-scope { z-index: 2 !important; }

/* A modal is a full-screen overlay, and the header is the one thing
   that must NOT float above a dimmed page. The modal lives inside
   .page-wrap, whose z-index is what traps it below the header, so the
   shell is raised for as long as a modal is up. Measured with the
   details modal open: a hit test at the top bar's centre returned the
   modal panel, and it must keep doing so. */
body > div.page-wrap:has(#details-modal:not(.hidden)),
body > div.page-wrap:has(#poster-modal:not(.hidden)) { z-index: 3; }

/* ---------- Floating chrome needs clearance: sticky offset + footer/tabbar gaps ---------- */
body .nav-scope + .page-wrap { padding-top: 0.75rem; }
/* ---------- Bottom tab bar: floating glass pill matching the header ---------- */
body .tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border: none;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 -8px 24px -18px rgba(15, 23, 42, 0.3);
}
body .tabbar-inner {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  max-width: 34rem; margin-inline: auto;
  padding: 0.375rem 0.5rem calc(0.375rem + env(safe-area-inset-bottom, 0));
}
body .tab {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  padding: 0.5rem 0.25rem; border-radius: 6px;
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
  text-decoration: none; min-height: 3.5rem; justify-content: center;
  transition: color 0.1s ease, background-color 0.1s ease;
}
body .tab svg { width: 1.4rem; height: 1.4rem; }
body .tab:hover { color: var(--ink); background: #F1F5F9; }
body .tab:active { background: #E2E8F0; }
body .tab.is-active { color: var(--brand-deep); }
body .tab.is-active .tab-pill { background: var(--brand-soft); }
body .tab .tab-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.2rem 0.9rem; border-radius: 9999px;
}
body .tab .tab-dot {
  width: 0.3rem; height: 0.3rem; border-radius: 9999px;
  background: var(--brand); margin-top: 0.1rem; opacity: 0;
}
body .tab.is-active .tab-dot { opacity: 1; }
/* Content clearance so the edge-docked tabbar never covers CTAs/toasts */
body.has-tabbar { padding-bottom: 6.5rem; }
/* WCAG 2.2 2.4.11 Focus Not Obscured (Minimum), the bottom half.
   The padding-bottom above reserves room at the END of the document, which is
   what stops the last control being unreachable. It does nothing for a
   control in the middle of the page: the bar is position:fixed, so when the
   browser scrolls a newly focused element into view it parks that element at
   the very bottom of the viewport -- exactly under an 85px bar. Measured at
   390x844: the bar's top edge is at y=759 and the scroller had no
   scroll-padding at all (getComputedStyle(document.documentElement)
   .scrollPaddingBottom === "auto").

   scroll-padding on the scrolling element is the browser-native way to say
   "when you bring something into view, leave this much room". Chrome honours
   it for sequential focus navigation, not just scrollIntoView, which is the
   case that matters here. Below 768px only: at 768px and up the bar is
   display:none, so reserving 6.5rem would just make every scroll stop short. */
@media (max-width: 767.5px) {
  html { scroll-padding-bottom: 6.5rem; }
}

/* ---------- A modal overlay must own the whole viewport ----------
   The tab bar and the event modals were both z-index 50, and the tab bar came
   later in the document, so it painted ON TOP of the dialog. Measured at
   390x844: 85px of the poster lightbox and 53px of the details modal sat
   behind the bar, and the "Join event" CTA lost 19px of its 44px height.
   Worse, the bar stayed interactive -- tapping "Events" with a dialog open
   navigated away and stranded it.

   Raising the overlay's own z-index is NOT enough, and this records why so
   nobody tries it again: the modal is nested inside .page-wrap, which is
   position:relative with z-index:1, so it forms a stacking context. A
   z-index of 60 on the modal is resolved *within* that context and still
   loses to the tab bar's root-level 50. Verified by hit-testing the tab bar's
   own centre with the dialog open -- it still returned the tab, not the
   overlay.

   So the bar is hidden instead. That removes the overlap, removes the stray
   taps, and drops a backdrop-filter compositor layer while a dialog is open.
   :has() is safe to rely on: Chrome 105+, Safari 15.4+, Firefox 121+.
   Unlayered, so it beats the layered md:hidden that hides the bar at 768px+.

   #club-poster-lightbox was in this list and is not any more: the club
   page's poster lightbox was removed with the poster it belonged to (clubs
   do not have posters). The two that remain are the shared event dialogs,
   which every page that renders an event card includes. */
body:has(#details-modal:not(.hidden)) .tabbar,
body:has(#poster-modal:not(.hidden)) .tabbar { display: none; }

/* The overlays must reach BOTH viewport edges. They are children of a
   .space-y-8 container, and computed margin-top came back as 32px -- the
   measured result was a dialog covering y=32..812 in an 844px viewport, so the
   top and bottom 32px strips of "backdrop" were actually live page. A tap
   meant to dismiss the dialog hit a nav link instead. No rule in any
   same-origin sheet matched margin-top on these elements, so rather than keep
   chasing which one wins, this is an explicit reset: light.css is the last
   stylesheet base.html loads, and it is unlayered. */
body #details-modal,
body #poster-modal { margin: 0; }
@media (min-width: 768px) {
  body .tabbar { display: none; }
  body.has-tabbar { padding-bottom: 0; }
}

/* ---------- Responsive tiers: tablet + desktop ---------- */
body .page-shell { padding: 1.25rem 1rem 6rem; }
@media (min-width: 768px) {
  body .page-shell { padding: 2.5rem 2rem; }
  /* Tablet: two-up grids, roomier cards */
  body .club-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body .stat-band { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  /* Desktop: three-up content, centered rail, sidebar inline */
  body .club-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body .stat-band { grid-template-columns: repeat(4, 1fr); }
  body .page-shell { max-width: 76rem; }
}

/* ---------- Masthead band: PAPER, not ink ----------
   This block used to say the band was "the ONE piece of ink on the page --
   and the anchor the page was missing": #0F172A, white type, a grid-line
   texture, tiles lifted out of the dark. It was written when the rest of
   the site was a dark dashboard. The site is a paper interface now, and the
   owner's report was that this band did not match it -- a black marketing
   strip over a school's white board is a different application's landing
   page. The band is a card like every other card: --card surface, --line
   hairline, --ink type, one --brand rule along the top.

   The band's own geometry (padding, the two-column split, the phone tier)
   lives in templates/events/homepage.html, because it is this page's
   layout and not part of the site's figure/ground. Nothing here may
   out-specify it: a `body .hero-band` rule is (0,1,1) and would silently
   beat the page's (0,1,0) breakpoints, which is exactly what happened to
   the padding before. */

/* ---------- Toasts above the tab bar ---------- */
body [aria-live="polite"] { bottom: 6.5rem !important; }
@media (min-width: 768px) {
  body [aria-live="polite"] { bottom: 1rem !important; }
}

/* ---------- Toasts above the event dialogs ----------
   The copy-link toast was invisible. #toast-container was z-50, the same as
   #details-modal and #poster-modal, and the modals come LATER in the
   document, so the dialog's dark backdrop painted over the one moment the
   reader is told something worked.

   80 sits above the modals' 50. The comparison happens inside .page-wrap,
   which ambient.css gives `position: relative; z-index: 1` and which is
   therefore a stacking context: the toast and both modals are inside it,
   so their z-indexes are compared with each other and 80 > 50 wins.

   The OTHER toast layer -- templates/_toasts.html, the Django messages --
   is a direct child of <body> with an inline z-index of 60, so it is
   already in the root stacking context and already paints above the whole
   of .page-wrap. It needs nothing.

   Measured with the details dialog open at 390px: the container computes
   z-index 80 against the modals' 50, and a hit test at the toast's own
   centre returns the toast -- it is on top, and it is clickable. */
body #toast-container { z-index: 80; pointer-events: auto; }

/* ---------- Header dropdowns: the club picker + shared enter/leave motion ---------- */
body .club-menu {
  position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 70;
  min-width: 14rem; max-width: 20rem; max-height: 22rem; overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  box-shadow: 0 24px 48px -20px rgba(15, 23, 42, 0.35);
  padding: 0.375rem;
}
/* The phone drawer. The menu is IN the flow there, not floating over it:
   a floating panel anchored to a row that sits under a sticky header is
   how the picker ended up half off the screen, and it has nothing to
   align to in a vertical list. */
@media (max-width: 767.5px) {
  body .topbar .club-menu {
    position: static; min-width: 0; max-width: none; max-height: none;
    margin: 0.125rem 0 0.25rem; padding: 0.25rem;
    overflow: visible;
    background: var(--card); border: 1px solid var(--line);
    box-shadow: none; border-radius: var(--radius-8);
  }
}
body .club-menu-label {
  margin: 0; padding: 0.375rem 0.625rem 0.25rem;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
body .club-menu-link {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.5rem 0.625rem; border-radius: 8px;
  font-size: 0.875rem; font-weight: 500; color: var(--ink); text-decoration: none;
}
body .club-menu-link:hover { background: #F0FDFA; text-decoration: none; }
/* The club the page is showing. It is marked with a word AND a shape, not
   with colour alone, so the answer survives a greyscale print. */
body .club-menu-link.is-current { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
body .club-menu-link.is-current .club-menu-name::after {
  content: " \2713"; color: var(--brand-deep); font-weight: 700;
}
body .club-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body .club-menu-role {
  flex-shrink: 0; font-size: 0.75rem; font-weight: 600;
  background: var(--teal-soft); border: 1px solid #99F6E4; color: #0F766E;
  border-radius: 6px; padding: 0.125rem 0.5rem;
}
body .club-menu-empty { font-size: 0.8125rem; color: var(--muted); padding: 0.5rem 0.625rem; margin: 0; }
/* The last row of the picker is a way OUT of it, so it is separated from
   the club list by a hairline rather than sitting among the clubs. */
body .club-menu-sep { height: 1px; margin: 0.375rem 0.25rem; background: var(--line); }
body .admin-link { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Account dropdown. It used to be a direct child of <body> with
   `position: fixed; right: 0; top: 76px`, so it was glued to the RIGHT
   EDGE OF THE SCREEN instead of to the button that opens it: measured on
   a 1905px viewport it sat at x=1689 while its own trigger was at
   x=1448-1599, i.e. 305px away from the thing it belongs to, hanging off
   the end of the bar. It is now inside the account wrapper and anchored
   to it: `right: 0` on an absolutely positioned box whose containing
   block is the trigger's own wrapper, so the menu's right edge IS the
   trigger's right edge and it cannot leave the viewport. */
body .topbar .account-dropdown {
  position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 70;
  min-width: 14rem; max-width: 20rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-8);
  box-shadow: 0 24px 48px -20px rgba(15, 23, 42, 0.35);
  padding: 0.25rem;
}
body .topbar .account-dropdown-link {
  display: block; width: 100%; text-align: left;
  padding: 0.5rem 0.75rem; border: none; border-radius: var(--radius-6);
  background: none; cursor: pointer; text-decoration: none;
  font-family: inherit; font-size: 0.9375rem; font-weight: 500;
  color: var(--ink);
}
body .topbar .account-dropdown-link:hover { background: #F0FDFA; color: var(--ink); text-decoration: none; }
body .menu-enter { transition: opacity 0.15s ease-out, transform 0.15s ease-out; }
body .menu-enter-start { opacity: 0; transform: translateY(-0.5rem); }
body .menu-enter-end { opacity: 1; transform: translateY(0); }
body .menu-leave { transition: opacity 0.1s ease-in, transform 0.1s ease-in; }
body .menu-leave-start { opacity: 1; transform: translateY(0); }
body .menu-leave-end { opacity: 0; transform: translateY(-0.5rem); }

@media print {
  body .tabbar, body .topbar { display: none !important; }
}

/* ---------- A column that is not worth a phone's width ----------
   The ECM tables are ops tables: nine columns of audit log, six of
   accounts, eight of the member directory. On a 390px phone none of them
   fits, so the table used to scroll sideways inside its card, and the
   columns that mattered were off-screen with nothing saying so.

   So the low-value columns go at phone width and the table fits: the role
   of a person, the category of an action, the phone number, the last-seen
   date. What is left is the fact. The full set is still there on a desktop
   and in the data.

   `!important` because the tables' own rules set `display: table-cell` on
   the cells, and a cell's own rule beats a class on the same element. */
@media (max-width: 639px) {
  .hide-sm { display: none !important; }
}

/* ---------- WCAG AA pass: the four palette steps that failed on small text
   ----------
   Every one of these was measured with getComputedStyle + a canvas
   resolve of the composited background, not read off a stylesheet.
   Four colours, all of them 11-14px text that needs 4.5:1:

     #B45309 amber-600   2.81-3.19:1   -> #B45309 amber-700 (4.52-5.02)
     #0D9488 teal-600    3.45-3.74:1   -> #0F766E teal-700  (4.82-5.47)
     #94A3B8 slate-400   2.17-2.86:1   -> var(--muted)       (4.95-5.74)
     #64748B slate-500   4.34-4.45:1   -> var(--muted)       (5.24-5.74)

   Two steps go further than amber-700, because these two sit on a
   wash of their own hue and the wash eats the margin:
     .kpi-delta.amber  #B45309 -> 6.25:1 on its rgba(180,83,9,.12) fill
     td.cell.busy      #B45309 -> 6.16:1 on its rgba(180,83,9,.13) fill
   (amber-700 measures 4.42 and 4.37 there -- under 4.5, which is why
   they are not simply "the amber-700 rule" like the rest.)

   Specificity, which is the whole reason this block exists here
   instead of in each page: every template carries its own <style>
   block, base.html renders {% block extra_head %} AFTER the
   stylesheet <link>s, so a page rule of equal specificity always
   wins on source order and a stylesheet edit cannot reach it. The
   page rules are all (0,1,0) -- `.eyebrow`, `.clubs-kicker`,
   `.tt-eyebrow`, `.field-optional`, ... -- so prefixing with `body`
   here is (0,1,1) and beats them regardless of order. The three
   compound selectors below need one extra class or element for the
   same reason: the page writes `.cover-banner .eyebrow` (0,2,0),
   `.table-rich thead th.break-col` (0,2,3) and
   `.d-table thead th` (0,1,3).

   `.d-green` and `.d-red` are the audit log's status-code figures.
   `.d-green` was #15803D on white = 1.74:1, i.e. invisible; #15803D
   is this theme's existing success step (5.02:1 on white, 4.58:1 on
   a #F1F5F9 panel) and .d-red moves off #B91C1C, which was 4.41:1 on
   that same panel, to the #B91C1C this theme already uses for
   .btn-danger and .chip-red.
   ------------------------------------------------------------ */

/* The SECTION EYEBROW role: one teal, everywhere.
   The role is "a small uppercase label that names the section you are in".
   It was split down the middle -- amber on one page, teal on the next --
   and the amber half sat at #B45309 on the club page, which measures
   3.11:1 at 12px: below AA, and below the 3:1 floor for the label's own
   glyph shapes. A role that paints itself two colours is a role that
   cannot be checked, so the family now resolves to ONE colour: the
   site's accent, --brand-deep (#0F766E), which measures 5.47:1 on white
   and 5.25:1 on --paper.

   Amber keeps its own job on this site -- caution and attention (the
   warning notices, the KPI deltas, the legend dots) -- and a label is
   not a caution. */
body .eyebrow,
body .cover-banner .eyebrow,
body .section-title,
body .tt-eyebrow { color: var(--brand-deep); }

/* teal-600 -> teal-700. These were already the accent; they are now the
   same token as the family above, so one edit moves all of them. */
body .clubs-kicker,
body .media-kicker,
body .login-kicker,
body .reg-eyebrow,
body .aside-title,
body .block-palette-title,
body .err-eyebrow,
body .d-teal { color: var(--brand-deep); }

/* The table header is its own role, not an eyebrow: the base header is
   --muted and the break column keeps the amber that marks it. */
body .table-rich thead th.break-col { color: #B45309; }
body .kpi-delta.amber { color: #B45309; }

/* slate-400 and slate-500 -> --muted. .q-num is the one exception:
   on the form-builder it was slate-400, on the respond form it is a
   teal badge on a teal wash, and teal-700 clears both (5.00:1 on the
   #F1F5F9 panel, 4.63:1 on the rgba(13,148,136,.12) fill). */
/* .reg-sub a is (0,1,1) in the page and out-specifies `body a`, which is
   only (0,0,2) -- so the teal-600 it declares is what actually renders,
   3.74:1. Needs the same extra class. */
body .reg-sub a { color: #0F766E; }

body .pres-label,
body .seat-open,
body .resp-foot,
body .field-optional,
body .tt-foot,
body .team-class,
body .finder-count { color: var(--muted); }
body .q-num { color: #0F766E; }

/* kpi-delta's teal sibling. The amber one is above because it needs
   amber-800 on its own wash; the teal one clears at teal-700. */
body .kpi-delta.teal { color: #0F766E; }

/* Page-local accent pills, avatars and headings. Every rule here belongs to
   a template this stylesheet does not own, and every one of them is the same
   defect: teal-600 or amber-600 sitting on a 10-14% wash of its own hue, or
   white type on a teal-600 button. Measured before, at 1280px:
     .role-chip.staff       #0D9488 on #E6F7F4   3.45:1
     .role-chip.president   #B45309 on #FEF3E2   2.63:1
     .team-avatar           #0D9488 on #E6F7F4   3.45:1
     .edit-avatar           #0D9488 on #E6F7F4   3.37:1
     .apply-btn             #FFFFFF on #0D9488   3.74:1
     .club-poster-eyebrow   #818CF8 on #FAFAFD   2.86:1
     .club-poster-zoom      #94A3B8 on #FAFAFD   2.46:1
     .q-remove              #B91C1C on #F1F5F9   4.41:1
     .notice-info .accent   #B45309 on #F1F5F9   2.91:1
     .panel h2              #B45309 on #FFFFFF   3.19:1
   The two `.panel-*-sex h2` rules are restated at the same weight only so
   the boys/girls blue and pink survive the `.panel h2` rule above them --
   without that they would both flatten to the family's teal. */
/* teal-700 CLEARS on the wash-over-white the measurement above used (#E6F7F4,
   4.64:1) but NOT on the surface the chip actually lands on: .role-chip is
   inside profile.html's .aside-card, whose own #F1F5F9 is under the teal wash,
   so the rendered pill is rgb(209,231,233) and #0F766E measures 4.25:1 there --
   re-measured live at 390px and 1280px. It takes the darker brand teal, the one
   .apply-btn:hover and profile.html's own avatar gradient already use: 5.89:1. */
body .role-chip.staff { color: var(--brand-ink); }
/* amber-700 is only 4.15:1 on this pill's own amber-14% fill, so it takes
   the same deeper step .kpi-delta.amber does. */
body .role-chip.president { color: #B45309; }
body .team-avatar,
body .edit-avatar,
body .d-avatar-sm { color: #0F766E; }
body .apply-btn { background: #0F766E; }
body .apply-btn:hover { background: #115E59; }
body .club-poster-eyebrow { color: var(--brand-deep); }
body .club-poster-zoom { color: var(--muted); }
body .q-remove { color: #B91C1C; }
body .notice-info .accent { color: #B45309; }
body .panel h2 { color: var(--brand-deep); }
body .panel-boys h2 { color: #1E40AF; }
body .panel-girls h2 { color: #9D174D; }
/* The two side-coloured initial tiles, blue-600 and pink-600 on a 12% wash
   of themselves: 4.32:1 and 3.97:1. One step down each. */
body .avatar-boys, body .pres-boys { color: #1E40AF; }
body .avatar-girls, body .pres-girls { color: #9D174D; }
/* The "← All Clubs" / "← Back to ..." links. club_detail.html, club_edit.html
   and club_list.html each ship their own `.text-teal-300 { #0D9488 }`, which
   is (0,1,0) and so out-specifies light.css's `body a` (0,0,2) -- 3.59:1. */
body .text-teal-300 { color: #0F766E; }
body .text-teal-400 { color: #0F766E; }
body .d-link { color: var(--brand-deep); }

/* audit log status-code figures */
body .d-green { color: #15803D; }
body .d-red { color: #B91C1C; }

/* The dark theme's orange steps. custom.css §17.2/§17.3 declare .d-eyebrow
   and .d-orange as #B45309 and .d-amber as #B45309 -- 2.17:1 and 1.67:1 on
   paper. .d-eyebrow is a live 12px eyebrow on /ecm/dashboard/ and
   /ecm/audit/, and an eyebrow is a SECTION LABEL, so it now takes the
   family's teal (--brand-deep) like every other eyebrow on the site; the
   other two are caution colours and stay amber, and they are remapped so
   they cannot fail the moment they are used on their own. */
body .d-eyebrow { color: var(--brand-deep); }
body .d-orange { color: #B45309; }
body .d-amber { color: #B45309; }

/* Table headers. Six templates -- incident_list, head_incidents, contacts,
   common_room_list, dashboard, audit_log -- each declare their own
   `thead th` colour at (0,1,3), and three of them put #64748B on their own
   #F1F5F9 header fill, which measures 4.34:1. One (0,1,4) rule here covers
   every one of them. */
body .table-rich thead th,
body .d-table thead th { color: var(--muted); }

/* Timetable cells. The FREE/BUSY labels are 13px on a 14%/13% wash
   of their own hue, which is the worst surface on the site: 2.76:1
   for Busy and 3.16:1 for FREE as shipped. The break column is a
   third amber tint and needs its own step for the same reason. */
body .table-rich tbody td.cell.free .cell-label,
body .table-rich tbody td.bg-green-100 .cell-label { color: #0F766E; }
body .table-rich tbody td.cell.busy .cell-label,
body .table-rich tbody td.bg-stone-100 .cell-label { color: #B45309; }
body .table-rich tbody td.break-cell { color: #B45309; }
/* 11px day heading, #64748B on #F1F5F9 = 4.34:1 */
body .week-day-name { color: var(--muted); }

/* The "Required" pill in the form builder paints a 12%-teal fill and
   a teal-600 label: 3.07:1. Teal-700 is 4.49:1 on that exact fill --
   still a hair under. #115E59, already this theme's deep step from
   the .d-btn hover and the .topbar link, is 6.22:1. */
body .required-toggle:has(input:checked) { color: #115E59; }

/* ---------- WCAG 2.2 SC 2.5.8 Target Size (Minimum) ----------
   Both dialogs in _event_modal.html are closable only by their own
   close button (plus Escape), so neither can be an exception. The
   two close buttons measured 36x36 and 40x40; the lightbox footer's
   two buttons measured 98.6x21 and 52.6x21 -- the 21px height is a
   straight failure of 2.5.8. All four are raised here because
   _event_modal.html is not this file; min-width/min-height only, so
   nothing else in those dialogs moves. */
#details-modal [aria-label="Close event details"],
#poster-modal [aria-label="Close poster"] {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#details-modal [aria-label="Share link"] {
  min-width: 44px;
  min-height: 44px;
}
#poster-modal button[onclick="downloadPoster()"],
#poster-modal button[onclick="window.print()"] {
  min-height: 24px;
  min-width: 24px;
}

/* ---------- The ECM club-event <summary> crushed its own name ----
   .d-ev summary is a single flex line holding three nowrap items --
   the name, a status pill and the date. At 320px the line is 196px
   and .d-ev-name (flex:1 1 auto, min-width:0) absorbed all of the
   shortfall: 40.1px shown against a 196px scrollWidth, and the
   "Approved" pill next to it lost 45px of its own. Wrapping gives the
   name the full line and drops pill + date onto a second one.
   Verified inert at 820px and above, where all three already fit. */
body .d-ev summary { flex-wrap: wrap; }

/* ---------- Themed scrollbar: soft-teal thumb on paper ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #FAFAFD !important; }
::-webkit-scrollbar-thumb {
  background: #0F766E !important;
  border-radius: 9999px;
  border: 2px solid #FAFAFD !important;
}
::-webkit-scrollbar-thumb:hover { background: #0D9488 !important; }
* {
  scrollbar-width: thin !important;
  scrollbar-color: #0D9488 #FAFAFD !important;
}

/* ---------- Smooth page switching ----------
   Cross-document view transitions (Chromium 126+, Safari 18+). Browsers
   without them navigate exactly as before -- the old page is replaced in one
   paint -- so this is an enhancement, never a dependency.

   The old page is HELD, not faded out.

   Before: both snapshots ran 280ms from the same start -- old from opacity 1
   to 0, new from 0 to 1, each also drifting 6-10px. At the halfway point that
   composites two half-transparent layers over the canvas, so every navigation
   passed through a near-blank frame: the page visibly washed out to paper for
   ~140ms and read as "the screen goes white". A dissolve between two things
   that are both disappearing has no frame that is fully opaque.

   After: the outgoing snapshot keeps opacity 1 for the whole transition and
   the incoming one crossfades in on top of it. Every intermediate frame is a
   blend of two opaque pages, so there is no blank state to see, at any
   duration. The translate/scale is gone with it: moving the entire viewport
   during a navigation reads as a lurch, and a scaled snapshot resamples the
   text. What is left is a plain 200ms dissolve, which is short enough to feel
   like the click was instant and long enough not to snap.

   200ms is --vt-duration (html scope, see the note at the top of this file for
   why it is not one of the --motion-* tokens).

   The easing is written out for the same reason, and it is not a detail: the
   first version of this rule read `var(--vt-duration) var(--ease-out-expo)`,
   and --ease-out-expo is declared on `body`. One unresolvable var() in an
   animation shorthand makes the whole declaration invalid at computed-value
   time, so it was dropped and the animation-name fell back to none -- the
   fade silently did not exist, while the UA group animation ran anyway and
   made the transition look like it was working. Verified with
   document.getAnimations({ subtree: true }) during a real navigation, which
   listed `-ua-view-transition-group-anim-root` and no ecm-vt-fade-in. */
@view-transition {
  navigation: auto;
}

/* The overlay's own backdrop. Every ::view-transition-* pseudo-element is a
   child of the document root, and this one sits UNDER both snapshots. It is
   never normally visible -- the outgoing snapshot is opaque for the whole
   transition -- but it is the last line between a missed frame and a white
   one: if a snapshot is missing (a very tall page, a browser that drops a
   texture, a tab woken from the background mid-dissolve) the reader sees
   paper, not the UA's white canvas. It is the same value as the inline rule
   in base.html's <head>, for the same reason. */
::view-transition {
  background-color: #EDF0F6;
}

::view-transition-old(root) {
  animation: none;
  opacity: 1;
}
::view-transition-new(root) {
  animation: ecm-vt-fade-in var(--vt-duration) cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes ecm-vt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* ---------- One entrance per navigation ----------
   Two classes turn the entrance animations off for a page change, because a
   page that is arriving should be complete when it arrives -- the staggered
   entrance belongs to a cold load, and on a navigation it is the thing that
   makes the new page look blank for a moment.

   .is-view-transition is put on <html> by base.html's pagereveal handler when
   the page arrived through the dissolve. On those loads the dissolve has
   already done the fade, and .stagger's children sit at opacity 0 for up to
   660ms, so the new-side snapshot would be captured with half the page still
   invisible and the rest would animate in underneath a transition that had
   already finished.

   .is-app-nav is the same thing for browsers with no cross-document view
   transition at all: base.html marks a same-origin link click in
   sessionStorage, and the next document reads it in the head, before the
   first paint. Without it, Safari (and any browser without the API) swaps to
   a page whose contents fade in from nothing -- the blank flash the whole
   exercise is about.

   The selector is (0,2,1): more specific than the single-class entrance rules
   in custom.css (0,1,0) and than the per-page copies in
   events/homepage.html and clubs/club_{list,detail}.html. Specificity has to
   do the work here rather than order, because those <style> blocks are
   injected into the body, after this file.

   A cold load gets neither class, so the staggered entrance is intact. */
html.is-view-transition .anim-fade-up,
html.is-view-transition .anim-fade-in,
html.is-view-transition .anim-pop,
html.is-view-transition .stagger > *,
html.is-app-nav .anim-fade-up,
html.is-app-nav .anim-fade-in,
html.is-app-nav .anim-pop,
html.is-app-nav .stagger > * {
  animation: none;
}

/* ============================================================
   ECM admin path — measured refinements, 2026-10-16
   Every value below carries the number that earned it. Measured in the
   live browser at 390x844 and 1440x900 against the light theme.
   ============================================================ */

/* ---------- 1. The dashboard KPI band was the last dark surface ----------
   `.dash-card` is the only element in the `.dash-*` family that hardcodes a
   dark fill instead of reading --ecm-*, so it never followed the family into
   the light theme: linear-gradient(rgba(23,29,37,.9), rgba(17,22,29,.95))
   over paper renders about rgb(46,52,60). Its text DOES read --ecm-*, which
   this file remaps for a light surface, so the two crossed:
     .dash-label / .dash-hint  #5B6779 on rgb(46,52,60)   2.22:1  (11-12px)
     .dash-num (teal .dash--good)  #0D9488 on the same    3.34:1
   On the same page .dash-op and .dash-panel are white, and the ECM KPI
   siblings (.kpi-card, .d-kpi) are white with a teal top border, so the band
   now joins them rather than staying the one dark rectangle on a light page.
   Same radius, same shadow, same hover lift: only the fill moves. */
body .dash-card {
  background: #FFFFFF;
  border-color: var(--line);
  border-top-color: var(--brand);
}
body .dash-card:hover { border-color: #CBD5E1; }
body .dash-label { color: var(--ink); }
body .dash-hint { color: var(--muted); }
/* The one .dash-chip variant with no light step: #B45309 on its own 10% wash
   measures 2.33:1. Same pair this theme already gives .chip-orange. */
body .dash-chip--orange { background: #FEF3E2; border-color: #FCD9A8; color: #B45309; }

/* ---------- 2. Hardcoded hexes the theme never remapped ---------- */
/* #0D9488 on paper, 3.59:1 -- the one eyebrow this file never picked up.
   It is a 12px uppercase label on /ecm/contact/ and /ecm/photographers/. */
body .contact-eyebrow { color: #0F766E; }
/* .contact-lines .lbl is (0,2,0) and out-specifies `body .lbl` above, so its
   #94A3B8 survived: 2.56:1 on white. */
body .contact-lines .lbl { color: var(--muted); }
/* The "Back to ..." links on the four ECM create pages (incident_issue,
   contact_create, common_room_create, staff_create), each an island rule
   @{color:#B45309}: 3.19:1 on white. Navigation, so it takes the same
   brand-deep the other ECM links use, 5.36:1. */
body .form-back a { color: var(--brand-deep); }
body .form-back a:hover { color: var(--brand); }
/* /ecm/accounts/ eyebrow #B45309 at 11px: 3.06:1. Now the family's
   teal, like every other section eyebrow. */
body .acc-eyebrow { color: var(--brand-deep); }
/* ...and its role pill: #B45309 on the amber 14% wash is 4.32:1, so it takes
   the same deeper step .role-chip.president does above. */
body .acc-role.staff { color: #B45309; }

/* ---------- 3. Phone: the row's verb stays in view ----------
   incident_list, common_room_list and contacts carry their primary action in
   the last column of a 640-720px-wide table inside a 292px scroll box, so on
   a phone the verb sat 348-799px off-screen with no affordance: measured
   /ecm/incidents/ "Acknowledge" fully outside the viewport, /ecm/contacts/
   "Deactivate" the same. The action column (always `th.num` / `td.num`) is
   pinned to the right edge of the scroll box, which is the fix the surface's
   own review asked for and needs no markup change. Backgrounds are restated
   because a sticky cell has to be opaque over the rows sliding under it. */
@media (max-width: 900px) {
  body .table-scroll table > thead > tr > th.num:last-child,
  body .table-scroll table > tbody > tr > td.num:last-child {
    position: sticky;
    right: 0;
    background-color: #FFFFFF;
    /* The first attempt used -6px 0 8px -8px: the negative spread cancels
       the blur, so the shadow came out invisible and the clipped cell under
       it read as a rendering bug. A crisp hairline (0 blur, 0 spread) plus a
       soft fade, both drawn as shadows so the collapsed-border table keeps
       its geometry. */
    box-shadow:
      -1px 0 0 0 var(--line),
      -10px 0 14px -10px rgba(15, 23, 42, 0.28);
  }
  body .table-scroll table > thead > tr > th.num:last-child { background-color: #F8FAFC; }
  body .table-scroll table > tbody > tr:nth-child(even) > td.num:last-child { background-color: #F8FAFC; }
  body .table-scroll table > tbody > tr:hover > td.num:last-child { background-color: #F0FDFA; }
  /* The pinned verb measured 26px tall (26x77), below the 44px this project
     sets for itself in docs/design-system.md. Only inside the pinned cell:
     the same class sits in toolbars elsewhere and is not yet a 44px control. */
  body .table-scroll table > tbody > tr > td.num:last-child .action-link {
    min-height: 34px;
    padding: 0.375rem 0.5rem;
  }
}

/* ============================================================
   4. The last teal-600 / amber-600 text steps, measured 2026-10-16
   A second sweep covered the templates that never rendered during the
   first pass -- the form builder, the respond form, the invite-join
   page, the head-staff page and the maths branch of register.html --
   probing each rule against the surface it actually lands on. Every
   value below is a page rule of (0,1,0) or lower; `body` gives this
   file (0,1,1), so it wins on specificity rather than source order
   and survives {% block extra_head %} rendering after the <link>s.
     .join-eyebrow                #0D9488 on paper               3.59:1
     .btn-next (its own label)    #FFFFFF on #0D9488             3.74:1
     .respond-eyebrow             #0D9488 on #F1F5F9             3.42:1
     .q-tag                       #0D9488 on #F1F5F9             3.42:1
     .q-num / .q-type-icon        #0D9488 on the 12% teal wash   3.23:1
     .block-ico                   #0D9488 on the 12% teal wash   3.09:1
     .block-btn:hover             #0D9488 on the 8% teal wash    3.35:1
     .q-move button:hover         #0D9488 on #F0FDFA             3.59:1
     maths field-label strong     #0D9488 on #F1F5F9             3.42:1
     .math-chip:has(:checked) .chip-text
                                  #0D9488 on its own 8% wash     3.28:1
     .notice-existing             #B45309 on its own 10% wash    2.84:1
     .q-label .req                #B91C1C on #F1F5F9             4.41:1
   Teal-700 clears all of those at 4.52-5.25:1 and is the same step
   this file already gives .q-num, .kpi-delta.teal and .chip-teal. It
   is the tightest of the fits at 4.52:1 (the 12% wash over #F1F5F9),
   so these three stay on teal-700 rather than stepping further down. */
body .join-eyebrow,
body .respond-eyebrow,
body .q-tag { color: #0F766E; }
body .q-type-icon,
body .block-ico,
body .math-sublevels .field-label strong,
body .math-chip:has(input:checked) .chip-text { color: #0F766E; }
body .block-btn:hover { color: #0F766E; }
body .q-move button:hover:not(:disabled) { color: #0F766E; }
/* .btn-next is the one case where the fill moves rather than the label:
   white 15px/600 on #0D9488 is 3.74:1, and teal-700 lifts the fill it
   sits on to 5.47:1 without touching the page's own hover split. */
body .btn-next { background: #0F766E; border-color: #0F766E; }
body .btn-next:hover { background: #115E59; }
/* Amber-700 on this notice's own 10% wash measures 4.49:1 -- under the
   line by a hundredth, so it takes the amber-800 this file already uses
   for .role-chip.president and .kpi-delta.amber. */
body .notice-existing { color: #B45309; }
/* Red-600 on a #F1F5F9 q-card is 4.41:1: the same step .q-remove takes. */
body .q-label .req { color: #B91C1C; }


/* ---------- Cheap-scroll overrides for touch / low-powered devices ----------
   Three properties account for most of this site's per-frame cost on a weak
   GPU, and none of them change how the page looks at rest:

   1. `background-attachment: fixed` re-rasterises the body's gradients on
      every scroll frame (and iOS ignores it outright in places, so the
      texture jumped). At 26px tiles the difference is invisible.
   2. A `backdrop-filter` on the sticky top bar and the fixed tab bar re-blurs
      the content behind them every frame while scrolling -- the classic
      mobile scroll-killer. They go opaque enough to read instead.
   3. Nothing here changes colours: the ink on .92 white is the same ink that
      already passes on .6 white over the page wash.

   Desktop keeps the glass and the fixed texture, where the GPU is not the
   constraint. */
@media (max-width: 768px) {
  body { background-attachment: scroll; }
  body .topbar,
  body .tabbar {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ============================================================
   5. The focus ring, the club page, the audience chip, the
      gallery tiles — one audit, one file, one set of numbers.
   ============================================================ */

/* ---------- 5.1 ONE focus ring, everywhere ----------
   What was there before, measured in the browser on the homepage:

     a plain link            2px solid #0D9488   3.64:1  (passes, barely)
     .ecm-btn                3px solid #0F766E   9.42:1  (a third teal)
     .btn                    amber halo #FCD9A8  1.22:1  FAILS
     input[type=search]      amber border #B45309 1.67:1 FAILS
                             + amber halo rgba(180,83,9,.2)  1.11:1
     .finder-input (home)    the same amber, because custom.css's
                             `body input[type="search"]:focus` is (0,2,2)
                             and out-specifies the page's own
                             `body .finder-input:focus` at (0,2,1)
     .media-edit             outline: none        no ring at all
     a.upl-tile              3px rgba(13,148,136,.45)  ~1.7:1 FAILS

   The ring is now one thing: 3px of --brand-deep (#0F766E), 2px clear of
   the control, so the ring never lands on the control's own border and
   both stay legible.

     #0F766E on #FFFFFF  5.47:1
     #0F766E on #FAFAFD  5.25:1
     #0F766E on #F8FAFC  5.19:1

   WCAG 2.2 SC 1.4.11 asks 3:1 for a focus indicator, and SC 2.4.13
   (Focus Appearance) asks 3:1 for the focused and unfocused states with
   the indicator at least 2px thick. 3px of #0F766E clears both with
   room to spare, and it is the same teal as the brand buttons, so the
   ring is not a second accent that only appears on focus.

   It is an OUTLINE, not a box-shadow: the user agent paints outlines in
   forced-colors mode and drops box-shadows entirely, so this ring
   survives Windows High Contrast.

   `!important` is load-bearing here, and deliberately so. base.html
   renders {% block extra_head %} AFTER the stylesheet <link>s, so every
   template's own <style> block is LATER in source order than this file,
   and fifteen of them write `outline: none` on a focus rule
   (homepage.html's .finder-input, event_media.html's .media-edit,
   media_upload.html's .upl-tile, accounts/login.html's .field-input,
   ecm/*.html's .dark-form inputs, ...). None of those templates belongs
   to this change, so the only way to impose one ring site-wide is a
   declaration that wins on importance rather than on order.

   `.error-box` is excluded on purpose: it is a focusable error message
   that is focused programmatically, and a red ring on it is meaningful.
   */
body :is(a, button, input, textarea, select, summary, [tabindex]):not(.error-box):focus-visible {
  outline: 3px solid var(--brand-deep) !important;
  outline-offset: 2px !important;
}

/* The controls the ring has to clear a neighbour on: the tab bar sits in a
   6px gutter and the header nav in a 8px one, so a 5px ring (2px offset +
   3px) still fits inside them rather than being clipped. These three
   rules only say so explicitly, because the ring is the site's one and
   they are the places where a clipped ring is most likely:
     - the bottom tab bar: .tab (min-height 3.5rem, inside a 6px pad)
     - the header nav:   .toplink
     - the event card:   .event-card, which is a role="button" article
   The gallery tiles (.media-tile) and the dialog's controls are buttons
   and anchors, so the rule above already reaches them. */
body .tab:focus-visible,
body .toplink:focus-visible,
body .event-card:focus-visible {
  outline: 3px solid var(--brand-deep) !important;
  outline-offset: 2px !important;
}

/* The card is a role="button" article, so it is focusable, and it
   carries `transition-all duration-200` -- which animates the outline
   longhands, so the ring faded in over 200ms instead of appearing.
   Narrowing the transition to the three properties the card actually
   animates makes the ring instant, which is what a focus indicator has
   to be. */
body .event-card:focus-visible {
  transition-property: transform, box-shadow, border-color;
}

/* ---------- 5.2 The club page's three failing bits ----------
   club_detail.html owns all three of these in its own <style> block,
   which is (0,1,0) or (0,2,0) and later in source order than this
   file. A `body`-prefixed rule is (0,1,1) / (0,2,1) and out-specifies
   them regardless of order, so the fix lives here and the template
   stays untouched.

   1. .club-identity .eyebrow -- #B45309 on #FAFAFD was 3.11:1 at 12px.
      It is a section eyebrow, so it takes the family's teal: #0F766E
      measures 5.42:1 on #FAFAFD.
   2. .avatar-sm -- #0D9488 on its own rgba(13,148,136,.12) fill
      (#E6FAF7) was 3.38:1 at 13.5px. #0F766E measures 5.30:1 there.
   3. .roster-class -- #64748B on #F1F5F9 was 4.23:1 at 14.6px.
      #475569 measures 7.30:1 there, and it is the site's own body
      grey (--slate), so the class chip stops being a lighter grey
      than the text beside it. */
body .club-identity .eyebrow { color: var(--brand-deep); }
body .avatar-sm { color: #0F766E; }
body .roster-class { color: #475569; }

/* The two eyebrows that no page rule in this file covered:
   .resp-eyebrow (events/form_responses.html) and .dir-eyebrow
   (ecm/member_directory.html) both shipped #B45309 / #B45309 and
   belong to the same family. */
body .resp-eyebrow,
body .dir-eyebrow { color: var(--brand-deep); }

/* ---------- 5.3 The gallery page's audience badge ----------
   The card, the details dialog and the event detail page all render the
   audience with .audience-chip--girls / --boys / --coed from THIS file,
   so those three agree with each other. The per-event gallery
   (/events/media/<pk>/, templates/events/event_media.html) did not: it
   renders the audience as its own `.badge badge-indigo` pair, which
   paints #1E40AF purple on rgba(30,64,175,.12). The same "Girls" was
   pink on the homepage and purple on the gallery page, and indigo is not
   a colour this palette has at all.

   The badge's GEOMETRY is already the chip's -- measured on
   /events/media/1/: the audience badge and the location badge beside it
   are both 27.9px tall, same radius, same 13px/600 type -- so only the
   colour is wrong.

   The colour cannot be made exactly right from this file. The gallery
   page is one event per page: it includes no event card, no dialog and
   no script of ours, and the audience appears exactly once, as the text
   of a span with no class of its own. Measured in the browser, the
   page's only per-side artefact is that text: no data- attribute, no
   class, no ancestor carries the side. A per-audience palette is
   therefore not expressible here in CSS -- the gallery needs the
   template to put the modifier class on the span (the one-line change
   is in the report).

   What this rule does is put the badge INTO the shared chip family
   instead of an off-palette indigo: it takes the chip's own default
   palette, which is the same cream-and-amber the co-ed chip uses, and
   it measures 5.82:1 on it.

   The :not() guards matter: if the template later carries the real
   modifier class (.audience-chip--girls and friends), those rules win
   and this one steps out of the way. It is a fallback, not a
   competitor. */
body .media-hero .badge-indigo:not(.audience-chip--girls):not(.audience-chip--boys):not(.audience-chip--coed) {
  background: #FEF3E2;
  border: 1px solid #FCD9A8;
  color: #B45309;
}

/* ---------- 5.4 The gallery tiles get a hover ----------
   .media-tile had no :hover rule at all: no lift, no shadow, no border
   change, so a tile looked exactly the same whether the pointer was on
   it or not. Its sibling .upl-tile at least changed its border. The
   lift here is the event card's own: 2px up, the card's raised shadow,
   and the brand teal border that .upl-tile already uses.

   event_media.html owns .media-tile's geometry, so the hover lives here
   rather than there. */
body .media-tile:hover {
  transform: translateY(-2px);
  border-color: var(--brand-deep);
  box-shadow: 0 8px 24px -12px rgba(15, 23, 42, 0.28);
}

/* ---------- 5.5 The gallery page's buttons reach 44px ----------
   "Contact photographers" measured 38px tall. The house floor is 44px
   (docs/design-system.md rule 5), and the only rule that floored it --
   `.panel .btn-primary { min-height: 2.75rem }` inside a
   `max-width: 639px` media query -- never reached it: that button is
   `.btn .btn-ghost`, not `.btn-primary`, and the media query stopped
   at 640px. The floor is now applied to the gallery page's own
   `.btn` at EVERY width.

   `.media-eyebrow` is the gallery's own heading, and it is what scopes
   this: the rule does not touch the .btn on any other page. */
body:has(.media-eyebrow) .panel .btn {
  min-height: 44px;
}

/* The gallery's "← All media" back link measured 23.6px on the desktop. The
   page's own rule floors it below 640px only, and on a wide screen a
   24px-tall link is a link you have to aim at. */
body:has(.media-eyebrow) .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}

/* Back arrow: size and vertically center the glyph in every back-link on the
    site. The SVG is placed directly in the back-link (no span.back-arrow
    wrapper). The link is a flex row, so the arrow is a flex item and
    `align-items: center` on the link does the centring -- no margin-top and
    no translateY nudge, which is what pushed the arrow a few pixels below
    the text's optical centre on every page. */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.back-link .back-arrow-svg,
.back-link a .back-arrow-svg,
.back-arrow-svg {
  display: block;
  flex: 0 0 auto;
  align-self: center;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  transform: none;
  vertical-align: middle;
}

/* ---------- 5.6 .text-brand ----------
   text-brand has no compiled utility in tailwind.css, so the details
   dialog defines it in its own <style> block and the event card had to
   fall back to a palette utility (text-indigo-500) for the same two
   icons -- which is why the card's clock and pin were indigo and the
   dialog's were teal. It is defined here, once, for the whole site. */
body .text-brand { color: var(--brand); }

/* ---------- Contact visibility: three answers in one track ----------

   Each contact channel is a segmented control -- Public / Club only /
   Private -- instead of a checkbox. A checkbox cannot say "publish this",
   and the answer most students give for a club's Instagram is exactly that.

   A label carries the selected state itself (`:has(input:checked)`) rather
   than a sliding element positioned by arithmetic: the reference pill is
   `--container_width / 3`, which pins the control to a fixed width and
   breaks the moment a segment's text is longer than a third of it. This
   version sizes to its own labels, works at 320px, and needs no JS. */
.vis-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 1rem; padding: 0.625rem 0;
}
.vis-row + .vis-row { border-top: 1px solid var(--line); }
.vis-row-label {
  flex: 0 0 8.5rem; font-size: 0.875rem; font-weight: 600; color: var(--ink);
}
.vis-choice {
  display: inline-flex; flex: 1 1 16rem; max-width: 22rem;
  padding: 3px; gap: 2px;
  background: #F1F5F9; border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}
/* THE pill. One definition, and it is the one that wins.

   These rows are always nested inside a `.field`, and several pages caption
   their inputs with a `.field label { display:block; color:#0F172A;
   margin-bottom:.375rem }` rule in their own <style> block. That block comes
   after this stylesheet, and a bare `.vis-choice label` ties with it at
   (0,1,1) -- so the caption's rule used to win on order alone: each pill
   computed `display: block` (its `align-items: center` inert, the word stuck
   at the top of a 44px box), took #0F172A instead of `--muted` (so an
   unselected pill read like the selected one), and carried a 6.75px
   margin-bottom that inflated the group from 52px to 58.75px.

   `.field .vis-choice label` measures (0,2,1), which clears any `.field label`
   caption rule wherever it lives, and the pages now say `.field > label` as
   well. The plain `.vis-choice label` half keeps the widget working if it is
   ever used outside a `.field`. Note the sibling rules below carry the same
   extra `.field` so that `:hover` and `:checked` still outrank this one. */
.field .vis-choice label,
.vis-choice label {
  position: relative; flex: 1 1 0; display: inline-flex;
  align-items: center; justify-content: center;
  min-height: 44px; padding: 0 0.5rem; margin-bottom: 0;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.2;
  text-align: center; color: var(--muted);
  border-radius: var(--radius-pill); cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
/* An unselected pill is a muted word. Darkening it on hover is the only
   affordance it has, so the rule has to outrank the base colour above. */
.field .vis-choice label:hover,
.vis-choice label:hover { color: var(--ink); }
/* The radio is invisible but still focusable, so the keyboard and a screen
   reader get a real radio group. Focus is drawn on the label. */
.vis-choice input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.field .vis-choice label:has(input:checked),
.vis-choice label:has(input:checked) {
  background: var(--brand-deep); color: #FFFFFF;
}
.field .vis-choice label:has(input:focus-visible),
.vis-choice label:has(input:focus-visible) {
  outline: 2px solid var(--brand-deep); outline-offset: 2px;
}
.field .vis-choice label:has(input:focus-visible):has(input:checked),
.vis-choice label:has(input:focus-visible):has(input:checked) {
  outline-color: var(--ink);
}
/* THE PREFERRED CHANNEL CANNOT BE PRIVATE, SO ITS PRIVATE PILL IS DISABLED.
   `preferred_contact_errors` (accounts.forms) refuses a preferred channel
   whose visibility answers "private" -- the account cannot be created that
   way. `invite_join.html` disables that pill and moves the tick to Club only
   when the channel is picked, so the student sees WHY the option is gone
   rather than being refused at submit for a control they never touched.

   THE SPECIFICITY TRAP. The selected-fill rule above,
   `.field .vis-choice label:has(input:checked)`, measures (0,3,1), and it
   keeps matching after the gadget disables the radio: the browser does not
   clear `checked` when a radio is disabled, and this script moves the tick
   in the same tick as it disables the box, so there is a moment where the
   input is BOTH checked and disabled. A plain
   `.vis-choice label.is-disabled` at (0,2,1) loses that fight and the pill
   paints the selected teal while dimmed -- which reads as "chosen but greyed"
   and is the exact opposite of "you cannot have this one".

   So the disabled rule matches the checked rule's own pseudo-class and adds
   `:has(input:disabled)` on top of it. The result measures (0,4,1), clears
   (0,3,1) wherever it sits, and a disabled pill can never carry the selected
   fill. It also carries `color` and the fill explicitly rather than relying
   on the base rule, because the checked rule sets `color: #FFFFFF` and is
   still the later, more specific declaration for this element. */
.field .vis-choice label.is-disabled:has(input:checked):has(input:disabled),
.vis-choice label.is-disabled:has(input:checked):has(input:disabled),
.field .vis-choice label:has(input:disabled),
.vis-choice label:has(input:disabled) {
  opacity: .55; cursor: not-allowed;
  background: transparent; color: var(--muted);
}
.vis-hint {
  flex: 0 0 100%; margin: 0; font-size: 0.8125rem; color: var(--muted);
}

/* WHAT THE THREE ANSWERS MEAN, one line each.
   A paragraph of the same information was accurate and unread, so this is the
   same facts at a length somebody actually reads: the word in ink, the meaning
   after it. No bullets -- the three pills are rows above it and a bullet list
   under them reads as a second set of options. */
.vis-legend {
  flex: 0 0 100%; margin: 0 0 0.375rem; padding: 0; list-style: none;
  display: grid; gap: 0.125rem;
  font-size: 0.8125rem; line-height: 1.45; color: var(--muted);
}
.vis-legend li { margin: 0; }
.vis-legend strong { color: var(--ink); font-weight: 600; }
@media (max-width: 520px) {
  .vis-row-label { flex: 0 0 100%; }
  .vis-choice { max-width: none; }
  /* Same `.field` prefix as the base rule, so the phone size is not the one
     declaration a page's caption rule can still outrank. */
  .field .vis-choice label,
  .vis-choice label { font-size: 0.75rem; padding: 0 0.25rem; }
}

/* ---- The join wizard's "you already have an account" note ----------------
   A quiet panel, not an alarm: nothing is wrong, the link is simply being
   added to an account that already exists. Amber would read as a warning and
   teal as success; neither is true here. */
.join-notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-deep);
  border-radius: var(--radius-6);
  background: var(--brand-soft);
  padding: .875rem 1rem;
  margin-bottom: 1.25rem;
}

.join-notice-title {
  margin: 0 0 .25rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--brand-deep);
}

.join-notice-body {
  margin: 0;
  font-size: .875rem;
  line-height: 1.55;
  color: var(--slate);
}

/* ---- The roster's toast -------------------------------------------------
   Confirmation for a write that does not reload the page. Bottom centre on a
   phone and bottom right on a desk, where the switch the reader just flipped
   is already off screen. It is a live region, so a screen reader announces the
   sentence without the focus having to move. */
.staff-toast {
  position: fixed; z-index: 60; left: 50%; bottom: 1rem;
  transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  border-radius: var(--radius-8);
  background: #0F172A; color: #FFFFFF;
  font-size: 0.875rem; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.staff-toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

.staff-toast[data-state="error"] { background: #B91C1C; }

@media (min-width: 640px) {
  .staff-toast { left: auto; right: 1.5rem; transform: translate(0, 1rem); }
  .staff-toast.is-shown { transform: translate(0, 0); }
}

/* The three visibility words sit in boxes of equal width, so the word has to
   be centred in its box: left-aligned, "Public" in a 96px pill reads as though
   the pill has a hole in it. That centring lives in the single `.vis-choice
   label` rule above -- it used to be repeated here as a second definition,
   which is exactly how a widget ends up with two authorities and one of them
   stale. */


/* ==========================================================================
   THE INVITE JOIN WIZARD
   ==========================================================================

   Every rule the wizard page needs, in the stylesheet and not in the page.

   The page used to carry its own <style> block that was parsed AFTER these
   linked sheets, so at equal specificity it won -- and it carried the bug
   that broke the visibility pills twice: `.field label` (0,1,1) in the page
   block outranked `.vis-choice label` (0,1,1) in this file purely on order,
   so the pills computed display:block, lost their centring, and took the
   caption's ink. A widget with two authorities and one of them stale is the
   defect; one authority is the fix.

   The class names are unchanged from the page they came from, so nothing
   else needs to know they moved.
   -------------------------------------------------------------------------- */

.join-shell { max-width: 40rem; margin: 0 auto; padding: 2rem 1rem 4rem; }

.join-eyebrow {
  margin: 0 0 0.375rem;
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--brand-deep);
}

/* The heading. Fraunces, the same display face every page's h1 uses, so the
   wizard reads as part of the site rather than as a form bolted onto it. */
.join-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1.75rem; line-height: 1.15; font-weight: 700;
  color: var(--ink);
}

.join-sub { margin: 0 0 1.25rem; font-size: 0.875rem; color: var(--muted); }

/* The one fact the reader needs before typing: what this link is for. */
.join-plate {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3125rem;
  margin: 0 0 1.5rem; padding: 0.625rem 0.875rem;
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--brand); border-radius: var(--radius-12);
  font-size: 0.9375rem; line-height: 1.45; color: var(--muted);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.join-plate strong { color: var(--ink); font-weight: 700; }

/* ---------- Progress, as words -------------------------------------------
   An ordered list of the steps by name. The current one is teal and bold, a
   passed one is muted with a tick, and the rest are quiet. The number is
   aria-hidden because the list item already announces its position. */
.join-steps { margin: 0 0 0.5rem; }
.join-step-list {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.25rem 0.5rem; margin: 0; padding: 0; list-style: none;
}
.join-step {
  display: inline-flex; align-items: center; gap: 0.375rem;
  font-size: 0.8125rem; font-weight: 600; color: var(--muted);
}
.join-step + .join-step::before {
  content: ""; display: block;
  width: 0.875rem; height: 1px; margin-right: 0.125rem;
  background: var(--line);
}
.join-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.25rem; height: 1.25rem; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--card);
  font-size: 0.6875rem; font-weight: 700; color: var(--muted);
}
.join-step.is-done { color: var(--slate); }
.join-step.is-done .join-step-num {
  background: var(--brand-soft); border-color: var(--brand);
  color: var(--brand-deep);
}
.join-step.is-now { color: var(--ink); }
.join-step.is-now .join-step-num {
  background: var(--brand-deep); border-color: var(--brand-deep);
  color: #FFFFFF;
}
.join-step-count {
  margin: 0 0 1rem; font-size: 0.8125rem; color: var(--muted);
}

.join-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-12); padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.join-error-summary {
  margin: 0 0 1rem; padding: 0.875rem 1rem;
  background: #FEF2F2; border: 1px solid #FECACA;
  border-radius: var(--radius-8);
  font-size: 0.875rem; line-height: 1.45; color: #B91C1C;
}

/* ---------- Fields ------------------------------------------------------
   `.field > label` and not `.field label`. The descendant selector also
   caught the labels inside the visibility pills, the radio cards and the
   subject chips, and set them display:block with a caption's ink -- which is
   how an unselected pill came to look selected. Direct children only. */
.field { margin-bottom: 1.125rem; }
.field > label,
.field > .field-label {
  display: block; font-size: 0.8125rem; font-weight: 600;
  color: var(--ink); margin-bottom: 0.375rem;
}
.field-label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--ink); margin-bottom: 0.375rem; }
.field-optional {
  font-size: 0.75rem; font-weight: 500; color: var(--muted);
  text-transform: none; letter-spacing: 0;
}
/* Not scoped to `.field`, because these hints also sit BETWEEN fields: the
   seat line under the Grade/Section row is a note about the whole row, not
   about one box, so it lives outside the `.field` div. Scoped, it rendered as
   plain 16px body text in full ink -- the loudest thing on the page. */
.field .hint,
.join-card .hint { margin: 0.25rem 0 0; font-size: 0.75rem; line-height: 1.45; color: var(--muted); }
.field-error {
  display: block; margin-top: 0.375rem;
  font-size: 0.75rem; font-weight: 600; color: #B91C1C;
}

/* Three across is one row on a desk and three rows on a phone; the grade
   selects share a row the same way. */
.field-row { display: grid; grid-template-columns: 1fr; gap: 0 0.75rem; }
@media (min-width: 480px) {
  .field-row { grid-template-columns: repeat(3, 1fr); }
}

/* The 44px floor. The padding sets the height, so the floor is a min-height
   and the type keeps its size. */
input.field-input, select.field-input, textarea.field-input {
  width: 100%; min-height: 44px; padding: 0.625rem 1rem;
  border: 1px solid #CBD5E1; border-radius: var(--radius-8);
  background: var(--card); color: var(--ink);
  font-size: 0.875rem; font-family: inherit; box-sizing: border-box;
}
input.field-input:focus, select.field-input:focus, textarea.field-input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}
.field.invalid input.field-input,
.field.invalid select.field-input,
.field.invalid textarea.field-input {
  border-color: #B91C1C; box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.14);
}
textarea.field-input { min-height: 4.5rem; resize: vertical; line-height: 1.5; }

.frozen-name {
  margin: 0; padding: 0.875rem 1rem;
  background: #F1F5F9; border: 1px dashed #CBD5E1;
  border-radius: var(--radius-8);
  font-size: 0.875rem; color: var(--ink);
}

/* ---------- Radio cards, one question ------------------------------------ */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.choice-grid.three { grid-template-columns: repeat(3, 1fr); }
.choice {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 1rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-12);
  background: var(--card); text-align: center; cursor: pointer;
}
.choice:hover { border-color: #99F6E4; }
.choice:has(input:checked) {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.choice:has(input:focus-visible) {
  outline: 2px solid var(--brand-deep); outline-offset: 2px;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .icon { display: block; width: 28px; height: 28px; flex-shrink: 0; }
.choice .name { font-size: 0.875rem; font-weight: 700; color: var(--ink); }
.choice .sub { font-size: 0.75rem; color: var(--muted); }
@media (max-width: 520px) { .choice-grid, .choice-grid.three { grid-template-columns: 1fr; } }

/* ---------- Subject chips ------------------------------------------------ */
.subject-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 2.75rem; }
.subject-chip { position: relative; }
.subject-chip input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.subject-chip .chip-text {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0.375rem 0.75rem;
  background: #F8FAFC; border: 1px solid #CBD5E1;
  border-radius: var(--radius-8);
  font-size: 0.8125rem; font-weight: 500; color: #334155;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease,
              color 150ms ease, box-shadow 150ms ease;
}
.subject-chip:hover .chip-text { border-color: #99F6E4; }
.subject-chip:has(input:focus-visible) .chip-text {
  outline: 2px solid var(--brand-deep); outline-offset: 2px;
}
.subject-chip:has(input:checked) .chip-text {
  background: var(--brand-deep); border-color: var(--brand-deep);
  color: #FFFFFF; font-weight: 700;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}
.subject-chip.locked .chip-text { opacity: 0.35; cursor: not-allowed; }

.math-sublevels {
  display: none; margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.math-sublevels.show { display: block; }
.math-sublevels .field-label { font-size: 0.75rem; color: var(--muted); }
.math-sublevels .field-label strong { color: var(--brand-deep); }
.math-chips { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.math-chip { position: relative; }
.math-chip input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.math-chip .chip-text {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 3rem; min-height: 44px; padding: 0.375rem 0.6rem;
  background: var(--card); border: 1px solid #CBD5E1;
  border-radius: var(--radius-8);
  font-size: 0.75rem; font-weight: 700; color: #334155;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease,
              background-color 150ms ease;
}
.math-chip:has(input:checked) .chip-text {
  border-color: var(--brand); background: var(--brand-soft);
  color: var(--brand-deep);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

/* ---------- The page's verbs --------------------------------------------- */
.btn-next {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; min-height: 48px; padding: 1rem 1.5rem;
  background: var(--brand-deep); color: #FFFFFF;
  border: 1px solid var(--brand-deep); border-radius: var(--radius-8);
  font-size: 0.9375rem; font-weight: 600; font-family: inherit;
  cursor: pointer;
}
.btn-next:hover { background: #115E59; border-color: #115E59; }
.btn-next:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.back-link { margin: 0 0 1rem; display: inline-flex; align-items: center; }
.back-link a {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 44px; color: var(--brand-deep); font-weight: 600;
  text-decoration: none;
}
.back-link a:hover { text-decoration: underline; }
