/* ============================================================
   ECM Design Tokens & Base Utilities
   WSS School — warm dark, dense, accessible
   ============================================================ */

/* ----------------------------------------------------------
   0. Alpine.js x-cloak (hide before init)
   ---------------------------------------------------------- */
[x-cloak] {
  display: none !important;
}

/* Size utilities that the compiled Tailwind build does not contain.
   The build is content-scanned, so a class is only present if it is spelled
   literally somewhere in templates/. Anything sized in markup that the scan
   misses is a no-op and falls back to the element's intrinsic size. The worst
   case was the nav chevron: `w-3.5 h-3.5` missing meant a 14px icon rendered
   at 71px, which stretched the header row to 113px and pushed the "My Clubs"
   trigger off the top of the page.

   Re-audited against static/css/tailwind.css (447 classes): w-3/h-3, w-3.5/h-3.5,
   w-6/h-6, w-7/h-7, w-10/h-10, w-16/h-16, mt-0.5 and ml-0.5 ARE all in the build
   now and are kept below only as a fallback for pages that ship an older
   cached tailwind.css. `-mt-0.5` (the "My Clubs" chevron nudge, _nav.html:28) is
   genuinely still missing, which is why only that one is declared here. */
.w-3  { width: 0.75rem; }
.h-3  { height: 0.75rem; }
.w-3\.5  { width: 0.875rem; }
.h-3\.5  { height: 0.875rem; }
.w-6  { width: 1.5rem; }
.h-6  { height: 1.5rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }
.-mt-0\.5 { margin-top: -0.125rem; }

/* Visually hidden but available to screen readers.
   Tailwind's own .sr-only is NOT in the compiled build (the compiled
   tailwind.css only contains the utilities the old scan picked up, and
   pages without the Play CDN get nothing), so it is defined here
   instead. Without it, `class="sr-only"` renders as visible text. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ----------------------------------------------------------
   1. Custom Properties
   ---------------------------------------------------------- */
