/* ==========================================================================
   Troop 37 & 201 — site styles
   1. Tokens (light, then dark)   2. Base   3. Bootstrap mapped onto tokens
   4. Design-system components (docs/design/system.md)   5. Page-specific styles
   Fonts: Roboto Slab (display) + Roboto (body) + Roboto Condensed (labels/nav), loaded in base.html.
   Spacing follows an 8-pt scale (0.5rem steps).
   Theme: <html data-bs-theme="light|dark"> is set before paint by base.html from the saved
   choice (light / dark / auto); without JS the prefers-color-scheme block below applies.
   ========================================================================== */

:root {
  /* ---- Brand palette: Scouting America official values (docs/research/04 §4.1). Never used
     directly in components; components use the role tokens further down. ---- */
  --c-forest: #243E2C;        /* Scouts BSA Olive: primary */
  --c-forest-deep: #182b1e;
  --c-forest-ink: #0f1c13;
  --c-moss: #006B3F;          /* Venturing Green: positive states */
  --c-moss-soft: #e1ede6;
  --c-sand: #D6CEBD;          /* Tan */
  --c-sand-soft: #E9E9E4;     /* Light Tan */
  --c-sand-deep: #AD9D7B;     /* Dark Tan: borders/fills only, never text */
  --c-ember: #CE1126;         /* Scouting America Red: the one primary CTA per screen */
  --c-ember-deep: #a30d1e;
  --c-ember-soft: #f8e3e5;
  --c-red: #CE1126;
  --c-red-deep: #a30d1e;
  --c-black: #232528;         /* Dark Gray: body text */
  --c-blue: #003F87;          /* Blue: links */
  --c-blue-deep: #003366;
  --c-sky: #9AB3D5;           /* Pale Blue: decorative on dark, links in dark mode */
  --c-gray: #515354;          /* Warm Gray: secondary text */

  /* ---- Surfaces & text ---- */
  --bg: #ffffff;              /* public page background */
  --bg-app: #f6f5f1;          /* Manage / account page background */
  --surface: #ffffff;         /* cards, tables, inputs */
  --surface-2: #E9E9E4;       /* sunken: empty states, chips, table heads */
  --surface-tint: #f5f4f0;    /* bands, hover rows */
  --surface-hover: #f2f6f1;   /* selected rows / chosen tiles */
  --text: #232528;
  --text-muted: #515354;
  --text-subtle: #6b6d6e;     /* placeholders, de-emphasised meta (still 5.3:1 on white) */
  --line: #ddd8cc;
  --line-strong: #c9c3b4;
  --link: #003F87;
  --link-hover: #003366;
  --focus: #CE1126;
  --focus-ring: 0 0 0 .25rem rgb(206 17 38 / .35);

  /* ---- Action roles ---- */
  --primary: #243E2C;         /* olive buttons, active nav, selected states */
  --primary-hover: #182b1e;
  --primary-ink: #ffffff;     /* text on --primary */
  --primary-text: #243E2C;    /* olive used as text/outline */
  --accent: #CE1126;          /* the single red CTA */
  --accent-hover: #a30d1e;
  --accent-ink: #ffffff;
  --accent-text: #a30d1e;     /* red as text (kickers, month labels): 7:1 on white */
  --disabled-bg: #c9c4b8;

  /* ---- Status tones (bg / fg pairs, every pair ≥ 7:1) ---- */
  --success-bg: #e1ede6;  --success-fg: #1d5a3a;
  --warning-bg: #fae7cb;  --warning-fg: #7a4205;
  --danger-bg:  #f8e3e5;  --danger-fg:  #a30d1e;
  --info-bg:    #dbe5f5;  --info-fg:    #003F87;
  --neutral-bg: #ecebe6;  --neutral-fg: #4a4c4d;
  --dark-bg:    #232528;  --dark-fg:    #ffffff;

  /* ---- Event category colours (calendar, cards). fg on bg ≥ 7:1 ---- */
  --cat-camping-fg: #2b5a33;        --cat-camping-bg: #dfece0;
  --cat-backpacking-fg: #6a4714;    --cat-backpacking-bg: #f0e6d2;
  --cat-hiking-fg: #0f6459;         --cat-hiking-bg: #d8edea;
  --cat-kayak-fg: #003f87;          --cat-kayak-bg: #dbe5f5;
  --cat-high-adventure-fg: #59308f; --cat-high-adventure-bg: #e8dff5;
  --cat-outdoor-fg: #874a05;        --cat-outdoor-bg: #fae7cb;
  --cat-day-trip-fg: #a3421b;       --cat-day-trip-bg: #fadfd2;
  --cat-overnight-fg: #2e4a9c;      --cat-overnight-bg: #e0e6f7;
  --cat-service-fg: #a40f1f;        --cat-service-bg: #f9dee0;
  --cat-training-fg: #892765;       --cat-training-bg: #f5dcec;
  --cat-admin-fg: #495460;          --cat-admin-bg: #e5e8ec;
  --cat-other-fg: #565e56;          --cat-other-bg: #eae7df;
  --cat-default-fg: #4b5563;        --cat-default-bg: #e8e6de;

  --tag-bg: #D6CEBD; --tag-fg: #0f1c13;   /* category tag on cards */
  --icon: #006B3F;                         /* leading icons in facts/meta */

  /* ---- Chrome (header/footer stay dark olive in both themes) ---- */
  --header-bg: #243E2C;
  --header-bg-stuck: rgb(24 43 30 / .92);
  --header-ink: #ffffff;
  --footer-bg: #0f1c13;
  --footer-ink: #cfd8cf;

  /* ---- Elevation ---- */
  --shadow-1: 0 1px 2px rgb(35 37 40 / .06), 0 4px 14px rgb(35 37 40 / .06);
  --shadow-2: 0 2px 6px rgb(35 37 40 / .08), 0 14px 36px rgb(35 37 40 / .12);
  --shadow-inset: inset 0 0 0 1px var(--line);

  /* ---- Shape ---- */
  --radius-xs: .375rem;
  --radius-sm: .625rem;
  --radius: 1rem;
  --radius-pill: 999px;

  /* ---- Spacing (8-pt) ---- */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem; --sp-8: 4rem;

  /* ---- Type ---- */
  --font-display: "Roboto Slab", "Rockwell", Georgia, serif;
  --font-body: "Roboto", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-cond: "Roboto Condensed", "Roboto", "Arial Narrow", sans-serif;
  --fs-xs: .75rem;      /* labels, pills */
  --fs-sm: .875rem;     /* meta, table cells on phones */
  --fs-base: 1.0625rem; /* body */
  --fs-lg: 1.25rem;     /* card titles */
  --fs-xl: 1.5rem;      /* section titles in app */
  --fs-2xl: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem);   /* app page titles */
  --fs-3xl: clamp(2.2rem, 4.5vw, 3.5rem);            /* public page titles */

  /* ---- Motion ---- */
  --dur-1: .12s;
  --dur-2: .22s;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --header-h: 4.25rem;
  --tap: 2.75rem;       /* 44px minimum touch target */

  /* Legacy aliases (older templates/CSS); prefer the role tokens above. */
  --troop-green: var(--primary);
  --troop-green-dark: var(--primary-hover);
  --troop-tan: var(--c-sand);
  --troop-red: var(--accent);
  --card-shadow: var(--shadow-1);

  /* Bootstrap hooks */
  --bs-font-sans-serif: var(--font-body);
  --bs-body-font-family: var(--font-body);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--text-muted);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-tint);
  --bs-link-color: var(--link);
  --bs-link-hover-color: var(--link-hover);
  --bs-link-color-rgb: 0, 63, 135;
  --bs-link-hover-color-rgb: 0, 51, 102;
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 36, 62, 44;
  --bs-heading-color: var(--text);
  color-scheme: light;
}

/* Dark theme. Same block twice: once for an explicit/JS-resolved choice, once for no-JS
   visitors whose system is dark. Keep the two in sync. */
