/* ==========================================================================
   LockerTalk design system

   1. Tokens          primitives + semantic tokens, light and dark
   2. Bootstrap bridge maps the tokens onto Bootstrap 5.3's CSS variables
                       so every stock component follows the active theme
   3. Motion          durations, easings, keyframes, reduced motion
   4. Base            element defaults and typography
   5. Shell           header, navigation, page shell, footer
   6. Components      buttons, forms, cards, tables, badges, alerts, menus…
   7. Features        org, review, opportunity, plan and admin pieces
   8. Pages           home, browse, auth, errors
   9. Utilities

   THEMING
   The <head> script in _Layout.cshtml resolves the viewer's preference
   (localStorage "lt-theme": system | light | dark, default system →
   prefers-color-scheme) and sets data-bs-theme="light|dark" on <html>
   before first paint. Light tokens live on :root; dark tokens override
   them under [data-bs-theme="dark"]. Components only ever reference the
   semantic tokens, never raw colors.

   SHAPE RULE
   Controls (buttons, inputs, menus items) use --radius (10px). Containers
   (cards, panels, menus, modals) use --radius-lg (14px); large feature
   surfaces use --radius-xl (20px). Badges and chips use --radius-sm (6px).
   Only filter chips and the avatar monogram deviate, deliberately.

   BREAKPOINTS (Bootstrap's): sm 576 · md 768 · lg 992 · xl 1200 · xxl 1400.
   Media queries can't read custom properties, so they're documented here.

   Z-INDEX: Bootstrap's scale is kept (dropdown 1000, sticky 1020,
   fixed 1030, modal 1055, toast 1090). The header uses --z-header.
   ========================================================================== */

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

:root,
[data-bs-theme="light"] {
  color-scheme: light;

  /* Surfaces: a cool, slightly blue-tinted neutral family (one gray family
     across the product, matching the brand cyan). */
  --bg: #F5F7FA;
  --bg-elevated: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1F4F8;
  --surface-3: #E7ECF2;
  --surface-inverse: #0E1319;
  --border: #E2E7EE;
  --border-strong: #CAD2DD;
  --control-border: #848E9B;   /* input/checkbox outlines: 3:1 on --surface and --bg (WCAG 1.4.11) */

  --text: #0F161E;
  --text-muted: #4F5B6A;   /* 7.0:1 on white */
  --text-subtle: #5F6B7B;  /* 5.5:1 on white, 4.9:1 on --surface-2 */
  --text-inverse: #F3F6F9;

  /* Brand accent: the logo's cyan, deepened for AA contrast in light mode. */
  --accent: #0A73B0;
  --accent-hover: #08618F;
  --accent-active: #075480;
  --accent-text: #0A6BA3;          /* links and accent text on surfaces */
  --on-accent: #FFFFFF;            /* 5.2:1 on --accent */
  --accent-soft: rgba(10, 115, 176, 0.09);
  --accent-soft-strong: rgba(10, 115, 176, 0.16);
  --accent-ring: rgba(10, 115, 176, 0.32);

  --success: #17763F;       /* 5.0:1 on --success-soft */
  --success-soft: #E6F5EC;
  --success-border: #B9E2C8;
  --warning: #9A5B00;
  --warning-soft: #FDF3E1;
  --warning-border: #F2D6A2;
  --danger: #C2352B;
  --danger-hover: #A62B22;
  --danger-soft: #FCEBEA;
  --danger-border: #F3C3BF;
  --gold: #B7860B;

  --shadow-color: 215 30% 20%;
  --shadow-xs: 0 1px 2px hsl(var(--shadow-color) / 0.06);
  --shadow-sm: 0 1px 2px hsl(var(--shadow-color) / 0.06), 0 1px 3px hsl(var(--shadow-color) / 0.05);
  --shadow: 0 2px 4px hsl(var(--shadow-color) / 0.04), 0 8px 24px -6px hsl(var(--shadow-color) / 0.12);
  --shadow-lg: 0 4px 8px hsl(var(--shadow-color) / 0.05), 0 24px 48px -12px hsl(var(--shadow-color) / 0.22);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.6);

  --header-bg: rgba(255, 255, 255, 0.78);
  --scrim: rgba(14, 19, 25, 0.45);
  --hero-grid: rgba(15, 22, 30, 0.045);
}

[data-bs-theme="dark"] {
  color-scheme: dark;

  --bg: #0A0D11;
  --bg-elevated: #101419;
  --surface: #13181E;
  --surface-2: #192027;
  --surface-3: #212932;
  --surface-inverse: #F3F6F9;
  --border: #242C36;
  --border-strong: #34404D;
  --control-border: #626E7C;   /* 3.4:1 on --surface and --bg-elevated */

  --text: #EDF1F5;
  --text-muted: #A2ADBA;   /* 7.4:1 on --surface */
  --text-subtle: #8693A2;  /* 5.3:1 on --surface */
  --text-inverse: #0F161E;

  /* The logo's cyan, used as-is on dark. It's a light color, so text on
     top of it is dark (the logo itself is cyan-on-black). */
  --accent: #4DB3EA;
  --accent-hover: #72C4F0;
  --accent-active: #34A2DD;
  --accent-text: #6CC0EE;
  --on-accent: #041621;            /* 9.1:1 on --accent */
  --accent-soft: rgba(77, 179, 234, 0.10);
  --accent-soft-strong: rgba(77, 179, 234, 0.18);
  --accent-ring: rgba(77, 179, 234, 0.40);

  --success: #4ADE80;
  --success-soft: rgba(74, 222, 128, 0.10);
  --success-border: rgba(74, 222, 128, 0.28);
  --warning: #F5B83D;
  --warning-soft: rgba(245, 184, 61, 0.10);
  --warning-border: rgba(245, 184, 61, 0.28);
  --danger: #F87171;
  --danger-hover: #FCA5A5;
  --danger-soft: rgba(248, 113, 113, 0.10);
  --danger-border: rgba(248, 113, 113, 0.30);
  --gold: #E3B341;

  --shadow-color: 215 40% 2%;
  --shadow-xs: 0 1px 2px hsl(var(--shadow-color) / 0.5);
  --shadow-sm: 0 1px 2px hsl(var(--shadow-color) / 0.5), 0 1px 3px hsl(var(--shadow-color) / 0.3);
  --shadow: 0 2px 4px hsl(var(--shadow-color) / 0.4), 0 10px 28px -6px hsl(var(--shadow-color) / 0.6);
  --shadow-lg: 0 4px 8px hsl(var(--shadow-color) / 0.4), 0 28px 56px -12px hsl(var(--shadow-color) / 0.75);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  --header-bg: rgba(10, 13, 17, 0.76);
  --scrim: rgba(0, 0, 0, 0.6);
  --hero-grid: rgba(237, 241, 245, 0.035);
}

:root {
  /* Type */
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Barlow Condensed', 'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --fs-2xs: 0.6875rem;  /* 11 */
  --fs-xs: 0.75rem;     /* 12 */
  --fs-sm: 0.8125rem;   /* 13 */
  --fs-base: 0.9375rem; /* 15: UI + body copy */
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: clamp(2rem, 1.4rem + 2.2vw, 2.75rem);
  --fs-display: clamp(2.75rem, 1.6rem + 4.4vw, 4.75rem);

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-tight: 1.1;
  --lh-snug: 1.3;
  --lh-body: 1.6;

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Shape */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Focus: a solid accent ring (>= 3:1 against the page in both themes,
     WCAG 1.4.11 / 2.4.7) separated from the control by a 2px gap in the
     page color, so it also shows on accent-filled buttons. */
  --focus-ring: 0 0 0 2px var(--bg-elevated), 0 0 0 4px var(--accent);

  /* Layers */
  --z-header: 1030;

  /* Controls */
  --control-h: 2.625rem;     /* 42px: inputs and default buttons */
  --control-h-sm: 2.125rem;  /* 34px */
  --control-h-lg: 3rem;      /* 48px */
  --header-h: 4rem;
}

/* 2. Bootstrap bridge ------------------------------------------------------ */

:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-body-font-family: var(--font-sans);
  --bs-body-font-size: var(--fs-base);
  --bs-body-line-height: var(--lh-body);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-heading-color: var(--text);
  --bs-secondary-color: var(--text-muted);
  --bs-tertiary-color: var(--text-subtle);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--border);
  --bs-border-color-translucent: var(--border);
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
  --bs-border-radius-xl: var(--radius-xl);
  --bs-link-color: var(--accent-text);
  --bs-link-hover-color: var(--accent-hover);
  --bs-focus-ring-color: var(--accent-ring);
  --bs-box-shadow: var(--shadow);
  --bs-box-shadow-sm: var(--shadow-sm);
  --bs-box-shadow-lg: var(--shadow-lg);

  --bs-primary-text-emphasis: var(--accent-text);
  --bs-primary-bg-subtle: var(--accent-soft);
  --bs-primary-border-subtle: var(--accent-soft-strong);
  --bs-success-text-emphasis: var(--success);
  --bs-success-bg-subtle: var(--success-soft);
  --bs-success-border-subtle: var(--success-border);
  --bs-warning-text-emphasis: var(--warning);
  --bs-warning-bg-subtle: var(--warning-soft);
  --bs-warning-border-subtle: var(--warning-border);
  --bs-danger-text-emphasis: var(--danger);
  --bs-danger-bg-subtle: var(--danger-soft);
  --bs-danger-border-subtle: var(--danger-border);
  --bs-info-text-emphasis: var(--accent-text);
  --bs-info-bg-subtle: var(--accent-soft);
  --bs-info-border-subtle: var(--accent-soft-strong);

  --bs-form-valid-color: var(--success);
  --bs-form-valid-border-color: var(--success);
  --bs-form-invalid-color: var(--danger);
  --bs-form-invalid-border-color: var(--danger);
}

/* 3. Motion ---------------------------------------------------------------- */

:root {
  --dur-instant: 80ms;   /* press feedback */
  --dur-fast: 140ms;     /* hover, focus, color */
  --dur-base: 220ms;     /* menus, toggles, small movement */
  --dur-slow: 360ms;     /* entrances, panels, modals */
  --dur-slower: 600ms;   /* data fills, counters */

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);       /* entering / settling */
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);        /* leaving */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);    /* moving between states */
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);  /* small confirmations only */

  --stagger: 40ms;
  --enter-distance: 10px;
}

@keyframes lt-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lt-rise-in {
  from { opacity: 0; transform: translateY(var(--enter-distance)); }
  to { opacity: 1; transform: none; }
}
@keyframes lt-menu-in {
  from { opacity: 0; translate: 0 -6px; scale: 0.98; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}
@keyframes lt-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes lt-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes lt-fill-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes lt-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes lt-progress {
  0% { transform: translateX(-100%) scaleX(0.3); }
  50% { transform: translateX(10%) scaleX(0.6); }
  100% { transform: translateX(100%) scaleX(0.3); }
}
@keyframes lt-spin { to { transform: rotate(360deg); } }
@keyframes lt-ping {
  0% { box-shadow: 0 0 0 0 var(--accent-ring); }
  100% { box-shadow: 0 0 0 8px transparent; }
}

/* Cross-document page transitions (progressive enhancement: Chromium
   only today; other browsers just navigate normally). The header keeps
   its own transition group so it stays put while the page crossfades. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: var(--dur-fast) var(--ease-in) both lt-fade-out-vt; }
::view-transition-new(root) { animation: var(--dur-base) var(--ease-out) both lt-fade-in-vt; }
::view-transition-group(org-tab-indicator) { animation-duration: var(--dur-slow); animation-timing-function: var(--ease-out); }
@keyframes lt-fade-out-vt { to { opacity: 0; } }
@keyframes lt-fade-in-vt { from { opacity: 0; transform: translateY(4px); } }

/* Scroll-reveal: site.js adds .is-visible via IntersectionObserver. Only
   hidden when JS is running (html.js) AND motion is allowed, so content
   is never stuck invisible. */
@media (prefers-reduced-motion: no-preference) {
  html.js [data-reveal]:not(.is-visible) {
    opacity: 0;
    transform: translateY(14px);
  }
  html.js [data-reveal] {
    transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
    transition-delay: calc(var(--reveal-i, 0) * 60ms);
  }
}

/* Reduced motion: keep state changes (color, opacity) but drop movement,
   loops and page transitions. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  @view-transition { navigation: none; }
}

/* 4. Base ------------------------------------------------------------------ */

* { box-sizing: border-box; }

html {
  font-size: 16px;
  background: var(--bg);
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  /* Full-bleed decoration (the home hero grid) must never cause sideways
     scrolling. clip, unlike hidden, doesn't break the sticky header. */
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--text);
  text-wrap: balance;
  margin-top: 0;
}

