/* ==========================================================================
   Material Design 3 — token-based theme (plain CSS, no @material/web).

   Layer 1 below (--club-primary / --club-secondary) is set inline per club
   in base.html. Layer 2 derives the full M3 color-role system from those
   two brand colors using color-mix(), so every club gets a real M3 tonal
   relationship (containers, on-* pairs, outlines, tinted neutrals) without
   needing a build step to run real HCT tonal-palette generation. Error and
   the "extended" success/warning roles are fixed, not brand-derived — M3
   itself treats error this way, and success/warning aren't roles M3
   defines at all, so there's nothing brand-specific to derive them from.
   ========================================================================== */

:root {
  /* Layer 1: brand seeds. Overridden per-club inline in base.html — these
     are just a neutral fallback for pages that render with no club resolved. */
  --club-primary: #0059A0;
  --club-secondary: #0C3C60;

  /* ---- Layer 2a: color roles derived from the brand seeds ---- */
  --md-sys-color-primary: var(--club-primary);
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: color-mix(in oklch, var(--club-primary) 28%, white 72%);
  --md-sys-color-on-primary-container: color-mix(in oklch, var(--club-primary) 75%, black 25%);

  --md-sys-color-secondary: var(--club-secondary);
  --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: color-mix(in oklch, var(--club-secondary) 28%, white 72%);
  --md-sys-color-on-secondary-container: color-mix(in oklch, var(--club-secondary) 75%, black 25%);

  --md-sys-color-tertiary: color-mix(in oklch, var(--club-primary) 50%, var(--club-secondary) 50%);
  --md-sys-color-on-tertiary: #FFFFFF;
  --md-sys-color-tertiary-container: color-mix(in oklch, var(--md-sys-color-tertiary) 28%, white 72%);
  --md-sys-color-on-tertiary-container: color-mix(in oklch, var(--md-sys-color-tertiary) 75%, black 25%);

  /* Neutral surfaces are a standard M3 neutral scale, tinted a little
     towards the brand hue (M3's own neutral/neutral-variant palettes carry
     a hint of the primary's chroma rather than being pure gray). */
  --md-sys-color-surface: color-mix(in oklch, var(--club-primary) 3%, #FFFBFE 97%);
  --md-sys-color-surface-dim: color-mix(in oklch, var(--club-primary) 6%, #DDD9E0 94%);
  --md-sys-color-surface-bright: color-mix(in oklch, var(--club-primary) 3%, #FFFBFE 97%);
  --md-sys-color-surface-container-lowest: #FFFFFF;
  --md-sys-color-surface-container-low: color-mix(in oklch, var(--club-primary) 4%, #F7F3FA 96%);
  --md-sys-color-surface-container: color-mix(in oklch, var(--club-primary) 5%, #F1ECF4 95%);
  --md-sys-color-surface-container-high: color-mix(in oklch, var(--club-primary) 6%, #EBE6EE 94%);
  --md-sys-color-surface-container-highest: color-mix(in oklch, var(--club-primary) 7%, #E5E0E9 93%);
  --md-sys-color-on-surface: color-mix(in oklch, var(--club-primary) 6%, #1C1B1E 94%);
  --md-sys-color-on-surface-variant: color-mix(in oklch, var(--club-primary) 8%, #48454B 92%);
  --md-sys-color-outline: color-mix(in oklch, var(--club-primary) 10%, #78767A 90%);
  --md-sys-color-outline-variant: color-mix(in oklch, var(--club-primary) 8%, #C9C5CE 92%);
  --md-sys-color-inverse-surface: color-mix(in oklch, var(--club-primary) 6%, #313033 94%);
  --md-sys-color-inverse-on-surface: color-mix(in oklch, var(--club-primary) 3%, #F4EFF4 97%);
  --md-sys-color-scrim: #000000;
  --md-sys-color-shadow: #000000;

  /* ---- Layer 2b: fixed roles (not brand-derived, same as upstream M3) ---- */
  --md-sys-color-error: #B3261E;
  --md-sys-color-on-error: #FFFFFF;
  --md-sys-color-error-container: #F9DEDC;
  --md-sys-color-on-error-container: #410E0B;

  /* Extended (app-specific) semantic roles, in the M3 "extended color"
     style — success/warning aren't part of the M3 spec, so they get their
     own fixed, non-brand-derived palettes rather than being invented from
     primary/secondary. */
  --md-extended-color-success: #2E7D32;
  --md-extended-color-on-success: #FFFFFF;
  --md-extended-color-success-container: #C9F0C6;
  --md-extended-color-on-success-container: #072109;
  --md-extended-color-warning: #7A5900;
  --md-extended-color-on-warning: #FFFFFF;
  --md-extended-color-warning-container: #FFDEA6;
  --md-extended-color-on-warning-container: #271900;

  /* ---- Shape scale ---- */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 999px;

  /* ---- Elevation (key + ambient shadow pairs) ---- */
  --md-sys-elevation-0: none;
  --md-sys-elevation-1: 0 1px 2px 0 rgba(0, 0, 0, 0.30), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-2: 0 1px 2px 0 rgba(0, 0, 0, 0.30), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-3: 0 1px 3px 0 rgba(0, 0, 0, 0.30), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-4: 0 2px 3px 0 rgba(0, 0, 0, 0.30), 0 6px 10px 4px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-5: 0 4px 4px 0 rgba(0, 0, 0, 0.30), 0 8px 12px 6px rgba(0, 0, 0, 0.15);

  /* ---- State-layer opacities (hover/focus/pressed, per M3 spec) ---- */
  --md-sys-state-hover-opacity: 0.08;
  --md-sys-state-focus-opacity: 0.12;
  --md-sys-state-pressed-opacity: 0.12;

  /* ---- Type scale: size / line-height / weight / tracking per role ---- */
  --md-sys-typescale-headline-large-size: 2rem;
  --md-sys-typescale-headline-large-line-height: 2.5rem;
  --md-sys-typescale-headline-large-weight: 400;

  --md-sys-typescale-headline-medium-size: 1.75rem;
  --md-sys-typescale-headline-medium-line-height: 2.25rem;
  --md-sys-typescale-headline-medium-weight: 400;

  --md-sys-typescale-headline-small-size: 1.5rem;
  --md-sys-typescale-headline-small-line-height: 2rem;
  --md-sys-typescale-headline-small-weight: 400;

  --md-sys-typescale-title-large-size: 1.375rem;
  --md-sys-typescale-title-large-line-height: 1.75rem;
  --md-sys-typescale-title-large-weight: 400;

  --md-sys-typescale-title-medium-size: 1rem;
  --md-sys-typescale-title-medium-line-height: 1.5rem;
  --md-sys-typescale-title-medium-weight: 500;
  --md-sys-typescale-title-medium-tracking: 0.009375rem;

  --md-sys-typescale-title-small-size: 0.875rem;
  --md-sys-typescale-title-small-line-height: 1.25rem;
  --md-sys-typescale-title-small-weight: 500;
  --md-sys-typescale-title-small-tracking: 0.00625rem;

  --md-sys-typescale-body-large-size: 1rem;
  --md-sys-typescale-body-large-line-height: 1.5rem;
  --md-sys-typescale-body-large-weight: 400;
  --md-sys-typescale-body-large-tracking: 0.03125rem;

  --md-sys-typescale-body-medium-size: 0.875rem;
  --md-sys-typescale-body-medium-line-height: 1.25rem;
  --md-sys-typescale-body-medium-weight: 400;
  --md-sys-typescale-body-medium-tracking: 0.015625rem;

  --md-sys-typescale-body-small-size: 0.75rem;
  --md-sys-typescale-body-small-line-height: 1rem;
  --md-sys-typescale-body-small-weight: 400;
  --md-sys-typescale-body-small-tracking: 0.025rem;

  --md-sys-typescale-label-large-size: 0.875rem;
  --md-sys-typescale-label-large-line-height: 1.25rem;
  --md-sys-typescale-label-large-weight: 500;
  --md-sys-typescale-label-large-tracking: 0.00625rem;

  --md-sys-typescale-label-medium-size: 0.75rem;
  --md-sys-typescale-label-medium-line-height: 1rem;
  --md-sys-typescale-label-medium-weight: 500;
  --md-sys-typescale-label-medium-tracking: 0.03125rem;

  --md-sys-typescale-label-small-size: 0.6875rem;
  --md-sys-typescale-label-small-line-height: 1rem;
  --md-sys-typescale-label-small-weight: 500;
  --md-sys-typescale-label-small-tracking: 0.03125rem;

  /* Club-brand highlight stripe colour for "box" components (header,
     .profile-card, .empty-state, .config-panel, .table-scroll,
     .info-dialog). Defaults to secondary; a box nested inside another box
     switches this to primary (see the nested-box `:is()` rule in "Cards &
     panels" below) so two nested stripes read as distinct layers instead
     of just doubling up on the same colour. */
  --box-accent: var(--md-sys-color-secondary);

  /* Background for the same "box" components listed above. A nested box
     (e.g. .table-scroll inside .config-panel, as on "Club Users") steps
     this up one surface-container tier so it reads as sitting a shade
     lighter on top of its parent instead of blending flush into it — see
     the nested-box `:is()` rule below, which overrides this the same way
     it overrides --box-accent. */
  --box-surface: var(--md-sys-color-surface-container-low);

  /* .button-danger's fill — defaults to the plain error/on-error pair
     (a solid, properly dark red in light mode). Dark mode overrides this
     below: --md-sys-color-error itself is the *light*, pale-pink M3
     tone-inverted accent (correct for icon-button-danger's text/icon use
     elsewhere), which read as too washed-out for a solid filled button —
     see the dark-mode override for the actual darker red used instead. */
  --button-danger-bg: var(--md-sys-color-error);
  --button-danger-color: var(--md-sys-color-on-error);

  /* Hints the browser to theme its own native chrome (scrollbars, form
     control defaults, etc.) for whichever scheme is actually active —
     "light dark" here since :root itself is the light palette until one
     of the overrides below (system dark, or an explicit override) wins. */
  color-scheme: light dark;
}

/* ==========================================================================
   Dark mode — three-way: system preference (auto, the default), or an
   explicit override persisted client-side (see the theme switcher script
   in base.html, which sets/clears documentElement[data-theme]). Every
   token below is the exact same brand-derivation technique as the light
   palette above, just re-rooted in dark neutrals — and, for the accent
   pairs (primary/secondary/tertiary/success/warning), with the tone
   direction inverted the way real M3 dark schemes do: the plain role
   (e.g. "primary") becomes the light, legible-on-dark-surface tone, and
   "on-primary" becomes the dark tone that was primary-container's own
   on-color in light mode — so an accent still reads as the same brand
   hue, just flipped to work against a near-black surface instead of a
   near-white one.

   Colour-scheme media query first, explicit override second — deliberate
   order: an explicit choice must always win regardless of source order,
   but keeping "system, then explicit" here matches the light-mode-first
   structure above and keeps this file readable top-to-bottom as
   "increasingly specific wins." The :not([data-theme="light"]) guard is
   what actually lets an explicit light choice override a dark system
   preference; :root[data-theme="dark"]'s own higher specificity is what
   lets an explicit dark choice override a light system preference.
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --md-sys-color-primary: color-mix(in oklch, var(--club-primary) 55%, white 45%);
    --md-sys-color-on-primary: color-mix(in oklch, var(--club-primary) 75%, black 25%);
    --md-sys-color-primary-container: color-mix(in oklch, var(--club-primary) 40%, black 60%);
    --md-sys-color-on-primary-container: color-mix(in oklch, var(--club-primary) 20%, white 80%);

    --md-sys-color-secondary: color-mix(in oklch, var(--club-secondary) 55%, white 45%);
    --md-sys-color-on-secondary: color-mix(in oklch, var(--club-secondary) 75%, black 25%);
    --md-sys-color-secondary-container: color-mix(in oklch, var(--club-secondary) 40%, black 60%);
    --md-sys-color-on-secondary-container: color-mix(in oklch, var(--club-secondary) 20%, white 80%);

    --md-sys-color-tertiary: color-mix(
      in oklch,
      color-mix(in oklch, var(--club-primary) 50%, var(--club-secondary) 50%) 55%,
      white 45%
    );
    --md-sys-color-on-tertiary: color-mix(
      in oklch,
      color-mix(in oklch, var(--club-primary) 50%, var(--club-secondary) 50%) 75%,
      black 25%
    );
    --md-sys-color-tertiary-container: color-mix(
      in oklch,
      color-mix(in oklch, var(--club-primary) 50%, var(--club-secondary) 50%) 40%,
      black 60%
    );
    --md-sys-color-on-tertiary-container: color-mix(
      in oklch,
      color-mix(in oklch, var(--club-primary) 50%, var(--club-secondary) 50%) 20%,
      white 80%
    );

    /* Neutral tones start from the M3 baseline dark palette but widen the
       gap between tiers considerably (M3's own baseline container/
       container-high/container-highest steps read as near-identical
       panels in practice — feedback from real use, 2026-08-11) so a
       card/header/table stands out clearly against the page background
       and against each other, not just against pure black. Tinted
       towards the brand hue by the same percentages light mode uses. */
    --md-sys-color-surface: color-mix(in oklch, var(--club-primary) 3%, #141218 97%);
    --md-sys-color-surface-dim: color-mix(in oklch, var(--club-primary) 3%, #141218 97%);
    --md-sys-color-surface-bright: color-mix(in oklch, var(--club-primary) 6%, #545057 94%);
    --md-sys-color-surface-container-lowest: color-mix(in oklch, var(--club-primary) 2%, #0F0D13 98%);
    --md-sys-color-surface-container-low: color-mix(in oklch, var(--club-primary) 4%, #2C2A30 96%);
    --md-sys-color-surface-container: color-mix(in oklch, var(--club-primary) 5%, #36343B 95%);
    --md-sys-color-surface-container-high: color-mix(in oklch, var(--club-primary) 6%, #403D45 94%);
    --md-sys-color-surface-container-highest: color-mix(in oklch, var(--club-primary) 7%, #4B474F 93%);
    --md-sys-color-on-surface: color-mix(in oklch, var(--club-primary) 4%, #E6E0E9 96%);
    --md-sys-color-on-surface-variant: color-mix(in oklch, var(--club-primary) 6%, #CAC4D0 94%);
    --md-sys-color-outline: color-mix(in oklch, var(--club-primary) 8%, #938F99 92%);
    --md-sys-color-outline-variant: color-mix(in oklch, var(--club-primary) 6%, #49454F 94%);
    --md-sys-color-inverse-surface: color-mix(in oklch, var(--club-primary) 4%, #E6E0E9 96%);
    --md-sys-color-inverse-on-surface: color-mix(in oklch, var(--club-primary) 6%, #322F35 94%);
    --md-sys-color-scrim: #000000;
    --md-sys-color-shadow: #000000;

    /* Fixed roles: real M3 baseline dark values, not brand-derived —
       same reasoning as the light palette's own fixed error role. */
    --md-sys-color-error: #F2B8B5;
    --md-sys-color-on-error: #601410;
    --md-sys-color-error-container: #8C1D18;
    --md-sys-color-on-error-container: #F9DEDC;

    /* Extended success/warning: same tone-inversion formula as the accent
       pairs above, rooted at the identical light-mode base colours so
       both schemes are recognisably the same hue. The *-container tones
       (.flash-success/.toast backgrounds) are mixed a little lighter than
       the 40/60 split used elsewhere in this file — at 40% they read as
       barely distinguishable from the surrounding dark panel backgrounds. */
    --md-extended-color-success: color-mix(in oklch, #2E7D32 55%, white 45%);
    --md-extended-color-on-success: color-mix(in oklch, #2E7D32 75%, black 25%);
    --md-extended-color-success-container: color-mix(in oklch, #2E7D32 60%, black 40%);
    --md-extended-color-on-success-container: color-mix(in oklch, #2E7D32 20%, white 80%);
    --md-extended-color-warning: color-mix(in oklch, #7A5900 55%, white 45%);
    --md-extended-color-on-warning: color-mix(in oklch, #7A5900 75%, black 25%);
    --md-extended-color-warning-container: color-mix(in oklch, #7A5900 60%, black 40%);
    --md-extended-color-on-warning-container: color-mix(in oklch, #7A5900 20%, white 80%);

    /* .button-danger: the light-mode error red, not the pale-pink
       tone-inverted --md-sys-color-error dark accent — see the comment
       on --button-danger-bg's :root default above. */
    --button-danger-bg: #B3261E;
    --button-danger-color: #FFFFFF;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --md-sys-color-primary: color-mix(in oklch, var(--club-primary) 55%, white 45%);
  --md-sys-color-on-primary: color-mix(in oklch, var(--club-primary) 75%, black 25%);
  --md-sys-color-primary-container: color-mix(in oklch, var(--club-primary) 40%, black 60%);
  --md-sys-color-on-primary-container: color-mix(in oklch, var(--club-primary) 20%, white 80%);

  --md-sys-color-secondary: color-mix(in oklch, var(--club-secondary) 55%, white 45%);
  --md-sys-color-on-secondary: color-mix(in oklch, var(--club-secondary) 75%, black 25%);
  --md-sys-color-secondary-container: color-mix(in oklch, var(--club-secondary) 40%, black 60%);
  --md-sys-color-on-secondary-container: color-mix(in oklch, var(--club-secondary) 20%, white 80%);

  --md-sys-color-tertiary: color-mix(
    in oklch,
    color-mix(in oklch, var(--club-primary) 50%, var(--club-secondary) 50%) 55%,
    white 45%
  );
  --md-sys-color-on-tertiary: color-mix(
    in oklch,
    color-mix(in oklch, var(--club-primary) 50%, var(--club-secondary) 50%) 75%,
    black 25%
  );
  --md-sys-color-tertiary-container: color-mix(
    in oklch,
    color-mix(in oklch, var(--club-primary) 50%, var(--club-secondary) 50%) 40%,
    black 60%
  );
  --md-sys-color-on-tertiary-container: color-mix(
    in oklch,
    color-mix(in oklch, var(--club-primary) 50%, var(--club-secondary) 50%) 20%,
    white 80%
  );

  --md-sys-color-surface: color-mix(in oklch, var(--club-primary) 3%, #141218 97%);
  --md-sys-color-surface-dim: color-mix(in oklch, var(--club-primary) 3%, #141218 97%);
  --md-sys-color-surface-bright: color-mix(in oklch, var(--club-primary) 6%, #545057 94%);
  --md-sys-color-surface-container-lowest: color-mix(in oklch, var(--club-primary) 2%, #0F0D13 98%);
  --md-sys-color-surface-container-low: color-mix(in oklch, var(--club-primary) 4%, #2C2A30 96%);
  --md-sys-color-surface-container: color-mix(in oklch, var(--club-primary) 5%, #36343B 95%);
  --md-sys-color-surface-container-high: color-mix(in oklch, var(--club-primary) 6%, #403D45 94%);
  --md-sys-color-surface-container-highest: color-mix(in oklch, var(--club-primary) 7%, #4B474F 93%);
  --md-sys-color-on-surface: color-mix(in oklch, var(--club-primary) 4%, #E6E0E9 96%);
  --md-sys-color-on-surface-variant: color-mix(in oklch, var(--club-primary) 6%, #CAC4D0 94%);
  --md-sys-color-outline: color-mix(in oklch, var(--club-primary) 8%, #938F99 92%);
  --md-sys-color-outline-variant: color-mix(in oklch, var(--club-primary) 6%, #49454F 94%);
  --md-sys-color-inverse-surface: color-mix(in oklch, var(--club-primary) 4%, #E6E0E9 96%);
  --md-sys-color-inverse-on-surface: color-mix(in oklch, var(--club-primary) 6%, #322F35 94%);
  --md-sys-color-scrim: #000000;
  --md-sys-color-shadow: #000000;

  --md-sys-color-error: #F2B8B5;
  --md-sys-color-on-error: #601410;
  --md-sys-color-error-container: #8C1D18;
  --md-sys-color-on-error-container: #F9DEDC;

  --md-extended-color-success: color-mix(in oklch, #2E7D32 55%, white 45%);
  --md-extended-color-on-success: color-mix(in oklch, #2E7D32 75%, black 25%);
  --md-extended-color-success-container: color-mix(in oklch, #2E7D32 60%, black 40%);
  --md-extended-color-on-success-container: color-mix(in oklch, #2E7D32 20%, white 80%);
  --md-extended-color-warning: color-mix(in oklch, #7A5900 55%, white 45%);
  --md-extended-color-on-warning: color-mix(in oklch, #7A5900 75%, black 25%);
  --md-extended-color-warning-container: color-mix(in oklch, #7A5900 60%, black 40%);
  --md-extended-color-on-warning-container: color-mix(in oklch, #7A5900 20%, white 80%);

  --button-danger-bg: #B3261E;
  --button-danger-color: #FFFFFF;

  color-scheme: dark;
}

/* An explicit light override needs no token redefinitions of its own —
   :root's own values already are the light palette; this only exists so
   the dark media query's :not([data-theme="light"]) guard has something
   concrete to key off, and so native browser chrome is hinted correctly
   even when the system itself prefers dark. */
:root[data-theme="light"] {
  color-scheme: light;
}

/* ==========================================================================
   Base
   ========================================================================== */

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  letter-spacing: var(--md-sys-typescale-body-large-tracking);
}

h1 {
  font-size: var(--md-sys-typescale-headline-small-size);
  line-height: var(--md-sys-typescale-headline-small-line-height);
  font-weight: var(--md-sys-typescale-headline-small-weight);
  color: var(--md-sys-color-on-surface);
  margin: 0 0 0.25rem;
}

h2 {
  font-size: var(--md-sys-typescale-title-large-size);
  line-height: var(--md-sys-typescale-title-large-line-height);
  font-weight: var(--md-sys-typescale-title-large-weight);
  color: var(--md-sys-color-on-surface);
  margin: 0 0 0.5rem;
}

h3 {
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line-height);
  font-weight: var(--md-sys-typescale-title-medium-weight);
  letter-spacing: var(--md-sys-typescale-title-medium-tracking);
  color: var(--md-sys-color-on-surface);
  margin: 0 0 0.5rem;
}

a {
  color: var(--md-sys-color-primary);
}

/* ==========================================================================
   Top app bar + navigation
   ========================================================================== */

header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: -1rem -1rem 1rem;
  padding: 0.875rem 1rem;
  background: var(--md-sys-color-surface-container-low);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  /* Club-brand highlight stripe. A box-shadow rather than border-top so it
     survives the desktop breakpoint's `border` shorthand below untouched,
     and so it follows the header's border-radius there instead of
     squaring off the corners. */
  box-shadow: inset 0 3px 0 0 var(--box-accent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  font-size: var(--md-sys-typescale-title-large-size);
  line-height: var(--md-sys-typescale-title-large-line-height);
  font-weight: 500;
}

.club-logo {
  height: 32px;
  width: auto;
  border-radius: var(--md-sys-shape-corner-small);
}

.brand-club-name {
  font-weight: 500;
}

/* The "Fill-In Finder" module label next to a club's own name is
   de-emphasized because the club identifies the tenant. On platform-only
   pages .brand-club-name instead renders the full-weight Clubsie wordmark. */
.brand-tagline {
  font-size: var(--md-sys-typescale-body-medium-size);
  font-weight: 400;
  color: var(--md-sys-color-on-surface-variant);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 -0.5rem;
}

nav a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
}

nav a:hover,
nav a:focus-visible {
  background: color-mix(in oklch, var(--md-sys-color-on-surface) 8%, transparent);
}

nav a.nav-link-active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
}

/* Contextual navigation for the selected Clubsie module. The primary row
   chooses the module; this smaller, tinted row contains only that module's
   destinations. It wraps naturally on narrow screens like the primary row. */
.module-nav {
  gap: 0.125rem;
  margin: 0.125rem -0.25rem -0.25rem;
  padding: 0.375rem 0.25rem;
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-primary-container);
}

.module-nav a {
  min-height: 2.25rem;
  padding: 0 0.625rem;
  color: var(--md-sys-color-on-primary-container);
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line-height);
  font-weight: var(--md-sys-typescale-label-medium-weight);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
}

.module-nav a:hover,
.module-nav a:focus-visible {
  background: color-mix(in oklch, var(--md-sys-color-on-primary-container) 8%, transparent);
}

.module-nav a.nav-link-active {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

/* "Admin" nav menu — a <details>/<summary> disclosure (same pattern as
   .withdrawn-profiles) rather than JS, so it works with no script and
   degrades to a plain expanding block if positioning isn't supported. */
nav details {
  position: relative;
}

nav summary {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  cursor: pointer;
  list-style: none;
}

nav summary::-webkit-details-marker {
  display: none;
}

nav summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  margin-top: -0.15rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

nav summary:hover,
nav summary:focus-visible {
  background: color-mix(in oklch, var(--md-sys-color-on-surface) 8%, transparent);
}

nav details[open] > summary {
  background: color-mix(in oklch, var(--md-sys-color-primary) 12%, transparent);
  color: var(--md-sys-color-primary);
}

nav details[open] > summary::after {
  margin-top: 0.15rem;
  transform: rotate(-135deg);
}

.nav-menu-items {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 11rem;
  padding: 0.4rem;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-small);
  box-shadow: var(--md-sys-elevation-2);
}

.nav-menu-items a,
.nav-menu-items button {
  min-height: 2.5rem;
  border-radius: var(--md-sys-shape-corner-extra-small);
}

/* Cog / account-settings menu — same disclosure as "Admin" above, but
   icon-only (no label, no expand arrow) and pinned to the row's right
   edge so it reads as a persistent account control rather than a nav
   link. */
.nav-menu-cog {
  margin-left: auto;
}

.nav-menu-cog > summary {
  gap: 0;
  padding: 0 0.6rem;
}

.nav-menu-cog > summary::after {
  content: none;
}

.nav-menu-items-right {
  left: auto;
  right: 0;
}

.nav-menu-items form {
  margin: 0;
}

/* Matches "nav a"'s label-large typescale explicitly, since that rule
   only targets <a> elements and this button (Reset Password) otherwise
   falls back to the inherited body font, reading visibly smaller/lighter
   than "Log out" right next to it. */
.nav-menu-items button {
  display: flex;
  align-items: center;
  /* The generic "button" rule below sets justify-content: center for
     regular buttons; this one needs to read as a left-aligned menu row
     like "Log out" next to it, not have its label centered. */
  justify-content: flex-start;
  width: 100%;
  padding: 0 0.75rem;
  border: none;
  background: none;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.nav-menu-items button:hover,
.nav-menu-items button:focus-visible {
  background: color-mix(in oklch, var(--md-sys-color-on-surface) 8%, transparent);
}

/* Light/Dark/Auto — a compact segmented control, not more menu rows, so
   it needs to override quite a bit of .nav-menu-items button's own
   full-width/left-aligned row styling above (same specificity, so
   source order — this comes after — is what actually wins). */
.theme-switcher {
  display: flex;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
}

.theme-switcher button {
  flex: 1;
  width: auto;
  min-height: 2rem;
  justify-content: center;
  padding: 0.3rem 0;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-extra-small);
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-medium-size);
  line-height: var(--md-sys-typescale-label-medium-line-height);
}

.theme-switcher button[aria-pressed="true"] {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
}

.theme-switcher button:hover {
  background: color-mix(in oklch, var(--md-sys-color-on-surface) 8%, transparent);
}

.theme-switcher button[aria-pressed="true"]:hover {
  background: color-mix(in oklch, var(--md-sys-color-secondary-container) 92%, var(--md-sys-color-on-secondary-container) 8%);
}

@media (min-width: 600px) {
  header {
    border-radius: var(--md-sys-shape-corner-large);
    margin: 0 0 1.5rem;
    border: 1px solid var(--md-sys-color-outline-variant);
  }
}

/* ==========================================================================
   Flash messages (M3 banner-style)
   ========================================================================== */

.flashes {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.5rem;
}

.flashes li {
  padding: 0.75rem 1rem;
  border-radius: var(--md-sys-shape-corner-medium);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
  /* Default/uncategorized flashes (e.g. Flask-Login's own
     login-required redirect, category "message") get a neutral tonal
     background — only .flash-error/.flash-success override this. */
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}

.flash-error {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.flash-success {
  background: var(--md-extended-color-success-container);
  color: var(--md-extended-color-on-success-container);
}

span.flash-error {
  display: block;
  background: none;
  padding: 0;
  color: var(--md-sys-color-error);
  font-size: var(--md-sys-typescale-body-small-size);
}

/* ==========================================================================
   Toasts (M3 snackbar-style) — "success" flashes only; see the split in
   base.html and docs/work/0008-toast-confirmations.md. Fixed near the
   bottom of the viewport rather than at the top with .flashes, since a
   toast should surface near wherever the action just happened, not
   require scrolling back up to be seen.
   ========================================================================== */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 20;
  display: grid;
  gap: 0.5rem;
  width: min(28rem, calc(100vw - 2rem));
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--md-sys-shape-corner-medium);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
  background: var(--md-extended-color-success-container);
  color: var(--md-extended-color-on-success-container);
  box-shadow: var(--md-sys-elevation-2);
}

.toast-close {
  flex-shrink: 0;
  min-height: auto;
  min-width: auto;
  padding: 0.15rem 0.5rem;
  background: none;
  border: none;
  border-radius: var(--md-sys-shape-corner-small);
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover {
  background: color-mix(in oklch, var(--md-extended-color-on-success-container) 12%, transparent);
  box-shadow: none;
}

/* ==========================================================================
   Notice banner (site-wide, e.g. open help requests)
   ========================================================================== */

.notice-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-extended-color-warning-container);
  color: var(--md-extended-color-on-warning-container);
  font-size: var(--md-sys-typescale-body-medium-size);
}

.notice-banner p {
  margin: 0;
}

.notice-banner a {
  color: inherit;
  font-weight: var(--md-sys-typescale-label-large-weight);
}

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

button,
input[type="submit"],
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  padding: 0.5rem 1.5rem;
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: var(--md-sys-typescale-label-large-weight);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

button:hover,
input[type="submit"]:hover,
.button:hover {
  background: color-mix(in oklch, var(--md-sys-color-primary) 92%, var(--md-sys-color-on-primary) 8%);
  box-shadow: var(--md-sys-elevation-1);
}

button:focus-visible,
input[type="submit"]:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.button-secondary {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.button-secondary:hover {
  background: color-mix(in oklch, var(--md-sys-color-primary) 8%, transparent);
  box-shadow: none;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  background: none;
  color: var(--md-sys-color-error);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
  padding: 0.4rem;
}

.icon-button:hover {
  background: color-mix(in oklch, var(--md-sys-color-error) 8%, transparent);
  border-color: var(--md-sys-color-error);
  box-shadow: none;
}

.icon-button-neutral {
  color: var(--md-sys-color-primary);
}

.icon-button-neutral:hover {
  background: color-mix(in oklch, var(--md-sys-color-primary) 8%, transparent);
  border-color: var(--md-sys-color-primary);
  box-shadow: none;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==========================================================================
   Cards & panels
   ========================================================================== */

.profile-card,
.empty-state,
.profile-form fieldset,
.consent-box,
.config-panel {
  background: var(--box-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 1rem;
}

/* Club-brand highlight, same technique as header's top stripe. */
.profile-card,
.empty-state {
  box-shadow: inset 0 3px 0 0 var(--box-accent);
}

.config-panel {
  margin-bottom: 1rem;
  box-shadow: inset 0 3px 0 0 var(--box-accent);
}

/* A box nested inside another box (e.g. a .table-scroll or .empty-state
   inside a .config-panel, both used throughout the admin pages — see
   "Club Users") switches to the primary colour for its own stripe, so the
   two don't just double up on an identical secondary line, and sits a
   shade between the page background and a first-level panel — reading as
   recessed into its parent rather than another card stacked on top of
   it, and clearly distinct from the parent's own background either way. */
:is(.profile-card, .empty-state, .config-panel, .table-scroll, .info-dialog)
  :is(.profile-card, .empty-state, .config-panel, .table-scroll, .info-dialog) {
  --box-accent: var(--md-sys-color-primary);
  --box-surface: color-mix(
    in oklch,
    var(--md-sys-color-surface) 50%,
    var(--md-sys-color-surface-container-low) 50%
  );
}

.config-panel h2 {
  color: var(--md-sys-color-on-surface);
  margin-top: 0;
}

.consent-box {
  background: var(--md-sys-color-surface-container);
}

.page-heading,
.profile-card-heading,
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Breathing room before whatever boxed content (.config-panel,
   .profile-card, .table-scroll, ...) follows the page's unboxed intro
   heading/text — without this, that first box sits right up against the
   intro paragraph with no visual separation. */
.page-heading {
  margin-bottom: 1.5rem;
}

.page-heading h1,
.page-heading h2,
.profile-card h2 {
  margin-bottom: 0;
}

.page-heading p,
.profile-card-heading p {
  margin: 0.25rem 0 0;
  color: var(--md-sys-color-on-surface-variant);
}

.profile-list {
  display: grid;
  gap: 1rem;
  margin: 0 0 1rem;
}

.profile-details {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.profile-details div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.1rem;
}

.profile-details dt {
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}

.profile-details dd {
  margin: 0;
}

.withdraw-form {
  margin-top: 1rem;
}

.withdrawn-profiles {
  margin-top: 1.5rem;
}

.withdrawn-profiles summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}

.form-intro {
  color: var(--md-sys-color-on-surface-variant);
}

/* ==========================================================================
   Forms (M3 outlined text field, simplified for server-rendered markup —
   labels stay static above the field rather than the JS-free floating-label
   trick, since WTForms doesn't reliably emit placeholders to hook it on)
   ========================================================================== */

.role-choice {
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}

.role-choice legend {
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  padding: 0 0.25rem;
}

.role-option {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.5rem;
  align-items: baseline;
  padding: 0.35rem 0;
  cursor: pointer;
}

.role-name {
  font-weight: 600;
}

.role-description {
  grid-column: 2;
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--md-sys-color-on-surface-variant);
}

.profile-form {
  display: grid;
  gap: 1rem;
}

.profile-form fieldset {
  margin: 0;
}

.profile-form legend {
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  padding: 0 0.25rem;
}

.form-field {
  display: grid;
  gap: 0.35rem;
}

.form-field > label {
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-size);
  font-weight: 500;
}

.form-field input,
.form-field select,
.form-field textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small);
  padding: 0.6rem 0.75rem;
  font: inherit;
}

.form-field textarea {
  min-height: 4.5rem;
}

.form-field input:focus-visible,
.form-field select:focus-visible,
.form-field textarea:focus-visible {
  outline: none;
  border: 2px solid var(--md-sys-color-primary);
  padding: calc(0.6rem - 1px) calc(0.75rem - 1px);
}

.choice-list {
  display: grid;
  gap: 0.5rem;
}

.choice-list label,
.consent-box > label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  min-height: 2.5rem;
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--md-sys-color-primary);
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
}

.field-hint {
  display: block;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-small-size);
}

.form-actions {
  justify-content: flex-start;
}

.inline-form {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.inline-form .form-field {
  flex: 1 1 14rem;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-scroll {
  overflow-x: auto;
  background: var(--box-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  /* Actual border, not the box-shadow trick used elsewhere: the sticky
     first/last column cells paint their own opaque background right at
     this container's top edge, which would hide an inset shadow there. A
     real border sits outside the padding box, so it stays visible. */
  border-top: 3px solid var(--box-accent);
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-scroll table {
  white-space: nowrap;
}

/* Every .table-scroll table here follows the same shape: an identifying
   first column (name/label) and an actions/details last column, with
   whatever's in between (status, dates, config values) being the part
   that's fine to scroll past. Pinning those two ends means a narrow
   screen never has to horizontally scroll just to see which row this is
   or reach the button that acts on it — the scrollable middle columns
   are still reachable by swiping, they just aren't load-bearing for
   identifying the row or acting on it. Inert (no visible effect) whenever
   the table already fits without scrolling, e.g. on wider screens. */
.table-scroll th:first-child,
.table-scroll td:first-child,
.table-scroll th:last-child,
.table-scroll td:last-child {
  position: sticky;
  /* Must track .table-scroll's own background (--box-surface, inherited
     from the ancestor table-scroll element) rather than a fixed token —
     a nested .table-scroll steps up a tier via the rule above, and these
     opaque sticky cells would otherwise paint the wrong, mismatched
     shade underneath the scrolling columns. */
  background: var(--box-surface);
}

.table-scroll th:first-child,
.table-scroll td:first-child {
  left: 0;
}

.table-scroll th:last-child,
.table-scroll td:last-child {
  right: 0;
}

/* Opt-out for a table whose last column isn't an actions/details column
   (see the comment above) -- e.g. global_admin/emails.html, where the last
   column is just one more tracking-status field, arbitrarily last rather
   than load-bearing the way a Manage/Edit action is elsewhere. Pinning it
   would just be a stray fixed column with no purpose. */
.table-scroll.table-no-sticky-last th:last-child,
.table-scroll.table-no-sticky-last td:last-child {
  position: static;
  background: none;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  font-size: var(--md-sys-typescale-body-medium-size);
}

th {
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  font-size: var(--md-sys-typescale-label-large-size);
}

/* Sortable column headers (e.g. admin/competitions.html's Age Groups
   table): the whole header is a link so its full width/height is
   clickable, not just the text. */
.sortable-header {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: inherit;
  text-decoration: none;
}

.sortable-header:hover {
  text-decoration: underline;
}

.sort-indicator {
  font-size: 0.7em;
  color: var(--md-sys-color-outline);
}

.sortable-header-active .sort-indicator {
  color: var(--md-sys-color-on-surface-variant);
}

/* ==========================================================================
   Status pills (M3 "assist chip"-style: outlined, not filled — a filled
   pill reads as the same kind of control as a filled button, which is
   exactly what these need to *not* look like next to actions like
   Deactivate/Reactivate. Transparent/surface background, a currentColor
   border, and coloured text instead — informational, not actionable.)
   ========================================================================== */

.status-pill {
  display: inline-block;
  border-radius: var(--md-sys-shape-corner-full);
  border: 1px solid currentColor;
  padding: 0.15rem 0.65rem;
  background: transparent;
  font-size: var(--md-sys-typescale-label-medium-size);
  font-weight: var(--md-sys-typescale-label-medium-weight);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
}

.status-active,
.status-accepted,
.status-open,
.status-closed-filled,
.status-available,
.status-clear,
.status-sent {
  color: var(--md-extended-color-success);
}

.status-inactive,
.status-expired,
.status-superseded,
.status-closed-enough,
.status-resolved,
.status-unknown {
  color: var(--md-sys-color-on-surface-variant);
}

.status-pending,
.status-discussion-needed {
  color: var(--md-extended-color-warning);
}

.status-cancelled,
.status-not-available,
.status-clash,
.status-revoked,
.status-failed {
  color: var(--md-sys-color-error);
}

/* ==========================================================================
   Info dialog (M3-styled native <dialog> — no JS beyond the one-line
   showModal() call in the trigger button's onclick; closing is a plain
   method="dialog" form, handled natively by the browser)
   ========================================================================== */

.info-dialog {
  width: min(28rem, calc(100vw - 2rem));
  padding: 1.25rem;
  border: none;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  box-shadow: inset 0 3px 0 0 var(--box-accent), var(--md-sys-elevation-3);
  /* Undo the ancestor <table>'s white-space: nowrap (for its own
     horizontal-scroll behavior) — a <dialog> renders in the top layer but
     is still a DOM descendant for inheritance, so without this its content
     would try to render as one unbreakable line too. */
  white-space: normal;
}

.info-dialog::backdrop {
  background: color-mix(in oklch, var(--md-sys-color-scrim) 32%, transparent);
}

.info-dialog h4 {
  margin: 0 0 1rem;
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line-height);
  font-weight: var(--md-sys-typescale-title-medium-weight);
  overflow-wrap: break-word;
}

.info-dialog .form-actions {
  margin-top: 1.25rem;
}

/* A "Cancel"/"Close" .button-secondary inside a dialog gets a solid
   tonal fill (M3 "Filled Tonal Button") instead of its usual
   transparent-with-outline look — next to a solid filled action button
   (e.g. .button-danger's "Deactivate") a transparent button reads as
   barely a button at all. Uses the club's own primary-container/
   on-primary-container pair (brand-derived, see --club-primary in
   base.html) rather than a neutral grey, so it's clearly a branded,
   visible control. */
.info-dialog .button-secondary {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: transparent;
}

.info-dialog .button-secondary:hover {
  background: color-mix(in oklch, var(--md-sys-color-primary-container) 85%, var(--md-sys-color-on-primary-container) 15%);
}

/* ==========================================================================
   Misc
   ========================================================================== */

.graphic-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.graphic-preview form {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   KB Chat: member answer display
   ========================================================================== */

.kb-chat-answer h2 {
  font-size: var(--md-sys-typescale-title-medium-size);
  margin-bottom: 0.25rem;
}

.kb-chat-answer h2:not(:first-child) {
  margin-top: 1rem;
}

.kb-chat-rating {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

.kb-chat-rating form {
  margin: 0;
}

/* ==========================================================================
   KB Chat: admin pages
   ========================================================================== */

.button-danger {
  background: var(--button-danger-bg);
  color: var(--button-danger-color);
}

.button-danger:hover {
  background: color-mix(in oklch, var(--button-danger-bg) 92%, var(--button-danger-color) 8%);
}

.truncate {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-chat-citation-list {
  margin: 0.5rem 0;
}

.kb-chat-citation-list ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.kb-chat-signal-icons {
  display: inline-flex;
  gap: 0.35rem;
}

.kb-chat-filter-form summary {
  cursor: pointer;
  font-weight: var(--md-sys-typescale-label-large-weight);
  margin-bottom: 0.5rem;
}

.kb-chat-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0.5rem 0 1rem;
}

.kb-chat-filter-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--md-sys-typescale-body-medium-size);
}

.kb-health-item {
  margin-bottom: 1rem;
}

/* ==========================================================================
   Responsive breakpoints (mobile-first; base rules above already target
   phone width — these widen things out for tablet/desktop, roughly M3's
   compact / medium / expanded window-size classes)
   ========================================================================== */

@media (min-width: 600px) {
  body {
    padding: 1.5rem;
  }

  h1 {
    font-size: var(--md-sys-typescale-headline-medium-size);
    line-height: var(--md-sys-typescale-headline-medium-line-height);
  }

  .profile-details div {
    grid-template-columns: minmax(7rem, 1fr) 2fr;
    gap: 0.75rem;
  }

  .profile-form {
    max-width: 30rem;
  }
}

@media (min-width: 905px) {
  body {
    /* 840px was still capping desktop uncomfortably narrow for the
       data-heavy admin tables (Age Groups, Emails, Clubs, ...); wide
       screens have the room. */
    max-width: 1100px;
  }
}