:root[data-bs-theme="dark"] {
  --bg: #111511;
  --bg-app: #0e120f;
  --surface: #1a201b;
  --surface-2: #232b24;
  --surface-tint: #161b17;
  --surface-hover: #1f2b22;
  --text: #ece8dc;
  --text-muted: #b0b8ad;
  --text-subtle: #959d93;
  --line: #313b32;
  --line-strong: #46524a;
  --link: #9AB3D5;
  --link-hover: #c5d6ea;
  --focus: #ff8a95;
  --focus-ring: 0 0 0 .25rem rgb(255 138 149 / .45);
  --primary: #2f5a3b;
  --primary-hover: #3a6b48;
  --primary-ink: #ffffff;
  --primary-text: #a9cbb2;
  --accent: #CE1126;
  --accent-hover: #e0283c;
  --accent-text: #f58a94;
  --disabled-bg: #3d443e;
  --success-bg: #1c3324;  --success-fg: #a6dbb7;
  --warning-bg: #3a2b14;  --warning-fg: #f3c784;
  --danger-bg:  #3d1a1f;  --danger-fg:  #f7a8b0;
  --info-bg:    #17263b;  --info-fg:    #b3c9ea;
  --neutral-bg: #272e28;  --neutral-fg: #c9cec5;
  --dark-bg:    #e9e9e4;  --dark-fg:    #232528;
  --cat-camping-fg: #a8d4b0;        --cat-camping-bg: #1d3322;
  --cat-backpacking-fg: #e3c592;    --cat-backpacking-bg: #33281a;
  --cat-hiking-fg: #8fd6cb;         --cat-hiking-bg: #13302c;
  --cat-kayak-fg: #a9c4ec;          --cat-kayak-bg: #15273f;
  --cat-high-adventure-fg: #cdb5f0; --cat-high-adventure-bg: #2a1f3c;
  --cat-outdoor-fg: #f2c27e;        --cat-outdoor-bg: #382712;
  --cat-day-trip-fg: #f4b195;       --cat-day-trip-bg: #3a2219;
  --cat-overnight-fg: #b0bff0;      --cat-overnight-bg: #1b2440;
  --cat-service-fg: #f6a3ab;        --cat-service-bg: #3d1a1f;
  --cat-training-fg: #eeaad5;       --cat-training-bg: #38192d;
  --cat-admin-fg: #c3cad3;          --cat-admin-bg: #262b31;
  --cat-other-fg: #c9cdc4;          --cat-other-bg: #292d28;
  --cat-default-fg: #c9cdc4;        --cat-default-bg: #292d28;
  --tag-bg: #3b4a3d; --tag-fg: #ece8dc;
  --icon: #9AB3D5;
  --header-bg: #1a2e20;
  --header-bg-stuck: rgb(20 34 25 / .92);
  --footer-bg: #0b140e;
  --c-moss-soft: var(--success-bg);
  --c-ember-soft: var(--danger-bg);
  --c-sand-soft: #262b24;
  --c-forest-ink: #ece8dc;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4), 0 4px 14px rgb(0 0 0 / .35);
  --shadow-2: 0 2px 6px rgb(0 0 0 / .45), 0 14px 36px rgb(0 0 0 / .5);
  --bs-link-color-rgb: 154, 179, 213;
  --bs-link-hover-color-rgb: 197, 214, 234;
  --bs-primary-rgb: 47, 90, 59;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme]) {
    --bg: #111511; --bg-app: #0e120f; --surface: #1a201b; --surface-2: #232b24; --surface-tint: #161b17; --surface-hover: #1f2b22;
    --text: #ece8dc; --text-muted: #b0b8ad; --text-subtle: #959d93; --line: #313b32; --line-strong: #46524a;
    --link: #9AB3D5; --link-hover: #c5d6ea; --focus: #ff8a95; --focus-ring: 0 0 0 .25rem rgb(255 138 149 / .45);
    --primary: #2f5a3b; --primary-hover: #3a6b48; --primary-text: #a9cbb2; --accent-hover: #e0283c; --accent-text: #f58a94; --disabled-bg: #3d443e;
    --success-bg: #1c3324; --success-fg: #a6dbb7; --warning-bg: #3a2b14; --warning-fg: #f3c784; --danger-bg: #3d1a1f; --danger-fg: #f7a8b0;
    --info-bg: #17263b; --info-fg: #b3c9ea; --neutral-bg: #272e28; --neutral-fg: #c9cec5; --dark-bg: #e9e9e4; --dark-fg: #232528;
    --cat-camping-fg: #a8d4b0; --cat-camping-bg: #1d3322; --cat-backpacking-fg: #e3c592; --cat-backpacking-bg: #33281a;
    --cat-hiking-fg: #8fd6cb; --cat-hiking-bg: #13302c; --cat-kayak-fg: #a9c4ec; --cat-kayak-bg: #15273f;
    --cat-high-adventure-fg: #cdb5f0; --cat-high-adventure-bg: #2a1f3c; --cat-outdoor-fg: #f2c27e; --cat-outdoor-bg: #382712;
    --cat-day-trip-fg: #f4b195; --cat-day-trip-bg: #3a2219; --cat-overnight-fg: #b0bff0; --cat-overnight-bg: #1b2440;
    --cat-service-fg: #f6a3ab; --cat-service-bg: #3d1a1f; --cat-training-fg: #eeaad5; --cat-training-bg: #38192d;
    --cat-admin-fg: #c3cad3; --cat-admin-bg: #262b31; --cat-other-fg: #c9cdc4; --cat-other-bg: #292d28;
    --cat-default-fg: #c9cdc4; --cat-default-bg: #292d28;
    --tag-bg: #3b4a3d; --tag-fg: #ece8dc; --icon: #9AB3D5;
    --header-bg: #1a2e20; --header-bg-stuck: rgb(20 34 25 / .92); --footer-bg: #0b140e;
    --c-moss-soft: var(--success-bg); --c-ember-soft: var(--danger-bg); --c-sand-soft: #262b24; --c-forest-ink: #ece8dc;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .4), 0 4px 14px rgb(0 0 0 / .35);
    --shadow-2: 0 2px 6px rgb(0 0 0 / .45), 0 14px 36px rgb(0 0 0 / .5);
    --bs-body-bg: var(--bg); --bs-body-color: var(--text);
    --bs-link-color-rgb: 154, 179, 213; --bs-link-hover-color-rgb: 197, 214, 234; --bs-primary-rgb: 47, 90, 59;
    color-scheme: dark;
  }
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0s; --dur-2: 0s; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html { scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
main { flex: 1; }
a { color: var(--link); text-decoration-thickness: .08em; text-underline-offset: .14em; }
a:hover { color: var(--link-hover); }
h1, h2, h3, .h1, .h2, .h3, .display-font { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; line-height: 1.12; color: var(--text); }
h4, h5, h6, .h4, .h5, .h6 { font-weight: 700; color: var(--text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: var(--focus-ring); }
img { max-width: 100%; height: auto; }
::selection { background: var(--c-ember); color: #fff; }
.text-muted, .text-body-secondary { color: var(--text-muted) !important; }
.text-danger { color: var(--danger-fg) !important; }
.text-success { color: var(--success-fg) !important; }
.text-warning { color: var(--warning-fg) !important; }
.text-info { color: var(--info-fg) !important; }
.text-dark, .text-body { color: var(--text) !important; }
.bg-light, .bg-body-tertiary { background-color: var(--surface-tint) !important; color: var(--text); }
.bg-white, .bg-body { background-color: var(--surface) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--line) !important; }
hr { border-color: var(--line); opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .lift { transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) ease; }
  .lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
  .zoom img { transition: transform .6s var(--ease); }
  .zoom:hover img { transform: scale(1.05); }
  .btn { transition: transform var(--dur-1) ease, background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
  .btn:active { transform: translateY(1px) scale(.99); }
  .site-header { transition: background-color .25s ease, box-shadow .25s ease; }
  .site-header .nav-link { transition: background-color .15s ease, color .15s ease; }
  .toc li a { transition: color .15s ease, border-color .15s ease; }
}

/* Skip link */
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 2000; background: var(--accent); color: #fff; padding: .5rem 1rem; border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: 1rem; color: #fff; }
main:focus { outline: none; }

/* --------------------------------------------------------------------------
   Bootstrap mapped onto tokens (so legacy markup follows the theme)
   -------------------------------------------------------------------------- */
.btn { font-weight: 600; border-radius: var(--radius-pill); padding: .55rem 1.2rem; letter-spacing: .005em; --bs-btn-disabled-opacity: .55; }
.btn-sm { padding: .3rem .8rem; }
.btn-lg { padding: .8rem 1.6rem; font-size: var(--fs-base); }
/* Hierarchy: .btn-ember = the one primary action (red) · .btn-primary = solid olive (confirm inside a card/row)
   · .btn-outline-primary = secondary · .btn-outline-secondary / .btn-link = tertiary */
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-color: var(--primary-ink); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-hover-color: var(--primary-ink); --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover); --bs-btn-active-color: var(--primary-ink); --bs-btn-disabled-bg: var(--disabled-bg); --bs-btn-disabled-border-color: var(--disabled-bg); --bs-btn-disabled-color: var(--primary-ink); }
.btn-outline-primary { --bs-btn-color: var(--primary-text); --bs-btn-border-color: var(--primary-text); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-hover-color: var(--primary-ink); --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover); --bs-btn-active-color: var(--primary-ink); --bs-btn-disabled-color: var(--text-subtle); --bs-btn-disabled-border-color: var(--line-strong); }
.btn-ember, .btn.reg-cta, .btn.pl-cta { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: var(--accent-ink); --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover); --bs-btn-hover-color: var(--accent-ink); --bs-btn-active-bg: var(--accent-hover); --bs-btn-active-border-color: var(--accent-hover); --bs-btn-active-color: var(--accent-ink); --bs-btn-disabled-bg: var(--disabled-bg); --bs-btn-disabled-border-color: var(--disabled-bg); --bs-btn-disabled-color: #fff; --bs-btn-focus-shadow-rgb: 206, 17, 38; }
.btn-outline-secondary { --bs-btn-color: var(--text-muted); --bs-btn-border-color: var(--line-strong); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--line-strong); --bs-btn-hover-color: var(--text); --bs-btn-active-bg: var(--surface-2); --bs-btn-active-color: var(--text); --bs-btn-active-border-color: var(--line-strong); }
.btn-secondary { --bs-btn-bg: var(--neutral-bg); --bs-btn-color: var(--neutral-fg); --bs-btn-border-color: var(--line-strong); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--line-strong); }
.btn-outline-danger { --bs-btn-color: var(--danger-fg); --bs-btn-border-color: var(--danger-fg); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--accent-hover); --bs-btn-active-color: #fff; }
.btn-danger { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover); }
.btn-outline-success { --bs-btn-color: var(--success-fg); --bs-btn-border-color: var(--success-fg); --bs-btn-hover-bg: var(--c-moss); --bs-btn-hover-border-color: var(--c-moss); --bs-btn-hover-color: #fff; }
.btn-success { --bs-btn-bg: var(--c-moss); --bs-btn-border-color: var(--c-moss); --bs-btn-hover-bg: #005632; --bs-btn-hover-border-color: #005632; }
.btn-outline-warning { --bs-btn-color: var(--warning-fg); --bs-btn-border-color: var(--warning-fg); --bs-btn-hover-bg: var(--warning-bg); --bs-btn-hover-color: var(--warning-fg); --bs-btn-hover-border-color: var(--warning-fg); }
.btn-outline-dark { --bs-btn-color: var(--text); --bs-btn-border-color: var(--text); --bs-btn-hover-bg: var(--text); --bs-btn-hover-color: var(--bg); --bs-btn-hover-border-color: var(--text); }
.btn-link { --bs-btn-color: var(--link); --bs-btn-hover-color: var(--link-hover); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-color: #0f1c13; --bs-btn-hover-bg: #f3eedf; --bs-btn-hover-color: #0f1c13; --bs-btn-border-color: #fff; }
.btn-outline-light:hover { color: #0f1c13; }
.btn-check:checked + .btn-outline-primary, .btn-check:checked + .btn-outline-secondary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

.card { --bs-card-bg: var(--surface); --bs-card-color: var(--text); --bs-card-cap-bg: var(--surface-tint); --bs-card-border-color: var(--line); border: 0; border-radius: var(--radius); box-shadow: var(--shadow-1); background: var(--surface); color: var(--text); }
.card-body { padding: 1.25rem; }
.card-header, .card-footer { background: var(--surface-tint); border-color: var(--line); }

.badge { font-family: var(--font-cond); font-weight: 600; letter-spacing: .03em; border-radius: var(--radius-pill); padding: .4em .75em; }
.badge-cat { background: var(--tag-bg); color: var(--tag-fg); }
.text-bg-success { background-color: var(--success-bg) !important; color: var(--success-fg) !important; }
.text-bg-warning { background-color: var(--warning-bg) !important; color: var(--warning-fg) !important; }
.text-bg-danger  { background-color: var(--danger-bg) !important;  color: var(--danger-fg) !important; }
.text-bg-info, .text-bg-primary { background-color: var(--info-bg) !important; color: var(--info-fg) !important; }
.text-bg-secondary, .text-bg-light { background-color: var(--neutral-bg) !important; color: var(--neutral-fg) !important; }
.text-bg-dark { background-color: var(--dark-bg) !important; color: var(--dark-fg) !important; }

.alert { --bs-alert-border-color: transparent; border: 0; border-radius: var(--radius-sm); }
.alert-success { --bs-alert-bg: var(--success-bg); --bs-alert-color: var(--success-fg); --bs-alert-link-color: var(--success-fg); }
.alert-danger  { --bs-alert-bg: var(--danger-bg);  --bs-alert-color: var(--danger-fg);  --bs-alert-link-color: var(--danger-fg); }
.alert-warning { --bs-alert-bg: var(--warning-bg); --bs-alert-color: var(--warning-fg); --bs-alert-link-color: var(--warning-fg); }
.alert-info    { --bs-alert-bg: var(--info-bg);    --bs-alert-color: var(--info-fg);    --bs-alert-link-color: var(--info-fg); }
.alert-secondary, .alert-light { --bs-alert-bg: var(--surface-2); --bs-alert-color: var(--text); --bs-alert-link-color: var(--link); }
.alert a { color: inherit; font-weight: 600; }
.alert .btn-close { padding: 1rem; }

.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--line); --bs-table-hover-bg: var(--surface-hover); --bs-table-hover-color: var(--text); --bs-table-striped-bg: var(--surface-tint); --bs-table-striped-color: var(--text); --bs-table-active-bg: var(--surface-2); --bs-table-active-color: var(--text); }
.table-light { --bs-table-bg: var(--surface-tint); --bs-table-color: var(--text); --bs-table-border-color: var(--line); }
.table-warning { --bs-table-bg: var(--warning-bg); --bs-table-color: var(--warning-fg); }
.table-danger { --bs-table-bg: var(--danger-bg); --bs-table-color: var(--danger-fg); }
.table-success { --bs-table-bg: var(--success-bg); --bs-table-color: var(--success-fg); }
.table-secondary { --bs-table-bg: var(--surface-2); --bs-table-color: var(--text); }
.table-sm td, .table-sm th { vertical-align: middle; }
.table thead th { font-family: var(--font-cond); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); white-space: nowrap; }

.form-control, .form-select { background-color: var(--surface); color: var(--text); border-radius: var(--radius-sm); border-color: var(--line-strong); }
.form-control::placeholder { color: var(--text-subtle); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--surface-2); }
.form-control:focus, .form-select:focus { background-color: var(--surface); color: var(--text); border-color: var(--primary-text); box-shadow: 0 0 0 .25rem rgb(0 63 135 / .18); }
.form-check-input { background-color: var(--surface); border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: var(--focus-ring); }
.input-group-text { background: var(--surface-2); color: var(--text-muted); border-color: var(--line-strong); }
form label.form-label { font-weight: 600; font-size: .9rem; }