/* Display levels use the condensed athletic face from the logo; working
   headings (h3 and below) stay in Geist for legibility at small sizes. */
h1, .h1, h2, .h2 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.005em;
}
h1, .h1 { font-size: var(--fs-3xl); }
h2, .h2 { font-size: var(--fs-2xl); }

h3, .h3, h4, .h4, h5, .h5 {
  font-family: var(--font-sans);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: -0.015em;
}
h3, .h3 { font-size: var(--fs-xl); }
h4, .h4 { font-size: var(--fs-lg); }
h5, .h5 { font-size: var(--fs-md); }

h6, .h6 {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.005em;
  line-height: var(--lh-snug);
  color: var(--text-muted);
}

p { text-wrap: pretty; }
.lead { font-size: var(--fs-lg); color: var(--text-muted); font-weight: var(--fw-regular); }
small, .small { font-size: var(--fs-sm); }
strong, b { font-weight: var(--fw-semibold); }

.text-muted { color: var(--text-muted) !important; }
.form-text { color: var(--text-muted); font-size: var(--fs-sm); }

a {
  color: var(--accent-text);
  text-decoration: none;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--accent-hover); }
p a:not(.btn), .form-text a, dd a, .alert a:not(.btn), .auth-foot a { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
p a:not(.btn):hover, .form-text a:hover, dd a:hover { text-decoration-color: currentColor; }

code, pre, kbd, samp, .font-mono { font-family: var(--font-mono); font-size: 0.875em; }
code { color: var(--text); background: var(--surface-2); padding: 0.1em 0.35em; border-radius: var(--radius-sm); }
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

hr { border-color: var(--border); opacity: 1; }

::selection { background: var(--accent-soft-strong); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Bootstrap's .nav-link swaps the outline for a 25% tint ring, too faint
   to see (WCAG 1.4.11). Put the solid outline back. */
.nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: none;
}

.icon { flex: 0 0 auto; display: inline-block; vertical-align: -0.15em; }

img { max-width: 100%; }

/* Skip link: invisible until focused, then a clear, in-front control. */
.visually-hidden-focusable:focus,
.visually-hidden-focusable:focus-within {
  position: fixed !important;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 2000;
  width: auto !important;
  height: auto !important;
  padding: var(--space-3) var(--space-4) !important;
  margin: 0 !important;
  clip: auto !important;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-lg);
}

/* 5. Shell ----------------------------------------------------------------- */

.container { --bs-gutter-x: 2rem; max-width: 1240px; }
@media (max-width: 575.98px) { .container { --bs-gutter-x: 2rem; } }

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
  view-transition-name: site-header;
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 1px 0 hsl(var(--shadow-color) / 0.02), 0 6px 20px -12px hsl(var(--shadow-color) / 0.25);
}
/* Before JS runs (or without it) the header just keeps its border. */
html:not(.js) .site-header { border-bottom-color: var(--border); }

.site-header .navbar {
  min-height: var(--header-h);
  padding: var(--space-2) 0;
  background: transparent;
}
.site-header .navbar > .container { gap: var(--space-2); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: var(--surface-inverse);
  color: var(--accent);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: var(--fw-bold);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-base) var(--ease-spring);
}
[data-bs-theme="dark"] .brand-mark { background: #06090C; box-shadow: inset 0 0 0 1px var(--border-strong); }
[data-bs-theme="light"] .brand-mark { color: #4DB3EA; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.04); }
.brand-word {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: var(--fw-bold);
  font-size: 1.4rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1;
}

/* Primary nav links */
.primary-nav { gap: var(--space-1); }
.primary-nav .nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.primary-nav .nav-link:hover { color: var(--text); background: var(--surface-2); }
.primary-nav .nav-link[aria-current="page"] { color: var(--text); }
@media (min-width: 992px) {
  .primary-nav { margin-left: var(--space-6); }
  .primary-nav .nav-link[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: var(--space-3);
    right: var(--space-3);
    bottom: calc(-1 * (var(--header-h) - 2.5rem) / 2);
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--accent);
  }
}

.header-actions { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }

/* Round icon buttons used in the header (theme, bell, menu). */
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-instant) var(--ease-out);
}
.icon-btn:hover,
.icon-btn[aria-expanded="true"] { color: var(--text); background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }

/* Theme menu: the trigger shows the icon of the active preference. */
.theme-toggle .theme-icon { display: none; }
[data-theme-pref="system"] .theme-toggle .theme-icon-system,
[data-theme-pref="light"] .theme-toggle .theme-icon-light,
[data-theme-pref="dark"] .theme-toggle .theme-icon-dark { display: inline-block; }
html:not([data-theme-pref]) .theme-toggle .theme-icon-system { display: inline-block; }
.theme-menu { min-width: 11rem; }
.theme-menu .dropdown-item .check { margin-left: auto; opacity: 0; color: var(--accent-text); }
.theme-menu .dropdown-item[aria-checked="true"] { color: var(--text); font-weight: var(--fw-medium); }
.theme-menu .dropdown-item[aria-checked="true"] .check { opacity: 1; }

/* Notification bell */
.notification-bell { position: relative; }
/* The extra .badge class lifts this above the .badge.bg-danger skin further
   down (which also sets a border-color), keeping a solid pill with its ring. */
.notification-bell .badge.notification-badge {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 1.05rem;
  height: 1.05rem;
  display: inline-grid;
  place-items: center;
  padding: 0 0.25rem;
  font-size: 0.625rem;
  font-weight: var(--fw-bold);
  line-height: 1;
  border-radius: var(--radius-full);
  background: var(--danger) !important;
  color: #fff !important;
  border: 2px solid var(--bg);
  animation: lt-pop var(--dur-slow) var(--ease-spring) 400ms both;
}
[data-bs-theme="dark"] .notification-bell .badge.notification-badge { color: #1B0505 !important; }

/* Account menu trigger */
.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 2.5rem;
  padding: 0 var(--space-2) 0 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.account-trigger:hover,
.account-trigger[aria-expanded="true"] { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.account-trigger .chev { color: var(--text-subtle); transition: transform var(--dur-base) var(--ease-out); }
.account-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }
.account-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: var(--radius-full);
  background: var(--accent-soft-strong);
  color: var(--accent-text);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
}
img.user-avatar { object-fit: cover; }
.account-menu { min-width: 15rem; }
.account-menu-head { padding: var(--space-3) var(--space-4) var(--space-2); }
.account-menu-head .name { display: block; font-weight: var(--fw-semibold); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-head .meta { display: block; font-size: var(--fs-xs); color: var(--text-muted); }
.account-menu form { margin: 0; }
.account-menu button.dropdown-item { width: 100%; text-align: left; }

/* Auth links when signed out */
.auth-links { display: flex; align-items: center; gap: var(--space-1); }

/* Mobile menu toggle: three bars that fold into an X. */
.nav-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.nav-toggle:focus { box-shadow: none; }
.nav-toggle:focus-visible { box-shadow: var(--focus-ring); }
.nav-toggle-bars { position: relative; display: block; width: 16px; height: 12px; }
.nav-toggle-bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.75px;
  border-radius: 2px;
  background: currentColor;
  transition: transform var(--dur-base) var(--ease-in-out), opacity var(--dur-fast) var(--ease-out), top var(--dur-base) var(--ease-in-out);
}
.nav-toggle-bars span:nth-child(1) { top: 0; }
.nav-toggle-bars span:nth-child(2) { top: 5px; }
.nav-toggle-bars span:nth-child(3) { top: 10px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) { top: 5px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) { top: 5px; transform: rotate(-45deg); }

@media (max-width: 991.98px) {
  /* DOM order is brand, toggle, menu, actions (so the menu follows its
     toggle for keyboard users); visually the toggle sits after the actions
     and the menu drops below the row. */
  .site-header .header-actions { order: 1; }
  .site-header .nav-toggle { order: 2; margin-left: calc(var(--space-1) - var(--space-2)); }
  .site-header .navbar-collapse { order: 4; flex-basis: 100%; }
  .site-header .navbar-collapse .primary-nav {
    padding: var(--space-2) 0 var(--space-3);
    margin-top: var(--space-2);
    border-top: 1px solid var(--border);
    gap: 2px;
  }
  .site-header .primary-nav .nav-link {
    display: flex;
    min-height: 2.875rem;
    padding: var(--space-3);
    font-size: var(--fs-md);
  }
  .site-header .primary-nav .nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
}

/* Page shell */
.page-shell { flex: 1 0 auto; width: 100%; }
main { min-height: 50vh; }
main > :first-child.alert { margin-top: var(--space-4); }

/* Page header used at the top of index-style pages. */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-10) 0 var(--space-6);
}
.page-header h1 { margin-bottom: var(--space-2); }
.page-header p { margin: 0; color: var(--text-muted); max-width: 60ch; }
@media (max-width: 575.98px) { .page-header { padding-top: var(--space-6); } }

/* Footer */
.site-footer {
  flex-shrink: 0;
  margin-top: var(--space-20);
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.site-footer .footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-8);
  padding: var(--space-10) 0 var(--space-8);
}
.site-footer .footer-blurb { max-width: 34ch; margin: var(--space-3) 0 0; color: var(--text-muted); }
.site-footer .footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }
.site-footer .footer-nav a { color: var(--text-muted); padding: var(--space-1) 0; }
.site-footer .footer-nav a:hover { color: var(--text); }
.site-footer .footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4) 0 var(--space-6);
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
}
.site-footer .brand-word { font-size: 1.2rem; }

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

/* Buttons ----------------------------------------------------------------- */

