@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400..700&family=Oswald:wght@400;500;600;700&display=swap");

:root {
    /* Brand colors */
    --ga-blue-600: #1268b3;
    --ga-blue-300: #79b3e2;
    --ga-blue-300-rgb: 121, 179, 226;
    --ga-blue-200: #a6d0f0;
    --ga-blue-200-rgb: 166, 208, 240;
    --ga-blue-900: #16325c;
    --ga-yellow-500: #ffcb05;

    /* Status colors. The theme's own danger, success, warning and info sit
       below 4.5:1 as text, and danger and success below it under white text.
       These keep each hue (derived in OKLCH) and clear WCAG AA on white, on
       the page background and on the tone's own subtle tint.
         red/green-600   text, and fills under white text (5.2:1)
         red/green-700   hover and active for those fills
         orange/cyan-700 text only: warning and info fills keep the theme's
                         lighter colors because they carry dark text */
    --ga-red-600: #c2365c;
    --ga-red-600-rgb: 194, 54, 92;
    --ga-red-700: #a5264a;
    --ga-green-600: #327b4e;
    --ga-green-600-rgb: 50, 123, 78;
    --ga-green-700: #23653d;
    --ga-orange-700: #a95936;
    --ga-cyan-700: #007897;

    /* Neutrals */
    --ga-white: #ffffff;
    --ga-gray-800: #2b2f36;
    --ga-gray-500: #6b7280;
    --ga-gray-200: #e5e7eb;

    /* Typography */
    --ga-font-body: "Geist", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    --ga-font-head: "Oswald", "Geist", system-ui, sans-serif;

    /* Type scale — role tokens; see the Type scale block below and
       docs/DESIGN.md "Typography". Every font-size in the app resolves to
       one of these. */
    --ga-type-caption: 0.75rem;     /* 12px — meta, badges, table headers, chart labels */
    --ga-type-body: 0.875rem;       /* 14px — body, table cells, controls, h6 */
    --ga-type-heading-sm: 1rem;     /* 16px — h5, card titles */
    --ga-type-heading-md: 1.25rem;  /* 20px — h4 */
    --ga-type-heading-lg: 1.5rem;   /* 24px — h3, KPI figures */
    --ga-type-display-sm: clamp(1.625rem, 1.5114rem + 0.4848vw, 1.875rem); /* 26 -> 30px — h2 */
    --ga-type-display-lg: clamp(1.875rem, 1.7045rem + 0.7273vw, 2.25rem);  /* 30 -> 36px — h1 */

    --ga-leading-display: 1.1;
    --ga-leading-heading: 1.3;
    --ga-leading-body: 1.5;
    --ga-leading-caption: 1.35;

    --ga-tracking-display: -0.01em;
    --ga-tracking-overline: 0.06em;

    /* Semantic aliases */
    --ga-color-primary: var(--ga-blue-600);
    --ga-color-primary-soft: var(--ga-blue-300);
    --ga-color-primary-deep: var(--ga-blue-900);
    --ga-color-accent: var(--ga-yellow-500);
    --ga-color-text: var(--ga-gray-800);
    --ga-color-muted: var(--ga-gray-500);
    --ga-color-border: var(--ga-gray-200);

    --bs-primary: var(--ga-color-primary);
    --bs-primary-rgb: 18, 104, 179;
    --bs-secondary: var(--ga-color-primary-deep);
    --bs-secondary-rgb: 22, 50, 92;

    /* Danger and success fills carry white text in both themes. */
    --bs-danger: var(--ga-red-600);
    --bs-danger-rgb: var(--ga-red-600-rgb);
    --bs-success: var(--ga-green-600);
    --bs-success-rgb: var(--ga-green-600-rgb);

    /* Spacing — base spacer (1rem) and card-body standard (1.5rem = p-4) */
    --bs-spacer: 1rem;

    /* Layout — component sizes that other components line up with.
       --ga-topbar-height    the sticky topbar (.page-header), every width
       --ga-masthead-height  the member masthead banner and its preview */
    --ga-topbar-height: 4rem;
    --ga-masthead-height: 10rem;
    --bs-card-spacer-y: 1.5rem;
    --bs-card-spacer-x: 1.5rem;
    --bs-card-border-radius: .85rem;
    --bs-card-inner-border-radius: .85rem;

    /* Image scrims: the brand's deepest blue laid over a photo, so white text
       reads on any image. The same in both themes, since the photo, not the
       page, is underneath. Over a white photo, white text is 5.4:1 on
       --ga-scrim and 7.4:1 on --ga-scrim-strong.
         --ga-scrim-strong  under text (82%)
         --ga-scrim         under text, the lighter stop of a gradient (72%)
         --ga-scrim-soft    the top of a gradient, away from text (28%) */
    --ga-scrim-strong: color-mix(in srgb, var(--ga-color-primary-deep) 82%, transparent);
    --ga-scrim: color-mix(in srgb, var(--ga-color-primary-deep) 72%, transparent);
    --ga-scrim-soft: color-mix(in srgb, var(--ga-color-primary-deep) 28%, transparent);
}