.list-group { --bs-list-group-bg: var(--surface); --bs-list-group-color: var(--text); --bs-list-group-border-color: var(--line); --bs-list-group-action-hover-bg: var(--surface-hover); --bs-list-group-action-hover-color: var(--text); --bs-list-group-active-bg: var(--primary); --bs-list-group-active-border-color: var(--primary); }
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-color: var(--text); --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--surface-2); --bs-dropdown-link-hover-color: var(--text); --bs-dropdown-border-color: var(--line); --bs-dropdown-link-active-bg: var(--primary); --bs-dropdown-divider-bg: var(--line); }
.modal { --bs-modal-bg: var(--surface); --bs-modal-color: var(--text); --bs-modal-border-color: var(--line); --bs-modal-header-border-color: var(--line); --bs-modal-footer-border-color: var(--line); --bs-modal-border-radius: var(--radius); }
.offcanvas, .offcanvas-lg { --bs-offcanvas-bg: var(--surface); --bs-offcanvas-color: var(--text); --bs-offcanvas-border-color: var(--line); }
.popover { --bs-popover-bg: var(--surface); --bs-popover-body-color: var(--text); --bs-popover-header-bg: var(--surface-tint); --bs-popover-header-color: var(--text); --bs-popover-border-color: var(--line); }
.nav-tabs { --bs-nav-tabs-border-color: var(--line); --bs-nav-tabs-link-active-bg: var(--surface); --bs-nav-tabs-link-active-color: var(--text); --bs-nav-tabs-link-active-border-color: var(--line) var(--line) var(--surface); --bs-nav-tabs-link-hover-border-color: var(--line); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--primary); --bs-nav-pills-link-active-color: var(--primary-ink); }
.nav-link { color: var(--link); }
.pagination { --bs-pagination-bg: var(--surface); --bs-pagination-color: var(--link); --bs-pagination-border-color: var(--line); --bs-pagination-hover-bg: var(--surface-2); --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); --bs-pagination-disabled-bg: var(--surface-tint); --bs-pagination-disabled-color: var(--text-subtle); }
.progress { --bs-progress-bg: var(--surface-2); --bs-progress-bar-bg: var(--primary); }
.accordion { --bs-accordion-bg: var(--surface); --bs-accordion-color: var(--text); --bs-accordion-border-color: var(--line); --bs-accordion-btn-color: var(--text); --bs-accordion-active-bg: var(--surface-tint); --bs-accordion-active-color: var(--text); }
pre, code { color: var(--text); }
kbd { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); }
:root[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

.breadcrumb { font-size: .9rem; --bs-breadcrumb-divider-color: var(--text-muted); margin: 0; }
.breadcrumb-item a { text-decoration: none; font-weight: 600; }
.breadcrumb-item.active { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Header / nav
   -------------------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 1030; background: var(--header-bg); color: var(--header-ink); box-shadow: 0 1px 0 rgb(255 255 255 / .06); }
.site-header.is-stuck { background: var(--header-bg-stuck); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); box-shadow: 0 6px 24px rgb(0 0 0 / .18); }
.site-header .navbar { min-height: var(--header-h); padding-block: .5rem; }
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.brand:hover, .brand:focus { color: #fff; }
.brand img { width: 2.25rem; height: 2.25rem; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1; letter-spacing: -.01em; }
.brand-sub { display: block; font-family: var(--font-body); font-weight: 600; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c-sky); margin-top: .3rem; }
.site-header .nav-link { white-space: nowrap; position: relative; color: rgb(255 255 255 / .86); font-family: var(--font-cond); font-weight: 600; font-size: 1.02rem; letter-spacing: .01em; padding: .5rem .8rem !important; border-radius: var(--radius-pill); display: inline-flex; align-items: center; gap: .35rem; }
.site-header .nav-link:hover, .site-header .nav-link:focus { color: #fff; background: rgb(255 255 255 / .1); }
.site-header .nav-link.active { color: #fff; background: rgb(255 255 255 / .14); }
.site-header .nav-link.active::after { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: .2rem; height: 2px; border-radius: 2px; background: var(--c-ember); }
.site-header .nav-cta { background: var(--c-ember); color: #fff !important; }
.site-header .nav-cta:hover { background: var(--c-ember-deep) !important; }
.site-header .navbar-toggler { border-color: rgb(255 255 255 / .35); min-width: var(--tap); min-height: var(--tap); }
.site-header .navbar-toggler-icon { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
.site-header .navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgb(206 17 38 / .5); }
.site-header .dropdown-menu { border: 0; box-shadow: var(--shadow-2); border-radius: var(--radius-sm); }
.site-header .dropdown-item { font-weight: 600; }
.site-header form .nav-link { border: 0; background: transparent; }
.nav-sep { width: 1px; align-self: stretch; margin: .5rem .35rem; background: rgb(255 255 255 / .18); }
@media (max-width: 1199.98px) {
  .site-header .navbar-collapse { padding: .75rem 0 1rem; }
  .site-header .nav-link { padding: .65rem .8rem !important; min-height: var(--tap); width: 100%; }
  .site-header .nav-link.active::after { left: 0; right: auto; top: .6rem; bottom: .6rem; width: 3px; height: auto; }
  .site-header .nav-cta { display: inline-flex; width: auto; margin-top: .5rem; }
  .nav-sep { width: auto; height: 1px; margin: .5rem 0; }
  .nav-group-lbl { display: block; font-family: var(--font-cond); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--c-sky); padding: .25rem .8rem; }
}
@media (min-width: 1200px) { .nav-group-lbl { display: none; } }

@media (min-width: 1200px) { .signout-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
@media (min-width: 1200px) and (max-width: 1399.98px) { .site-header .nav-link { padding: .5rem .55rem !important; font-size: .98rem; } .brand-sub { display: none; } }

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section-tight { padding-block: clamp(2rem, 5vw, 3.5rem); }
.kicker { display: inline-block; font-family: var(--font-cond); font-weight: 700; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-text); margin-bottom: .6rem; }
.kicker::before { content: ""; display: inline-block; width: 1.5rem; height: 2px; background: currentColor; vertical-align: middle; margin-right: .6rem; }
.section-title { font-size: clamp(1.85rem, 3.2vw, 2.6rem); margin: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 2rem; }
.section-head p { max-width: 60ch; color: var(--text-muted); margin: .5rem 0 0; }
.more-link { font-weight: 700; text-decoration: none; white-space: nowrap; }
.more-link::after { content: " →"; }
.band-sand { background: var(--c-sand-soft); }
.band-tint { background: var(--surface-tint); }
.band-forest { background: var(--c-forest); color: #fff; }
.band-forest a { color: #fff; }
.container-wide { max-width: 1560px; }
/* --------------------------------------------------------------------------
   Home: hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative; isolation: isolate; color: #fff; overflow: hidden;
  min-height: min(86vh, 820px); display: flex; align-items: flex-end;
  background: var(--c-forest-deep);
}
.hero-media { position: absolute; inset: 0; z-index: -2; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: center 45%; display: block; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgb(15 28 19 / .55) 0%, rgb(15 28 19 / .05) 30%, rgb(15 28 19 / .25) 60%, rgb(15 28 19 / .9) 100%),
    linear-gradient(90deg, rgb(15 28 19 / .72) 0%, rgb(15 28 19 / .35) 40%, rgb(15 28 19 / 0) 72%);
}
.hero-inner { position: relative; padding-block: clamp(5rem, 12vw, 9rem) clamp(2.5rem, 6vw, 4.5rem); width: 100%; }
.hero-eyebrow { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; font-family: var(--font-cond); font-weight: 700; font-size: .85rem; letter-spacing: .16em; text-transform: uppercase; color: var(--c-sand); margin-bottom: 1.25rem; }
.hero-eyebrow .dot { width: .4rem; height: .4rem; border-radius: 50%; background: var(--c-ember); }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 5.1rem); font-weight: 700; line-height: 1.02; letter-spacing: -.02em; color: #fff; max-width: 15ch; margin: 0 0 1.25rem; text-wrap: balance; }
.hero h1 em { font-style: normal; font-weight: 300; color: var(--c-sand); }
.hero p.lead { font-size: clamp(1.1rem, 1.6vw, 1.35rem); max-width: 52ch; color: rgb(255 255 255 / .9); margin-bottom: 2rem; text-wrap: pretty; }
.hero .btn-outline-light { border-width: 2px; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem 2rem; margin-top: clamp(2rem, 5vw, 3.5rem); padding-top: 1.5rem; border-top: 1px solid rgb(255 255 255 / .22); max-width: 46rem; }
.hero-stats .num { font-family: var(--font-display); font-size: clamp(1.6rem, 2.6vw, 2.25rem); font-weight: 600; line-height: 1; color: #fff; }
.hero-stats .lbl { font-family: var(--font-cond); font-size: .88rem; letter-spacing: .08em; text-transform: uppercase; color: var(--c-sand); margin-top: .35rem; font-weight: 600; }

/* --------------------------------------------------------------------------
   Home: upcoming event cards
   -------------------------------------------------------------------------- */
.up-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 1.25rem; }
.up-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; border-top: 4px solid var(--cat, var(--c-forest)); }
.up-card .up-img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; display: block; }
.up-card .up-body { display: flex; gap: 1rem; padding: 1.1rem 1.25rem 1.25rem; flex: 1; }
.up-date { flex: 0 0 3.6rem; text-align: center; background: var(--c-sand-soft); border-radius: var(--radius-sm); padding: .45rem .25rem; align-self: flex-start; color: var(--text); }
.up-date .mon { font-family: var(--font-cond); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.up-date .day { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; line-height: 1.05; }
.up-date .dow { font-size: .72rem; color: var(--text-muted); font-weight: 600; }
.up-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; line-height: 1.2; margin: 0 0 .3rem; overflow-wrap: break-word; }
.up-title a { color: inherit; text-decoration: none; }
.up-title a::after { content: ""; position: absolute; inset: 0; }
/* The whole card is the link, so the keyboard focus ring goes around the card, not just the title. */
@supports selector(:has(a)) {
  .up-card:has(.up-title a:focus-visible), .troop-card:has(.more-link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
  .up-title a:focus-visible, .troop-card .more-link:focus-visible { outline: none; }
}
.up-agenda { list-style: none; margin: 0; padding: 0; }
.up-agenda .up-body { padding: 1rem 1.15rem; }
.up-signin { margin: 1.25rem 0 0; }
.up-signin .btn { white-space: normal; }
.up-meta { font-size: .9rem; color: var(--text-muted); }
.up-meta i { color: var(--icon); margin-right: .2rem; }
.up-sum { margin: .6rem 0 0; font-size: .95rem; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.up-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; position: relative; z-index: 1; }
.up-tags .badge { font-size: .72rem; }
.badge-open { background: var(--success-bg); color: var(--success-fg); }
.badge-open i { color: inherit; }
.badge-full { background: var(--danger-bg); color: var(--danger-fg); }
.badge-nights { background: transparent; color: var(--text-muted); border: 1px solid var(--line); }

/* Category colours (research §9.4; a text label always accompanies the colour) */
[data-cat="camping"], [data-cat="overnight"] { --cat: #243E2C; }
[data-cat="kayak"] { --cat: #003366; }
[data-cat="outdoor"], [data-cat="day-trip"] { --cat: #003F87; }
[data-cat="service"] { --cat: #006B3F; }
[data-cat="high-adventure"] { --cat: #CE1126; }
[data-cat="backpacking"], [data-cat="hiking"], [data-cat="hike"] { --cat: #8a7652; }
[data-cat="training"], [data-cat="admin"], [data-cat="dues"], [data-cat="other"] { --cat: #515354; }

/* --------------------------------------------------------------------------
   Home: troops
   -------------------------------------------------------------------------- */
.troop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1.5rem; }
.troop-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.troop-card figure { margin: 0; position: relative; aspect-ratio: 4 / 3; overflow: hidden; }
.troop-card figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.troop-card .unit-tag { position: absolute; left: 1rem; top: 1rem; background: var(--unit, var(--c-forest)); color: #fff; font-family: var(--font-cond); font-weight: 700; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; padding: .35rem .7rem; border-radius: 999px; }
.troop-card .body { padding: 1.4rem 1.5rem 1.6rem; display: flex; flex-direction: column; flex: 1; border-top: 4px solid var(--unit, var(--c-forest)); }
.troop-card h3 { font-size: 1.5rem; margin: 0 0 .5rem; }
.troop-card p { color: var(--text-muted); margin: 0 0 1rem; flex: 1; }
.troop-card .more-link::before { content: ""; position: absolute; inset: 0; }
.troop-card[data-unit="t37"] { --unit: var(--c-forest); }
.troop-card[data-unit="t201"] { --unit: var(--c-red); }
.troop-card[data-unit="t201"] .unit-tag { background: var(--c-black); }
.troop-card[data-unit="crew"] { --unit: var(--c-ember); }

/* Photo strip */
.photo-strip { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: clamp(7rem, 14vw, 13rem); gap: .5rem; }
.photo-strip figure { margin: 0; overflow: hidden; border-radius: var(--radius-sm); }
.photo-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-strip .w3 { grid-column: span 3; }
.photo-strip .w4 { grid-column: span 4; }
.photo-strip .w5 { grid-column: span 5; }
.photo-strip .w6 { grid-column: span 6; }
.photo-strip .tall { grid-row: span 2; }
@media (max-width: 767.98px) { .photo-strip .w3, .photo-strip .w4, .photo-strip .w5 { grid-column: span 6; } .photo-strip .w6 { grid-column: span 12; } .photo-strip .tall { grid-row: span 1; } }

/* --------------------------------------------------------------------------
   Home: open house + join bands
   -------------------------------------------------------------------------- */
.announce { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; align-items: center; }
@media (min-width: 768px) { .announce { grid-template-columns: 11rem minmax(0, 1fr) auto; gap: 2.5rem; } }
.announce .poster { border-radius: var(--radius-sm); box-shadow: var(--shadow-2); width: 11rem; height: auto; rotate: -2deg; }
.announce .when { font-family: var(--font-display); font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 600; margin: .25rem 0 .5rem; }
.announce .when small { font-family: var(--font-body); font-size: 1rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.announce .where { color: var(--text-muted); margin: 0; }
.announce p { max-width: 64ch; text-wrap: pretty; }

.join { position: relative; isolation: isolate; color: #fff; overflow: hidden; background: #0f1c13; }
.join .bg { position: absolute; inset: 0; z-index: -2; }
.join .bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.join::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgb(15 28 19 / .92) 0%, rgb(15 28 19 / .7) 55%, rgb(15 28 19 / .35) 100%); }
.join h2 { color: #fff; font-size: clamp(2rem, 4vw, 3rem); }
.join p { color: rgb(255 255 255 / .88); max-width: 58ch; font-size: 1.1rem; }
.join .meet { display: inline-flex; flex-wrap: wrap; gap: .6rem 1.4rem; font-weight: 600; color: var(--c-sand); margin: .5rem 0 1.5rem; }
.join .meet i { color: var(--c-ember); margin-right: .3rem; }

/* --------------------------------------------------------------------------
   Home: quick actions (answers when / where / who / how to visit)
   -------------------------------------------------------------------------- */
.quick { position: relative; z-index: 2; margin-top: clamp(-3.5rem, -6vw, -2.5rem); }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1rem; }
.quick-card { display: flex; flex-direction: column; gap: .35rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 1.35rem 1.4rem 1.3rem; color: var(--text); text-decoration: none; min-height: 9.5rem; position: relative; overflow: hidden; }
.quick-card:hover { color: var(--text); }
.quick-card i { font-size: 1.5rem; color: var(--accent-text); line-height: 1; }
.quick-card .t { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; margin-top: .35rem; }
.quick-card .d { color: var(--text-muted); font-size: .95rem; line-height: 1.4; }
.quick-card .go { position: absolute; right: 1.1rem; top: 1.1rem; color: var(--text-muted); font-size: 1.1rem; }
.quick-card--accent { background: var(--c-ember); color: #fff; }
.quick-card--accent:hover { color: #fff; }
.quick-card--accent i, .quick-card--accent .d, .quick-card--accent .go { color: rgb(255 255 255 / .9); }
.quick-card--accent .d { color: #fff; }
@media (max-width: 575.98px) {
  .quick { margin-top: -1.5rem; }
  /* Phones: compact rows (icon · title and text · arrow) so four links don't fill a whole screen. */
  .quick-grid { gap: .65rem; }
  .quick-card { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: .15rem .9rem; align-items: start; min-height: 0; padding: 1rem 2.9rem 1.05rem 1.1rem; }
  .quick-card > i { grid-row: 1 / span 2; margin-top: .2rem; }
  .quick-card .t { margin-top: 0; font-size: 1.125rem; }
  .quick-card .d { font-size: .9rem; }
  .quick-card .go { top: 50%; right: 1rem; translate: 0 -50%; }
  /* The copy spans the full width on a phone, so the scrim darkens top to bottom rather than left to right. */
  .hero::after { background: linear-gradient(180deg, rgb(15 28 19 / .5) 0%, rgb(15 28 19 / .18) 20%, rgb(15 28 19 / .6) 46%, rgb(15 28 19 / .92) 100%); }
  .hero-eyebrow { font-size: .75rem; letter-spacing: .1em; }
  .hero-stats { gap: .75rem 1rem; }
}

/* Empty state */
.empty { display: grid; place-items: center; text-align: center; gap: .5rem; padding: 3rem 1.5rem; border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); }
.empty i { font-size: 2rem; color: var(--text-subtle); }
.empty .t { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--text); }

/* --------------------------------------------------------------------------
   Event page
   -------------------------------------------------------------------------- */
.event-hero { position: relative; isolation: isolate; color: #fff; min-height: 22rem; display: flex; align-items: flex-end; background: var(--cat, var(--c-forest)); overflow: hidden; }
.event-hero--img { min-height: clamp(20rem, 52vh, 34rem); }
.event-hero .media { position: absolute; inset: 0; z-index: -2; }
.event-hero .media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.event-hero--img::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgb(15 28 19 / .35) 0%, rgb(15 28 19 / .08) 28%, rgb(15 28 19 / .5) 60%, rgb(15 28 19 / .9) 100%); }
.event-hero--img .crumbs, .event-hero--img .when { text-shadow: 0 1px 3px rgb(0 0 0 / .55); }
.event-hero--band { --band: var(--cat, var(--c-forest)); background: linear-gradient(135deg, color-mix(in srgb, var(--band) 85%, #000) 0%, var(--band) 60%, color-mix(in srgb, var(--band) 80%, #e8dfc8) 100%); }
.event-hero--band::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .18; background-image: radial-gradient(circle at 20% 20%, #fff 0 2px, transparent 3px), radial-gradient(circle at 70% 60%, #fff 0 1.5px, transparent 2.5px); background-size: 7rem 7rem, 5rem 5rem; }
.event-hero .inner { position: relative; width: 100%; padding-block: clamp(3rem, 8vw, 5rem) clamp(1.75rem, 4vw, 2.75rem); }
.event-hero .crumbs a { color: rgb(255 255 255 / .85); text-decoration: none; font-weight: 600; font-size: .9rem; }
.event-hero .crumbs a:hover { color: #fff; text-decoration: underline; }
/* Touch: a taller tap area for the small breadcrumb and "more" links without moving anything. */
@media (pointer: coarse) { .event-hero .crumbs a, .section-head .more-link { display: inline-block; padding-block: .7rem; margin-block: -.7rem; } }
.event-hero .cat { display: inline-block; background: rgb(255 255 255 / .16); backdrop-filter: blur(6px); color: #fff; font-family: var(--font-cond); font-weight: 700; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; padding: .35rem .8rem; border-radius: 999px; margin-bottom: .9rem; }
.event-hero .cat--danger { background: var(--c-red); }
.event-hero h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.02; letter-spacing: -.02em; max-width: 20ch; margin: 0 0 .75rem; text-wrap: balance; }
.event-hero .when { font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: rgb(255 255 255 / .9); font-weight: 600; margin: 0; }
.event-hero .when i { color: var(--c-sand); }

.event-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; padding-block: clamp(2rem, 5vw, 3.5rem); }
@media (min-width: 992px) { .event-layout { grid-template-columns: minmax(0, 1fr) 22rem; gap: 3.5rem; } }
.event-aside { position: relative; }
/* Phones and tablets: when there is something to act on (Register, your registration, a balance), the
   registration card sits right under the hero instead of after the whole description. */
@media (max-width: 991.98px) { .event-layout:has(.event-aside .reg-cta, .event-aside .alert) { gap: 1.5rem; } .event-aside:has(.reg-cta, .alert) { order: -1; } }
@media (min-width: 992px) { .event-aside .sticky { position: sticky; top: calc(var(--header-h) + 1.25rem); } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.fact { display: flex; gap: .9rem; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-1); padding: 1rem 1.1rem; }
.fact i { font-size: 1.35rem; color: var(--icon); line-height: 1; margin-top: .15rem; }
.fact .lbl { font-family: var(--font-cond); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.fact .val { font-weight: 600; line-height: 1.3; }
.fact .val a { text-decoration: none; font-weight: 600; }
/* Phones: one grouped card with divided rows instead of a stack of separate boxes. */
@media (max-width: 575.98px) {
  .facts { gap: 0; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-1); }
  .fact { background: transparent; box-shadow: none; border-radius: 0; padding: .8rem 1rem; }
  .fact + .fact { border-top: 1px solid var(--line); }
}
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 999px; font-family: var(--font-cond); font-size: .9rem; font-weight: 600; background: var(--c-sand-soft); color: var(--text); border: 1px solid var(--line); }
.chip i { color: var(--accent-text); }
.chip--med { background: var(--danger-bg); color: var(--danger-fg); border-color: transparent; }
.subhead { font-family: var(--font-body); font-size: .82rem; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin: 2rem 0 .75rem; }
.leaders { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .75rem 1.5rem; }
.leaders .lbl { font-family: var(--font-cond); font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.leaders .val { font-weight: 600; }

/* --------------------------------------------------------------------------
   Prose (markdown bodies)
   -------------------------------------------------------------------------- */
.prose, .event-body { font-size: 1.0625rem; line-height: 1.65; }
.prose { max-width: 70ch; }
/* ":::columns" blocks in page text: sections side by side (e.g. the two troops on About) */
.prose:has(> .md-cols) { max-width: 72rem; }
.prose .md-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1.5rem 2.5rem; margin: 0 0 2rem; }
.prose .md-col > :first-child { margin-top: 0; }
.prose .md-col img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius-sm); }
.prose > :first-child { margin-top: 0; }
.prose p, .event-body p { margin-bottom: 1.1rem; text-wrap: pretty; }
.prose h1, .prose h2, .prose h3, .prose h4, .event-body h1, .event-body h2, .event-body h3, .event-body h4 { margin-top: 2.25rem; margin-bottom: .75rem; }
.prose h1, .event-body h1 { font-size: 1.9rem; }
.prose h2, .event-body h2 { font-size: 1.6rem; }
.prose h3, .event-body h3 { font-size: 1.3rem; }
.prose h4, .event-body h4 { font-size: 1.1rem; }
.prose img, .event-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); box-shadow: var(--shadow-1); margin: .5rem 0 1.25rem; }
.prose hr, .event-body hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; opacity: 1; }
.prose ul, .prose ol, .event-body ul, .event-body ol { padding-left: 1.4rem; margin-bottom: 1.1rem; }
.prose li, .event-body li { margin-bottom: .3rem; }
.prose li > ul, .prose li > ol { margin: .3rem 0 .3rem; }
.prose blockquote, .event-body blockquote { border-left: 4px solid var(--accent); padding: .25rem 0 .25rem 1.25rem; color: var(--text-muted); font-family: var(--font-display); font-size: 1.2rem; margin: 1.5rem 0; }
.prose table, .event-body table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .97rem; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-1); display: block; overflow-x: auto; }
.prose th, .event-body th { text-align: left; background: var(--c-sand-soft); font-weight: 700; padding: .65rem .8rem; border-bottom: 2px solid var(--line); }
.prose td, .event-body td { padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose iframe, .event-body iframe { max-width: 100%; border-radius: var(--radius-sm); }
.prose a, .event-body a { overflow-wrap: anywhere; }
.prose code, .event-body code { background: var(--c-sand-soft); padding: .1em .35em; border-radius: .3em; color: var(--link); }

/* --------------------------------------------------------------------------
   Content pages
   -------------------------------------------------------------------------- */
.page-head { padding-block: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 3vw, 2rem); }
.page-head h1 { font-size: clamp(2.2rem, 4.5vw, 3.5rem); letter-spacing: -.02em; margin: .5rem 0 0; text-wrap: balance; }
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; padding-bottom: clamp(3rem, 6vw, 5rem); }
@media (min-width: 992px) { .page-layout.has-toc { grid-template-columns: minmax(0, 38rem) 16rem; justify-content: start; gap: clamp(3rem, 7vw, 6.5rem); } }
/* Reading column: about 75 characters a line; the contents list sits beside the text, not across the page. An imported
   <h1> in the body is a section heading here (the page title is the h1). */
.page-layout .prose { max-width: 38rem; }
.page-layout .prose:has(> .md-cols) { max-width: 72rem; }   /* side-by-side sections need the width */
@media (min-width: 992px) { .page-layout.has-toc:has(.md-cols) { grid-template-columns: minmax(0, 1fr); } }
.page-layout:has(.md-cols) .toc { display: none !important; }
.page-layout .prose h1 { font-size: 1.6rem; }
.toc { display: none; }
@media (min-width: 992px) { .page-layout.has-toc .toc { display: block; position: sticky; top: calc(var(--header-h) + 1.25rem); align-self: start; max-height: calc(100vh - var(--header-h) - 2.5rem); overflow: auto; } }
.toc .lbl { font-family: var(--font-cond); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-bottom: .6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: .3rem 0 .3rem .9rem; color: var(--text-muted); text-decoration: none; font-size: .92rem; line-height: 1.3; margin-left: -2px; border-left: 2px solid transparent; }
.toc li.lvl-3 a { padding-left: 1.7rem; font-size: .86rem; }
.toc li a:hover { color: var(--text); }
.toc li a.active { color: var(--link); border-left-color: var(--accent); font-weight: 600; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); padding: clamp(2.5rem, 6vw, 4rem) 0 1.5rem; font-size: .95rem; margin-top: auto; }
.site-footer a { color: #e8efe8; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .brand-name { color: #fff; }
.site-footer .lbl { font-family: var(--font-cond); font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--c-sky); font-weight: 700; margin-bottom: .8rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .45rem; }
.site-footer .legal { border-top: 1px solid rgb(255 255 255 / .12); margin-top: 2.5rem; padding-top: 1.25rem; font-size: .85rem; color: #9fb09f; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
.site-footer i { color: var(--c-ember); margin-right: .35rem; }

/* --------------------------------------------------------------------------
   Legacy components still used by other templates
   -------------------------------------------------------------------------- */
.event-card .event-img { height: 160px; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.event-date-badge { min-width: 3.5rem; text-align: center; background: var(--c-forest); color: #fff; border-radius: .5rem; padding: .35rem .5rem; line-height: 1.1; }
.event-date-badge .mon { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.event-date-badge .day { font-size: 1.4rem; font-weight: 700; }
.event-body img { max-width: 100%; height: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid .cal-head { font-weight: 600; text-align: center; padding: .25rem; font-size: .85rem; }
.cal-grid .cal-day { background: var(--surface); min-height: 6.5rem; padding: .25rem; font-size: .8rem; }
.cal-grid .cal-day.other { background: var(--surface-2); color: var(--text-subtle); }
.cal-grid .cal-day.today { outline: 2px solid var(--c-forest); }
.cal-grid .cal-ev { display: block; background: var(--c-forest); color: #fff; border-radius: .25rem; padding: 0 .3rem; margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
@media (max-width: 640px) { .cal-grid .cal-day { min-height: 4rem; } .cal-grid .cal-ev { font-size: .65rem; } }
.table-sm td, .table-sm th { vertical-align: middle; }
.stat { font-size: clamp(1.3rem, 1rem + 1.4vw, 1.75rem); font-weight: 700; line-height: 1.15; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-label { font-family: var(--font-cond); font-size: .78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; line-height: 1.2; }

/* --------------------------------------------------------------------------
   Manage / account legacy helpers
   -------------------------------------------------------------------------- */
.subnav { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; border-bottom-color: var(--line); }
.subnav::-webkit-scrollbar { display: none; }
.subnav .nav-link { white-space: nowrap; color: var(--text-muted); font-weight: 600; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: .5rem .85rem; }
.subnav .nav-link:hover { color: var(--primary-text); border-bottom-color: var(--line); }
.subnav .nav-link.active { color: var(--primary-text); background: transparent; border-bottom-color: var(--accent); }
.admin h1, .account-page h1 { font-family: var(--font-display); }
.admin .table td, .admin .table th { vertical-align: middle; }
@media (max-width: 575.98px) {
  .admin .table { font-size: .875rem; }
  .admin .table-responsive { -webkit-overflow-scrolling: touch; }
  .admin .table-responsive > .table td, .admin .table-responsive > .table th { white-space: nowrap; }
}

/* Error pages */
.error-page { text-align: center; padding-block: clamp(3rem, 14vh, 8rem); max-width: 40rem; }
.error-page .code { font-family: var(--font-display); font-weight: 700; font-size: clamp(4rem, 14vw, 7rem); line-height: 1; color: var(--text-subtle); letter-spacing: -.03em; }
.error-page h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: .75rem 0; }
.error-page .lead { color: var(--text-muted); margin-bottom: 2rem; }

/* Sign in and "check your email": one centred card with room around it */
.auth-stage { padding-block: clamp(1.5rem, 9vh, 6rem); }
.auth-stage .card { box-shadow: var(--shadow-2); }
.auth-stage .card-body { padding: clamp(1.5rem, 5vw, 2.5rem) !important; }
.auth-stage h1 { font-size: clamp(1.6rem, 4vw, 2rem); margin-bottom: .75rem; }
.auth-stage .form-control, .auth-stage .btn { min-height: 3rem; }
.auth-stage .btn { display: inline-flex; align-items: center; justify-content: center; }

@media print {
  /* Paper: content only. The theme script switches to the light tokens while printing. */
  .site-header, .site-footer, .skip-link, .rail, .rail-open, .page-actions, .ds-tabs, .event-tabs-bar, .next-steps, .seg,
  .btn, .btn-close, .crumbs, .ros-find, .no-print { display: none !important; }
  body, body.app { background: #fff !important; color: #000; }
  body.has-rail > main, body.has-rail > .site-footer { margin-left: 0 !important; }
  main.container { max-width: none; padding: 0 !important; }
  .card, .stat-tile { box-shadow: none !important; border: 1px solid #bbb; }
  .stat-tile, tr, .ds-list > li { break-inside: avoid; }
  .table-responsive, .scroll-box { overflow: visible !important; max-height: none !important; }
  .more-left, .more-right { -webkit-mask-image: none !important; mask-image: none !important; }
  h1, h2, h3 { break-after: avoid; }
}

/* ==========================================================================
   Design-system components (macros in templates/_components.html; docs/design/system.md)
   ========================================================================== */

/* App pages (Manage, account, messages) sit on a slightly warmer background so cards lift. */
body.app { background: var(--bg-app); }

/* Page header: crumbs, kicker, title (+count/pill), subtitle, actions */
.page-header { margin: 0 0 var(--sp-5); }
.page-header .crumbs { margin-bottom: var(--sp-2); }
.page-header-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-3) var(--sp-5); }
.page-header-text { min-width: 0; flex: 1 1 18rem; }
.page-header .kicker { margin-bottom: .35rem; }
.page-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2xl); line-height: 1.12; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
.page-count { font-family: var(--font-body); font-size: .5em; font-weight: 500; color: var(--text-muted); letter-spacing: 0; vertical-align: middle; }
.page-title .pill { font-size: .4em; vertical-align: middle; }
.page-sub { margin: .4rem 0 0; color: var(--text-muted); max-width: 70ch; }
.page-sub strong { color: var(--text); }
/* Page help: "?" beside the title, panel under it (macros help_toggle / help_panel) */
.page-title-row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.page-title-row .page-title { min-width: 0; }
.page-help-btn { flex: none; display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: transparent; color: var(--text-subtle);
  font-size: var(--fs-sm); line-height: 1; cursor: pointer; opacity: .75; transition: opacity .15s, color .15s, border-color .15s, background-color .15s; }
.page-help-btn:hover, .page-help-btn:focus-visible, .page-help-btn[aria-expanded="true"] { opacity: 1; color: var(--primary-text); border-color: var(--line-strong); background: var(--surface); }
.page-help-btn:focus-visible, .page-help-close:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
/* Coarse pointers get a bigger hit area without a bigger icon. */
@media (pointer: coarse) { .page-help-btn { position: relative; } .page-help-btn::after { content: ""; position: absolute; inset: -.5rem; } }
.page-help { display: flex; align-items: flex-start; gap: var(--sp-2); margin: var(--sp-2) 0 0; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
  max-width: 70ch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }
.page-help[hidden] { display: none; }
.page-help-body { flex: 1 1 auto; min-width: 0; padding-top: .15rem; }
.page-help-body p { margin: 0 0 var(--sp-2); }
.page-help-body p:last-child { margin-bottom: 0; }
.page-help-body strong { color: var(--text); }
.page-help-close { flex: none; display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; padding: 0;
  border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-subtle); cursor: pointer; }
.page-help-close:hover { color: var(--text); background: var(--surface-tint); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
@media (max-width: 575.98px) {
  .page-header { margin-bottom: var(--sp-4); }
  .page-actions { width: 100%; }
}

/* Breadcrumbs */
.crumbs .breadcrumb { margin: 0; font-size: var(--fs-sm); }
.crumbs .breadcrumb-item + .breadcrumb-item::before { color: var(--text-subtle); }

/* Section header */
.ds-section { margin-bottom: var(--sp-6); }
.section-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2) var(--sp-4); margin: 0 0 var(--sp-3); }
.section-header-title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; margin: 0; }
.section-header-sub { margin: .25rem 0 0; color: var(--text-muted); font-size: var(--fs-sm); }

/* Card */
.ds-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); padding: 1.1rem 1.25rem 0; }
.ds-card-head + .card-body { padding-top: .6rem; }
.ds-card-head + .table-responsive, .ds-card-head + .list-group, .ds-card-head + .ds-list { margin-top: .6rem; }
.ds-card-title { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; margin: 0; }
.ds-card-sub { margin: .2rem 0 0; color: var(--text-muted); font-size: var(--fs-sm); }
.ds-list { list-style: none; margin: 0; padding: 0; }
.ds-list > li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: .6rem 0; border-top: 1px solid var(--line); }
.ds-list > li:first-child { border-top: 0; padding-top: 0; }
.ds-list .meta { color: var(--text-muted); font-size: var(--fs-sm); }

/* Stat tile */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.stat-tile { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 1rem 1.15rem; min-width: 0; }
.stat-tile .stat a { color: inherit; text-decoration: none; }
.stat-note { font-size: var(--fs-sm); color: var(--text-muted); margin-top: .2rem; }
.stat-tile--danger .stat { color: var(--danger-fg); }
.stat-tile--warning .stat { color: var(--warning-fg); }
.stat-tile--success .stat { color: var(--success-fg); }
@media (max-width: 575.98px) { .stat-grid { grid-template-columns: 1fr 1fr; } }

/* Chip (neutral tag) */
.chip--success { background: var(--success-bg); color: var(--success-fg); border-color: transparent; }
.chip--danger { background: var(--danger-bg); color: var(--danger-fg); border-color: transparent; }
.chip--info { background: var(--info-bg); color: var(--info-fg); border-color: transparent; }

/* Status pill: a state word with a fixed colour meaning */
.pill { display: inline-flex; align-items: center; gap: .3em; font-family: var(--font-cond); font-weight: 600; font-size: var(--fs-xs);
  letter-spacing: .03em; line-height: 1.3; padding: .2em .65em; border-radius: var(--radius-pill); white-space: nowrap; vertical-align: .1em;
  background: var(--neutral-bg); color: var(--neutral-fg); }
.pill--success { background: var(--success-bg); color: var(--success-fg); }
.pill--warning { background: var(--warning-bg); color: var(--warning-fg); }
.pill--danger  { background: var(--danger-bg);  color: var(--danger-fg); }
.pill--info    { background: var(--info-bg);    color: var(--info-fg); }
.pill--neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.pill--dark    { background: var(--dark-bg);    color: var(--dark-fg); }
.pill--outline { background: transparent; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* Empty state */
.empty--compact { padding: 1.5rem 1rem; }
.empty p { max-width: 42ch; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-2); }
.empty-row td { color: var(--text-muted); padding: 1.25rem 1rem !important; text-align: center; }

/* Data table */
.table-card { overflow: hidden; }
.table-card > .table-responsive { border-radius: var(--radius); }
.data-table { margin: 0; }
.data-table > :not(caption) > * > * { padding: .6rem .75rem; }
.data-table thead th { background: var(--surface-tint); border-bottom: 1px solid var(--line); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .row-actions { text-align: right; white-space: nowrap; }
.data-table .row-actions .btn { padding: .25rem .5rem; }
@media (max-width: 575.98px) {
  .data-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table--stack, .data-table--stack tbody, .data-table--stack tr, .data-table--stack td { display: block; width: 100%; }
  .data-table--stack tr { padding: .75rem 1rem; border-top: 1px solid var(--line); }
  .data-table--stack tr:first-child { border-top: 0; }
  .data-table--stack > :not(caption) > * > * { padding: .1rem 0; border: 0; white-space: normal !important; }
  .data-table--stack td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; color: var(--text-muted); font-family: var(--font-cond); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; margin-right: .3rem; }
  .data-table--stack td:empty { display: none; }
  .data-table--stack td:first-child { font-size: 1rem; margin-bottom: .2rem; }
  .data-table--stack .row-actions { text-align: left; margin-top: .4rem; }
  .data-table--stack .empty-row td::before { content: none; }
}
/* Auto-stack: on a phone, any other .table wider than its box becomes one block per row, each cell
   labelled from its column heading (script in base.html adds .table-stack, .stack-title, data-label).
   Opt out with .no-stack on the table or a wrapper; row editors stay tables. */
@media (max-width: 575.98px) {
  .table-stack { display: block; width: 100%; }
  .table-stack > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-stack > tbody, .table-stack > tfoot { display: block; }
  .table-stack > * > tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1rem; padding: .7rem 0; border-top: 1px solid var(--line);
    background-color: var(--bs-table-bg); color: var(--bs-table-color); }
  .table-stack > tbody:first-of-type > tr:first-child { border-top: 0; padding-top: .25rem; }
  .card > .table-responsive > .table-stack > * > tr, .card > .table-stack > * > tr { padding-inline: 1rem; }
  .table-stack > * > tr > * { display: block; flex: 0 1 auto; width: auto !important; min-width: 0; max-width: 100%; padding: 0; border: 0;
    background: transparent; box-shadow: none; text-align: left !important; white-space: normal !important; overflow-wrap: anywhere; }
  .table-stack > * > tr > .stack-title { flex: 1 0 100%; order: -1; font-size: 1rem; font-weight: 600; }
  .table-stack > * > tr > .stack-wide { flex: 1 0 100%; }
  .table-stack > * > tr > td[data-label]::before { content: attr(data-label); margin-right: .35rem; color: var(--text-muted); font-family: var(--font-cond);
    font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; }
  .table-stack > * > tr > .stack-skip, .table-stack > * > tr > td:empty { display: none; }
}
/* Sideways-scrolling boxes (wide tables on tablets, section tabs): fade the edge that has more to show
   (script in base.html sets .more-left / .more-right as the box scrolls). */
.more-right { -webkit-mask-image: linear-gradient(to left, transparent, #000 2.25rem); mask-image: linear-gradient(to left, transparent, #000 2.25rem); }
.more-left { -webkit-mask-image: linear-gradient(to right, transparent, #000 2.25rem); mask-image: linear-gradient(to right, transparent, #000 2.25rem); }
.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 2.25rem, #000 calc(100% - 2.25rem), transparent);
  mask-image: linear-gradient(to right, transparent, #000 2.25rem, #000 calc(100% - 2.25rem), transparent); }

/* Alerts with an icon */
.ds-alert { display: flex; gap: .65rem; align-items: flex-start; }
.ds-alert > .bi { flex: none; margin-top: .15rem; }

/* Tabs (sub-pages within a Manage section) */
.ds-tabs { margin: 0 0 var(--sp-4); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: relative; }
@media (max-width: 575.98px) { .ds-tabs .nav-link > .bi { display: none; } .ds-tabs .nav-link { padding-inline: .6rem; } }
.ds-tabs::-webkit-scrollbar { display: none; }
.ds-tabs .nav { flex-wrap: nowrap; gap: .25rem; }
.ds-tabs .nav-link { white-space: nowrap; color: var(--text-muted); font-family: var(--font-cond); font-weight: 600; font-size: 1rem;
  padding: .6rem .85rem; border-bottom: 3px solid transparent; border-radius: 0; min-height: var(--tap); display: inline-flex; align-items: center; gap: .35rem; }
.ds-tabs .nav-link:hover { color: var(--text); border-bottom-color: var(--line-strong); }
.ds-tabs .nav-link.active { color: var(--primary-text); border-bottom-color: var(--accent); }
.tab-count { font-family: var(--font-cond); font-size: var(--fs-xs); font-weight: 700; line-height: 1; min-width: 1.4rem; padding: .2rem .45rem;
  border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-muted); text-align: center; }
.ds-tabs .nav-link.active .tab-count { background: var(--neutral-bg); color: var(--text); }
.tab-count--warning, .ds-tabs .nav-link.active .tab-count--warning { background: var(--warning-bg); color: var(--warning-fg); }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-pill); padding: .2rem; gap: .1rem; }
.seg-item { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .9rem; border-radius: var(--radius-pill); font-size: var(--fs-sm);
  font-weight: 600; color: var(--text-muted); text-decoration: none; white-space: nowrap; min-height: 2.25rem; }
.seg-item:hover { color: var(--text); }
.seg-item.active { background: var(--surface); color: var(--primary-text); box-shadow: 0 1px 2px rgb(0 0 0 / .14); }

/* Next steps row */
.next-steps { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4); }
.next-steps-lbl { font-family: var(--font-cond); font-weight: 700; font-size: var(--fs-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); margin-right: .25rem; }
.next-step { display: inline-flex; align-items: center; gap: .4rem; min-height: var(--tap); padding: .4rem .9rem; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--shadow-inset); color: var(--text); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); }
.next-step:hover { box-shadow: inset 0 0 0 1px var(--primary-text); color: var(--primary-text); }
.next-step i { color: var(--accent-text); }