.btn {
  --bs-btn-font-family: var(--font-sans);
  --bs-btn-font-weight: var(--fw-medium);
  --bs-btn-font-size: var(--fs-base);
  --bs-btn-line-height: 1.25;
  --bs-btn-padding-x: 1.05rem;
  --bs-btn-padding-y: 0.625rem;
  --bs-btn-border-radius: var(--radius);
  --bs-btn-focus-box-shadow: var(--focus-ring);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-h);
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition:
    color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-instant) var(--ease-out);
}
.btn:active,
.btn.active:active { transform: translateY(1px) scale(0.985); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn .icon { transition: transform var(--dur-base) var(--ease-out); }
.btn:hover .icon-nudge { transform: translateX(3px); }

.btn-lg {
  --bs-btn-font-size: var(--fs-md);
  --bs-btn-padding-x: 1.4rem;
  --bs-btn-padding-y: 0.75rem;
  --bs-btn-border-radius: var(--radius);
  min-height: var(--control-h-lg);
}
.btn-sm {
  --bs-btn-font-size: var(--fs-sm);
  --bs-btn-padding-x: 0.75rem;
  --bs-btn-padding-y: 0.375rem;
  --bs-btn-border-radius: 8px;
  min-height: var(--control-h-sm);
  gap: 0.35rem;
}

.btn-primary {
  --bs-btn-color: var(--on-accent);
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: var(--on-accent);
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-color: var(--on-accent);
  --bs-btn-active-bg: var(--accent-active);
  --bs-btn-active-border-color: var(--accent-active);
  --bs-btn-disabled-color: var(--text-subtle);
  --bs-btn-disabled-bg: var(--surface-3);
  --bs-btn-disabled-border-color: var(--surface-3);
  box-shadow: var(--highlight), var(--shadow-xs);
}
.btn-primary:hover { box-shadow: var(--highlight), var(--shadow-sm); }

.btn-secondary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-dark {
  --bs-btn-color: var(--text);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--text);
  --bs-btn-hover-bg: var(--surface-2);
  --bs-btn-hover-border-color: var(--border-strong);
  --bs-btn-active-color: var(--text);
  --bs-btn-active-bg: var(--surface-3);
  --bs-btn-active-border-color: var(--border-strong);
  --bs-btn-disabled-color: var(--text-subtle);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
/* Outline-primary reads as "secondary, but related to the brand action". */
.btn-outline-primary {
  --bs-btn-color: var(--accent-text);
  --bs-btn-border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  --bs-btn-hover-color: var(--accent-text);
  --bs-btn-hover-bg: var(--accent-soft);
  --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-color: var(--accent-text);
  --bs-btn-active-bg: var(--accent-soft-strong);
  --bs-btn-active-border-color: var(--accent);
}
.btn-outline-secondary { --bs-btn-color: var(--text); }

.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: #1A7F45;
  --bs-btn-border-color: #1A7F45;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #156B3A;
  --bs-btn-hover-border-color: #156B3A;
  --bs-btn-active-bg: #125C32;
  --bs-btn-active-border-color: #125C32;
}
.btn-outline-success {
  --bs-btn-color: var(--success);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--success-border);
  --bs-btn-hover-color: var(--success);
  --bs-btn-hover-bg: var(--success-soft);
  --bs-btn-hover-border-color: var(--success);
  --bs-btn-active-color: var(--success);
  --bs-btn-active-bg: var(--success-soft);
  --bs-btn-active-border-color: var(--success);
}
.btn-danger {
  --bs-btn-color: #fff;
  --bs-btn-bg: #C2352B;
  --bs-btn-border-color: #C2352B;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #A62B22;
  --bs-btn-hover-border-color: #A62B22;
  --bs-btn-active-bg: #8F241D;
  --bs-btn-active-border-color: #8F241D;
}
.btn-outline-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--danger);
  --bs-btn-hover-bg: var(--danger-soft);
  --bs-btn-hover-border-color: var(--danger);
  --bs-btn-active-color: var(--danger);
  --bs-btn-active-bg: var(--danger-soft);
  --bs-btn-active-border-color: var(--danger);
}
.btn-link {
  --bs-btn-color: var(--text-muted);
  --bs-btn-hover-color: var(--text);
  --bs-btn-active-color: var(--text);
  --bs-btn-disabled-color: var(--text-subtle);
  --bs-btn-padding-x: 0.6rem;
  text-decoration: none;
  box-shadow: none;
}
.btn-link:hover { text-decoration: none; }
.btn-link.p-0 { min-height: 0; }

/* A busy (submitting) button: keeps its width, swaps the label for a
   spinner. Set by site.js on form submit. */
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  border: 2px solid var(--bs-btn-color, currentColor);
  border-right-color: transparent;
  animation: lt-spin 0.7s linear infinite;
}
.btn-primary.is-busy::after { border-color: var(--on-accent); border-right-color: transparent; }
.btn-outline-secondary.is-busy::after,
.btn-outline-primary.is-busy::after { border-color: var(--text-muted); border-right-color: transparent; }

.btn-group > .btn:not(:focus-visible) { box-shadow: none; }
.btn-group > .btn:focus-visible { z-index: 2; }

/* Close button follows the theme instead of Bootstrap's fixed icon. */
.btn-close {
  --bs-btn-close-opacity: 0.6;
  --bs-btn-close-hover-opacity: 1;
  --bs-btn-close-focus-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
  transition: opacity var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* Forms ------------------------------------------------------------------- */

.form-label {
  display: inline-block;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  min-height: var(--control-h);
  padding: 0.55rem 0.85rem;
  font-size: var(--fs-base);
  line-height: 1.4;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select { background-color: var(--bg-elevated); border-color: var(--control-border); }
.form-control:hover:not(:focus):not(:disabled),
.form-select:hover:not(:focus):not(:disabled) { border-color: var(--text-subtle); }
.form-control::placeholder { color: var(--text-subtle); opacity: 1; }
.form-control:focus,
.form-select:focus {
  color: var(--text);
  background-color: var(--surface);
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  outline: none;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus { background-color: var(--bg-elevated); }

.form-control-sm, .form-select-sm { min-height: var(--control-h-sm); padding: 0.3rem 0.65rem; font-size: var(--fs-sm); border-radius: 8px; }
.form-control-lg { min-height: var(--control-h-lg); font-size: var(--fs-md); }
textarea.form-control { min-height: 7rem; line-height: var(--lh-body); }

.form-select {
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23677384' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m6 9 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 16px;
  cursor: pointer;
}
[data-bs-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238693A2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m6 9 6 6 6-6'/%3e%3c/svg%3e");
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
  background-color: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
  box-shadow: none;
  opacity: 1;
}

/* Native file picker button */
.form-control::file-selector-button {
  background: var(--surface-2);
  color: var(--text);
  border-right: 1px solid var(--border);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.form-control:hover:not(:disabled):not([readonly])::file-selector-button { background: var(--surface-3); }

/* Checkboxes, radios, switches */
.form-check-input {
  width: 1.1em;
  height: 1.1em;
  margin-top: 0.22em;
  background-color: var(--surface);
  border: 1.5px solid var(--control-border);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.form-check-label { color: var(--text); cursor: pointer; }
[data-bs-theme="dark"] .form-check-input:checked[type="checkbox"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23041621' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
[data-bs-theme="dark"] .form-check-input:checked[type="radio"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23041621'/%3e%3c/svg%3e");
}

/* Flatten grouped controls at rest only, so the focus ring still shows. */
.input-group > .form-control:not(:focus),
.input-group > .form-select:not(:focus) { box-shadow: none; }
.input-group-text {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border-strong);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}
.input-group > .btn:not(:focus-visible) { box-shadow: none; }

/* Floating labels (Identity Manage page) */
.form-floating > .form-control,
.form-floating > .form-select { min-height: 3.5rem; }
.form-floating > label { color: var(--text-muted); }
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label { color: var(--text-muted); }
.form-floating > .form-control:focus ~ label::after,
.form-floating > .form-control:not(:placeholder-shown) ~ label::after,
.form-floating > .form-select ~ label::after { background: transparent !important; }

/* Autofill: keep the theme's field colors. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
}
[data-bs-theme="dark"] input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px var(--bg-elevated) inset !important; }

/* Validation: jquery-validation-unobtrusive toggles these classes. */
.text-danger { color: var(--danger) !important; }
.field-validation-error,
span.text-danger:not(:empty) {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: var(--fs-sm);
  animation: lt-slide-down var(--dur-base) var(--ease-out);
}
.field-validation-valid { display: none; }
.input-validation-error,
.form-control.input-validation-error:focus {
  border-color: var(--danger) !important;
}
.input-validation-error:focus { box-shadow: 0 0 0 3px var(--danger-soft) !important; }
.validation-summary-errors,
[data-valmsg-summary="true"].validation-summary-errors {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-sm);
  animation: lt-slide-down var(--dur-base) var(--ease-out);
}
.validation-summary-errors ul,
[data-valmsg-summary="true"] ul { margin: 0; padding-left: 1.1rem; }
.validation-summary-valid { display: none; }

/* Search field: leading icon, clear button, loading spinner. */
.search-field { position: relative; display: block; }
.search-field > .icon-search {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  translate: 0 -50%;
  color: var(--text-subtle);
  pointer-events: none;
  transition: color var(--dur-fast) var(--ease-out);
}
.search-field:focus-within > .icon-search { color: var(--accent-text); }
.search-field > .form-control { padding-left: 2.5rem; padding-right: 2.75rem; }
.search-field.has-trailing > .form-control { padding-right: 3rem; }
.search-field.has-trailing.has-value > .form-control { padding-right: 5.25rem; }
.search-field input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  translate: 0 -50%;
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  opacity: 0;
  scale: 0.8;
  pointer-events: none;
  /* visibility (not just opacity) so the hidden button also leaves the Tab
     order; otherwise keyboard focus lands on an invisible control. */
  visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease-out), scale var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), visibility 0s linear var(--dur-fast);
}
.search-field.has-value .search-clear { opacity: 1; scale: 1; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.search-clear:hover { background: var(--surface-2); color: var(--text); }
.search-field.has-trailing .search-clear { right: 2.9rem; }
.search-field .search-kbd {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  translate: 0 -50%;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.search-field:focus-within .search-kbd,
.search-field.has-value .search-kbd { opacity: 0; }
@media (hover: none), (max-width: 767.98px) { .search-field .search-kbd { display: none; } }
.search-field .search-trailing {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  translate: 0 -50%;
}
.search-field .search-trailing .btn {
  min-height: 2rem;
  width: 2.2rem;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
}
.search-field .search-trailing .btn:hover { color: var(--accent-text); background: var(--accent-soft); }
.search-field .search-trailing .btn:focus-visible { box-shadow: var(--focus-ring); }
.search-field .search-trailing .btn:disabled { color: var(--text-subtle); }
.search-field .search-trailing .btn:disabled .icon { animation: lt-spin 1.2s linear infinite; }

/* Spinner shown inside the search field while results are refreshing. */
.search-field::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.85rem;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.search-field.is-loading::after { opacity: 1; animation: lt-spin 0.7s linear infinite; }
.search-field.is-loading > .icon-search { opacity: 0; }

/* Filter bar: a single toolbar grouping search + filters. Laid out by
   container width (not viewport) because the saved sidebar can narrow it. */
.filter-bar {
  container-type: inline-size;
  container-name: filterbar;
  margin-bottom: var(--space-4);
}
.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.filter-grid .form-control:not(:focus),
.filter-grid .form-select:not(:focus) { box-shadow: none; }
.filter-grid > .filter-primary { min-width: 0; }
.filter-more { grid-column: 1 / -1; }
.filter-more-inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  padding-top: var(--space-1);
}
.filter-toggle { position: relative; }
.filter-toggle .badge {
  min-width: 1.2rem;
  padding: 0.2em 0.4em;
  background: var(--accent) !important;
  color: var(--on-accent) !important;
  border: 0;
}
.filter-toggle .badge:empty { display: none; }
/* No-JS submit; the live-filter scripts make it redundant. */
.filter-submit { margin-top: var(--space-2); }
html.js .filter-submit { display: none !important; }
.filter-status { min-height: 1.25rem; margin: var(--space-2) var(--space-1) 0; font-size: var(--fs-sm); color: var(--text-muted); }
.filter-status:empty { display: none; }

/* The org search only has two secondary filters: show them inline even
   on narrow containers (two columns under the search box). */
.filter-grid.filter-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-grid.filter-grid-3 > .filter-primary { grid-column: 1 / -1; }

/* Wide container: everything on one row, the Filters toggle goes away and
   the collapsible group dissolves into the grid. */
@container filterbar (min-width: 44rem) {
  .filter-grid { grid-template-columns: minmax(14rem, 2.2fr) repeat(4, minmax(0, 1fr)); }
  .filter-grid.filter-grid-3 { grid-template-columns: minmax(14rem, 2.4fr) repeat(2, minmax(0, 1fr)); }
  .filter-grid.filter-grid-3 > .filter-primary { grid-column: auto; }
  .filter-toggle { display: none !important; }
  .filter-more.collapse:not(.show),
  .filter-more,
  .filter-more.collapsing { display: contents; height: auto !important; }
  .filter-more-inner { display: contents; }
}

/* Results region: dims and shows an indeterminate bar while a live
   filter request is in flight (aria-busy is toggled by the page script). */
.results-region { position: relative; }
.results-region::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transform-origin: left;
  pointer-events: none;
}
.results-region[aria-busy="true"]::before { opacity: 1; animation: lt-progress 1.1s var(--ease-in-out) infinite; }
.results-region > * { transition: opacity var(--dur-base) var(--ease-out); }
.results-region[aria-busy="true"] > * { opacity: 0.5; }

.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.results-meta .count { color: var(--text); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.results-meta .btn-link { min-height: 0; padding: 0; font-size: var(--fs-sm); }

/* Staggered entrance for result items (runs on first render and every
   time the live filter swaps the list in). */
@media (prefers-reduced-motion: no-preference) {
  .stagger > * { animation: lt-rise-in var(--dur-slow) var(--ease-out) both; }
  .stagger > *:nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
  .stagger > *:nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
  .stagger > *:nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
  .stagger > *:nth-child(5) { animation-delay: calc(var(--stagger) * 4); }
  .stagger > *:nth-child(6) { animation-delay: calc(var(--stagger) * 5); }
  .stagger > *:nth-child(7) { animation-delay: calc(var(--stagger) * 6); }
  .stagger > *:nth-child(8) { animation-delay: calc(var(--stagger) * 7); }
  .stagger > *:nth-child(n+9) { animation-delay: calc(var(--stagger) * 8); }
}

/* Cards ------------------------------------------------------------------- */

.card {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--radius-lg);
  --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
  --bs-card-cap-bg: var(--surface-2);
  --bs-card-color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.card-body { padding: var(--space-5) var(--space-6); }
@media (max-width: 575.98px) { .card-body { padding: var(--space-4) var(--space-4); } }
.card-title { color: var(--text); font-weight: var(--fw-semibold); letter-spacing: -0.015em; font-size: var(--fs-md); }
.card-text { color: var(--text-muted); }
.card-header, .card-footer { background: var(--surface-2); border-color: var(--border); }
.card-img-top { border-top-left-radius: calc(var(--radius-lg) - 1px); border-top-right-radius: calc(var(--radius-lg) - 1px); }

/* Interactive cards lift slightly and gain an accent edge. */
a.card,
.card-interactive {
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
a.card:hover,
.card-interactive:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.card-interactive:has(.stretched-link:focus-visible) { box-shadow: var(--focus-ring); border-color: var(--accent); }
.card-interactive .stretched-link:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) {
  a.card:hover, .card-interactive:hover { transform: none; }
}

/* Panel: a quieter grouping surface than a card (sidebars, facts). */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.panel + .panel { margin-top: var(--space-4); }
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

/* Tables ------------------------------------------------------------------ */

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-striped-color: var(--text);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-hover-color: var(--text);
  --bs-table-active-bg: var(--surface-3);
  --bs-table-border-color: var(--border);
  color: var(--text);
  border-color: var(--border);
  font-size: var(--fs-base);
  margin-bottom: 0;
}
.table > thead th,
.table > thead td {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.01em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table > :not(caption) > * > * {
  padding: 0.8rem 0.9rem;
  border-bottom-color: var(--border);
  background-color: var(--bs-table-bg);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.table > tbody > tr:last-child > * { border-bottom: 0; }
/* Positioned so visually-hidden (absolutely positioned) header text inside
   a scrolled table is clipped by it instead of widening the page at 320px
   (WCAG 1.4.10). */
.table-responsive { position: relative; }
.card > .table-responsive:first-child,
.card > .table:first-child { border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); overflow: hidden; }
.card > .table-responsive { border-radius: var(--radius-lg); }
/* Flush tables get the card's own inset on the outer columns. */
.card > .table-responsive > .table > :not(caption) > * > :first-child { padding-left: var(--space-5); }
.card > .table-responsive > .table > :not(caption) > * > :last-child { padding-right: var(--space-5); }
.table a { font-weight: var(--fw-medium); }

/* Admin tables → stacked cards on narrow screens. Each <td> carries a
   data-label matching its column header. */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td { display: block; width: 100%; }
  .table-stack tr { border-bottom: 1px solid var(--border); padding: var(--space-3) 0; }
  .table-stack tr:last-child { border-bottom: none; }
  .table-stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding: 0.3rem var(--space-4) !important;
    border: none !important;
    text-align: right;
  }
  .table-stack td::before {
    content: attr(data-label);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    flex-shrink: 0;
    text-align: left;
  }
  .table-stack td:empty::before { content: none; }
}