[data-bs-theme="light"] {
    --bs-body-color: var(--ga-color-text);
    --bs-body-color-rgb: 43, 47, 54;
    --bs-secondary-color: var(--ga-color-muted);
    --bs-secondary-color-rgb: 107, 114, 128;
    --bs-border-color: var(--ga-color-border);

    /* Tertiary text (.text-body-tertiary) was a 60% mix at 4.0:1; it is the
       lightest text that still clears AA, which is the secondary color. */
    --bs-tertiary-color: var(--bs-secondary-color);
    --bs-tertiary-color-rgb: var(--bs-secondary-color-rgb);

    /* Links in the brand blue (Bootstrap's default #0d6efd was never mapped). */
    --bs-link-color: var(--ga-color-primary);
    --bs-link-color-rgb: var(--bs-primary-rgb);
    --bs-link-hover-color: var(--ga-color-primary-deep);
    --bs-link-hover-color-rgb: var(--bs-secondary-rgb);

    /* Text on a tone's subtle tint (.text-*-emphasis, the subtle badges):
       the tone's own hue at AA, rather than the theme's near-black. */
    --bs-primary-text-emphasis: var(--ga-color-primary);
    --bs-danger-text-emphasis: var(--ga-red-600);
    --bs-success-text-emphasis: var(--ga-green-600);
    --bs-warning-text-emphasis: var(--ga-orange-700);
    --bs-info-text-emphasis: var(--ga-cyan-700);

    /* Inline code (sheet IDs, keys) reads as data, not as an error. */
    --bs-code-color: var(--ga-color-primary-deep);
}

[data-bs-theme="dark"] {
    --bs-body-color: #e7edf5;
    --bs-body-color-rgb: 231, 237, 245;
    --bs-secondary-color: #a8b4c7;
    --bs-secondary-color-rgb: 168, 180, 199;
    --bs-border-color: #2c3648;

    --bs-link-color: var(--ga-blue-300);
    --bs-link-color-rgb: var(--ga-blue-300-rgb);
    --bs-link-hover-color: var(--ga-blue-200);
    --bs-link-hover-color-rgb: var(--ga-blue-200-rgb);
    --bs-code-color: var(--ga-blue-300);
}

/* Warning and info as text use their AA text tokens; the utilities otherwise
   use the fill colors, which carry dark text and fail as text on white. */
[data-bs-theme="light"] .text-warning {
    color: var(--bs-warning-text-emphasis) !important;
}

[data-bs-theme="light"] .text-info {
    color: var(--bs-info-text-emphasis) !important;
}

/* Secondary text inside an alert sits on the alert's tint, where the page
   grey drops under 4.5:1; it takes the alert's own text token instead. */
.alert {
    --bs-secondary-color: var(--bs-alert-color);
}

/* On the dark canvas the fills are too dark to read as text; the theme's
   dark *-text-emphasis tones are the readable ones. */
[data-bs-theme="dark"] .text-danger {
    color: var(--bs-danger-text-emphasis) !important;
}

[data-bs-theme="dark"] .text-success {
    color: var(--bs-success-text-emphasis) !important;
}

[data-bs-theme="dark"] .text-warning {
    color: var(--bs-warning-text-emphasis) !important;
}

[data-bs-theme="dark"] .text-info {
    color: var(--bs-info-text-emphasis) !important;
}