/* Form field */
.form-field .req { color: var(--accent-text); }
.form-text { color: var(--text-muted); }

/* ==========================================================================
   Admin rail (left nav): staff only, every page. Top nav = the site; left nav = admin tools.
   Desktop: fixed under the header, collapsible to icons (html[data-rail="collapsed"]).
   Below 992px: an overlay opened from the header's "Admin" button.
   ========================================================================== */
:root { --rail-w: 13rem; }
:root[data-rail="collapsed"] { --rail-w: 3.75rem; }
.manage-main { min-width: 0; }
.rail { font-family: var(--font-cond); }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem .75rem .6rem; border-bottom: 1px solid var(--line); }
.rail-title { display: flex; align-items: center; gap: .6rem; min-width: 0; color: var(--text); }
.rail-title > .bi { color: var(--accent-text); font-size: 1.1rem; width: 1.25rem; text-align: center; flex: none; }
.rail-title strong { display: block; font-family: var(--font-display); font-size: 1.1rem; line-height: 1.1; }
.rail-role { display: block; font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-collapse { flex: none; align-items: center; justify-content: center; width: 2rem; height: 2rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); }
.rail-collapse:hover { background: var(--surface-2); color: var(--text); }
.rail-body { padding: .75rem .5rem 1.5rem; }
.rail-group { margin-bottom: .9rem; }
.rail-group-lbl { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 .25rem .75rem; white-space: nowrap; }
.rail-group ul { list-style: none; margin: 0; padding: 0; }
.rail-link { display: flex; align-items: center; gap: .65rem; min-height: 2.4rem; padding: .3rem .75rem; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 1rem; white-space: nowrap; }
.rail-link i { color: var(--text-muted); width: 1.25rem; text-align: center; flex: none; font-size: 1.05rem; }
.rail-link:hover { background: var(--surface-2); color: var(--text); }
.rail-link.active { background: var(--primary); color: var(--primary-ink); }
.rail-link.active i { color: inherit; }
.rail-open { display: inline-flex; align-items: center; gap: .35rem; min-height: var(--tap); padding: 0 .75rem; border: 1px solid rgb(255 255 255 / .35);
  border-radius: var(--radius-pill); background: transparent; color: #fff; font-family: var(--font-cond); font-weight: 600; }
.rail-open:hover { background: rgb(255 255 255 / .1); }
/* Admin "View as": a band across the top of the sticky header while previewing a role, and the
   switcher under the rail title. Status tones carry their own dark-mode values. */
:root { --viewas-h: 2.25rem; }
.view-as-bar { display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--viewas-h); padding: .2rem 1rem;
  background: var(--warning-bg); color: var(--warning-fg); font-family: var(--font-cond); font-weight: 600; border-bottom: 2px solid var(--warning-fg); }