/* Badges ------------------------------------------------------------------ */
/* Soft, tinted badges in both themes. The bg-* utility names from the
   views are kept and re-skinned here. */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3em 0.6em;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  line-height: 1.2;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  vertical-align: 0.1em;
}
.badge.bg-secondary,
.badge.bg-light { background: var(--surface-2) !important; color: var(--text-muted) !important; border-color: var(--border); }
.badge.bg-primary,
.badge.bg-info { background: var(--accent-soft) !important; color: var(--accent-text) !important; border-color: var(--accent-soft-strong); }
.badge.bg-success { background: var(--success-soft) !important; color: var(--success) !important; border-color: var(--success-border); }
.badge.bg-warning { background: var(--warning-soft) !important; color: var(--warning) !important; border-color: var(--warning-border); }
.badge.bg-danger { background: var(--danger-soft) !important; color: var(--danger) !important; border-color: var(--danger-border); }
.badge.rounded-pill { border-radius: var(--radius-full); }

/* Opportunity type chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.4;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.chip-accent { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-soft-strong); }
.chip-warning { color: var(--warning); background: var(--warning-soft); border-color: var(--warning-border); }
.chip-success { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }

/* Alerts ------------------------------------------------------------------ */

.alert {
  --bs-alert-border-radius: var(--radius);
  --bs-alert-padding-x: var(--space-4);
  --bs-alert-padding-y: var(--space-3);
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  font-size: var(--fs-base);
  border-width: 1px;
  animation: lt-slide-down var(--dur-slow) var(--ease-out);
}
.alert > * { min-width: 0; }
.alert::before {
  content: "";
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 0.1rem;
  background: currentColor;
  -webkit-mask: var(--alert-icon) center / contain no-repeat;
  mask: var(--alert-icon) center / contain no-repeat;
}
.alert-success { --alert-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='12' cy='12' r='9'/%3e%3cpath d='m8 12 3 3 5-6'/%3e%3c/svg%3e"); }
.alert-warning { --alert-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M12 3 2 20h20L12 3Z'/%3e%3cpath d='M12 10v4M12 17h.01'/%3e%3c/svg%3e"); }
.alert-danger { --alert-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='12' cy='12' r='9'/%3e%3cpath d='M12 7v6M12 16.5h.01'/%3e%3c/svg%3e"); }
.alert-info,
.alert-primary,
.alert-secondary { --alert-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='12' cy='12' r='9'/%3e%3cpath d='M12 11v5M12 8h.01'/%3e%3c/svg%3e"); }
/* Alert text stays readable body color; the icon and edge carry the tone. */
.alert-success, .alert-warning, .alert-danger, .alert-info, .alert-primary {
  --bs-alert-color: var(--text);
}
.alert-success::before { color: var(--success); }
.alert-warning::before { color: var(--warning); }
.alert-danger::before { color: var(--danger); }
.alert-info::before, .alert-primary::before { color: var(--accent-text); }
.alert-secondary { --bs-alert-color: var(--text); --bs-alert-bg: var(--surface-2); --bs-alert-border-color: var(--border); }
.alert .alert-link { color: inherit; font-weight: var(--fw-semibold); }
.alert-dismissible { padding-right: 3rem; }
.alert-dismissible .btn-close { padding: 0.9rem; }
.alert p:last-child { margin-bottom: 0; }

/* Dropdowns --------------------------------------------------------------- */

.dropdown-menu {
  --bs-dropdown-bg: var(--surface);
  --bs-dropdown-border-color: var(--border);
  --bs-dropdown-border-radius: var(--radius-lg);
  --bs-dropdown-color: var(--text);
  --bs-dropdown-link-color: var(--text);
  --bs-dropdown-link-hover-color: var(--text);
  --bs-dropdown-link-hover-bg: var(--surface-2);
  --bs-dropdown-link-active-color: var(--text);
  --bs-dropdown-link-active-bg: var(--surface-3);
  --bs-dropdown-divider-bg: var(--border);
  --bs-dropdown-padding-y: 0.35rem;
  --bs-dropdown-font-size: var(--fs-base);
  --bs-dropdown-header-color: var(--text-muted);
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  transform-origin: top right;
}
.dropdown-menu.show { animation: lt-menu-in var(--dur-base) var(--ease-out); }
.dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  color: var(--text);
  font-size: var(--fs-base);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.dropdown-menu .dropdown-item .icon { color: var(--text-subtle); }
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
.dropdown-menu .dropdown-item:hover .icon { color: var(--text-muted); }
.dropdown-menu .dropdown-item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.dropdown-menu .dropdown-item.text-danger:hover { background: var(--danger-soft); }
.dropdown-menu .dropdown-divider { margin: 0.35rem -0.35rem; border-top-color: var(--border); opacity: 1; }
.dropdown-header { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); padding: 0.4rem 0.65rem; }

/* Modals ------------------------------------------------------------------ */

.modal {
  --bs-modal-bg: var(--surface);
  --bs-modal-color: var(--text);
  --bs-modal-border-color: var(--border);
  --bs-modal-border-radius: var(--radius-xl);
  --bs-modal-inner-border-radius: calc(var(--radius-xl) - 1px);
  --bs-modal-header-border-color: var(--border);
  --bs-modal-footer-border-color: var(--border);
  --bs-modal-box-shadow: var(--shadow-lg);
  --bs-modal-padding: var(--space-6);
  --bs-modal-header-padding: var(--space-5) var(--space-6);
}
.modal-backdrop { --bs-backdrop-bg: var(--scrim); --bs-backdrop-opacity: 1; }
.modal-backdrop.fade { transition: opacity var(--dur-base) var(--ease-out); }
.modal-content { box-shadow: var(--shadow-lg); }
.modal-title { font-family: var(--font-sans); font-size: var(--fs-lg); font-weight: var(--fw-semibold); letter-spacing: -0.015em; }
.modal-footer { gap: var(--space-2); }
.modal-footer > * { margin: 0; }
.modal.fade .modal-dialog {
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
.modal.show .modal-dialog { transform: none; opacity: 1; }
@media (max-width: 575.98px) {
  .modal-dialog { margin: auto 0 0; max-width: none; }
  .modal-dialog-centered { min-height: 100%; align-items: flex-end; }
  .modal-content { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .modal.fade .modal-dialog { transform: translateY(24px); }
}

/* Pagination -------------------------------------------------------------- */

.pagination {
  --bs-pagination-color: var(--text-muted);
  --bs-pagination-bg: transparent;
  --bs-pagination-border-color: transparent;
  --bs-pagination-hover-color: var(--text);
  --bs-pagination-hover-bg: var(--surface-2);
  --bs-pagination-hover-border-color: transparent;
  --bs-pagination-focus-color: var(--text);
  --bs-pagination-focus-bg: var(--surface-2);
  --bs-pagination-focus-box-shadow: var(--focus-ring);
  --bs-pagination-active-color: var(--on-accent);
  --bs-pagination-active-bg: var(--accent);
  --bs-pagination-active-border-color: var(--accent);
  --bs-pagination-disabled-color: var(--text-subtle);
  --bs-pagination-disabled-bg: transparent;
  --bs-pagination-disabled-border-color: transparent;
  --bs-pagination-border-radius: var(--radius);
  --bs-pagination-font-size: var(--fs-sm);
  gap: var(--space-1);
  flex-wrap: wrap;
}
.page-link {
  display: inline-grid;
  place-items: center;
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 0.7rem;
  border-radius: var(--radius) !important;
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  margin-left: 0 !important;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.page-item.disabled .page-link { opacity: 0.6; }

/* Breadcrumb -------------------------------------------------------------- */

.breadcrumb {
  --bs-breadcrumb-divider-color: var(--text-subtle);
  --bs-breadcrumb-item-active-color: var(--text-muted);
  --bs-breadcrumb-divider: "/";
  margin-bottom: var(--space-4);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.breadcrumb-item { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item a:hover { color: var(--text); }
.breadcrumb-item.active { color: var(--text-muted); }

/* Nav pills (Bootstrap default nav-pills: manage nav, misc) */
.nav-pills {
  --bs-nav-pills-border-radius: var(--radius);
  --bs-nav-pills-link-active-color: var(--text);
  --bs-nav-pills-link-active-bg: var(--surface-2);
  --bs-nav-link-color: var(--text-muted);
  --bs-nav-link-hover-color: var(--text);
}
.nav-tabs {
  --bs-nav-tabs-border-color: var(--border);
  --bs-nav-tabs-link-active-bg: var(--surface);
  --bs-nav-tabs-link-active-border-color: var(--border) var(--border) var(--surface);
  --bs-nav-tabs-link-hover-border-color: var(--border);
  --bs-nav-link-color: var(--text-muted);
  --bs-nav-link-hover-color: var(--text);
}

/* List groups */
.list-group {
  --bs-list-group-bg: var(--surface);
  --bs-list-group-color: var(--text);
  --bs-list-group-border-color: var(--border);
  --bs-list-group-border-radius: var(--radius-lg);
  --bs-list-group-action-hover-bg: var(--surface-2);
  --bs-list-group-action-hover-color: var(--text);
  --bs-list-group-action-color: var(--text);
  --bs-list-group-active-bg: var(--accent);
  --bs-list-group-active-border-color: var(--accent);
  --bs-list-group-active-color: var(--on-accent);
}

/* Progress */
.progress, .progress-stacked { --bs-progress-bg: var(--surface-2); --bs-progress-bar-bg: var(--accent); --bs-progress-border-radius: var(--radius-full); }

/* Definition lists (facts panels, profile pages) */
dl dt { font-weight: var(--fw-medium); color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: 0.15rem; }
dl dd { color: var(--text); margin-bottom: var(--space-4); overflow-wrap: anywhere; }
dl dd:last-child { margin-bottom: 0; }

/* Empty states ------------------------------------------------------------ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-6);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  animation: lt-fade-in var(--dur-slow) var(--ease-out);
}
.empty-state-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: var(--space-2);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  box-shadow: inset 0 0 0 1px var(--border);
}
.empty-state h2,
.empty-state h3,
.empty-state .empty-state-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.015em;
  color: var(--text);
}
.empty-state p { max-width: 42ch; margin: 0; color: var(--text-muted); font-size: var(--fs-base); }
.empty-state .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); }
.card .empty-state { border: 0; background: transparent; }

/* Legacy placeholder surfaces */
.bg-light { background: var(--surface-2) !important; border: 1px solid var(--border); color: var(--text-muted); }
.bg-body, .bg-white { background: var(--surface) !important; }
.text-dark { color: var(--text) !important; }
.text-white { color: var(--text) !important; }
.text-body-secondary { color: var(--text-muted) !important; }

/* Toasts (site.js): transient errors from in-place actions. */
.toast-stack {
  position: fixed;
  z-index: 1090;
  right: var(--space-4);
  bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
@media (max-width: 575.98px) { .toast-stack { left: var(--space-4); } }
.lt-toast {
  max-width: 24rem;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--surface-inverse);
  color: var(--text-inverse);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: lt-rise-in var(--dur-slow) var(--ease-out);
}
.lt-toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--dur-base) var(--ease-in), transform var(--dur-base) var(--ease-in); }

/* 7. Features -------------------------------------------------------------- */

/* Org meta line: small facts separated by a dot. */
.org-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.org-meta .dot,
.review-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-subtle); flex: 0 0 auto; }
.meta-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.meta-item .icon { color: var(--text-subtle); }

/* Org avatars: uploaded logo or a monogram tile. */
.org-avatar {
  --size: 2.75rem;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: var(--size);
  height: var(--size);
  overflow: hidden;
  border-radius: 28%;
  background: var(--surface-2);
  color: var(--text-muted);
  box-shadow: inset 0 0 0 1px var(--border);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-style: italic;
  font-size: calc(var(--size) * 0.42);
  letter-spacing: 0.01em;
  line-height: 1;
  user-select: none;
}
.org-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.org-avatar-sm { --size: 1.75rem; border-radius: 26%; }
.org-avatar-lg { --size: 4.5rem; }
@media (min-width: 768px) { .org-avatar-lg { --size: 5.25rem; } }

/* Org result cards */
.org-card { height: 100%; }
.org-card .card-body { display: flex; flex-direction: column; gap: var(--space-3); height: 100%; }
.org-card-head { display: flex; align-items: center; gap: var(--space-3); padding-right: 5.5rem; min-width: 0; }
.org-card-head .card-title { margin: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.org-card-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.org-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
}
.org-card-foot .icon { transition: transform var(--dur-base) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.org-card:hover .org-card-foot { color: var(--accent-text); }
.org-card:hover .org-card-foot .icon { transform: translateX(3px); }
.org-card-corner { z-index: 2; }

/* Verified / claim indicators */
.org-verified,
.org-claim-cta,
.org-claim-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.org-verified { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }
.org-claim-hint { color: var(--text-muted); background: var(--surface); border-color: var(--border); }
.org-claim-cta {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: var(--accent-soft-strong);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.org-claim-cta:hover { color: var(--accent-text); background: var(--accent-soft-strong); border-color: var(--accent); }
.org-verified svg, .org-claim-cta svg, .org-claim-hint svg { flex: 0 0 auto; }

/* Listing cards: collapse the badge + save labels to icons, reveal on
   hover/focus so they don't crowd narrow cards. */
.org-badge-compact .org-verified > span:last-child,
.org-badge-compact .org-claim-hint > span:last-child,
.org-card-save-compact .save-btn-label { display: none; }
.org-badge-compact:hover .org-verified > span:last-child,
.org-badge-compact:hover .org-claim-hint > span:last-child,
.org-card-save-compact:hover .save-btn-label,
.org-card-save-compact:focus-within .save-btn-label { display: inline; }
.org-badge-compact .org-verified,
.org-badge-compact .org-claim-hint { min-height: var(--control-h-sm); padding: 0 0.55rem; }
.org-card-save-compact .btn { min-width: var(--control-h-sm); }

/* Press confirmation: site.js adds this to a toggle (save, like) the
   viewer just used, and it survives the post-redirect via sessionStorage. */
.just-pressed svg { animation: lt-pop var(--dur-slow) var(--ease-spring); }

/* Org profile header */
.org-hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}
.org-hero-main { display: flex; align-items: center; gap: var(--space-5); min-width: 0; flex: 1 1 28rem; }
.org-hero-main > div { min-width: 0; }
.org-hero h1 { margin: 0; font-size: clamp(2rem, 1.5rem + 2vw, 3rem); overflow-wrap: anywhere; }
.org-hero-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-2); }
.org-hero-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.org-hero-actions .save-btn { min-height: var(--control-h); padding-inline: 1rem; font-size: var(--fs-base); }
@media (max-width: 575.98px) {
  .org-hero-main { gap: var(--space-4); align-items: flex-start; }
}

/* Org profile tabs: underline tabs whose indicator morphs between pages
   via a named view transition. */
.org-tabs-nav {
  display: flex;
  gap: var(--space-1);
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.org-tabs-nav::-webkit-scrollbar { display: none; }
.org-tabs-nav .nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  margin-bottom: -1px;
  color: var(--text-muted);
  background: transparent !important;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.org-tabs-nav .nav-link:hover { color: var(--text); background: var(--surface-2) !important; }
.org-tabs-nav .nav-link.active { color: var(--text); font-weight: var(--fw-semibold); }
.org-tabs-nav .nav-link.active::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  view-transition-name: org-tab-indicator;
}

/* Rating summary: a scoreboard-style number with stars. */
.rating-summary { display: flex; align-items: center; gap: var(--space-4); }
.rating-summary .score {
  font-family: var(--font-display);
  font-size: 3.75rem;
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  line-height: 0.85;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.rating-summary .out-of { font-size: var(--fs-base); color: var(--text-subtle); }
.rating-summary .count { font-size: var(--fs-sm); color: var(--text-muted); }
.rating-summary-side { display: flex; flex-direction: column; gap: 0.3rem; }

.stars { position: relative; display: inline-flex; line-height: 0; color: var(--border-strong); }
.stars-fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--gold); white-space: nowrap; display: inline-flex; }
.stars .icon { width: 16px; height: 16px; }

.rating-bar {
  display: grid;
  grid-template-columns: minmax(6.5rem, 8.5rem) 1fr 2.25rem;
  align-items: center;
  gap: var(--space-3);
  padding: 0.4rem 0;
}
.rating-bar .label { font-size: var(--fs-sm); color: var(--text-muted); }
.rating-bar .track { position: relative; display: block; height: 6px; background: var(--surface-3); border-radius: var(--radius-full); overflow: hidden; }
.rating-bar .fill {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  background: var(--accent);
  border-radius: var(--radius-full);
  transform-origin: left center;
}
@media (prefers-reduced-motion: no-preference) {
  html.js .rating-card:not(.is-visible) .rating-bar .fill { transform: scaleX(0); }
  html.js .rating-card .rating-bar .fill { transition: transform var(--dur-slower) var(--ease-out); }
  html.js .rating-card .rating-bar:nth-child(2) .fill { transition-delay: 60ms; }
  html.js .rating-card .rating-bar:nth-child(3) .fill { transition-delay: 120ms; }
  html.js .rating-card .rating-bar:nth-child(4) .fill { transition-delay: 180ms; }
  html.js .rating-card .rating-bar:nth-child(5) .fill { transition-delay: 240ms; }
  html.js .rating-card .rating-bar:nth-child(6) .fill { transition-delay: 300ms; }
  html.js .rating-card .rating-bar:nth-child(7) .fill { transition-delay: 360ms; }
}
.rating-bar .value { font-size: var(--fs-sm); color: var(--text); font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); text-align: right; }

/* Rating pills (btn-check radio group on the review form) */
.rating-pills { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; }
.rating-pills .btn { min-width: 2.75rem; padding: 0.45rem 0.85rem; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.rating-pills-sm .btn { min-width: 2.35rem; min-height: var(--control-h-sm); padding: 0.3rem 0.7rem; font-size: var(--fs-sm); }
@media (max-width: 480px) {
  .rating-row { flex-direction: column; align-items: flex-start !important; gap: var(--space-2); }
  .rating-row .rating-pills-sm { width: 100%; justify-content: space-between; }
  .rating-row .rating-pills-sm .btn { flex: 1; }
}
.btn-check:checked + .btn-outline-secondary,
.btn-check:active + .btn-outline-secondary,
.btn-check:checked + .btn-outline-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--highlight), var(--shadow-xs);
}
.btn-check:focus-visible + .btn { outline: none; box-shadow: var(--focus-ring); }
.rating-row + .rating-row { border-top: 1px solid var(--border); }