body {
    font-family: var(--ga-font-body);
    color: var(--bs-body-color);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.sidebar-text.fs-3,
.navbar-brand {
    font-family: var(--ga-font-head);
}

/* ---------------------------------------------------------------------------
   Type scale
   ---------------------------------------------------------------------------
   One ramp, anchored on the 14px body and capped at a 36px page title, at a
   ratio of about 1.2 snapped to whole pixels:

     12    14    16    20    24    30    36
     cap   body  h5    h4    h3    h2    h1

   It replaces the two-band 14-24 / 36-48 scale (DDR-012), whose 48px title
   read as oversized next to dense operational screens (DDR-021). The display
   sizes are fluid from 375px to 1200px -- h1 is 30px on a phone and 36px on
   any laptop -- and fixed beyond.

   Text styles, the only ways to size text:
     h1-h6 / .h1-.h6    headings (card titles keep .h5/.h6, DDR-012)
     .fs-1 ... .fs-6    the same ladder as utilities
     .small / small     caption: meta, helper text, secondary table lines
     .text-overline     caption set in capitals: column headers, section labels
     .text-title        h5 size in the body face: titles that are read as a
                        sentence, where condensed Oswald at 16px is hard to
                        read. Accordion titles (.accordion-button) use it too,
                        so every DS Accordion reads the same.
   Component CSS that must size text references the --ga-type-* tokens; it
   never writes a number.
--------------------------------------------------------------------------- */
h1, .h1 {
    font-size: var(--ga-type-display-lg);
    line-height: var(--ga-leading-display);
    letter-spacing: var(--ga-tracking-display);
    font-weight: 600;
}

h2, .h2 {
    font-size: var(--ga-type-display-sm);
    line-height: var(--ga-leading-display);
    letter-spacing: var(--ga-tracking-display);
    font-weight: 600;
}

h3, .h3 {
    font-size: var(--ga-type-heading-lg);
    line-height: var(--ga-leading-heading);
    font-weight: 600;
}

h4, .h4 {
    font-size: var(--ga-type-heading-md);
    line-height: var(--ga-leading-heading);
    font-weight: 600;
}

h5, .h5 {
    font-size: var(--ga-type-heading-sm);
    line-height: var(--ga-leading-heading);
    font-weight: 600;
}

h6, .h6 {
    font-size: var(--ga-type-body);
    line-height: var(--ga-leading-heading);
    font-weight: 600;
}

.fs-1 { font-size: var(--ga-type-display-lg) !important; }
.fs-2 { font-size: var(--ga-type-display-sm) !important; }
.fs-3 { font-size: var(--ga-type-heading-lg) !important; }
.fs-4 { font-size: var(--ga-type-heading-md) !important; }
.fs-5 { font-size: var(--ga-type-heading-sm) !important; }
.fs-6 { font-size: var(--ga-type-body) !important; }

/* Bootstrap's .small is 0.875em of its parent, so it drifted with context
   (12.25px in body text, 31.5px inside an h1). The caption role is one size. */
.small,
small {
    font-size: var(--ga-type-caption);
    line-height: var(--ga-leading-caption);
}

.text-title,
.accordion-button {
    font-family: var(--ga-font-body);
    font-size: var(--ga-type-heading-sm);
    line-height: var(--ga-leading-heading);
    font-weight: 600;
    letter-spacing: normal;
}

.text-overline {
    font-family: var(--ga-font-body);
    font-size: var(--ga-type-caption);
    line-height: var(--ga-leading-caption);
    font-weight: 600;
    letter-spacing: var(--ga-tracking-overline);
    text-transform: uppercase;
}

/* Button and menu labels show as written. The theme capitalises every word
   (`text-transform: capitalize`), which turned sentence-case copy and
   translations into Title Case ("Guardar Cambios"); copy is sentence case
   (UX audit F34). */
.btn,
.dropdown-item {
    text-transform: none;
}

/* ---------------------------------------------------------------------------
   Theme components on the scale
   ---------------------------------------------------------------------------
   The compiled Assan/Bootstrap build sizes its own components off a 14px
   base with Bootstrap's multipliers: 12.25px small controls and tooltips,
   17.5px large controls, 10.2px badges, 0.875em helper text. None of those are
   steps; each maps to the nearest role here so a component and the text
   around it share one ladder.
--------------------------------------------------------------------------- */
:root {
    --bs-body-font-size: var(--ga-type-body);
    --bs-body-line-height: var(--ga-leading-body);
}

.form-text,
.valid-feedback,
.invalid-feedback,
.figure-caption,
.blockquote-footer,
.col-form-label-sm,
.form-control-sm,
.form-select-sm,
.input-group-sm > .btn,
.input-group-sm > .form-control,
.input-group-sm > .form-select,
.input-group-sm > .input-group-text,
.valid-tooltip,
.invalid-tooltip,
.dropdown-header,
.sidebar-title,
.tippy-box,
.avatar,
.avatar.xs,
.avatar.sm,
.progress-stacked,
.form-control-sm + .choices__list[aria-expanded].dropdown-menu .choices__item {
    font-size: var(--ga-type-caption);
}

.btn-sm,
.btn-group-sm > .btn {
    --bs-btn-font-size: var(--ga-type-caption);
}

.pagination-sm {
    --bs-pagination-font-size: var(--ga-type-caption);
}

.badge {
    --bs-badge-font-size: var(--ga-type-caption);
}

.tooltip {
    --bs-tooltip-font-size: var(--ga-type-caption);
}

.popover {
    --bs-popover-font-size: var(--ga-type-caption);
}

.avatar.lg {
    font-size: var(--ga-type-body);
}

.avatar.xxl {
    font-size: var(--ga-type-heading-md);
}

/* Bootstrap shrinks monospace to 0.875em of its parent, which falls off the
   scale wherever the parent is itself a step (10.5px inside a caption). Code
   takes its surrounding text's size instead. */
code,
kbd,
samp {
    font-size: inherit;
}

.lead,
.blockquote,
.col-form-label-lg,
.form-control-lg,
.form-select-lg,
.input-group-lg > .btn,
.input-group-lg > .form-control,
.input-group-lg > .form-select,
.input-group-lg > .input-group-text,
.avatar.xl,
.form-control-lg + .choices__list[aria-expanded].dropdown-menu .choices__item {
    font-size: var(--ga-type-heading-sm);
}

.btn-lg,
.btn-group-lg > .btn {
    --bs-btn-font-size: var(--ga-type-heading-sm);
}

.pagination-lg {
    --bs-pagination-font-size: var(--ga-type-heading-sm);
}

.navbar {
    --bs-navbar-brand-font-size: var(--ga-type-heading-md);
}

/* D3's axis generator writes font-size="10" as a presentation attribute on
   every axis group; any stylesheet rule outranks it, so this puts every
   chart's tick labels on the caption role without touching each chart. */
svg g[font-size] {
    font-size: var(--ga-type-caption);
}

/* The sidebar wordmark opts out of the scale: it sits in a fixed-width rail. */
.sidebar-text.fs-3 {
    font-size: var(--ga-type-heading-md) !important;
}

.text-body-secondary,
.small,
small {
    font-family: var(--ga-font-body);
}

/* Link color comes from --bs-link-color / --bs-link-hover-color, set per
   theme above. A blanket `[data-bs-theme="dark"] a { color }` used to also
   repaint buttons built as links (`a.btn-primary`) light blue on blue. */

/* ---------------------------------------------------------------------------
   Icons
   ---------------------------------------------------------------------------
   Icons are inline SVG (Lucide, plus Simple Icons for brand marks), sized in
   `em` so the font-size based sizing that the previous icon fonts used --
   `fs-*`, `style="font-size:18px"`, the `size` option -- keeps working.

   An inline SVG sits on the text baseline and hangs below it, unlike a glyph,
   so it needs a small nudge to line up with adjacent text. Colour comes from
   `currentColor` inside the SVG, so there is nothing to theme here.
--------------------------------------------------------------------------- */
.ui-icon {
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
}

/* In a flex row the icon should not stretch to the row's height. */
.d-flex > .ui-icon,
.d-inline-flex > .ui-icon {
    align-self: center;
}

/* Theme toggle icon.

   theme.bundle.js swapped this icon by writing the glyph name into the span's
   textContent, which an inline SVG cannot express, and the bundle is a compiled
   vendor file we do not edit. Both glyphs are rendered instead and CSS shows
   the one matching the theme the bundle set on <html>. That also means the icon
   is correct on first paint rather than after JS runs.

   The same selector drives the active row in the dropdown, which the bundle
   marked with a class it can no longer reach. */
.theme-icon-active [data-theme-icon] {
    display: none;
}

[data-bs-theme="light"] .theme-icon-active [data-theme-icon="light"],
[data-bs-theme="dark"] .theme-icon-active [data-theme-icon="dark"] {
    display: inline-block;
}

[data-bs-theme="light"] .dropdown-item[data-bs-theme-value="light"],
[data-bs-theme="dark"] .dropdown-item[data-bs-theme-value="dark"] {
    background-color: var(--bs-dropdown-link-active-bg);
    color: var(--bs-dropdown-link-active-color);
}

/* ---------------------------------------------------------------------------
   Vendor chrome that used an icon font
   ---------------------------------------------------------------------------
   The compiled Assan build draws dropdown carets and the sidebar collapse
   chevron as pseudo-element glyphs from the bootstrap-icons font
   (content: "\f282" and friends). Both icon fonts are gone, and style.css is a
   generated file we do not edit, so those glyphs are redrawn here from the
   Lucide chevrons.

   mask-image rather than background-image: a mask is painted with
   background-color, so the chevron follows currentColor and needs no per-theme
   rule. A data-URI background-image could not.

   The inline SVG uses single quotes and percent-encodes < > #. A double quote
   inside url("...") terminates the CSS string early, which silently drops the
   mask and leaves a solid currentColor square where the chevron should be.
--------------------------------------------------------------------------- */
.dropdown-toggle::after,
.page-sidebar .nav-link[data-bs-toggle="collapse"]::after,
.page-sidebar .sidebar-link[data-bs-toggle="collapse"]::after {
    content: "";
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    border: 0;
    vertical-align: -0.1em;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dropup .dropdown-toggle::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E");
}

.dropend .dropdown-toggle::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}