:root {
  /* Colour palette — warm dark (stone-900 base) */
  --color-primary: #B45309;        /* orange-500, brightened for dark bg */
  --color-primary-hover: #B45309;  /* orange-400 */
  --color-primary-light: rgba(180, 83, 9, 0.15);
  --color-secondary: #0F766E;      /* the brand's deep teal */
  --color-secondary-hover: #99F6E4;
  --color-secondary-light: rgba(15, 118, 110, 0.15);
  --color-accent: #B45309;         /* the system's caution */
  --color-accent-light: rgba(180, 83, 9, 0.15);

  --color-bg: #0F172A;             /* stone-900 */
  --color-bg-alt: #1F2937;         /* stone-800 */
  --color-text: #F1F5F9;           /* stone-100 */
  --color-text-muted: var(--muted);   /* placeholder/faint text: light-theme muted, see light.css --muted (#5B6779) */
  --color-border: rgba(255, 255, 255, 0.10);

  --color-success: #15803D;
  --color-success-light: rgba(21, 128, 61, 0.15);
  --color-danger: #B91C1C;
  --color-danger-light: rgba(185, 28, 28, 0.15);

  /* Palette V3 — semantic aliases */
  --elevated: #334155;
  --brand: #B45309;
  --brand2: #B45309;
  --teal: #0F766E;
  --boys: #93C5FD;
  --girls: #F9A8D4;
  --success: #15803D;
  --danger: #B91C1C;

  /* Gradients */
  --gradient-warm: linear-gradient(135deg, #1F2937 0%, #0F172A 50%, #1F2937 100%);

  /* Typography */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;

  --leading-tight: 1.25;
  --leading-normal: 1.5;

  /* Spacing & radii
     --radius-xl deliberately matches Tailwind's own --radius-xl (0.75rem).
     custom.css's :root is unlayered, so it overrides the compiled token and
     feeds .rounded-xl; leaving it at 1rem rendered every rounded-xl 16px on
     pages without a local copy and 12px on the pages that carry one (the
     Details button beside a 6px Join measured 16px on /, 12px on /clubs/ and
     /events/media/). No house rule reads --radius-xl -- only the compiled
     utility does -- so 0.75rem surfaces it everywhere at once.

     These are in PX, and that is the point of the whole block. They used
     to be rem, and custom.css raises the root font-size to 1.125rem at
     >=900px, so on a desktop the scale rendered 6.75 / 9 / 13.5px instead
     of 6 / 8 / 12 -- the site had five shapes where the rulebook says
     four, and the difference was invisible in a diff. The type scale is a
     decision; the shape scale is not, so it is absolute.

     The same rem-to-px correction is applied to every literal
     `border-radius` in the site (244 of them) and to the radius tokens
     in tokens.css and light.css. 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. */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows — deeper for dark bg */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.35);
  --shadow-md: 0 2px 8px rgba(15, 23, 42, 0.4), 0 1px 2px rgba(15, 23, 42, 0.35);
  --shadow-lg: 0 4px 16px rgba(15, 23, 42, 0.45), 0 2px 4px rgba(15, 23, 42, 0.35);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Focus ring — the site's one teal.
     It used to be an amber-400 halo, rgba(251,191,36,.35). Composited on
     white that paints #FDE9AF, which measures 1.22:1 against the surface it
     sits on: a keyboard user could not see where they were. WCAG 2.2
     SC 1.4.11 wants 3:1 for a focus indicator. The halo is now the site's
     amber at the same alpha -- rgba(180,83,9,.35) over white, which paints
     #E5C3A9 and measures 1.64:1. Still under the floor, which is why the
     outline below is the indicator and this is only its soft edge.

     The indicator itself is the OUTLINE, not this shadow: an outline is
     painted by the user agent in forced-colors mode, where a box-shadow
     ring is dropped entirely. This token is only the soft edge under it.
     The teal is --brand-deep (#0F766E), 5.47:1 on white and 5.25:1 on the
     paper background -- and it is the same teal as the brand buttons, so
     the ring is one colour with the rest of the site rather than a second
     accent that only appears on focus. */
  --focus-ring: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

/* ----------------------------------------------------------
   2. Base Typography & Reset Additions
   ---------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  tab-size: 4;
}

/* Slightly larger type for desktop viewports; the mobile sizes stay as-is. */
@media (min-width: 900px) {
  html { font-size: 1.125rem; }
}

body {
  min-height: 100vh;
  margin: 0;
  background-color: var(--color-bg);
  /* Subtle warm radial glow (top) + dark dot texture */
  background-image:
    radial-gradient(ellipse 90% 45% at 50% -5%, rgba(180, 83, 9, 0.07), transparent 70%),
    radial-gradient(circle, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: auto, 24px 24px;
  background-attachment: fixed;
}

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

/* Long club and event names are single unbreakable tokens, and every heading
   sits inside a flex/grid track, so the token set the track's min-content
   width and pushed the page into horizontal scroll — measured 20-157px of
   overflow on /clubs/, /clubs/<pk>/, /events/<pk>/, the ECM staff page and
   the contact page. `break-word` (never `anywhere`) is deliberate: it breaks
   only words that cannot fit on a line of their own, and the flex/grid
   parents carry min-width:0 so the track itself can shrink. */
h1,
h2,
h3,
h4 {
  overflow-wrap: break-word;
}

/* ----------------------------------------------------------
   3. Card
   ---------------------------------------------------------- */
.card {
  background-color: var(--color-bg-alt); /* stone-800 */
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* ----------------------------------------------------------
   4. Buttons
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: var(--leading-tight);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--color-text);
  transition: background-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.btn:focus-visible {
  /* The outline is the indicator: 3px of --brand-deep, 2px clear of the
     control, so the ring never touches the button's own border and both
     stay legible. The box-shadow is only the soft edge under it. */
  outline: 3px solid var(--brand-deep, #0F766E);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary — amber CTA (v3) */
.btn-primary {
  background-color: var(--brand);
  color: #0F172A;
  border-color: var(--brand);
}

.btn-primary:hover:not(:disabled) {
  background-color: #B45309;
  border-color: #B45309;
}

/* Secondary */
.btn-secondary {
  background-color: var(--color-secondary);
  color: #0F172A;
  border-color: var(--color-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-secondary-hover);
  border-color: var(--color-secondary-hover);
}

/* Danger */
.btn-danger {
  background-color: #B91C1C;
  color: #fff;
  border-color: #B91C1C;
}

.btn-danger:hover:not(:disabled) {
  background-color: #B91C1C;
  border-color: #B91C1C;
}

/* Ghost: a low-emphasis action that still needs to read as a control.
   Used for reversible toggles (hide/show) sitting next to a committing action
   (approve/reject), so the two are not weighted the same. */
.btn-ghost {
  background-color: transparent;
  color: #475569;
  border-color: #CBD5E1;
}

.btn-ghost:hover:not(:disabled) {
  background-color: #F1F5F9;
  color: #0F172A;
  border-color: #94A3B8;
}

/* The "Join" CTA on every event card, and the identical button that
   _event_modal_js.html rebuilds inside the details modal. The markup still
   carries the pre-teal Tailwind soup -- bg-indigo-600 / hover:bg-indigo-700 /
   active:bg-indigo-800 / shadow-indigo-500/25 / rounded-xl (12px) -- and
   light.css:3 states the palette has no purple. Those are all @layer
   utilities, so this unlayered rule outranks them and the button becomes the
   same teal CTA as .btn-primary (white on #0F766E measures 5.50:1).
   Only background/colour/radius/shadow are restyled: adding a border would
   grow the button's box by 2px, because the markup sets no border.
   .btn-event's other half is the modal's "Joined" state, which reuses the
   class with a bg-emerald-100 branch; excluding that branch here stops the
   two states from being flattened into one. */
.btn-event:not(.bg-emerald-100) {
  background-color: #0F766E;
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
}

.btn-event:not(.bg-emerald-100):hover:not(:disabled) {
  background-color: #115E59;
}

.btn-event:not(.bg-emerald-100):active:not(:disabled) {
  background-color: #0F766E;
  box-shadow: none;
}

.btn-event.bg-emerald-100 {
  background-color: #DCFCE7;
  color: #0F766E;
  border-radius: 6px;
}

.btn-event.bg-emerald-100:hover:not(:disabled) {
  background-color: #BBF7D0;
}

/* ----------------------------------------------------------------------
   Event-card actions: a deliberate button pair, not two rectangles that
   happen to sit beside each other.

   Two things kept breaking here. First, `body a` in light.css is UNLAYERED
   and outranks a layered utility, so the filled Register label kept
   resolving to link-teal on a teal fill (measured once at 1.18:1). Second,
   each neighbour resolved its own radius and height from whichever copy of
   --radius-xl the page happened to carry, so the 1px border on Details made
   it 2px taller than the button next to it. The whole control therefore
   lives here, unlayered and scoped to the row, with ONE geometry shared by
   every action.

   The affordance is a 3px hard bottom edge under a solid fill. A flat plate
   with a soft blur reads as decoration; a raised plate with a visible lip
   reads as something you press -- which is exactly what the previous
   flat/gradient attempts were missing. Hover lifts it 1px, active drops it
   2px so the lip briefly collapses: a real press, not a colour swap.

   The fill is the site's brand teal (--brand-deep), not an off-brand indigo
   utility: it is the same teal as the modal CTA, and white on #0F766E
   measures 5.47:1, so the label clears AA. */
body .event-card .event-card-actions {
  align-items: stretch;
  /* Three actions on a media card will not fit a phone; the row wraps rather
     than squeezing a label into two lines. See the nowrap rule below. */
  flex-wrap: wrap;
}

/* 44px tap-target floor for every action in the row. */
body .event-card .event-card-actions > a,
body .event-card .event-card-actions > button {
  min-height: 44px;
}

/* A label never breaks across two lines inside a control.
   Measured at 320px on the homepage: with `flex-1` on Sign up and Details at
   its own minimum, the primary was given 107px against the 116px the words
   need (16px icon + 8px gap + 52px of text "Sign up" + 40px padding), so the
   label broke after "Sign" and -- because the row stretches its children --
   dragged the Details button to 57.6px with it. Two of the four upcoming
   cards were rendering that. The row wrapping is the honest failure mode;
   splitting a two-word label is not. */
body .event-card .event-card-actions .ecm-btn {
  white-space: nowrap;
}

/* Side padding is tuned for a card at 1024px. On a 320px phone the pair plus
   their 8px gap comes to 233px inside a 230px content box, which is what left
   the label 9px short; 0.75rem of padding hands back 16px per control and the
   label ends up clear of the edge. The 44px floor and the vertical rhythm are
   untouched, and nothing above 400px moves. */
@media (max-width: 400px) {
  body .event-card .event-card-actions .ecm-btn {
    padding-inline: 0.75rem;
    gap: 0.375rem;
  }
}

body .ecm-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 12px;
  /* !important + unlayered: `body a` must never repaint a filled label. */
  text-decoration: none !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 150ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 150ms cubic-bezier(0.22, 1, 0.36, 1),
              background-color 150ms ease,
              border-color 150ms ease,
              color 150ms ease;
}
body .ecm-btn > svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

/* Typography is per-context: the card runs a compact 14px label, while the
   modal CTA keeps its own larger type. Structural rules above stay shared. */
body .event-card .event-card-actions .ecm-btn {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.005em;
}

/* Primary: the one thing the card is asking for. */
body .ecm-btn--primary {
  color: #FFFFFF;
  background-color: #0F766E;
  border-color: #115E59;
  box-shadow: 0 3px 0 0 #0F766E, 0 10px 20px -12px rgba(15, 118, 110, 0.85);
}
body .ecm-btn--primary:hover {
  color: #FFFFFF;
  background-color: #0F766E;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 0 #0F766E, 0 14px 26px -12px rgba(15, 118, 110, 0.95);
}
body .ecm-btn--primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 #0F766E, 0 4px 10px -8px rgba(15, 118, 110, 0.75);
}
body .ecm-btn--primary .ecm-btn__icon {
  transition: transform 160ms ease;
}
body .ecm-btn--primary:hover .ecm-btn__icon {
  transform: translateX(2px);
}

/* Secondary: the same plate, on a quiet surface. */
body .ecm-btn--secondary {
  color: #334155;
  background-color: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 3px 0 0 #E2E8F0;
}
body .ecm-btn--secondary:hover {
  color: #0F172A;
  background-color: #F8FAFC;
  border-color: #94A3B8;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 0 #CBD5E1;
}
body .ecm-btn--secondary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 #E2E8F0;
}

/* Tertiary: media is a third action on some cards, so it stays quiet and
   the row keeps a single obvious primary. */
body .ecm-btn--ghost {
  color: #0F766E;
  background-color: #F0FDFA;
  border-color: #99F6E4;
  font-weight: 600;
  box-shadow: 0 3px 0 0 #CCFBF1;
}
body .ecm-btn--ghost:hover {
  color: #115E59;
  background-color: #CCFBF1;
  border-color: #0F766E;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 0 #99F6E4;
}
body .ecm-btn--ghost:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 #CCFBF1;
}

/* Focus drawn outside the fill, so it stays visible on all three fills. */
body .ecm-btn:focus-visible {
  /* #0F766E was a third teal, one step past --brand-deep, used only here.
     One ring, one teal: this is now the same --brand-deep every other
     focusable gets, at the same 3px / 2px offset. */
  outline: 3px solid var(--brand-deep, #0F766E);
  outline-offset: 2px;
}

/* The lift/press is decorative motion; the colour change alone still shows
   hover and focus under a reduced-motion preference, so drop the movement. */
@media (prefers-reduced-motion: reduce) {
  body .ecm-btn,
  body .ecm-btn > svg,
  body .ecm-btn--primary .ecm-btn__icon {
    transition: none !important;
  }
  body .ecm-btn--primary:hover,
  body .ecm-btn--secondary:hover,
  body .ecm-btn--ghost:hover,
  body .ecm-btn--primary:active,
  body .ecm-btn--secondary:active,
  body .ecm-btn--ghost:active,
  body .ecm-btn--primary:hover .ecm-btn__icon {
    transform: none !important;
  }
}

/* A card whose only action is Details still ends in a full-width control.
   Form-less events have no Join to pair with it, and a lone 90px button in a
   361px row was measured to leave ~271px of gutter, with the row ending out
   of step with its Join neighbours. `:only-child` cannot fire on the
   two-button rows, and this is unlayered like the pins above, so it outranks
   the compiled .flex-1 utility (layered). */
body .event-card .event-card-actions > a:only-child,
body .event-card .event-card-actions > button:only-child {
  flex: 1 1 0%;
}

/* Poster-less event card: compact calendar-moment panel in place of the A4
   slab. All sizes live here, not in compiled utilities -- w-12/h-12 and
   text-[9px]/text-[13px] are not emitted by the content-scoped Tailwind
   build, so a class list would silently no-op. Contrast on the light
   gradient (#EFF6FF -> #FFFFFF -> #F8FAFC): slate-600 #475569 is >= 6.5:1
   everywhere on it; the boys' blue #1E40AF on the white tile is 8.6:1. */
.event-card-posterless {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1rem;
  background: linear-gradient(135deg, #EFF6FF 0%, #FFFFFF 55%, #F8FAFC 100%);
}
.event-card-moment {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.event-card-date-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.event-card-date-month {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1E40AF;
  line-height: 1;
}
.event-card-date-day {
  font-family: var(--font-display, "Fraunces", Georgia, serif);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  color: #0F172A;
  margin-top: 0.125rem;
}
.event-card-date-year {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  line-height: 1;
  margin-top: 0.125rem;
}
.event-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}
.event-card-time {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-card-room {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}
.event-card-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: #475569;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  white-space: nowrap;
}

/* Signed-in user's name in the top bar. It had no width budget at all, so a
   long username shoved the chevron and the whole topbar past the viewport.
   min-width:0 is what actually lets it shrink as a flex item. */
.nav-username {
  max-width: 9rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A4 poster hit area on the event card (opens the lightbox). The div carries
   an onclick and the markup only says cursor-pointer, which misdescribes a
   zoom affordance. */
.event-poster {
  cursor: zoom-in;
}

/* The card's club-name / audience-pill row. Below ~420px the two no longer
   fit side by side and the name lost more than half its width to a single
   8-character pill: measured at 320px on /clubs/34/ the name box was 137.2px
   against a 191px scrollWidth, i.e. 54px of "ROBOTICS SOCIETY" replaced by an
   ellipsis, because the pill is `shrink-0` and the name carried
   `max-w-[60%]` on top of that. Wrapping is the fix that does not need a
   shorter club name: the pill drops to its own line and the name gets the
   full row. 820px and up is unchanged -- there the row already fits on one
   line, measured 495.6px of name inside a 696px row. */
@media (max-width: 420px) {
  .event-card-toprow {
    flex-wrap: wrap;
  }
}

/* ----------------------------------------------------------
   5. Chip / Badge / Pill -- ONE base, five historical names
   ---------------------------------------------------------- */
/* The same pill was implemented six times (.chip, .badge, .status-pill,
   .d-chip, .seat-open-badge and profile.html's .tag) across 2 radii, 5
   paddings, 3 sizes and 2 weights. This block is the single base; the other
   names are aliases so every existing class="..." keeps working and the
   per-template copies can be deleted. Radius is 6px for all of them (house
   rule: 6px buttons and chips), which is also what light.css already pinned
   for .chip. */
.chip,
.badge,
.d-chip,
.status-pill,
.seat-open-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.625rem;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1;
  border-radius: 6px;
  white-space: nowrap;
  vertical-align: middle;
}

/* Borders are per-variant, not on the shared base: .badge and .d-chip were
   previously borderless, and forcing a 1px transparent border onto them would
   grow every one by 2px in both directions. */
.chip {
  background: rgba(255, 255, 255, 0.05); /* white/5 */
  border: 1px solid rgba(255, 255, 255, 0.10); /* white/10 */
  color: var(--color-text-muted);
}

/* .badge keeps no fill and no border of its own: it is a slot for a
   .badge-* modifier, and call sites pair it with an inline colour or with
   .seat-open-badge. */
.badge {
  background: transparent;
  border: 0;
}

.badge-success {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.badge-danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

.badge-primary {
  background-color: var(--color-primary-light);
  color: #B45309;
}

.badge-secondary {
  background-color: var(--color-secondary-light);
  color: var(--color-secondary);
}

/* Dashboard table pills. -orange/-amber/-stone already lived here; -teal/-red/
   -green were only defined inside three templates' own <style> blocks, so
   anywhere else the pill had no fill and inherited its colour. */
.d-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  color: var(--color-text-muted);
}

.d-chip-teal { background: rgba(15, 118, 110, 0.12); color: #0F766E; }
.d-chip-red { background: rgba(185, 28, 28, 0.12); color: #B91C1C; }
.d-chip-green { background: rgba(21, 128, 61, 0.14); color: #15803D; }
.d-chip-orange { background: rgba(180, 83, 9, 0.12); color: #B45309; }
.d-chip-amber { background: rgba(180, 83, 9, 0.12); color: #B45309; }
.d-chip-stone { background: rgba(71, 85, 105, 0.12); color: #94A3B8; }

/* ECM dashboard / media review segmented filter. It is an interactive control,
   so it is a step larger than a read-only pill and carries its own states. */
.status-pill {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: none;
}

.status-pill:hover {
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.20);
  text-decoration: none;
}

.status-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #0F172A;
}

.status-pill .pill-n {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Seat availability on the club staff page: the quietest pill in the set. */
.seat-open-badge {
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--color-text-muted);
}

.chip-teal {
  background: rgba(15, 118, 110, 0.12);
  color: #0F766E;
}

.chip-amber {
  background: rgba(180, 83, 9, 0.12);
  color: #B45309;
}

.chip-red {
  background: rgba(185, 28, 28, 0.12);
  color: #B91C1C;
}

.chip-stone {
  background: rgba(255, 255, 255, 0.06);
  color: #94A3B8;
}

.chip-success {
  background: rgba(21, 128, 61, 0.12);
  color: #15803D;
}

.chip-primary {
  background: rgba(13, 148, 136, 0.12);
  color: #0F766E;
}

.chip-danger {
  background: rgba(185, 28, 28, 0.12);
  color: #B91C1C;
}

.chip-secondary {
  background: rgba(15, 118, 110, 0.12);
  color: #0F766E;
}

.chip-green {
  background: rgba(21, 128, 61, 0.14);
  color: #15803D;
}

.chip-orange {
  background: rgba(180, 83, 9, 0.14);
  color: #FCD9A8;
}

/* ----------------------------------------------------------
   6. Focus-visible (global accessibility) — the brand teal
   ---------------------------------------------------------- */
:focus-visible {
  /* Was amber-400 (#FBBF24), the dark theme's accent: 1.67:1 on white, and
     the 2px ring around a 12px label was the only focus cue on half the
     site.
     --brand-deep measures 5.47:1 on white and 5.25:1 on paper, and it is
     the colour every other focusable on the site now uses. */
  outline: 3px solid var(--brand-deep, #0F766E);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

/* ----------------------------------------------------------
   7. Selection colour
   ---------------------------------------------------------- */
::selection {
  background-color: rgba(180, 83, 9, 0.25);
  color: var(--color-text);
}

/* ----------------------------------------------------------
   9. Skeleton loading states (HTMX hx-indicator)
   ---------------------------------------------------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background-color: #1F2937;
  border-radius: var(--radius-md);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

.htmx-request .skeleton {
  display: block;
}

/* htmx ships no stylesheet, so an element carrying `htmx-indicator` has no
   opinion about its own visibility and simply sits there at rest — which is
   why the timetable drew a permanent grey skeleton over every FREE/Busy cell
   and nothing ever removed it. This is the pair from the htmx docs: hidden at
   rest, shown while the element (or an ancestor) is in the request state.
   `.htmx-request` is applied by htmx at runtime, so it never appears in a
   template -- same reason the two rules further down survive. */
.htmx-indicator {
  opacity: 0;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* ----------------------------------------------------------
   10. Motion utilities & HTMX states (v1 — kept intact)
   Palette: primary #B45309, secondary #0F766E, accent #B45309,
   bg #0F172A, text #F1F5F9 (stone-900 dark). No gradients, no emojis.
   ---------------------------------------------------------- */
/* The single definition of the page-load entrance animation. Three templates
   used to carry their own copy: homepage.html (@keyframes fadeUp, 12px/0.4s)
   and club_detail.html + club_list.html (@keyframes fadeUp, 8px/0.4s), each
   re-declaring `.anim-fade-up` too. Because their <style> blocks are injected
   after this file, whichever page you were on decided the duration and the
   travel distance. One definition, one duration, here. */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes htmx-pulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.35;
  }
}

/* Page-load entrance: fade + 12px rise, .4s ease-out backwards */
.anim-fade-up {
  animation: fade-up 0.4s ease-out backwards;
}

/* Simple fade-in, .4s */
.anim-fade-in {
  animation: fade-in 0.4s ease-out backwards;
}

/* Small pop: scale .96 -> 1 + fade, .25s */
.anim-pop {
  animation: pop 0.25s ease-out backwards;
}

/* Gentle opacity pulse (live indicators, attention cues) */
.pulse-soft {
  animation: htmx-pulse 2s ease-in-out infinite;
}

/* Staggered children: each runs fade-up with incremental delay */
.stagger > * {
  animation: fade-up 0.4s ease-out backwards;
}

.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(7) { animation-delay: 360ms; }
.stagger > *:nth-child(8) { animation-delay: 420ms; }
.stagger > *:nth-child(9) { animation-delay: 480ms; }
.stagger > *:nth-child(10) { animation-delay: 540ms; }
.stagger > *:nth-child(11) { animation-delay: 600ms; }
.stagger > *:nth-child(12) { animation-delay: 660ms; }

/* Card hover: lift 3px + shadow-lg */
.hover-lift {
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* Button press feedback */
.btn-press:active {
  transform: scale(0.95);
}

/* HTMX request state: dim + pulse on the triggering element */
.htmx-request {
  opacity: 0.6;
  animation: htmx-pulse 1s ease-in-out infinite;
}

/* HTMX swap state: fade */
.htmx-swapping {
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

/* Focus rings in amber: see §6 (:focus-visible). */

/* Respect users who prefer reduced motion: kill all animation */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   11. Rich Desktop System — v2 (dark)
   Palette: #B45309 / #0F766E / #B45309 / #0F172A / #F1F5F9
   ============================================================ */

/* ----------------------------------------------------------
   11.1  Container
   ---------------------------------------------------------- */
.container-page {
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ----------------------------------------------------------
   11.3  Stat band — 4-up KPI grid (desktop)
   ---------------------------------------------------------- */
.stat-band {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
  .stat-band {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ----------------------------------------------------------
   11.4  KPI number
   ---------------------------------------------------------- */
.kpi-num {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: var(--leading-tight);
}

/* ----------------------------------------------------------
   11.6  Aside card
   ---------------------------------------------------------- */
.aside-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.aside-card + .aside-card {
  margin-top: 0.75rem;
}

/* ----------------------------------------------------------
   11.7  Table — rich, dense data table
   ---------------------------------------------------------- */
.table-rich {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table-rich thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-bg-alt); /* stone-800 */
}

.table-rich th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted); /* stone-400 */
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table-rich td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

/* Zebra striping — white/[0.02] */
.table-rich tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Hover highlight — white/5 */
.table-rich tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Right-align numeric columns */
.table-rich .num,
.table-rich td.num,
.table-rich th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------
   11.12  Tab indicator — animated underline
   ---------------------------------------------------------- */
.tab-indicator {
  position: relative;
  display: inline-block;
  padding-bottom: 0.375rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab-indicator:hover {
  color: var(--color-text);
}

.tab-indicator.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ----------------------------------------------------------
   11.13  Cover banner — rich header band (dark)
   ---------------------------------------------------------- */
.cover-banner {
  position: relative;
  padding: 3rem 2rem 2.5rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0F172A 0%, #1F2937 60%, #334155 100%);
  color: #FAFAFD;
  overflow: hidden;
}

.cover-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 80% 20%,
    rgba(180, 83, 9, 0.18) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.cover-banner > * {
  position: relative;
  z-index: 1;
}

/* ----------------------------------------------------------
   11.14  Info card — label/value rows
   ---------------------------------------------------------- */
.info-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
  gap: 1rem;
}

.info-row + .info-row {
  border-top: 1px solid var(--color-border);
}

.info-row .label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

.info-row .value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  text-align: right;
}

/* ----------------------------------------------------------
   11.15  Avatar — initial tiles (sm / md / lg)
   ---------------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #0F172A;
  font-weight: 600;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

.avatar-sm {
  width: 2rem;
  height: 2rem;
  font-size: var(--text-xs);
}

/* ----------------------------------------------------------
   11.16  Empty state — centered, generous padding
   ---------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.empty-state .empty-icon {
  margin-bottom: 1rem;
  opacity: 0.45;
}

.empty-state .empty-title {
  font-size: var(--text-lg);
  font-weight: 600;
  /* --color-text is the DARK theme's ink (#F1F5F9). At (0,2,0) this out-specified
     light.css's `body .empty-title` at (0,1,1), so on the light pages the title
     rendered #F1F5F9 on #F1F5F9 -- 1.00:1, i.e. invisible. --ink is the light
     theme's token and resolves correctly in both themes via light.css. */
  color: var(--ink);
  margin-bottom: 0.375rem;
}

.empty-state .empty-desc {
  font-size: var(--text-sm);
  max-width: 24rem;
  line-height: var(--leading-normal);
}

/* ============================================================
   14. Dark chrome — remap light Tailwind utilities used by
   shared templates (nav / sidebar / footer / page cards).
   custom.css loads after tailwind.css, so these win on equal
   specificity while still losing to inline styles.
   ============================================================ */

/* Surfaces
   .bg-stone-200 and .border-stone-100 / .text-stone-800 were removed here:
   the compiled build scans templates/ and no template has used any of the
   three for months, so both layers were carrying a second definition that
   nothing could reach. Add them back (and to light.css) if a page grows a
   use. */
.bg-white { background-color: #1F2937; }        /* stone-800 */
.bg-stone-50 { background-color: #0F172A; }     /* stone-900 */
.bg-stone-100 { background-color: #1F2937; }    /* stone-800 */

/* Text */
.text-stone-300 { color: #CBD5E1; }
.text-stone-400 { color: #94A3B8; }
.text-stone-500 { color: #94A3B8; }
.text-stone-600 { color: #94A3B8; }
.text-stone-700 { color: #E5E7F0; }
.text-stone-900 { color: #F1F5F9; }

/* Borders */
.border-stone-200 { border-color: rgba(255, 255, 255, 0.10); }
.border-stone-300 { border-color: rgba(255, 255, 255, 0.12); }

/* Amber accents (staff/club-head sections).
   .text-amber-600/700/800 have no reference in any template; only the
   bg-* washes and .hover\:bg-amber-50 are in use. */
.bg-amber-50 { background-color: rgba(180, 83, 9, 0.12); }
.bg-amber-100 { background-color: rgba(180, 83, 9, 0.18); }

.hover\:bg-amber-50:hover { background-color: rgba(180, 83, 9, 0.10); }

/* ============================================================
   15. (removed) Toast layer dark surfaces

   These three !important rules painted every Django-message toast
   #1F2937 with light ink, because the toasts used to be drawn dark. The
   site is a paper interface now, and the toast markup in
   templates/_toasts.html carries its own surface, ink, hairline and edge
   rule. Leaving the overrides in place meant a restyled toast was
   repainted into the old dark theme by a stylesheet that loaded later --
   the owner's report was that the popups do not follow the site design,
   and this section was why.
   ============================================================ */

/* ============================================================
   16. globals.css dark overrides — globals loads after custom.css,
   so these use higher-specificity selectors (body-prefixed) to win
   on element rules while still losing to Tailwind utilities.
   ============================================================ */

/* Headings (globals sets #0F172A) */
body h1,
body h2,
body h3,
body h4 {
  color: var(--color-text);
}

/* Links (globals sets #C2410C) */
body a {
  color: var(--color-primary);
}

/* Inputs (globals sets white bg / stone-300 border) */
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: #0F172A; /* stone-900 */
  border-color: rgba(255, 255, 255, 0.10);
  color: #F1F5F9;
}

body input[type="text"]:focus,
body input[type="email"]:focus,
body input[type="password"]:focus,
body input[type="number"]:focus,
body input[type="url"]:focus,
body input[type="date"]:focus,
body input[type="search"]:focus,
body textarea:focus,
body select:focus {
  /* Was `outline: none` + an amber border + an amber halo: the border
     (#B45309 on white) measured 1.67:1 and the halo 1.11:1, so the only
     thing a focused field showed was a tint nobody could see. The ring is
     now the brand teal, and it is an outline so it survives forced
     colours. */
  outline: 3px solid var(--brand-deep, #0F766E);
  outline-offset: 2px;
  border-color: var(--brand-deep, #0F766E);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

/* Plain tables (globals sets light header / hover) */
body thead th {
  background-color: #1F2937;
  color: var(--color-text-muted);
}

body tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Scrollbars (globals sets light track/thumb) */
::-webkit-scrollbar-track {
  background: #0F172A;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #334155 #0F172A;
}

/* ============================================================
   17. Consolidated shell helpers — extracted from per-template
   <style> blocks that repeat across 3+ templates.
   Follow-up agent strips the per-template duplicates.
   Palette: stone-900 #0F172A, stone-800 #1F2937,
   stone-100/400 text, orange #B45309, amber #B45309, teal #0F766E.
   ============================================================ */

/* ----------------------------------------------------------
   17.1  Page shells
   ---------------------------------------------------------- */
.page-shell {
  max-width: 68rem;
  margin-left: auto;
  margin-right: auto;
  padding: 2rem 1.5rem;
}

.page-dark {
  min-height: 100vh;
  background: #0F172A;
  padding: 2.5rem 1.5rem;
}

/* The one owner of the page-level h1.
   h1 carried six sizes, two weights and seventeen class vocabularies across
   the app (page-title, form-title, d-title, err-title, tt-title, media-title,
   respond-title, resp-title, contact-title, builder-title, profile-name,
   login-headline, reg-title, hero-title, and a bare `text-2xl font-bold
   text-stone-100` seven times), and every page shipped its own size in its own
   <style>. This rule is the single source: 24px, weight 600, matching
   light.css's `body h1` (Fraunces / 600 / -0.01em) so the two cannot disagree.
   Templates that still set `.page-title` themselves must drop their copy --
   see the report. */
.page-title {
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.page-sub {
  font-size: 0.875rem;
  color: #94A3B8;
  margin-bottom: 1.5rem;
}

/* ----------------------------------------------------------
   17.2  Eyebrow / label helpers
   ---------------------------------------------------------- */
.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #B45309;
  margin-bottom: 0.25rem;
}

.d-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #B45309;
}

/* ----------------------------------------------------------
   17.3  Typography helpers
   ---------------------------------------------------------- */
.text-strong { color: #F1F5F9; }
.text-muted  { color: #94A3B8; }
.text-faint  { color: #5B6779; }
.text-orange { color: #B45309; }
.text-dark   { color: #0F172A; }

.d-title { font-size: 1.5rem; font-weight: 700; color: #F1F5F9; letter-spacing: -0.02em; }
.d-sub   { font-size: 0.875rem; color: #94A3B8; }
.d-label { font-size: 0.875rem; font-weight: 500; color: #F1F5F9; }
.d-muted { font-size: 0.75rem; color: #5B6779; }
.d-h2    { font-size: 1.125rem; font-weight: 600; color: #F1F5F9; letter-spacing: -0.01em; }
.d-orange { color: #B45309; }
.d-amber  { color: #B45309; }

/* ----------------------------------------------------------
   17.4  KPI / stat tiles
   ---------------------------------------------------------- */
.kpi-card {
  background: #1F2937;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  border-top: 3px solid #B45309;
}

.kpi-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #F1F5F9;
  margin-top: 0.25rem;
}

.kpi-sub {
  font-size: 0.75rem;
  color: #94A3B8;
  margin-top: 0.125rem;
}

.stat-tile {
  background: #1F2937;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
  padding: 1rem 1.25rem;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #F1F5F9;
  margin-top: 0.25rem;
}

.stat-sub {
  font-size: 0.75rem;
  color: #94A3B8;
  margin-top: 0.125rem;
}

.d-kpi     { padding: 1.25rem; }
.d-kpi-num { font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* 17.5 (chip variants) and 11.8 (chip base) both lived here as a second copy
   of the rules now consolidated in section 5. Removed: they were the second
   radius (9999px on .d-chip) and the second padding in the pill family. */

/* ----------------------------------------------------------
   17.6  Cards & containers
   ---------------------------------------------------------- */
.form-card {
  width: 100%;
  max-width: 28rem;
  background: #1F2937;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.4);
  padding: 2rem;
}

.table-card {
  background: #1F2937;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow-x: auto;
}

.d-card {
  background: #1F2937;
  border: 1px solid #334155;
  border-radius: 12px;
}

/* 17.6b  Clickable card affordance (.d-card-link)

   `d-card-link` was used by two ECM templates and defined nowhere: zero rules
   in the CSSOM. Measured, an <a class="d-card d-kpi d-card-link"> was
   pixel-identical to the 17 static <div class="d-card"> on the same pages --
   same shadow, same border, same background -- with ONE difference on hover,
   and it was the wrong one. globals.css's global
   `a:hover { text-decoration: underline }` (0,1,1) flipped the anchor's
   text-decoration, which then propagates to every in-flow <p> inside it: the
   number, the label and the caption all underlined together, which reads as an
   underlined paragraph rather than a door. (getComputedStyle on the children
   reports `none` while hovered, which is why this is easy to miss: the property
   is on the anchor, the paint is on the children.) The colour half of the delta
   went #0F766E -> #0D9488, two teals that are near-identical, and
   transition-property was `color` alone, so nothing else could have animated.
   On touch there is no hover at all, so the affordance was literally nothing.

   Mirrors the convention this app already teaches (.dash-op, .link-card):
   lift, re-tint the border, kill the underline, and carry a PERSISTENT chevron
   so the cue exists without a pointer. Selectors are body-prefixed to outrank
   both `a:hover` (0,1,1) and light.css's `body a:hover` (0,1,2). */
body a.d-card-link {
  display: block;
  position: relative;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  padding-inline-end: 2.5rem;
  transition: transform var(--motion-1, 120ms) ease,
              box-shadow var(--motion-1, 120ms) ease,
              border-color var(--motion-1, 120ms) ease;
}
body a.d-card-link:hover,
body a.d-card-link:focus-visible {
  text-decoration: none;
  border-color: var(--ecm-brand, #0D9488);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06),
              0 16px 32px -16px rgba(15, 23, 42, 0.25);
}
body a.d-card-link:focus-visible {
  outline: 3px solid var(--brand-deep, #0F766E);
  outline-offset: 2px;
}
body a.d-card-link:active { transform: translateY(0); }
body a.d-card-link::after {
  content: "\2192";
  position: absolute;
  top: 1.25rem;
  inset-inline-end: 1.25rem;
  font-size: 0.875rem;
  line-height: 1;
  color: var(--ecm-brand, #0D9488);
  opacity: 0.55;
  transition: opacity var(--motion-1, 120ms) ease,
              translate var(--motion-1, 120ms) ease;
}
body a.d-card-link:hover::after,
body a.d-card-link:focus-visible::after { opacity: 1; translate: 2px 0; }

/* A bare <button> is `cursor: default` in Chrome, and role="button" inherits
   `auto` -- so every <button class="d-btn"> in the app, and the homepage event
   cards (article[role="button"]), gave no pointer feedback at all. */
body button, body [role="button"] { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  body a.d-card-link, body a.d-card-link::after { transition: none; }
  body a.d-card-link:hover { transform: none; }
}

/* ----------------------------------------------------------
   17.7  Forms
   ---------------------------------------------------------- */
.form-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #F1F5F9;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.form-sub {
  font-size: 0.875rem;
  color: #94A3B8;
  margin-bottom: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.875rem;
}

.form-back {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #94A3B8;
}

.form-foot {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: #94A3B8;
}

.dark-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  margin-bottom: 0.875rem;
}

.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #CBD5E1;
  margin-bottom: 0.375rem;
}

.field-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #0F172A;
  color: #F1F5F9;
  font-size: 0.875rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field-input:focus {
  outline: 3px solid var(--brand-deep, #0F766E);
  outline-offset: 2px;
  border-color: var(--brand-deep, #0F766E);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

/* WCAG 2.2 SC 2.5.8 (Target Size Minimum, AA) wants 24x24 CSS px.
   The club leader contact rows are a stack of inline mailto: links measured at
   129-143 x 19 at 390px, listed ~17px apart -- so the "spacing" exception does
   not rescue them, and they are the only way to contact a club president from
   a phone. inline-block plus block padding gives each a ~24px hit area that
   overlaps its neighbour's, which satisfies the criterion outright.
   Deliberately written here rather than in club_detail.html's inline <style>
   so the two stylesheets cannot disagree about specificity: this is
   (0,1,2) and loads before the page's unlayered (0,1,1), so it wins. */
body .head-detail a[href^="mailto:"] {
  display: inline-block;
  padding-block: 0.2rem;
  min-height: 24px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #CBD5E1;
  padding: 0.375rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.check-label:hover {
  background: rgba(255, 255, 255, 0.05);
}

.submit-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #0F766E;
  color: #fff;
  border: 1px solid #0F766E;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.submit-btn:hover {
  background: #0D9488;
}

.btn-block {
  width: 100%;
}

/* ----------------------------------------------------------
   17.8  Dashboard table
   ---------------------------------------------------------- */
.d-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

/* ----------------------------------------------------------
   17.9  Tab button
   ---------------------------------------------------------- */
.tab-btn {
  position: relative;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

/* ----------------------------------------------------------
   17.10  Message / alert banner
   ---------------------------------------------------------- */
.msg {
  background: #1F2937;
  border: 1px solid #334155;
  border-left: 3px solid #15803D;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #CBD5E1;
  margin-bottom: 0.75rem;
}

/* ----------------------------------------------------------
   17.11  Empty state (compact)
   ---------------------------------------------------------- */
.empty {
  padding: 3rem 1.5rem;
  text-align: center;
}

/* ----------------------------------------------------------
   17.12  Action link
   ---------------------------------------------------------- */
.action-link {
  font-size: 0.75rem;
  color: #B45309;
  background: none;
  border: none;
  cursor: pointer;
  /* WCAG 2.2 SC 2.5.8 (Target Size Minimum, AA) wants 24x24 CSS px. Measured at
     390px: "Acknowledge", "Activate" and "Deactivate" were 77x18 -- and each of
     those is a one-tap WRITE sitting at the far right of a table that needs up
     to 1029px of horizontal panning to reach. Block padding takes the height to
     26px without changing the visual weight. */
  padding: 0.25rem 0;
  font-family: inherit;
  min-height: 24px;
}

/* ----------------------------------------------------------
   17.13  Avatar tile
   ---------------------------------------------------------- */
.avatar-tile {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ============================================================
    19. Palette V3 — extended utilities
    ============================================================ */

/* ----------------------------------------------------------
    19.3  Table scroll + elevated surface
    ---------------------------------------------------------- */
.table-scroll {
  overflow-x: auto;
}

/* ----------------------------------------------------------
    19.4  Live dot — pulsing indicator
    ---------------------------------------------------------- */
@keyframes live-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

.live-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: #15803D;
  animation: live-pulse 1.8s ease-in-out infinite;
}

/* ----------------------------------------------------------
    19.6  Entrance — anim-rise (stagger-ready, v3)
    ---------------------------------------------------------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stale-compiler polyfills. Re-audited against the current build (447
   classes): all five of these ARE in static/css/tailwind.css now, so they are
   only here to cover a browser holding a cached tailwind.css from before the
   last rebuild. Harmless either way -- these are unlayered, so they only ever
   restate what the build already says. */
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.flex-1 { flex: 1 1 0%; }
.min-w-0 { min-width: 0; }
.whitespace-nowrap { white-space: nowrap; }

/* The Details and A4 lightbox overlays carry BOTH `hidden` and `flex` so they
   centre themselves when shown, and the JS toggles visibility with
   classList.remove("hidden") / .add("hidden"). Two display utilities in one
   @layer means the winner is decided by build order, and `flex` was winning:
   the overlays stayed display:flex at opacity 0, covering the viewport and
   swallowing every click on the page below them. (The Play CDN used to mask
   this by injecting its utilities unlayered, at higher priority.)

   Unlayered so it beats @layer utilities, and scoped by id so it cannot break
   the legitimate `hidden md:flex` nav row in _nav.html. */
#details-modal.hidden,
#poster-modal.hidden {
  display: none;
}

/* Deliberately unlayered.
   The `body select { width: 100% }` reset below is also unlayered, and
   Tailwind's utilities sit in @layer utilities, so no utility class can
   override it. As a flex item that width becomes the flex-basis, which let
   the "side" picker claim 1182px and squeezed its flex-1 sibling to 26px.
   This keeps the reset for stacked fields while letting flexbox size this
   one. */
.select-fixed { width: 12rem; }

/* Long identifiers (route names, emails, slugs) are unbreakable tokens and
   pushed pages into horizontal scroll on narrow screens. `break-word`
   (never `anywhere`): break only inside a token that cannot fit on a line
   of its own; parents carry min-width:0 so the track can shrink. */
code, kbd, samp {
  overflow-wrap: break-word;
}

/* Overflow guards: pills never escape their boxes.
   The guard was already here but inert: every pill also sets
   `white-space: nowrap`, which wins for wrapping and let a long value push
   ~370px past the box. Truncate instead of overflowing -- audit_log.html
   already does this with .d-truncate. `.status-pill` is deliberately NOT
   listed: it is a filter control, so clipping its label would be worse than
   letting the row wrap. */
.chip,
.tag,
.badge,
.d-chip,
.seat-open-badge {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── The password toggle ────────────────────────────────────────────
   A small button inside the right edge of a password field, so a
   password can be checked instead of typed twice. The rules are here
   rather than in the page that uses them because the field is in four
   pages and the button must look the same in all of them.

   `.pw-field` is the wrapper the script puts around the input. It is
   the positioned ancestor, so `top: 50%` resolves against the INPUT's
   height and `right` against the input's width. The button used to be
   a sibling of the input with `position: relative` set on the input
   itself, which positioned it against the PAGE instead: measured 103px
   to the right of the field it controls, and 109px outside the login
   card. */
.pw-field { position: relative; display: block; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  /* 44x44, painted. It used to be a 32px button with a pseudo-element that
     grew the HIT AREA to 44 -- and the pseudo-element reached 6px above
     and below the button, into the fields that sit above and below it in
     the form. A target is not 44px when the 44px around it belongs to
     something else: WCAG 2.5.8's spacing exception needs the 44px circle
     to be free of other targets, and it was not. The button is 44 tall
     now, inside a 48px field, so it is the target. */
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* No box. It was a 44px bordered button reading "Show", which put a
     second bordered control inside the field it belongs to. An icon needs
     no frame: 44px of target, the glyph in the brand ink, and the field's
     own border is the only border in the row. */
  border: none;
  background: transparent;
  color: var(--brand-deep);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand-deep); outline-offset: -2px; border-radius: var(--radius-sm); }
.pw-toggle svg { display: block; }