/* Five-star picker (_StarRatingInput). Markup is 1..5, so arrow keys move
   the same way the stars read. Every star up to the checked (or hovered)
   one fills; the stars after it go back to an outline, so the rating
   reads by shape as well as color (WCAG 1.4.1, 1.4.11). */
.star-rating { display: inline-flex; gap: 0.15rem; }
.star-rating label {
  cursor: pointer;
  font-size: 1.85rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--text-subtle);
  transition: color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-spring);
}
.star-rating label:hover { transform: scale(1.12); }
.star-rating:has(input:checked) label { color: var(--gold); -webkit-text-stroke-color: var(--gold); }
.star-rating input:checked + label ~ label { color: transparent; -webkit-text-stroke-color: var(--text-subtle); }
/* Hover previews a rating, overriding the checked one. */
.star-rating.star-rating:has(label:hover) label { color: var(--gold); -webkit-text-stroke-color: var(--gold); }
.star-rating:has(label:hover) label:hover ~ label { color: transparent; -webkit-text-stroke-color: var(--text-subtle); }
.star-rating input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* Review list */
.review { padding: var(--space-6) 0; border-bottom: 1px solid var(--border); }
.review:first-child { padding-top: var(--space-1); }
.review:last-child { border-bottom: none; padding-bottom: var(--space-1); }
.review-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
.review-rating {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  padding: 0.2rem 0.55rem 0.15rem;
  background: var(--surface-inverse);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: var(--fw-bold);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.review-rating .text-muted { color: color-mix(in srgb, var(--text-inverse) 60%, transparent) !important; font-family: var(--font-sans); font-size: var(--fs-2xs); font-weight: var(--fw-medium); }
.review-meta { color: var(--text-muted); font-size: var(--fs-sm); display: flex; gap: 0.35rem 0.5rem; align-items: center; flex-wrap: wrap; }
.review-admin-actions { margin: 0 0 0 auto; }

.review-block { margin-top: var(--space-4); padding-left: 1.6rem; position: relative; }
.review-block .label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.2rem -1.6rem;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.review-block .label::before {
  content: "";
  display: inline-grid;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 5px;
  background: var(--surface-2) var(--label-icon, none) center / 12px no-repeat;
  box-shadow: inset 0 0 0 1px var(--border);
}
/* Plain blocks (e.g. a denial reason) carry no marker. */
.review-block:not([class*="review-block--"]) { padding-left: 0; }
.review-block:not([class*="review-block--"]) .label { margin-left: 0; }
.review-block:not([class*="review-block--"]) .label::before { display: none; }
.review-block--pros .label::before { background-color: var(--success-soft); box-shadow: inset 0 0 0 1px var(--success-border); }
.review-block--cons .label::before { background-color: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger-border); }
.review-block--advice .label::before { background-color: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-soft-strong); }
.review-block--pros .label::before { --label-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A7F45' stroke-width='3' stroke-linecap='round'%3e%3cpath d='M12 5v14M5 12h14'/%3e%3c/svg%3e"); }
.review-block--cons .label::before { --label-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C2352B' stroke-width='3' stroke-linecap='round'%3e%3cpath d='M5 12h14'/%3e%3c/svg%3e"); }
.review-block--advice .label::before { --label-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A73B0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.4 1 1.1 1 1.8V16h5v-.3c0-.7.4-1.4 1-1.8A6 6 0 0 0 12 3Z'/%3e%3c/svg%3e"); }
[data-bs-theme="dark"] .review-block--pros .label::before { --label-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234ADE80' stroke-width='3' stroke-linecap='round'%3e%3cpath d='M12 5v14M5 12h14'/%3e%3c/svg%3e"); }
[data-bs-theme="dark"] .review-block--cons .label::before { --label-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F87171' stroke-width='3' stroke-linecap='round'%3e%3cpath d='M5 12h14'/%3e%3c/svg%3e"); }
[data-bs-theme="dark"] .review-block--advice .label::before { --label-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236CC0EE' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.4 1 1.1 1 1.8V16h5v-.3c0-.7.4-1.4 1-1.8A6 6 0 0 0 12 3Z'/%3e%3c/svg%3e"); }
.review-block p { margin: 0; color: var(--text); font-size: var(--fs-base); line-height: var(--lh-body); max-width: 70ch; white-space: pre-line; }

/* Free-plan paywall: blurred content behind an upgrade prompt. */
.review-blurred { position: relative; min-height: 7rem; margin-top: var(--space-3); }
.review-blur-content { filter: blur(6px); user-select: none; pointer-events: none; opacity: 0.8; }
.review-blur-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.review-blur-overlay p { max-width: 38ch; font-weight: var(--fw-medium); }

/* Organization response under a review */
.org-response {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.org-response-header { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin-bottom: 0.4rem; }
.org-response p { color: var(--text); font-size: var(--fs-base); line-height: var(--lh-body); }
.org-response-form { margin-top: var(--space-4); padding: var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* Opportunity cards */
.opp-card .card-body { display: flex; flex-direction: column; gap: var(--space-3); }
.opp-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
/* Rendered as h2 or h3 depending on the page outline; looks the same either way. */
.opp-card-title { margin: 0 0 0.35rem; font-family: var(--font-sans); font-size: var(--fs-lg); font-weight: var(--fw-semibold); line-height: var(--lh-snug); letter-spacing: -0.02em; }
.opp-card-title a { color: var(--text); }
.opp-card-title a:hover { color: var(--accent-text); }
.opp-card-org { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.opp-card-org:hover { color: var(--text); }
.opp-card-desc { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.opp-card .save-slot { position: relative; z-index: 2; flex: 0 0 auto; }
.opp-card-facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: var(--fs-sm); color: var(--text-muted); }
.opp-list { display: flex; flex-direction: column; gap: var(--space-3); }
.opp-group-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.opp-group-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.opp-group-title:first-child { margin-top: 0; }

/* Opportunity details: sticky key-facts + apply panel */

.sticky-side { position: sticky; top: calc(var(--header-h) + var(--space-4)); }

.apply-note { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }
.opp-description { white-space: pre-wrap; font-size: var(--fs-md); line-height: 1.7; max-width: 72ch; margin: 0; }
@media (max-width: 991.98px) { .sticky-side { position: static; } }

/* Saved sidebar (organizations / opportunities index pages) */
.page-shell:has(.saved-sidebar) {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  column-gap: var(--space-8);
  align-items: start;
}
.saved-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--space-6));
  margin-top: var(--space-10);
  padding: var(--space-4) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: calc(100vh - var(--header-h) - var(--space-12));
  overflow-y: auto;
}
.saved-sidebar.is-entering { animation: lt-rise-in var(--dur-slow) var(--ease-out); }
.saved-sidebar-section + .saved-sidebar-section { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.saved-sidebar-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: normal;
  color: var(--text);
  padding: 0 var(--space-2) var(--space-3);
}
.saved-sidebar-title .icon { color: var(--accent-text); }
.saved-sidebar ul { list-style: none; margin: 0; padding: 0; }
.saved-sidebar li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); border-radius: 8px; transition: opacity var(--dur-base) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }
.saved-sidebar li:hover { background: var(--surface-2); }
.saved-sidebar li + li { margin-top: 2px; }
.saved-sidebar li > span { padding: 0.45rem var(--space-2); font-size: var(--fs-sm); min-width: 0; }
.saved-sidebar a {
  display: block;
  flex: 1;
  min-width: 0;
  padding: 0.45rem var(--space-2);
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.saved-sidebar a:hover { color: var(--text); }
.saved-sidebar li form { flex: 0 0 auto; margin: 0; }
.saved-sidebar li form button {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-subtle);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.saved-sidebar li form button:hover { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 991.98px) {
  .page-shell:has(.saved-sidebar) { grid-template-columns: minmax(0, 1fr); }
  .saved-sidebar { position: static; order: 2; margin-top: var(--space-8); max-height: none; }
}

/* Location typeahead */
.opp-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  animation: lt-menu-in var(--dur-base) var(--ease-out);
}
.opp-suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.opp-suggestion-item:hover,
.opp-suggestion-item.active { background: var(--surface-2); }
.opp-suggestion-item.active { box-shadow: inset 2px 0 0 var(--accent); }
.opp-suggestion-city { color: var(--text); font-weight: var(--fw-medium); font-size: var(--fs-base); }
.opp-suggestion-country { color: var(--text-subtle); font-size: var(--fs-xs); }
.opp-suggestion-more {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
  padding: 0.55rem 0.7rem;
  border-top: 1px solid var(--border);
  cursor: pointer;
  color: var(--accent-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.opp-suggestion-more:hover { background: var(--surface-2); border-radius: 8px; }

/* Notification bell dropdown */
.notification-menu { width: 23rem; max-width: calc(100vw - 1.5rem); padding: 0; overflow: hidden; }
/* Phones: the bell sits well in from the right edge, so a menu pinned to
   the bell's right side runs off the left of the screen. Bootstrap doesn't
   use Popper inside .navbar, so make the bell's wrapper static and the menu
   spans the header (the positioned .navbar) instead, with page gutters. */
@media (max-width: 575.98px) {
  .header-actions .dropdown:has(> .notification-bell) { position: static; }
  .site-header .notification-menu[data-bs-popper] {
    left: var(--space-3);
    right: var(--space-3);
    width: auto;
    max-width: none;
  }
}
.notification-menu-header,
.notification-menu-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: 0.7rem var(--space-4);
}
.notification-menu-header { border-bottom: 1px solid var(--border); }
.notification-menu-header form { margin: 0; }
.notification-menu-header .btn-link { min-height: 0; font-size: var(--fs-sm); color: var(--accent-text); }
.notification-menu-footer { border-top: 1px solid var(--border); font-size: var(--fs-sm); background: var(--surface-2); }
.notification-menu-footer a { font-weight: var(--fw-medium); }
.notification-menu-body { max-height: min(60vh, 26rem); overflow-y: auto; }
.notification-menu-empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-8) var(--space-4); text-align: center; color: var(--text-muted); font-size: var(--fs-base); }
.notification-menu-empty .icon { color: var(--text-subtle); }
.notification-menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.65rem var(--space-4);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.notification-menu-item:last-child { border-bottom: none; }
.notification-menu-item:hover { background: var(--surface-2); }
.notification-menu-item.unread { background: var(--accent-soft); }
.notification-menu-item.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.notification-menu-item form { margin: 0; }
.notification-menu-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; color: var(--text); }
.notification-menu-link:hover { color: var(--text); }
.notification-menu-title { font-size: var(--fs-base); font-weight: var(--fw-medium); white-space: normal; line-height: 1.35; }
.notification-menu-sub { font-size: var(--fs-xs); color: var(--text-muted); }
/* The visible dot is 10px; the button around it is a 24px target
   (WCAG 2.5.8). */
.notification-menu-dot {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.notification-menu-dot::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--accent);
  transition: transform var(--dur-fast) var(--ease-spring), background-color var(--dur-fast) var(--ease-out);
}
.notification-menu-dot:hover::before { transform: scale(1.3); background: var(--accent-hover); }

/* Plan badge: blue check for Plus, gold for Pro. */
.plan-badge { display: inline-flex; align-items: center; line-height: 1; flex: 0 0 auto; }
.plan-badge-plus { color: var(--accent); }
.plan-badge-pro { color: var(--gold); }

/* Plans page */
.plans-page { max-width: 980px; margin: 0 auto; }
.plans-hero { text-align: left; padding: var(--space-6) 0 var(--space-8); }
.plans-hero h1 { font-size: var(--fs-display); margin-bottom: var(--space-3) !important; }
.plans-back-link { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text-muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.plans-back-link:hover { color: var(--text); }
.plans-section + .plans-section { margin-top: var(--space-12); }
.plans-section-header { margin-bottom: var(--space-5); }
.plans-section-header h2 { font-size: var(--fs-2xl); margin-bottom: var(--space-1); }
.plan-card { height: 100%; transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.plan-card .card-body { display: flex; flex-direction: column; height: 100%; padding: var(--space-6); }
.plan-card-current,
.plan-card-current:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.plan-card-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-1); }
.plan-card-name { font-family: var(--font-display); font-size: 2rem; font-weight: var(--fw-bold); letter-spacing: 0; margin: 0; }
.plan-card-price { margin: 0 0 var(--space-2); display: flex; align-items: baseline; gap: var(--space-2); }
.plan-card-amount { font-size: 1.75rem; font-weight: var(--fw-semibold); line-height: 1.1; }
.plan-card-period { font-size: var(--fs-sm); }
.plan-signup-summary { display: flex; justify-content: space-between; align-items: baseline; font-weight: var(--fw-semibold); }
.plan-signup-summary dd { margin: 0; }
.plan-signup-payment { border: 1px dashed var(--border, currentColor); border-radius: var(--radius-md, 0.5rem); padding: var(--space-4); opacity: 0.7; }
.plan-card-tagline { color: var(--text-muted); font-size: var(--fs-base); margin-bottom: var(--space-5); }
.plan-features-intro { font-size: var(--fs-sm); font-weight: var(--fw-semibold); margin-bottom: var(--space-2); }
.plan-features { list-style: none; padding: 0; margin: 0 0 var(--space-6); flex-grow: 1; }
.plan-features:last-child { margin-bottom: 0; }
.plan-features li { display: flex; align-items: flex-start; gap: var(--space-3); padding: 0.35rem 0; font-size: var(--fs-base); }
.plan-features svg { flex: 0 0 auto; margin-top: 0.25rem; color: var(--accent-text); }
.plan-card-note { color: var(--text-muted); font-size: var(--fs-sm); text-align: center; margin: 0 0 var(--space-2); }
.plan-card-action { margin-top: auto; }
.plans-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-strong);
  border-radius: var(--radius-lg);
  font-size: var(--fs-base);
}
.plan-cancel-list { color: var(--text-muted); font-size: var(--fs-base); padding-left: 1.1rem; margin-bottom: 0; }
.plan-cancel-list li + li { margin-top: 0.4rem; }