/* Bootstrap's own .dropstart .dropdown-toggle::after { display: none } still
   applies (compiled build), so only ::before needs drawing here -- the shared
   box rule above is scoped to plain .dropdown-toggle::after and does not
   reach this ::before at all, so every property has to be repeated rather
   than only the mask-image direction. Giving this bare ::before the same
   properties everywhere .dropdown-toggle is used, rather than only inside
   .dropstart, is exactly what put a second, unwanted chevron on every plain
   dropdown (theme switch, account menu): nothing in Bootstrap defines a
   .dropdown-toggle::before, so that box only exists here, unconditionally. */
.dropstart .dropdown-toggle::before {
    content: "";
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    border: 0;
    vertical-align: -0.1em;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* The sidebar chevron keeps the build's rotate-on-expand transition, so it
   points down when collapsed. */
.page-sidebar .nav-link[data-bs-toggle="collapse"]::after,
.page-sidebar .sidebar-link[data-bs-toggle="collapse"]::after {
    width: 1em;
    height: 1em;
}

/* ---------------------------------------------------------------------------
   Pagination
   ---------------------------------------------------------------------------
   The Assan build drives .pagination almost entirely from --bs-pagination-*
   tokens, but leaves three values as raw Bootstrap blue: the active page's
   background and border (#0d6efd) and the focus ring. Those are the only
   pagination colours a user actually notices, so on a brand-blue site the
   current page rendered in the wrong blue.

   Rebound to the brand primary here. White on the brand blue is 5.74:1, up
   from 4.5:1 on Bootstrap's, so the active page also reads better.
--------------------------------------------------------------------------- */
.pagination {
    /* Border: the build points these at --bs-border-color, a decorative token
       that is near-black in dark mode (#2c3648) and nearly invisible in light
       (#e5e7eb). Pagination is an interactive control, so it takes the muted
       grey the form fields use -- 3.54:1 on white, 3.75:1 on the dark body
       (WCAG 1.4.11). Bound through Bootstrap's own token rather than a
       border-color longhand, which the build's `border` shorthand can beat. */
    --bs-pagination-border-color: var(--ga-color-border-interactive);
    --bs-pagination-hover-border-color: var(--ga-color-border-interactive);
    --bs-pagination-disabled-border-color: var(--ga-color-border-interactive);

    /* Active state and focus ring were raw Bootstrap blue. */
    --bs-pagination-active-bg: var(--bs-primary);
    --bs-pagination-active-border-color: var(--bs-primary);
    --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Status badges use normal-size text, so their subtle palette needs the same
   AA contrast discipline as body copy. Bootstrap's own .text-* utilities only
   reach 1.5-4.1:1 on the matching -subtle background, so the text is bound to
   the theme's emphasis token instead.

   These were previously hardcoded hex values, which meant the near-black light
   mode colours stayed put when the theme flipped and rendered at 1.7-2.0:1 on
   the dark -subtle backgrounds -- invisible. The token flips with the theme and
   passes AA in both (14-16:1 light, 6.6-10:1 dark). Danger had no rule at all
   and was failing in both themes (4.03:1 light, 3.85:1 dark). */
.badge.bg-primary-subtle.text-primary { color: var(--bs-primary-text-emphasis) !important; }
.badge.bg-secondary-subtle.text-secondary { color: var(--bs-secondary-text-emphasis) !important; }
.badge.bg-success-subtle.text-success { color: var(--bs-success-text-emphasis) !important; }
.badge.bg-danger-subtle.text-danger { color: var(--bs-danger-text-emphasis) !important; }
.badge.bg-warning-subtle.text-warning { color: var(--bs-warning-text-emphasis) !important; }
.badge.bg-info-subtle.text-info { color: var(--bs-info-text-emphasis) !important; }

/* Utility-combo badges from existing templates can become low-contrast in dark mode. */
[data-bs-theme="dark"] .badge.bg-light.text-body.border {
    background-color: #2c3648 !important;
    color: #e7edf5 !important;
    border-color: #3b4962 !important;
}

/* Ghost: transparent bg/border, body-contrast text.
   Resting color (#2b2f36 on white) exceeds 10:1 — passes WCAG AA and AAA.
   Callers adding text-body-secondary (#6b7280) should restrict to icon-only
   use where the 3:1 non-text-contrast threshold applies. */
.btn-ghost {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-bg: rgba(var(--bs-body-color-rgb), .06);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-active-bg: rgba(var(--bs-body-color-rgb), .12);
    --bs-btn-active-border-color: transparent;
    --bs-btn-focus-shadow-rgb: var(--bs-body-color-rgb);
    --bs-btn-disabled-color: var(--bs-secondary-color);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: transparent;
}

button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    appearance: none;
    -webkit-appearance: none;
}

.btn-primary {
    --bs-btn-bg: var(--ga-color-primary);
    --bs-btn-border-color: var(--ga-color-primary);
    --bs-btn-hover-bg: var(--ga-color-primary-deep);
    --bs-btn-hover-border-color: var(--ga-color-primary-deep);
    --bs-btn-active-bg: var(--ga-color-primary-deep);
    --bs-btn-active-border-color: var(--ga-color-primary-deep);
}

.btn-danger {
    --bs-btn-bg: var(--bs-danger);
    --bs-btn-border-color: var(--bs-danger);
    --bs-btn-hover-bg: var(--ga-red-700);
    --bs-btn-hover-border-color: var(--ga-red-700);
    --bs-btn-active-bg: var(--ga-red-700);
    --bs-btn-active-border-color: var(--ga-red-700);
    --bs-btn-disabled-bg: var(--bs-danger);
    --bs-btn-disabled-border-color: var(--bs-danger);
}

.btn-outline-danger {
    --bs-btn-color: var(--bs-danger);
    --bs-btn-border-color: var(--bs-danger);
    --bs-btn-hover-bg: var(--bs-danger);
    --bs-btn-hover-border-color: var(--bs-danger);
    --bs-btn-active-bg: var(--ga-red-700);
    --bs-btn-active-border-color: var(--ga-red-700);
    --bs-btn-disabled-color: var(--bs-danger);
    --bs-btn-disabled-border-color: var(--bs-danger);
}

.btn-success {
    --bs-btn-bg: var(--bs-success);
    --bs-btn-border-color: var(--bs-success);
    --bs-btn-hover-bg: var(--ga-green-700);
    --bs-btn-hover-border-color: var(--ga-green-700);
    --bs-btn-active-bg: var(--ga-green-700);
    --bs-btn-active-border-color: var(--ga-green-700);
    --bs-btn-disabled-bg: var(--bs-success);
    --bs-btn-disabled-border-color: var(--bs-success);
}

.btn-outline-success {
    --bs-btn-color: var(--bs-success);
    --bs-btn-border-color: var(--bs-success);
    --bs-btn-hover-bg: var(--bs-success);
    --bs-btn-hover-border-color: var(--bs-success);
    --bs-btn-active-bg: var(--ga-green-700);
    --bs-btn-active-border-color: var(--ga-green-700);
    --bs-btn-disabled-color: var(--bs-success);
    --bs-btn-disabled-border-color: var(--bs-success);
}

/* On the dark canvas an outline button's text and border use the theme's
   light tokens; the fills stay as they are for the hover and active states. */
[data-bs-theme="dark"] .btn-outline-danger {
    --bs-btn-color: var(--bs-danger-text-emphasis);
    --bs-btn-border-color: var(--bs-danger-text-emphasis);
}

[data-bs-theme="dark"] .btn-outline-success {
    --bs-btn-color: var(--bs-success-text-emphasis);
    --bs-btn-border-color: var(--bs-success-text-emphasis);
}

.btn-outline-primary {
    --bs-btn-color: var(--ga-color-primary);
    --bs-btn-border-color: var(--ga-color-primary);
    --bs-btn-hover-bg: var(--ga-color-primary);
    --bs-btn-hover-border-color: var(--ga-color-primary);
    --bs-btn-active-bg: var(--ga-color-primary-deep);
    --bs-btn-active-border-color: var(--ga-color-primary-deep);
    --bs-btn-disabled-color: var(--ga-color-primary);
    --bs-btn-disabled-border-color: var(--ga-color-primary);
}

[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-border-color: var(--bs-link-color);
}

.btn-warning {
    --bs-btn-bg: var(--ga-color-accent);
    --bs-btn-border-color: var(--ga-color-accent);
    --bs-btn-color: var(--ga-color-primary-deep);
    --bs-btn-hover-bg: #f1be00;
    --bs-btn-hover-border-color: #f1be00;
    --bs-btn-hover-color: var(--ga-color-primary-deep);
}

.app-brand-logo-full {
    width: auto;
    height: auto;
    max-height: 58px;
    max-width: 240px;
    object-fit: contain;
    display: block;
}

.app-brand-logo-square {
    width: 40px;
    height: 40px;
    border-radius: .5rem;
    object-fit: cover;
    display: block;
}

.sidebar-brand-full {
    display: block;
}

.sidebar-brand-square {
    display: none;
}

.app-brand-logo-auth {
    width: auto;
    height: auto;
    max-height: 72px;
    max-width: 260px;
    object-fit: contain;
    display: block;
}

.app-footer-logo {
    width: auto;
    height: auto;
    max-height: 28px;
    max-width: 180px;
    object-fit: contain;
    display: block;
}

.member-topbar-avatar-img,
.staff-topbar-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.member-topbar-avatar-initials {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    font-size: var(--ga-type-caption);
    font-weight: 700;
    letter-spacing: var(--ga-tracking-overline);
}

/* Member controls meet the recommended comfortable touch-target size without
   changing the compact visual rhythm of the desktop header. */
.member-topbar-control,
.member-location-map-btn,
.event-location-map-btn {
    min-width: 40px;
    min-height: 40px;
}

@media (min-width: 992px) {
    body.page-sidebar-mini .page-sidebar:not(:hover) .aside-logo {
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.page-sidebar-mini .page-sidebar:not(:hover) .sidebar-brand-full {
        display: none;
    }

    body.page-sidebar-mini .page-sidebar:not(:hover) .sidebar-brand-square {
        display: block;
        width: 34px;
        height: 34px;
    }
}

/* ---------------------------------------------------------------------------
   Collapsed sidebar, keyboard and screen readers (WCAG 2.4.4, 2.4.7, 4.1.2)
   ---------------------------------------------------------------------------
   The staff sidebar starts collapsed (render_staff_page()). The theme hides
   every label with display: none and expands only on :hover, so collapsed,
   each link had no accessible name and a keyboard user tabbed through bare
   icons. Labels are now visually hidden instead of removed, and the sidebar
   expands whenever focus is inside it, the same way it does on hover.
   --------------------------------------------------------------------------- */
@media (min-width: 992px) {
    body.page-sidebar-mini .page-sidebar:not(:hover) .sidebar-text,
    body.page-sidebar-mini .page-sidebar:not(:hover) .sidebar-title > span {
        display: inline;
    }

    body.page-sidebar-mini .page-sidebar:not(:hover):not(:focus-within) .sidebar-text,
    body.page-sidebar-mini .page-sidebar:not(:hover):not(:focus-within) .sidebar-title > span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    body.page-sidebar-mini .page-sidebar:focus-within {
        width: 256px;
        box-shadow: var(--bs-box-shadow-lg);
    }

    body.page-sidebar-mini .page-sidebar:focus-within .sidebar-dropdown.show {
        display: block;
    }

    body.page-sidebar-mini .page-sidebar:focus-within .nav-link[data-bs-toggle="collapse"]::after {
        display: inline-block;
    }

    body.page-sidebar-mini .page-sidebar:focus-within .aside-logo {
        justify-content: flex-start !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    body.page-sidebar-mini .page-sidebar:focus-within .sidebar-brand-full {
        display: block;
    }

    body.page-sidebar-mini .page-sidebar:focus-within .sidebar-brand-square {
        display: none;
    }

    /* The build stamp ("dev · c733b78") does not fit the 72px rail and read
       as a clipped fragment. visibility, not display, so the rail keeps its
       height and the stamp returns as soon as the sidebar expands. */
    body.page-sidebar-mini .page-sidebar:not(:hover):not(:focus-within) .aside-footer {
        visibility: hidden;
    }
}

/* ---------------------------------------------------------------------------
   Non-text contrast for form controls (WCAG 1.4.11, AA)
   ---------------------------------------------------------------------------
   A control's visual boundary needs at least 3:1 against its background. The
   theme's --bs-border-color-translucent gives form fields #94a3b8 on white
   (2.56:1) and #334155 on #0f172a in dark (1.72:1), so both fall short.

   Overridden here for interactive controls only. Decorative boundaries — card
   edges, dividers, table rules — keep --bs-border-color / the translucent
   token, since 1.4.11 does not apply to them and raising those would make the
   whole UI read as heavier than intended.

   Focus, .is-invalid and .is-valid states set their own border-color at higher
   specificity and are unaffected. Disabled controls are exempt from 1.4.11.
--------------------------------------------------------------------------- */

:root,
[data-bs-theme="light"] {
    --ga-color-border-interactive: #808995; /* 3.54:1 on #ffffff */
}

[data-bs-theme="dark"] {
    --ga-color-border-interactive: #64748b; /* 3.75:1 on #0f172a */
}

.form-control,
.form-select,
.form-check-input,
.input-group-text,
.choices__inner {
    border-color: var(--ga-color-border-interactive);
}

/* ---------------------------------------------------------------------------
   Topbar above sticky page content
   ---------------------------------------------------------------------------
   .page-header (the topbar) is itself `position: sticky; z-index: 1020` in
   the compiled build -- the exact same tier Bootstrap's .sticky-top uses, and
   the same tier the Member Detail page's persistent summary header sets on
   itself. Two elements tied on z-index resolve by DOM order, and the page
   header is a sticky/fixed stacking context of its own: nothing painted
   *inside* it (including its dropdown menus, regardless of their own
   z-index -- this was tried first and did not help, for exactly this reason)
   can out-rank a later sibling that ties or beats the header's own z-index.
   The persistent header comes after the topbar in the DOM, so it won that
   tie and painted over the whole topbar, dropdown included, once scrolled far
   enough for the two to overlap.

   The topbar is the one piece of chrome that must outrank any in-page sticky
   content, current or future, so it moves to the .fixed-top tier (1030) --
   one step above sticky, and still below offcanvas/modal (1040+) so those
   continue to properly overlay it when open.
--------------------------------------------------------------------------- */
.page-header {
    z-index: 1030;
    min-height: var(--ga-topbar-height);
}

@media (max-width: 991.98px) {
    :root {
        --ga-masthead-height: 6.875rem;
    }
}

/* Anchor jumps and scrollIntoView() land below the sticky topbar, with one
   spacer of air: one rule instead of an offset per page. A page with more
   sticky chrome (the profile editor's save bar) raises it for itself. */
html {
    scroll-padding-top: calc(var(--ga-topbar-height) + var(--bs-spacer));
}

/* The collapsed sidebar expands over the page on hover or focus, topbar
   included. At 1030 it tied the topbar and lost on DOM order, so the topbar
   covered its logo row; one step up, still below offcanvas and modals. */
@media (min-width: 992px) {
    .page-sidebar {
        z-index: 1035;
    }
}


/* Focus ring (UX audit F17). One visible keyboard-focus style for every
   interactive element, replacing Bootstrap's 25%-opacity glow and the old
   45% outline (~2:1 against white). Solid primary clears 3:1 on light
   surfaces; the white halo keeps it legible on the dark sidebar and on
   filled buttons. :focus-visible only, so mouse clicks don't draw it. */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="tab"]:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.page-link:focus-visible,
.list-group-item-action:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.btn-close:focus-visible {
    outline: 2px solid var(--bs-primary, var(--ga-color-primary));
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--bs-body-bg, #fff);
}

/* Award badges (ui_award_badge(), member badges). Recognition, not state, so
   they sit outside the lifecycle palette: an icon, a label and one colour per
   family. Each text colour clears 4.5:1 on its tint in both themes. */
.app-award-badge {
    --award-bg: #e8edf6;
    --award-fg: #16325c;
    --award-border: #c9d4e8;
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .3rem .625rem .3rem .5rem;
    border: 1px solid var(--award-border);
    border-radius: 999px;
    background: var(--award-bg);
    color: var(--award-fg);
    font-size: var(--ga-type-caption);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: default;
}
.app-award-badge__icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.app-award-badge--governance { --award-bg: #e8edf6; --award-fg: #16325c; --award-border: #c9d4e8; }
.app-award-badge--events     { --award-bg: #e5f1fb; --award-fg: #0b4f8a; --award-border: #bcd9f2; }
.app-award-badge--support    { --award-bg: #fdf4d3; --award-fg: #634900; --award-border: #efd98a; }
.app-award-badge--impact     { --award-bg: #e3f3ea; --award-fg: #1a5c3d; --award-border: #b5dcc6; }
[data-bs-theme="dark"] .app-award-badge--governance { --award-bg: #1c2a44; --award-fg: #c9d6ee; --award-border: #34466a; }
[data-bs-theme="dark"] .app-award-badge--events     { --award-bg: #0f2f4d; --award-fg: #a9d2f5; --award-border: #245077; }
[data-bs-theme="dark"] .app-award-badge--support    { --award-bg: #3a2f08; --award-fg: #f5dc85; --award-border: #5e4c14; }
[data-bs-theme="dark"] .app-award-badge--impact     { --award-bg: #12382a; --award-fg: #a5dcbf; --award-border: #245a43; }