.view-as-bar form { margin: 0; }
.view-as-exit { border: 1px solid var(--warning-fg); border-radius: var(--radius-pill); background: transparent; color: inherit; font-weight: 700; padding: .05rem .8rem; }
.view-as-exit:hover, .view-as-exit:focus-visible { background: var(--warning-fg); color: var(--warning-bg); }
.rail-viewas { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
.rail-viewas-lbl { display: flex; align-items: center; gap: .6rem; margin: 0; color: var(--text-muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; white-space: nowrap; }
.rail-viewas-lbl .bi { width: 1.25rem; text-align: center; font-size: 1rem; }
.rail-viewas-ctl { display: flex; gap: .35rem; min-width: 0; flex: 1 1 100%; }
.rail-viewas-ctl .form-select { min-width: 0; }
body.viewing-as .rail-viewas { background: var(--warning-bg); }
@media (min-width: 992px) {
  .rail { position: fixed; z-index: 1020; top: var(--header-h); bottom: 0; left: 0; width: var(--rail-w); overflow-y: auto; overflow-x: hidden;
    background: var(--surface); border-right: 1px solid var(--line); scrollbar-width: thin; }
  .rail .offcanvas-body { display: block; overflow: visible; }
  body.viewing-as .rail { top: calc(var(--header-h) + var(--viewas-h)); }
  body.has-rail > main, body.has-rail > .site-footer { margin-left: var(--rail-w); width: auto; }
  /* body is a flex column: an auto right margin (from .container) would shrink main to its content. */
  body.has-rail > main.container { padding-inline: clamp(1rem, 2.5vw, 2.5rem); margin-right: 0; }
  :root[data-rail="collapsed"] .rail-label, :root[data-rail="collapsed"] .rail-group-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  :root[data-rail="collapsed"] .rail-head { flex-direction: column; padding-inline: .25rem; }
  :root[data-rail="collapsed"] .rail-collapse .bi { transform: rotate(180deg); }
  :root[data-rail="collapsed"] .rail-link { justify-content: center; padding-inline: 0; }
  :root[data-rail="collapsed"] .rail-group { margin-bottom: .5rem; padding-top: .5rem; border-top: 1px solid var(--line); }
  :root[data-rail="collapsed"] .rail-group:first-child { border-top: 0; padding-top: 0; }
}
@media (min-width: 992px) and (prefers-reduced-motion: no-preference) {
  /* Animate only while the user toggles (not on load or resize). */
  :root.rail-anim .rail, :root.rail-anim body.has-rail > main, :root.rail-anim body.has-rail > .site-footer { transition: width var(--dur-2) var(--ease), margin-left var(--dur-2) var(--ease); }
}
@media (max-width: 991.98px) {
  .rail.offcanvas-lg { --bs-offcanvas-width: min(18rem, 86vw); --bs-offcanvas-bg: var(--surface); --bs-offcanvas-color: var(--text); }
  .rail-link { min-height: var(--tap); }
}

/* ==========================================================================
   Theme toggle (header)
   ========================================================================== */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-width: var(--tap); min-height: var(--tap);
  border: 0; background: transparent; color: rgb(255 255 255 / .86); border-radius: var(--radius-pill); font-family: var(--font-cond); font-weight: 600; padding: 0 .6rem; }
.theme-toggle:hover, .theme-toggle:focus-visible { color: #fff; background: rgb(255 255 255 / .1); }
.theme-toggle .bi { font-size: 1.1rem; }
.theme-toggle .theme-label { font-size: .95rem; }
@media (min-width: 1200px) { .theme-toggle .theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.header-tools { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
@media (min-width: 1200px) { .header-tools { order: 3; margin-left: .25rem; } }

/* Touch: every control at least 44px tall */
@media (pointer: coarse) {
  .btn, .form-control, .form-select, .site-header .nav-link, .page-link, .seg-item { min-height: var(--tap); }
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
  .btn-group > .btn { display: inline-flex; }
}

/* Markdown editor (Manage) and small helpers moved out of inline <style>/style= */
.md-preview { min-height: 10rem; }
.row-editor .form-control, .row-editor .form-select { font-size: .875rem; }
/* Row editors keep their columns on a phone and scroll sideways in their box; fields never shrink below a usable width. */
@media (max-width: 767.98px) {
  .row-editor td > .form-control { min-width: 4.5rem; }
  .row-editor td > .form-control[type="number"] { min-width: 3.75rem; }
  .row-editor td > .form-select { min-width: 6.5rem; }
  .row-editor td:first-child > .form-control { min-width: 9rem; }
}
.gap-badges .badge, .gap-badges .chip { margin-right: .2rem; }
.pre-line { white-space: pre-line; }
.pre-wrap { white-space: pre-wrap; }
.w-input-xs { width: 5rem; }
.w-input-sm { width: 10rem; }
.mw-select { max-width: 16rem; }
.mw-form { max-width: 28rem; }
/* View-only planning for members: controls disabled, editing affordances hidden */
fieldset.ro { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.ro .row-actions, fieldset.ro .open-ev, fieldset.ro .sb-act, fieldset.ro .pl-cta, fieldset.ro .pl-skip-btn { display: none !important; }
.planning-tabs { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
/* School breaks admin: one compact form row per break */
.sb-form { display: grid; grid-template-columns: minmax(10rem, 1.4fr) repeat(3, minmax(8.5rem, 1fr)) minmax(10rem, 1.6fr) auto;
  gap: .5rem; align-items: end; }
.sb-act { display: flex; gap: .35rem; }
@media (max-width: 991.98px) { .sb-form { grid-template-columns: 1fr 1fr; } .sb-name, .sb-note { grid-column: 1 / -1; } }
.scroll-box { max-height: 24rem; overflow: auto; }
.img-cover-preview { max-height: 200px; width: 100%; object-fit: cover; }
/* Event editor, Image card: focal point tool and the photo picker (admin/event_edit.html).
   js/focus.js sets object-position on any [data-focus-x][data-focus-y] cover crop. */
.img-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.img-tools .btn, .focus-panel .btn { min-height: var(--tap); display: inline-flex; align-items: center; gap: .35rem; }
.focus-panel { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-tint); padding: .75rem; }
.focus-stage { position: relative; width: fit-content; max-width: 100%; margin-inline: auto; cursor: crosshair;
  touch-action: none; user-select: none; -webkit-user-select: none; border-radius: var(--radius-xs); outline-offset: 3px; }
.focus-stage:focus-visible { outline: 3px solid var(--focus); }
.focus-stage img { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; border-radius: var(--radius-xs); pointer-events: none; }
.focus-dot { position: absolute; left: 50%; top: 50%; width: 1.75rem; height: 1.75rem; margin: -.875rem 0 0 -.875rem;
  border-radius: 50%; border: 3px solid var(--primary-ink); background: transparent;   /* a ring: the face stays visible */
  box-shadow: 0 0 0 2px var(--accent), inset 0 0 0 1px var(--c-forest-ink), 0 2px 6px color-mix(in srgb, var(--c-forest-ink) 50%, transparent);
  pointer-events: none; }
.focus-previews { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .75rem; align-items: start; }
.focus-pv { margin: 0; }
.focus-pv img { display: block; width: 100%; object-fit: cover; border-radius: var(--radius-xs); background: var(--surface-2); }
.focus-pv figcaption { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }
.focus-pv--hero { grid-column: 1 / -1; }
.focus-pv--hero img { aspect-ratio: 21 / 9; }
.focus-pv--phone img { aspect-ratio: 4 / 5; }
.focus-pv--card img { aspect-ratio: 16 / 9; }
.focus-pv--square img { aspect-ratio: 1; }
.focus-pv--card, .focus-pv--square { grid-column: 2; }
.focus-pv--phone { grid-row: span 2; }
.picker-head { font-size: .95rem; font-weight: 600; margin: 1rem 0 .5rem; }
.picker-head:first-child { margin-top: 0; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; }
.picker-item { padding: 0; border: 2px solid transparent; border-radius: var(--radius-xs); background: var(--surface-2); overflow: hidden; cursor: pointer; }
.picker-item img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.picker-item:hover, .picker-item:focus-visible { border-color: var(--primary); }
.picker-item:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.picker-item.is-current { border-color: var(--accent); }
.picker-more { text-align: center; margin-top: 1rem; }
@media (max-width: 575.98px) { .picker-grid { grid-template-columns: repeat(3, 1fr); gap: .35rem; } }
.basis-14 { flex-basis: 14rem; }
.col-w-2 { width: 2rem; } .col-w-4 { width: 4.5rem; } .col-w-5 { width: 5.5rem; } .col-w-7 { width: 7rem; } .col-w-9 { width: 9rem; } .col-min-10 { min-width: 10rem; }
.trip-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; margin-bottom: .5rem; text-decoration: none; }
.trip-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-xs); }

/* Phones: keep brand + tools on one row */
@media (max-width: 575.98px) {
  .theme-toggle .theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .site-header .container { flex-wrap: wrap; }
  .site-header .navbar-collapse { flex-basis: 100%; }
  .brand-name { font-size: 1.1rem; }
  .brand-sub { font-size: .6rem; letter-spacing: .1em; }
  .header-tools { gap: .15rem; }
  .rail-open { padding: 0 .6rem; }
}
@media (max-width: 379.98px) { .brand-sub { display: none; } }
@media (max-width: 575.98px) {
  body.has-rail .brand-sub { display: none; }
  body.has-rail .brand img { width: 2rem; height: 2rem; }
  .site-header .navbar-toggler { padding: .25rem .5rem; }
}

/* Bare checkboxes in dense admin forms: at least 24px targets (WCAG 2.5.8) */
label > .form-check-input[type="checkbox"] { width: 1.5rem; height: 1.5rem; vertical-align: -.35rem; }

/* Who's going (event page, troop families only) */
.going { margin-top: var(--space-6, 2.5rem); }
.going-total, .going-n { display: inline-block; min-width: 1.6em; padding: 0 .45em; margin-left: .35rem; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font: 600 .8rem/1.6 var(--font-cond); text-align: center; vertical-align: middle; }
/* Each group is a label and a wrap of name pills: 70 names take a few rows, not 70. */
.going-groups { display: grid; gap: 1.1rem; }
.going-label { font: 700 .8rem/1.2 var(--font-cond); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 .4rem; }
.going-names { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.going-names li { padding: .2rem .75rem; border-radius: var(--radius-pill); background: var(--surface-2); font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; }
.going-wait .going-names li { background: transparent; border: 1px dashed var(--line-strong); color: var(--text-muted); }
.going-note { font-size: .8rem; color: var(--text-muted); margin-top: .75rem; }

/* Per-event admin tabs (_components.event_tabs). On public pages: a slim staff-only bar above the hero. */
.event-tabs .ds-tabs { margin-bottom: var(--sp-3); }
.event-tabs-bar { background: var(--surface-tint); border-bottom: 1px solid var(--line); }
.event-tabs--slim .ds-tabs { margin: 0; border-bottom: 0; }
.event-tabs--slim .ds-tabs .nav-link { font-size: .9rem; padding-block: .4rem; }

/* Previous / next event pager (event page) */
.ev-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2rem; }
.ev-pager-link { display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1.1rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; min-height: 44px; }
.ev-pager-link:hover { border-color: var(--link); color: var(--text); }
.ev-pager-next { text-align: right; align-items: flex-end; }
.ev-pager-dir { font: 700 .75rem/1.2 var(--font-cond); letter-spacing: .06em; text-transform: uppercase; color: var(--link); }
.ev-pager-title { font-weight: 600; }
.ev-pager-when { font-size: .85rem; color: var(--text-muted); }
@media (max-width: 575.98px) { .ev-pager { grid-template-columns: 1fr; } .ev-pager-next { text-align: left; align-items: flex-start; } }

/* Admin documentation */
.docs-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 2rem; align-items: start; }
.docs-nav { position: sticky; top: calc(var(--header-h) + 1rem); }
.docs-nav ul { list-style: none; padding: 0; margin: 0; }
.docs-nav a { display: block; padding: .45rem .75rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.docs-nav a:hover { background: var(--surface-2); }
.docs-nav a.active { background: var(--surface-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--c-ember); }
.docs-src { font-size: .8rem; color: var(--text-muted); margin-top: 1rem; padding-left: .75rem; }
.docs-body { max-width: 75ch; }
.docs-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; }
.docs-body th, .docs-body td { border-bottom: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.docs-body pre { background: var(--surface-2); padding: .75rem 1rem; border-radius: var(--radius-sm); overflow-x: auto; }
.docs-body h2 { margin-top: 2rem; } .docs-body h3 { margin-top: 1.5rem; }
@media (max-width: 767.98px) { .docs-layout { grid-template-columns: 1fr; } .docs-nav { position: static; } }

/* Events sheet: quick link from the (sticky) title cell to the event's planning page */
.title-row { display: flex; align-items: center; gap: .25rem; }
.title-row .cell-title { flex: 1 1 auto; min-width: 0; }
.open-ev { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .2rem; padding: .15rem .4rem; border-radius: 999px;
  color: var(--link); text-decoration: none; font: 600 .75rem/1 var(--font-cond); white-space: nowrap; }
.open-ev:hover { background: var(--surface-2); }
.open-ev i { font-size: 1rem; }
@media (max-width: 1100px) { .open-ev-lbl { display: none; } }

/* Profile: login & roles card */
.pf-login-row { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.pf-login-row:last-child { border-bottom: 0; }
.pf-roles { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.pf-role-check { font-size: .85rem; display: inline-flex; gap: .25rem; align-items: center; }
.pf-login-email { max-width: 18rem; }

/* Roster: find anyone (scouts + adults) */
.ros-find { position: relative; display: flex; align-items: center; gap: .5rem; margin: 0 0 1rem; padding: .25rem .75rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1); }
.ros-find:focus-within { border-color: var(--link); }
.ros-find > .bi { color: var(--text-muted); }
.ros-find input { flex: 1; border: 0; background: transparent; color: var(--text); padding: .55rem 0; font-size: 1rem; outline: none; min-width: 0; }
.ros-find-key { font-size: .75rem; color: var(--text-muted); background: var(--surface-2); border-radius: 4px; padding: 0 .35rem; }
.ros-find-results { position: absolute; left: 0; right: 0; top: calc(100% + .35rem); z-index: 50; list-style: none; margin: 0; padding: .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); max-height: 26rem; overflow-y: auto; }
.ros-find-results li a { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "kind name" "kind detail";
  column-gap: .6rem; padding: .45rem .6rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.ros-find-results li.active a, .ros-find-results li a:hover { background: var(--surface-2); }
.rf-kind { grid-area: kind; align-self: center; font: 700 .7rem/1 var(--font-cond); text-transform: uppercase; letter-spacing: .05em;
  padding: .3rem .45rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.rf-scout { background: var(--c-moss-soft); color: var(--primary-text); }
.rf-name { grid-area: name; font-weight: 600; }
.rf-detail { grid-area: detail; font-size: .85rem; color: var(--text-muted); }
.rf-inactive { font-size: .7rem; font-weight: 400; color: var(--text-muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 .35rem; }
.rf-all a { display: block !important; color: var(--link) !important; font-weight: 600; }
@media (max-width: 575.98px) { .ros-find-key { display: none; } }

/* Docs -> Key documents */
.keydoc { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid var(--line); }
.keydoc:first-child { border-top: 0; }
.keydoc-main { min-width: 0; overflow-wrap: anywhere; }
.keydoc-actions { display: flex; gap: .25rem; align-items: center; }

/* ---- AI placeholder illustrations (Event.image_ai): a small label so nobody takes them for photos ---- */
.ai-wrap { position: relative; }
.ai-label { display: inline-flex; align-items: center; gap: .3em; font-family: var(--font-cond); font-weight: 600;
  font-size: var(--fs-xs); letter-spacing: .04em; line-height: 1.2; padding: .2rem .55rem; border-radius: 999px;
  background: var(--dark-bg); color: var(--dark-fg); opacity: .88; pointer-events: none; }
.ai-label--over { position: absolute; top: .5rem; right: .5rem; z-index: 2; }
.event-hero .ai-label--hero { letter-spacing: .08em; font-weight: 600; opacity: 1; }
.ai-prompt { white-space: pre-wrap; font-size: var(--fs-xs); background: var(--surface-2); color: var(--text);
  padding: .75rem; border-radius: var(--radius); }
@media print { .ai-label { opacity: 1; } }
/* --------------------------------------------------------------------------
   Leadership (admin): who holds the key positions, per troop (FB-4)
   -------------------------------------------------------------------------- */
.lead-section { margin-bottom: 1.5rem; }
.lead-h { font-size: 1.05rem; font-weight: 700; margin: 0 0 .6rem; display: flex; align-items: center; gap: .45rem; }
.lead-h i { color: var(--accent-text); }
.lead-list { margin: 0; }
.lead-row { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; gap: .15rem 1rem; padding: .4rem 0; border-top: 1px solid var(--line); }
.lead-row:first-child { border-top: 0; padding-top: 0; }
.lead-row dt { font-weight: 600; font-size: .9rem; color: var(--text); }
.lead-row dd { margin: 0; }
.lead-names { display: flex; flex-wrap: wrap; gap: .1rem .9rem; }
.lead-note { display: block; font-weight: 400; font-size: .8rem; color: var(--text-muted); }
.lead-name { white-space: nowrap; }
.lead-unit { font-size: .72rem; font-weight: 600; padding: 0 .35rem; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral-fg); }
.lead-open { color: var(--text-subtle); font-style: italic; }
.lead-open--flag { color: var(--warning-fg); background: var(--warning-bg); font-style: normal; font-weight: 600; padding: 0 .4rem; border-radius: .25rem; }
@media (max-width: 575px) { .lead-row { grid-template-columns: 8.5rem 1fr; gap: .1rem .6rem; } }

/* --------------------------------------------------------------------------
   Staff role toggles (FB-14): Admin set apart, then the other roles; fixed widths so rows line up
   -------------------------------------------------------------------------- */
.role-set { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin: 0; }
.role-group { display: inline-flex; flex-wrap: wrap; gap: .35rem; padding-left: .5rem; border-left: 1px solid var(--line); }
.role-chip { display: inline-flex; align-items: center; justify-content: center; gap: .2rem; width: 6.4rem; min-height: 32px;
  padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent;
  color: var(--text-muted); font: 600 .8rem/1.2 var(--font-cond); cursor: pointer; transition: background-color .12s, border-color .12s, color .12s; }
.role-chip .bi { width: .9em; visibility: hidden; }
.role-chip.off { border-style: dashed; }
.role-chip.off:hover, .role-chip.implied:hover { color: var(--primary-text); border-color: var(--primary-text); }
.role-chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.role-chip.on .bi, .role-chip.implied .bi { visibility: visible; }
.role-chip.implied { background: var(--surface-2); border-color: var(--surface-2); color: var(--text-muted); }
.role-chip--admin.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
span.role-chip { cursor: default; }
.role-set[aria-busy="true"] .role-chip { cursor: progress; opacity: .7; }
.role-set--static { gap: .35rem; }
.role-toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 1080; max-width: min(36rem, calc(100vw - 2rem));
  padding: .55rem .9rem; border-radius: var(--radius-sm, .5rem); background: var(--dark-bg); color: var(--dark-fg); font-size: .9rem;
  box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .2s; }
.role-toast.show { opacity: 1; }
.role-toast.is-error { background: var(--danger-bg); color: var(--danger-fg); }
/* In the profile's narrow Roles card: Admin on its own line, the other four in a 2×2 block below */
.pf-roles .role-set { flex-direction: column; align-items: flex-start; }
.pf-roles .role-group { display: grid; grid-template-columns: repeat(2, 6.4rem); padding: .35rem 0 0; border-left: 0; border-top: 1px solid var(--line); }

/* ---- Swipe to next/previous (static/js/swipe.js): touch devices only ---- */
.swipe-area { touch-action: pan-y pinch-zoom; }
.swipe-anim { transition: transform .2s var(--ease), opacity .2s var(--ease); }
.swipe-tip { position: fixed; top: 50%; z-index: 1070; max-width: min(18rem, 70vw); padding: .5rem .85rem; border-radius: var(--radius-pill);
  background: var(--dark-bg); color: var(--dark-fg); font: 600 .9rem/1.25 var(--font-cond); box-shadow: var(--shadow-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; pointer-events: none; transform: translateY(-50%) scale(.92);
  transition: opacity .12s, transform .12s, background-color .12s, color .12s; }
.swipe-tip--prev { left: .75rem; }
.swipe-tip--next { right: .75rem; }
.swipe-tip.is-on { opacity: .82; }
.swipe-tip.is-ready { opacity: 1; transform: translateY(-50%) scale(1); background: var(--primary); color: var(--primary-ink); }
.swipe-tip--none { background: var(--surface-2); color: var(--text-muted); }
.swipe-hint { position: fixed; left: 50%; bottom: 1.25rem; z-index: 1070; display: flex; align-items: center; gap: .45rem;
  padding: .5rem 1rem; border-radius: var(--radius-pill); background: var(--dark-bg); color: var(--dark-fg); font-size: .9rem;
  box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transform: translate(-50%, .5rem); transition: opacity .3s, transform .3s var(--ease); }
.swipe-hint.is-on { opacity: .95; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  .swipe-anim, .swipe-tip, .swipe-hint { transition: none; }
}
@media print { .swipe-tip, .swipe-hint { display: none; } }

/* Event editor: what the same event charged in earlier years (FB-15) */
.price-ref { background: var(--surface-tint); border-left: 3px solid var(--line); border-radius: var(--bs-border-radius-sm, .25rem); padding: .5rem .75rem; }
.price-ref summary { cursor: pointer; color: var(--text-muted); }
/* "Cost to be announced" switch and the apply-new-prices link in the editor's Price options card */
.price-tbd-box { background: var(--surface-tint); border-left: 3px solid var(--primary); border-radius: var(--bs-border-radius-sm, .25rem); padding: .5rem .75rem; }
.price-summary { font-size: 1.15rem; font-weight: 600; }

/* --------------------------------------------------------------------------
   Files for families (FB-19/20): event page, sign-up flow, registration page (_event_files.html)
   and the editor's "Files for families" card (admin/event_edit.html)
   -------------------------------------------------------------------------- */
.ef-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.ef-list--grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.ef-item { display: flex; align-items: center; gap: .75rem; min-height: var(--tap); padding: .6rem .75rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .12s, background-color .12s; }
.ef-item:hover, .ef-item:focus-visible { border-color: var(--line-strong); background: var(--surface-tint); color: var(--text); }
.ef-icon { flex: none; width: 2.4rem; height: 2.4rem; border-radius: var(--radius-xs); display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.25rem; background: var(--neutral-bg); color: var(--neutral-fg); }
.ef-icon--pdf { background: var(--danger-bg); color: var(--danger-fg); }
.ef-icon--word { background: var(--info-bg); color: var(--info-fg); }
.ef-icon--excel { background: var(--success-bg); color: var(--success-fg); }
.ef-icon--image { background: var(--warning-bg); color: var(--warning-fg); }
.ef-text { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.ef-title { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.ef-meta { font-size: .82rem; color: var(--text-muted); }
.ef-go { flex: none; color: var(--text-subtle); }
.ef-item:hover .ef-go { color: var(--primary-text); }
.ef-card .card-body > .h5 i { color: var(--accent-text); }

/* Editor card: one row per file (title, where it shows, order, remove) */
.ef-rows { list-style: none; margin: 0 0 .75rem; padding: 0; }
.ef-row { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; gap: .35rem .65rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
.ef-row:first-child { border-top: 0; }
.ef-row-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(11rem, 15rem); gap: .35rem .5rem; min-width: 0; }
.ef-row-file { grid-column: 1 / -1; font-size: .8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.ef-row-file a { color: inherit; }
.ef-row-tools { display: flex; gap: .25rem; }
.ef-row-tools .btn { min-width: 2.25rem; }
.ef-drop { border: 2px dashed var(--line-strong); border-radius: var(--radius-sm); padding: .75rem; background: var(--surface-tint); }
.ef-drop.is-over { border-color: var(--primary-text); background: var(--surface-hover); }
.ef-picked { list-style: none; padding: 0; margin: .4rem 0 0; font-size: .85rem; color: var(--text-muted); }
.ef-picked:empty { display: none; }
@media (max-width: 575px) {
  .ef-row { grid-template-columns: 2.4rem minmax(0, 1fr); }
  .ef-row-fields { grid-template-columns: minmax(0, 1fr); }
  .ef-row-tools { grid-column: 2; }
}