/* Account (Identity Manage) nav */
.manage-nav { gap: 2px; }
.manage-nav .nav-link {
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  background: transparent;
  border-radius: var(--radius);
  font-weight: var(--fw-medium);
  font-size: var(--fs-base);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.manage-nav .nav-link:hover { color: var(--text); background: var(--surface-2); }
.manage-nav .nav-link.active { color: var(--text); background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
@media (max-width: 767.98px) {
  .manage-nav {
    flex-direction: row !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: var(--space-1);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
  }
  .manage-nav::-webkit-scrollbar { display: none; }
  .manage-nav .nav-link { white-space: nowrap; }
  .manage-nav .nav-link.active { box-shadow: inset 0 -2px 0 var(--accent); }
}

/* Account (Identity Manage) shell */
.account-shell { padding-top: var(--space-10); }
.account-nav { position: sticky; top: calc(var(--header-h) + var(--space-6)); }
/* Identity UI's own pages: the layout renders their title as the h1. */
.account-bundled > h1 + h3 { display: none; }
.account-nav-title { margin: 0 0 var(--space-3); padding: 0 0.75rem; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-subtle); }
.account-main > h1:first-child,
.account-main > .d-flex:first-child h1 { font-size: clamp(2rem, 1.6rem + 1.4vw, 2.6rem); }
.account-main > h3:first-child { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: 0; margin-bottom: var(--space-4); }
@media (max-width: 767.98px) {
  .account-shell { padding-top: var(--space-6); }
  .account-nav { position: static; }
  .account-nav-title { display: none; }
}

/* Admin area */
.admin-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: var(--space-8);
  padding-top: var(--space-8);
  align-items: start;
}
.admin-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--space-4));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}
.admin-sidebar-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.admin-sidebar ul { list-style: none; margin: 0; padding: 0; }
.admin-sidebar li + li { margin-top: 2px; }
.admin-sidebar-section { margin-top: var(--space-3) !important; padding-top: var(--space-3); border-top: 1px solid var(--border); }
.admin-sidebar a {
  display: flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: var(--fw-medium);
  font-size: var(--fs-base);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.admin-sidebar a:hover { background: var(--surface-2); color: var(--text); }
.admin-sidebar a.active { background: var(--surface-2); color: var(--text); font-weight: var(--fw-semibold); box-shadow: inset 2px 0 0 var(--accent); }
.admin-main { min-width: 0; }
.admin-main > h1:first-child,
.admin-main > .d-flex:first-child h1 { font-size: var(--fs-2xl); }
@media (max-width: 991.98px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); padding-top: var(--space-5); }
  .admin-sidebar { position: static; padding: var(--space-2); }
  .admin-sidebar-title { display: none; }
  .admin-sidebar ul { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; }
  .admin-sidebar ul::-webkit-scrollbar { display: none; }
  .admin-sidebar li + li { margin-top: 0; }
  .admin-sidebar a { white-space: nowrap; }
  .admin-sidebar a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .admin-sidebar-section { margin-top: 0 !important; padding-top: 0; border-top: none; }
}

/* Admin stat tiles (Analytics) inherit card styles; the big numbers use
   the display face. */
.admin-main .card .fs-2,
.admin-main .card .fs-3 { font-family: var(--font-display); font-weight: var(--fw-bold) !important; letter-spacing: 0; font-variant-numeric: tabular-nums; }

/* Click-to-upload avatar / logo widget */
.avatar-uploader { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.avatar-uploader-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  border-radius: 28%;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  color: inherit;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.avatar-uploader-trigger:hover,
.avatar-uploader-trigger:focus-visible { border-color: var(--accent); box-shadow: var(--focus-ring); outline: none; }
.avatar-uploader-trigger:active { transform: scale(0.97); }
.avatar-uploader-trigger img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-uploader-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.5rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 55%);
  color: #fff;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
  pointer-events: none;
}
.avatar-uploader-trigger:hover .avatar-uploader-overlay,
.avatar-uploader-trigger:focus-visible .avatar-uploader-overlay,
.avatar-uploader-empty .avatar-uploader-overlay { opacity: 1; }
.avatar-uploader-empty .avatar-uploader-overlay { background: linear-gradient(to top, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 55%); }
.profile-photo-placeholder { color: var(--text-muted); display: flex; align-items: center; justify-content: center; }
.avatar-uploader-hint { flex: 1 1 16rem; min-width: 0; }

/* User avatars (admin + public author page) */
.admin-user-avatar,
.admin-user-avatar-lg {
  border-radius: 30%;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.admin-user-avatar { width: 36px; height: 36px; }
.admin-user-avatar-lg { width: 72px; height: 72px; }
.admin-user-avatar-placeholder { color: var(--text-muted); }
.mod-thumb { width: 5rem; height: 5rem; object-fit: cover; }
.author-avatar,
.author-avatar-placeholder {
  width: 128px;
  height: 128px;
  border-radius: 28%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.author-avatar-placeholder { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }

/* Test-runner pills (admin Tests page) */
.tests-pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem; border-radius: var(--radius-full); font-size: var(--fs-sm); font-weight: var(--fw-semibold); border: 1px solid transparent; }
.tests-pill-pass { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }
.tests-pill-fail { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }
.tests-pill-error { color: var(--warning); background: var(--warning-soft); border-color: var(--warning-border); }

/* Social posts (_SocialPostCard) and the site-wide feed */
.social-feed { max-width: 42rem; margin: 0 auto; }
.social-post { overflow: hidden; }
.social-post-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-3); }
.social-post-org { display: flex; align-items: center; gap: var(--space-3); color: var(--text); min-width: 0; }
.social-post-org:hover { color: var(--text); }
.social-post-org:hover .name { color: var(--accent-text); }
.social-post-org .name { display: block; font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color var(--dur-fast) var(--ease-out); }
.social-post-org .meta { display: block; font-size: var(--fs-sm); color: var(--text-muted); }
.social-post-photo { display: block; width: 100%; max-height: 36rem; object-fit: cover; background: var(--surface-2); }
.social-post-caption { white-space: pre-line; }
.social-comment { transition: opacity var(--dur-base) var(--ease-out); }
.social-feed-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-8);
}
.social-feed-pager > :last-child { justify-self: end; }
@media (max-width: 575.98px) {
  .social-post-head { padding: var(--space-3) var(--space-4) var(--space-2); }
  .social-feed-pager { grid-template-columns: 1fr 1fr; }
  .social-feed-pager > .text-muted { display: none; }
}
.social-image-strip { gap: 0.25rem; scroll-snap-type: x mandatory; }
.social-image-strip img { height: 320px; width: auto; flex: 0 0 auto; object-fit: cover; scroll-snap-align: start; }
.social-photo-input::file-selector-button {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.35rem 1rem;
  margin-right: 0.85rem;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.form-control.social-photo-input:hover:not(:disabled):not([readonly])::file-selector-button { background: var(--surface-3); border-color: var(--accent); color: var(--text); }
.social-photo-hint { color: var(--text-muted); }
.social-action-btn { display: inline-flex; align-items: center; gap: 0.4rem; border-radius: var(--radius-full) !important; font-variant-numeric: tabular-nums; }

/* 8. Pages ----------------------------------------------------------------- */

/* Home: hero */
.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--space-12);
  align-items: center;
  padding: var(--space-16) 0 var(--space-16);
}
.home-hero::before {
  /* Faint court-line grid behind the hero, masked so it fades out. */
  content: "";
  position: absolute;
  inset: -2rem calc(50% - 50vw) 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--hero-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 60% 70% at 30% 35%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 30% 35%, #000 20%, transparent 75%);
  pointer-events: none;
}
.home-hero h1 {
  font-size: var(--fs-display);
  line-height: 0.95;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-5);
  max-width: 13ch;
}
.home-hero h1 em { font-style: italic; color: var(--accent-text); }
.home-hero .lead { max-width: 44ch; margin-bottom: var(--space-8); font-size: var(--fs-lg); }
.hero-search { display: flex; gap: var(--space-2); max-width: 34rem; }
.hero-search .search-field { flex: 1; }
.hero-search .form-control { min-height: var(--control-h-lg); font-size: var(--fs-md); border-radius: var(--radius); }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-top: var(--space-5); font-size: var(--fs-sm); color: var(--text-muted); }
.hero-links a { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: var(--fw-medium); }

/* Home: scoreboard of real site numbers */
.scoreboard {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.scoreboard-cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-1);
  min-height: 9.5rem;
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
}
.scoreboard-cell.is-feature { grid-column: 1 / -1; background: var(--surface-inverse); color: var(--text-inverse); min-height: 11rem; }
.scoreboard-cell.is-feature .scoreboard-label { color: color-mix(in srgb, var(--text-inverse) 70%, transparent); }
.scoreboard-cell.is-feature .scoreboard-value { color: var(--text-inverse); }
[data-bs-theme="dark"] .scoreboard-cell.is-feature { background: #05080B; color: var(--text); }
[data-bs-theme="dark"] .scoreboard-cell.is-feature .scoreboard-value { color: var(--accent); }
[data-bs-theme="dark"] .scoreboard-cell.is-feature .scoreboard-label { color: var(--text-muted); }
[data-bs-theme="light"] .scoreboard-cell.is-feature .scoreboard-value { color: #4DB3EA; }
.scoreboard-value {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  font-weight: var(--fw-bold);
  line-height: 0.9;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.scoreboard-cell.is-feature .scoreboard-value { font-size: clamp(3.5rem, 2.5rem + 3vw, 5rem); font-style: italic; }
.scoreboard-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-medium); }

@media (max-width: 991.98px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); gap: var(--space-10); padding: var(--space-10) 0 var(--space-12); }
  .home-hero h1 { max-width: 14ch; }
}
@media (max-width: 575.98px) {
  .hero-search { flex-direction: column; }
  .hero-search .btn { width: 100%; }
  .scoreboard-cell { min-height: 7.5rem; padding: var(--space-4); }
  .scoreboard-cell.is-feature { min-height: 8.5rem; }
}

/* Home: section rhythm */
.home-section { padding: var(--space-12) 0; }
.home-section + .home-section { border-top: 1px solid var(--border); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-6); }
.section-head h2 { margin: 0; font-size: clamp(1.9rem, 1.5rem + 1.4vw, 2.5rem); }
.section-head p { margin: var(--space-2) 0 0; color: var(--text-muted); max-width: 52ch; }
.section-link { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: var(--fw-medium); font-size: var(--fs-sm); white-space: nowrap; }
.section-link .icon { transition: transform var(--dur-base) var(--ease-out); }
.section-link:hover .icon { transform: translateX(3px); }

/* Sport picker tiles */
.sport-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--space-3); }
.sport-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: 8rem;
  padding: var(--space-4) var(--space-5);
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.sport-tile:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow); }
.sport-tile-name { font-family: var(--font-display); font-size: 1.85rem; font-weight: var(--fw-bold); font-style: italic; text-transform: uppercase; line-height: 1; letter-spacing: 0.01em; }
.sport-tile-count { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-muted); }
.sport-tile-count .icon { color: var(--text-subtle); transition: transform var(--dur-base) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.sport-tile:hover .sport-tile-count .icon { transform: translateX(3px); color: var(--accent-text); }
.sport-tile::after {
  /* Oversized initial as a watermark: gives each tile its own shape. */
  content: attr(data-initial);
  position: absolute;
  right: -0.1em;
  top: -0.25em;
  font-family: var(--font-display);
  font-size: 7rem;
  font-weight: var(--fw-bold);
  font-style: italic;
  line-height: 1;
  color: var(--text);
  opacity: 0.04;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.sport-tile:hover::after { opacity: 0.08; transform: translateX(-4px); }

/* Recently reviewed list (not cards: a ranked list with hairlines) */
.recent-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.recent-item a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.recent-item a:hover { background: var(--surface); color: var(--text); }
.recent-item .name { display: block; font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .sub { display: block; font-size: var(--fs-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-score { display: flex; align-items: center; gap: var(--space-3); text-align: right; }
.recent-score .num { font-family: var(--font-display); font-size: 1.75rem; font-weight: var(--fw-bold); line-height: 1; font-variant-numeric: tabular-nums; }
.recent-score .of { display: block; font-size: var(--fs-xs); color: var(--text-muted); }
@media (max-width: 575.98px) { .recent-score .stars { display: none; } }

/* How it works: a two-column explainer, not three identical cards */
.how-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--space-12); align-items: start; }
.how-grid h2 { font-size: clamp(2rem, 1.5rem + 1.8vw, 2.9rem); max-width: 14ch; }
.how-steps { list-style: none; margin: 0; padding: 0; counter-reset: how; }
.how-steps li { position: relative; display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: var(--space-4); padding: var(--space-5) 0; border-top: 1px solid var(--border); }
.how-steps li:last-child { border-bottom: 1px solid var(--border); }
.how-steps li::before {
  counter-increment: how;
  content: counter(how, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: var(--fw-bold);
  font-style: italic;
  line-height: 1;
  color: var(--accent-text);
}
.how-steps h3 { margin: 0 0 0.3rem; font-size: var(--fs-md); }
.how-steps p { margin: 0; color: var(--text-muted); max-width: 52ch; }
@media (max-width: 991.98px) { .how-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); } }

/* CTA band */
.cta-band {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-6);
  padding: var(--space-10);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--surface-inverse);
  color: var(--text-inverse);
}
[data-bs-theme="dark"] .cta-band { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.cta-band h2 { color: inherit; margin: 0 0 var(--space-2); font-size: clamp(1.9rem, 1.5rem + 1.4vw, 2.6rem); }
.cta-band p { margin: 0; max-width: 46ch; color: color-mix(in srgb, currentColor 72%, transparent); }
.cta-band::after {
  content: "";
  position: absolute;
  right: -6rem;
  bottom: -9rem;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, #4DB3EA 35%, transparent);
  box-shadow: 0 0 0 3rem color-mix(in srgb, #4DB3EA 6%, transparent), 0 0 0 6rem color-mix(in srgb, #4DB3EA 3%, transparent);
  pointer-events: none;
}
.cta-band .btn { position: relative; z-index: 1; }
[data-bs-theme="light"] .cta-band .btn-primary { --bs-btn-bg: #4DB3EA; --bs-btn-border-color: #4DB3EA; --bs-btn-color: #041621; --bs-btn-hover-bg: #72C4F0; --bs-btn-hover-border-color: #72C4F0; --bs-btn-hover-color: #041621; }
@media (max-width: 575.98px) { .cta-band { padding: var(--space-6); } }

/* Auth pages */
.auth-shell { display: flex; justify-content: center; padding: var(--space-12) 0 var(--space-4); }
.auth-card {
  width: 100%;
  max-width: 28rem;
  padding: var(--space-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  animation: lt-rise-in var(--dur-slow) var(--ease-out);
}
.auth-card.is-wide { max-width: 40rem; }
.auth-card h1 { font-size: 2.4rem; margin-bottom: var(--space-1); }
.auth-card .auth-sub { color: var(--text-muted); margin-bottom: var(--space-6); }
.auth-card .brand-mark { width: 2.5rem; height: 2.5rem; font-size: 1.3rem; border-radius: 11px; margin-bottom: var(--space-5); }
.auth-foot { margin: var(--space-6) calc(-1 * var(--space-8)) calc(-1 * var(--space-8)); padding: var(--space-4) var(--space-8); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); text-align: center; font-size: var(--fs-base); color: var(--text-muted); }
@media (max-width: 575.98px) {
  .auth-shell { padding-top: var(--space-6); }
  .auth-card { padding: var(--space-6) var(--space-5); border-radius: var(--radius-lg); }
  .auth-foot { margin: var(--space-6) calc(-1 * var(--space-5)) calc(-1 * var(--space-6)); padding: var(--space-4) var(--space-5); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
}

/* Error / status pages */
.status-page { display: flex; flex-direction: column; align-items: flex-start; max-width: 36rem; margin: 0 auto; padding: var(--space-16) 0 var(--space-8); }
.status-code {
  font-family: var(--font-display);
  font-size: clamp(6rem, 4rem + 10vw, 11rem);
  font-weight: var(--fw-bold);
  font-style: italic;
  line-height: 0.8;
  letter-spacing: -0.02em;
  color: var(--accent-text);
  margin-bottom: var(--space-4);
}
.status-page h1 { margin-bottom: var(--space-2); }
.status-page p { color: var(--text-muted); margin-bottom: var(--space-6); max-width: 46ch; }
.status-page .actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Legal documents: Terms, Privacy, Subscription and Refund Policy.
   Long-form reading text, so a narrow measure and body line height. */
.legal-doc { max-width: 72ch; font-size: var(--fs-md); line-height: var(--lh-body); }
.legal-doc h2 {
  font-size: var(--fs-xl);
  margin: var(--space-10) 0 var(--space-3);
  scroll-margin-top: var(--space-20);
}
.legal-doc h3 { font-size: var(--fs-lg); margin: var(--space-6) 0 var(--space-2); }
.legal-doc p, .legal-doc li { overflow-wrap: anywhere; }
.legal-doc p { margin: 0 0 var(--space-4); }
.legal-doc ul, .legal-doc ol { margin: 0 0 var(--space-4); padding-left: var(--space-6); }
.legal-doc li { margin-bottom: var(--space-2); }
.legal-doc li > ul { margin-top: var(--space-2); }
.legal-doc address { margin: 0 0 var(--space-4); padding-left: var(--space-6); font-style: normal; }
.legal-doc .legal-effective { color: var(--text-muted); }
.legal-toc {
  margin: 0 0 var(--space-8);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.legal-toc h2 { font-size: var(--fs-base); margin: 0 0 var(--space-2); }
.legal-toc ol { columns: 2 22ch; column-gap: var(--space-8); margin: 0; padding-left: var(--space-5); font-size: var(--fs-sm); }
.legal-toc li { break-inside: avoid; margin-bottom: var(--space-1); }

/* 9. Utilities ------------------------------------------------------------- */

.text-accent { color: var(--accent-text) !important; }
.bg-surface { background: var(--surface) !important; }
.border-soft { border-color: var(--border) !important; }
.divider { height: 1px; background: var(--border); margin: var(--space-8) 0; }
.tabular { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }
.pre-wrap { white-space: pre-wrap; }

/* Fixed input widths for short fields (amounts, periods) that shouldn't
   stretch to the full column. */
.field-w-xs { max-width: 5.625rem; }
.field-w-sm { max-width: 12.5rem; }
.field-w-md { max-width: 17.5rem; }
.row.no-gutters > [class*="col-"] { padding-left: 0.5rem; padding-right: 0.5rem; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow) !important; }
.border { border-color: var(--border) !important; }
.border-top, .border-bottom, .border-start, .border-end { border-color: var(--border) !important; }
.rounded { border-radius: var(--radius) !important; }
.rounded-3 { border-radius: var(--radius-lg) !important; }

/* Development-only run date control, shown beside the theme toggle */
.run-date-form { display: flex; align-items: center; gap: var(--space-1); margin: 0; }
.run-date-label { font-size: var(--text-sm, .8125rem); color: var(--text-muted, inherit); margin: 0; }
.run-date-label.is-shifted { color: var(--bs-warning-text-emphasis, #997404); font-weight: 600; }
.run-date-input { width: auto; }
@media (max-width: 575.98px) { .run-date-label { display: none; } }

/* ─── Staff tasks (Areas/Admin/Views/Tasks) ─────────────────────────── */
.admin-sidebar-tasks { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.admin-sidebar-count {
  min-width: 1.5rem; padding: 0 var(--space-2); border-radius: var(--radius-full);
  background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-soft-strong);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-align: center; font-variant-numeric: tabular-nums;
}

.task-scope-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.task-scope-tabs::-webkit-scrollbar { display: none; }
.task-scope-tabs .nav-link { white-space: nowrap; }

.task-chip-count { margin-left: var(--space-1); opacity: .75; font-variant-numeric: tabular-nums; }
.task-chip-overdue.btn-outline-secondary { color: var(--danger); border-color: var(--danger-border); }
.task-chip-overdue.btn-outline-secondary:hover { background: var(--danger-soft); color: var(--danger); }

.task-status-badge { display: inline-flex; align-items: center; gap: 4px; }
.task-overdue-text { color: var(--danger); font-weight: var(--fw-medium); }

.task-table td { vertical-align: middle; }
.task-row-overdue > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.task-row-closed > td { color: var(--text-muted); }
.task-row-closed a { color: var(--text-muted); }
.task-progress-cell { min-width: 9rem; }

.task-progress { height: 6px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.task-progress-lg { height: 8px; }
.task-progress-bar { height: 100%; border-radius: inherit; background: var(--warning); transition: width .3s ease; }
.task-progress-bar.is-ready { background: var(--success); }
@media (prefers-reduced-motion: reduce) { .task-progress-bar { transition: none; } }

.task-checklist li { display: flex; align-items: center; gap: var(--space-2); padding: 3px 0; font-size: var(--fs-sm); }
.task-checklist .task-check-icon { display: inline-flex; }
.task-checklist li.is-filled { color: var(--text-muted); }
.task-checklist li.is-filled .task-check-icon { color: var(--success); }
.task-checklist li.is-missing .task-check-icon { color: var(--warning); }

.task-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--space-3) var(--space-5); margin-bottom: 0; }
.task-meta dt { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.task-meta dd { margin: 0; }

.task-instructions {
  padding: var(--space-4); border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--accent-soft-strong);
  white-space: pre-line;
}

.task-legend { font-size: var(--fs-sm); font-weight: var(--fw-semibold); margin-bottom: var(--space-2); }
.task-field { margin-bottom: var(--space-3); }
.task-research-form .task-field.is-missing .form-control { border-color: var(--warning-border); background: var(--warning-soft); }
.task-research-form .task-field.is-missing .form-control:focus { background: var(--surface); }
.task-research-form .form-control.input-validation-error { border-color: var(--danger); background: var(--surface); }
.task-field-state {
  display: inline-flex; align-items: center; gap: 3px; margin-left: var(--space-2);
  padding: 0 var(--space-2); border-radius: var(--radius-full); border: 1px solid;
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); vertical-align: middle;
}
.task-field-state.is-filled { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }
.task-field-state.is-missing { color: var(--warning); background: var(--warning-soft); border-color: var(--warning-border); }
.task-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); }

.task-panel { border-top: 1px solid var(--border); padding: var(--space-2) 0; }
.task-panel:first-of-type { border-top: 0; padding-top: 0; }
.task-panel > summary { cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-medium); padding: var(--space-1) 0; }

.task-history li { padding: var(--space-2) 0; border-top: 1px solid var(--border); }
.task-history li:first-child { border-top: 0; padding-top: 0; }
.task-history-text { white-space: pre-line; overflow-wrap: anywhere; }
.task-org-values dd { overflow-wrap: anywhere; white-space: pre-line; }
.task-org-picker .min-w-0 { min-width: 0; }
