/* ============================================================
   ROYAL SWIMMING ACADEMY — MEMBER PORTAL DESIGN SYSTEM
   Tokens + components. Layered on top of Bootstrap 5.3.
   ------------------------------------------------------------
   Brand:  purple #2e3192 · yellow #f8b800 · pink #f40064
   ============================================================ */

:root {
    /* --- Brand: royal blue (logo #2e3192) — token names kept as --rsa-purple-* to avoid churn --- */
    --rsa-purple-50:  #f3f3f9;
    --rsa-purple-100: #e0e0ef;
    --rsa-purple-200: #bcbddc;
    --rsa-purple-300: #9698c8;
    --rsa-purple-400: #686bb0;
    --rsa-purple-500: #474a9f;
    --rsa-purple-600: #2e3192;
    --rsa-purple-700: #262878;
    --rsa-purple-800: #1e205f;
    --rsa-purple-900: #151642;

    /* --- Brand: yellow --- */
    --rsa-yellow-50:  #fffaeb;
    --rsa-yellow-100: #fdf0c7;
    --rsa-yellow-200: #fbe291;
    --rsa-yellow-400: #fac52e;
    --rsa-yellow-500: #f8b800;
    --rsa-yellow-600: #d09800;
    --rsa-yellow-700: #966d00;

    /* --- Brand: pink --- */
    --rsa-pink-50:  #ffeef4;
    --rsa-pink-100: #ffd6e4;
    --rsa-pink-200: #ffadc9;
    --rsa-pink-400: #ff3d86;
    --rsa-pink-500: #f40064;
    --rsa-pink-600: #cc0054;
    --rsa-pink-700: #9e0041;

    /* --- Neutrals --- */
    --rsa-white:    #ffffff;
    --rsa-gray-50:  #f8f8fb;
    --rsa-gray-100: #f1f0f6;
    --rsa-gray-200: #e5e3ed;
    --rsa-gray-300: #d3d0de;
    --rsa-gray-400: #a3a0b3;
    --rsa-gray-500: #6f6c81;
    --rsa-gray-600: #514e63;
    --rsa-gray-700: #3a3849;
    --rsa-gray-800: #262433;
    --rsa-gray-900: #16141f;

    /* --- Status --- */
    --rsa-success:    #12855f;
    --rsa-success-bg: #e4f6ef;
    --rsa-warning:    #b07b00;
    --rsa-warning-bg: var(--rsa-yellow-50);
    --rsa-danger:     var(--rsa-pink-600);
    --rsa-danger-bg:  var(--rsa-pink-50);
    --rsa-info:       var(--rsa-purple-600);
    --rsa-info-bg:    var(--rsa-purple-50);

    /* --- Surfaces --- */
    --rsa-page-bg:   #f3f4fa;
    --rsa-surface:   #ffffff;
    --rsa-line:      var(--rsa-gray-200);
    --rsa-line-soft: var(--rsa-gray-100);

    /* --- Type --- */
    --rsa-font: 'Inter', 'Aptos', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    --rsa-font-display: 'Outfit', 'Inter', 'Aptos Display', 'Segoe UI Variable Display', 'Segoe UI', system-ui, sans-serif;
    /* references, event codes, account numbers — same humanist face, just
       weighted and pill-boxed; no monospace anywhere by request */
    --rsa-font-mono: var(--rsa-font);

    /* --- Shape --- */
    --rsa-radius-sm: 8px;
    --rsa-radius:    12px;
    --rsa-radius-lg: 16px;
    --rsa-radius-xl: 22px;

    /* --- Elevation (blue-tinted, not grey) --- */
    --rsa-shadow-xs: 0 1px 2px color-mix(in srgb, var(--rsa-purple-600) 5%, transparent);
    --rsa-shadow-sm: 0 1px 3px color-mix(in srgb, var(--rsa-purple-600) 7%, transparent), 0 1px 2px color-mix(in srgb, var(--rsa-purple-600) 5%, transparent);
    --rsa-shadow-md: 0 6px 16px -6px color-mix(in srgb, var(--rsa-purple-600) 16%, transparent), 0 2px 6px -2px color-mix(in srgb, var(--rsa-purple-600) 7%, transparent);
    --rsa-shadow-lg: 0 18px 38px -14px color-mix(in srgb, var(--rsa-purple-600) 26%, transparent), 0 6px 14px -8px color-mix(in srgb, var(--rsa-purple-600) 12%, transparent);

    --rsa-ring: 0 0 0 3px color-mix(in srgb, var(--rsa-purple-600) 16%, transparent);

    /* --- Motion --- */
    --rsa-fast: 140ms cubic-bezier(.4, 0, .2, 1);
    --rsa-base: 220ms cubic-bezier(.4, 0, .2, 1);

    /* --- Shell metrics --- */
    --rsa-sidebar-w: 264px;
    --rsa-topbar-h:  64px;

    /* --- Bootstrap remap ---
       Bootstrap builds its utilities (.text-danger, .bg-primary, links) from the -rgb triples, which
       a var() cannot supply; ClubPalette writes a club's own triples after these RSA defaults. */
    --bs-primary: var(--rsa-purple-600);
    --bs-primary-rgb: 46, 49, 146;
    --bs-link-color: var(--rsa-purple-600);
    --bs-link-color-rgb: 46, 49, 146;
    --bs-link-hover-color: var(--rsa-purple-800);
    --bs-link-hover-color-rgb: 30, 32, 95;
    --bs-danger: var(--rsa-danger);
    --bs-danger-rgb: 204, 0, 84;
    --bs-danger-text-emphasis: var(--rsa-pink-700);
    --bs-danger-bg-subtle: var(--rsa-pink-50);
    --bs-danger-border-subtle: var(--rsa-pink-100);
    --bs-font-monospace: var(--rsa-font-mono);
    --bs-body-color: #3a3849;
    --bs-body-color-rgb: 58, 56, 73;
    --bs-body-bg: #f3f4fa;
    --bs-border-color: #e5e3ed;
    --bs-secondary-color: #6f6c81;
    --bs-emphasis-color: #16141f;
    --bs-border-radius: 12px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 16px;
    --bs-focus-ring-color: color-mix(in srgb, var(--rsa-purple-600) 20%, transparent);
}

/* ============================================================
   BASE
   ============================================================ */

/* The portal keeps its scrollbar's room even when a page is short. Otherwise a page that loads
   short (a skeleton) and grows past the screen gains a scrollbar, and the centred column jumps
   sideways by half its width. Not on the full-bleed sign-in scene, which has no scrolling column. */
html:has(.shell), html:has(.home-shell) { scrollbar-gutter: stable; }

html, body {
    font-family: var(--rsa-font);
    color: var(--rsa-gray-700);
    background: var(--rsa-page-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--rsa-font-display);
    color: var(--rsa-gray-900);
    font-weight: 650;
    letter-spacing: -.015em;
}

a { color: var(--rsa-purple-600); text-decoration: none; }
a:hover { color: var(--rsa-purple-800); }

/* A reference or code (RSA-2026-V0042, an event code): the one treatment for them everywhere. */
code {
    font-family: var(--rsa-font);
    /* Scaled to the text it sits in, but never below 11px: in a 12px meta line .8125em came to 9.75px. */
    font-size: max(.8125em, .6875rem);
    font-weight: 600;
    letter-spacing: .015em;
    font-variant-numeric: tabular-nums;
    color: var(--rsa-purple-700);
    background: var(--rsa-purple-50);
    border: 1px solid var(--rsa-purple-100);
    border-radius: 6px;
    padding: .1em .45em;
}

/* Identity strings (emails, names-as-data): body face, just weighted —
   an email in monospace reads like a dev tool, not a person. */
.ident {
    font-weight: 600;
    color: var(--rsa-gray-800);
    letter-spacing: -.005em;
    overflow-wrap: anywhere;
}

::selection { background: var(--rsa-purple-100); color: var(--rsa-purple-800); }

:focus-visible {
    outline: 2px solid var(--rsa-purple-500);
    outline-offset: 2px;
}

/* ============================================================
   BUTTONS (Bootstrap overrides + brand variants)
   ============================================================ */

.btn {
    --bs-btn-border-radius: var(--rsa-radius-sm);
    font-weight: 550;
    letter-spacing: -.005em;
    transition: background var(--rsa-fast), border-color var(--rsa-fast),
                color var(--rsa-fast), box-shadow var(--rsa-fast), transform var(--rsa-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary,
.btn-brand {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--rsa-purple-600);
    --bs-btn-border-color: var(--rsa-purple-600);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--rsa-purple-700);
    --bs-btn-hover-border-color: var(--rsa-purple-700);
    --bs-btn-active-bg: var(--rsa-purple-800);
    --bs-btn-active-border-color: var(--rsa-purple-800);
    --bs-btn-disabled-bg: var(--rsa-purple-600);
    --bs-btn-disabled-border-color: var(--rsa-purple-600);
    color: #fff;
    background: var(--rsa-purple-600);
    border: 1px solid var(--rsa-purple-600);
}
.btn-primary:disabled, .btn-brand:disabled,
.btn-primary.disabled, .btn-brand.disabled {
    color: #fff;
    background: var(--rsa-purple-600);
    border-color: var(--rsa-purple-600);
    opacity: .45;
}
.btn-pink:disabled { color: #fff; opacity: .45; }
.btn-sunshine:disabled { color: var(--rsa-purple-800); opacity: .5; }
.btn-primary:hover, .btn-brand:hover {
    background: var(--rsa-purple-700);
    border-color: var(--rsa-purple-700);
    color: #fff;
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--rsa-purple-600) 45%, transparent);
}

/* Fills brand blue with white text on hover, focus and press — the same pattern as the danger and
   success outlines below. It used to hover to a pale tint with dark text, but a stale rule in
   app.css painted the background solid blue underneath, leaving dark-blue text on blue. */
.btn-outline-primary {
    --bs-btn-color: var(--rsa-purple-600);
    --bs-btn-border-color: var(--rsa-purple-200);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--rsa-purple-600);
    --bs-btn-hover-border-color: var(--rsa-purple-600);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--rsa-purple-700);
    --bs-btn-active-border-color: var(--rsa-purple-700);
}

.btn-outline-secondary {
    --bs-btn-color: var(--rsa-gray-600);
    --bs-btn-border-color: var(--rsa-gray-300);
    --bs-btn-hover-color: var(--rsa-gray-800);
    --bs-btn-hover-bg: var(--rsa-gray-100);
    --bs-btn-hover-border-color: var(--rsa-gray-400);
    --bs-btn-active-bg: var(--rsa-gray-200);
    background: #fff;
}

.btn-pink {
    color: #fff;
    background: var(--rsa-pink-500);
    border: 1px solid var(--rsa-pink-500);
}
.btn-pink:hover {
    color: #fff;
    background: var(--rsa-pink-600);
    border-color: var(--rsa-pink-600);
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--rsa-pink-500) 45%, transparent);
}

.btn-sunshine {
    color: var(--rsa-purple-800);
    background: var(--rsa-yellow-500);
    border: 1px solid var(--rsa-yellow-500);
    font-weight: 650;
}
.btn-sunshine:hover {
    color: var(--rsa-purple-900);
    background: var(--rsa-yellow-400);
    border-color: var(--rsa-yellow-400);
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--rsa-yellow-500) 55%, transparent);
}

.btn-soft {
    color: var(--rsa-purple-700);
    background: var(--rsa-purple-50);
    border: 1px solid var(--rsa-purple-100);
}
.btn-soft:hover {
    color: var(--rsa-purple-800);
    background: var(--rsa-purple-100);
    border-color: var(--rsa-purple-200);
}

.btn-quiet {
    color: var(--rsa-gray-600);
    background: transparent;
    border: 1px solid transparent;
}
.btn-quiet:hover { color: var(--rsa-gray-900); background: var(--rsa-gray-100); }

.btn-outline-danger {
    --bs-btn-color: var(--rsa-pink-600);
    --bs-btn-border-color: var(--rsa-pink-200);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--rsa-pink-500);
    --bs-btn-hover-border-color: var(--rsa-pink-500);
}
/* Destructive confirms: the brand's danger pink, not Bootstrap's #dc3545 beside it. */
.btn-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--rsa-pink-600);
    --bs-btn-border-color: var(--rsa-pink-600);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--rsa-pink-700);
    --bs-btn-hover-border-color: var(--rsa-pink-700);
    --bs-btn-active-bg: var(--rsa-pink-700);
    --bs-btn-active-border-color: var(--rsa-pink-700);
    --bs-btn-disabled-bg: var(--rsa-pink-600);
    --bs-btn-disabled-border-color: var(--rsa-pink-600);
}
.btn-outline-success {
    --bs-btn-color: var(--rsa-success);
    --bs-btn-border-color: #9fdcc6;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--rsa-success);
    --bs-btn-hover-border-color: var(--rsa-success);
}

.btn-lg { --bs-btn-border-radius: var(--rsa-radius); font-size: 1rem; padding: .8rem 1.5rem; }
.btn-sm { --bs-btn-border-radius: 7px; font-size: .8125rem; }

/* ============================================================
   FORMS
   ============================================================ */

.form-label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--rsa-gray-700);
    margin-bottom: .3rem;
    letter-spacing: .005em;
}
.form-control, .form-select {
    border-color: var(--rsa-gray-300);
    border-radius: var(--rsa-radius-sm);
    padding: .55rem .75rem;
    color: var(--rsa-gray-800);
    background-color: #fff;
    transition: border-color var(--rsa-fast), box-shadow var(--rsa-fast);
}
/* The shorthand above also took away the room Bootstrap keeps for a select's chevron, so long options ran under it. */
.form-select { padding-right: 2.25rem; }
/* ...and Bootstrap's small size, so -sm controls stood 40px tall beside the 31px btn-sm buttons next to them. */
.form-control-sm, .form-select-sm { padding-top: .25rem; padding-bottom: .25rem; padding-left: .6rem; font-size: .8125rem; border-radius: 7px; }
.form-control-sm { padding-right: .6rem; }
.form-select-sm { padding-right: 2rem; background-position: right .5rem center; }
.form-control::placeholder { color: var(--rsa-gray-400); }

/* The one date picker (DateField.razor): day, month and year dropdowns side by side, each as wide
   as its longest option and no wider, so "14 Mar 1985" reads as one date. */
.date-field { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.date-field > .form-select { flex: 0 0 auto; width: auto; }
.date-field__day { min-width: 4.75rem; }
.date-field__month { min-width: 5.75rem; }
.date-field__year { min-width: 5.75rem; }
.date-field__time { min-width: 4.25rem; }
.date-field__colon { color: var(--rsa-gray-500); font-weight: 600; }
.date-field--sm .date-field__day { min-width: 4.25rem; }
.date-field--sm .date-field__month { min-width: 5rem; }
.date-field--sm .date-field__year { min-width: 5.25rem; }
.date-field--sm .date-field__time { min-width: 3.75rem; }
/* Inside a table cell the date and time stay on one line; the table scrolls instead. */
td .date-field { flex-wrap: nowrap; }
.form-control:focus, .form-select:focus {
    border-color: var(--rsa-purple-400);
    box-shadow: var(--rsa-ring);
}
.form-control:disabled, .form-control[readonly] {
    background: var(--rsa-gray-100);
    color: var(--rsa-gray-500);
}
.form-text { color: var(--rsa-gray-500); font-size: .78125rem; }
.form-check-input { border-color: var(--rsa-gray-400); }
.form-check-input:checked {
    background-color: var(--rsa-purple-600);
    border-color: var(--rsa-purple-600);
}
.form-check-input:focus { border-color: var(--rsa-purple-400); box-shadow: var(--rsa-ring); }
.validation-message, .field-validation-error { color: var(--rsa-pink-600); font-size: .8125rem; }
.invalid { outline: none; border-color: var(--rsa-pink-500) !important; }
.valid.modified:not([type=checkbox]) { outline: none; border-color: #52c39d !important; }

/* Checkbox / radio rows that read as tappable tiles */
.check-tile {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .55rem .7rem;
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius-sm);
    background: #fff;
    cursor: pointer;
    transition: border-color var(--rsa-fast), background var(--rsa-fast);
    margin: 0;
}
.check-tile:hover { border-color: var(--rsa-purple-300); background: var(--rsa-purple-50); }
.check-tile:has(input:checked) {
    border-color: var(--rsa-purple-400);
    background: var(--rsa-purple-50);
    box-shadow: inset 0 0 0 1px var(--rsa-purple-300);
}
/* Left unticked after trying to submit: shown, so it is clear what still needs a tick. */
.check-tile--missing,
.check-tile--missing:hover {
    border-color: var(--bs-danger, #dc3545);
    background: #fff5f5;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bs-danger, #dc3545) 45%, transparent);
}
/* Scrolled to by id: clear of the sticky top bar. */
.scroll-target { scroll-margin-top: calc(var(--rsa-topbar-h) + .75rem); }
/* Centred on the first line of the .8125rem label beside it (it sat a couple of pixels low). */
.check-tile input { margin-top: .05rem; flex-shrink: 0; }
.check-tile__text { font-size: .8125rem; line-height: 1.35; min-width: 0; }

/* ============================================================
   PAGE HEADER
   ============================================================ */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-head__eyebrow {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--rsa-purple-400);
    margin-bottom: .3rem;
}
.page-head__title {
    font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2rem);
    font-weight: 700;
    color: var(--rsa-gray-900);
    margin: 0;
    line-height: 1.15;
    text-wrap: balance;
}
/* "pretty" stops a lone last word ("document.", "correspondence.") dangling on its own line. */
.page-head__sub {
    color: var(--rsa-gray-500);
    font-size: .875rem;
    margin: .35rem 0 0;
    max-width: 62ch;
    text-wrap: pretty;
}
.page-head__sub code { white-space: nowrap; }
.page-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}
/* A header whose actions are all conditional (Profile while editing) would otherwise keep an empty
   full-width row on a phone, a gap's worth of dead space under the title. */
.page-head__actions:empty { display: none; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .8125rem;
    font-weight: 550;
    color: var(--rsa-gray-500);
    margin-bottom: .75rem;
}
.back-link:hover { color: var(--rsa-purple-600); }

/* ============================================================
   PANELS (cards)
   ============================================================ */

.panel {
    background: var(--rsa-surface);
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius-lg);
    box-shadow: var(--rsa-shadow-sm);
    overflow: hidden;
}
.panel + .panel { margin-top: 1.25rem; }
.panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--rsa-line-soft);
    background: linear-gradient(180deg, #fff 0%, var(--rsa-gray-50) 100%);
}
.panel__title {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    font-size: .9375rem;
    font-weight: 650;
    color: var(--rsa-gray-800);
}
.panel__title i { color: var(--rsa-purple-500); font-size: 1rem; }
.panel__sub { font-size: .78125rem; color: var(--rsa-gray-500); margin: .15rem 0 0; text-wrap: pretty; }
.panel__body { padding: 1.25rem; }
.panel__body--flush { padding: 0; }
.panel__foot {
    padding: .9rem 1.25rem;
    border-top: 1px solid var(--rsa-line-soft);
    background: var(--rsa-gray-50);
}
.panel--accent { border-top: 3px solid var(--rsa-purple-600); }
/* Something waiting on the member (an unfinished draft): yellow, the attention colour. */
.panel--attention { border-top: 3px solid var(--rsa-yellow-500); }
.panel--success { border-color: #9fdcc6; }
.panel--pink { border-color: var(--rsa-pink-200); }
/* A panel after a form (whose last child is its actions bar) keeps the panel rhythm, and so does a
   form after a panel (the profile banner above the edit form, which sat flush on it). */
form + .panel,
.panel + form { margin-top: 1.25rem; }

/* Bootstrap paints cards, list groups and modals in --bs-body-bg, which is the page grey here. */
.card { --bs-card-bg: var(--rsa-surface); }
.list-group { --bs-list-group-bg: var(--rsa-surface); }
.modal { --bs-modal-bg: var(--rsa-surface); }

/* Bootstrap .card kept in sync so untouched markup still looks right */
.card {
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius-lg);
    box-shadow: var(--rsa-shadow-sm);
}
.card-header {
    background: linear-gradient(180deg, #fff 0%, var(--rsa-gray-50) 100%);
    border-bottom: 1px solid var(--rsa-line-soft);
    font-weight: 650;
    color: var(--rsa-gray-800);
}
/* Most admin headers wrap their title in <strong>, which would take "bolder" than 650 to 900. */
.card-header strong, .card-header b { font-weight: inherit; }

/* ============================================================
   STAT TILES
   ============================================================ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-tile {
    position: relative;
    display: block;
    background: var(--rsa-surface);
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius-lg);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--rsa-shadow-xs);
    overflow: hidden;
    transition: transform var(--rsa-base), box-shadow var(--rsa-base), border-color var(--rsa-base);
    color: inherit;
}
.stat-tile::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--tile-accent, var(--rsa-purple-600));
}
a.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--rsa-shadow-md);
    border-color: var(--rsa-purple-200);
    color: inherit;
}
.stat-tile__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .55rem;
}
.stat-tile__label {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--rsa-gray-500);
}
.stat-tile__icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    background: var(--tile-soft, var(--rsa-purple-50));
    color: var(--tile-accent, var(--rsa-purple-600));
    flex-shrink: 0;
}
.stat-tile__value {
    font-family: var(--rsa-font-display);
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -.02em;
    color: var(--tile-accent, var(--rsa-purple-600));
}
/* Smaller type ("Settled", a date) in the same line box as a full-size figure, so the line under
   it sits level with its neighbours' instead of a few pixels higher. */
.stat-tile__value--sm { font-size: 1.375rem; line-height: calc(1.875rem * 1.05); }
.stat-tile__meta { font-size: .78125rem; color: var(--rsa-gray-500); margin-top: .3rem; }

.stat-tile--purple { --tile-accent: var(--rsa-purple-600); --tile-soft: var(--rsa-purple-50); }
.stat-tile--pink   { --tile-accent: var(--rsa-pink-500);   --tile-soft: var(--rsa-pink-50); }
.stat-tile--yellow { --tile-accent: var(--rsa-yellow-600); --tile-soft: var(--rsa-yellow-50); }
.stat-tile--green  { --tile-accent: var(--rsa-success);    --tile-soft: var(--rsa-success-bg); }
.stat-tile--gray   { --tile-accent: var(--rsa-gray-500);   --tile-soft: var(--rsa-gray-100); }

/* Phones: two tiles a row rather than four tall ones filling the screen, with the tile
   tightened so a label like "Account balance" still sits on one line beside its icon. */
@media (max-width: 575.98px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .75rem;
    }
    .stat-tile { padding: .85rem .9rem .9rem 1rem; }
    .stat-tile__top { margin-bottom: .4rem; gap: .35rem; }
    .stat-tile__label { font-size: .625rem; letter-spacing: .05em; line-height: 1.25; min-width: 0; }
    .stat-tile__icon { width: 28px; height: 28px; border-radius: 8px; font-size: .875rem; }
    .stat-tile__value { font-size: 1.375rem; }
    .stat-tile__value--sm { font-size: 1.125rem; line-height: calc(1.375rem * 1.05); }
    .stat-tile__meta { font-size: .71875rem; }
    .stat-tile .count-ring { width: 48px; height: 48px; }
    .stat-tile .count-ring::before { inset: 5px; }
    .stat-tile .count-ring__num { font-size: .9375rem; }
}

/* ============================================================
   CHIPS / BADGES
   ============================================================ */

.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .6875rem;
    font-weight: 650;
    letter-spacing: .02em;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--rsa-gray-100);
    color: var(--rsa-gray-600);
    border: 1px solid transparent;
}
.chip i { font-size: .8125rem; }
/* A chip holding a sentence ("1 swimmer and 1 official registered") wraps inside a narrow card
   instead of running out of it. */
.chip--wrap { white-space: normal; max-width: 100%; border-radius: .75rem; align-items: flex-start; }
.chip--wrap i { line-height: 1.5; flex-shrink: 0; }
.chip--purple { background: var(--rsa-purple-50);  color: var(--rsa-purple-700); border-color: var(--rsa-purple-100); }
.chip--pink   { background: var(--rsa-pink-50);    color: var(--rsa-pink-700);   border-color: var(--rsa-pink-100); }
.chip--yellow { background: var(--rsa-yellow-50);  color: var(--rsa-yellow-700);  border-color: var(--rsa-yellow-100); }
.chip--green  { background: var(--rsa-success-bg); color: #0b6349;               border-color: #b9e6d5; }
.chip--gray   { background: var(--rsa-gray-100);   color: var(--rsa-gray-600);   border-color: var(--rsa-gray-200); }
.chip--outline{ background: #fff; color: var(--rsa-gray-600); border-color: var(--rsa-line); }
.chip--dot::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Bootstrap badge remap so untouched markup stays on-brand */
.badge.bg-primary   { background: var(--rsa-purple-600) !important; }
/* Neutral states (Cancelled, Void, Inactive, "0 …", "From deployment") read quiet rather than as a heavy dark pill. */
.badge.bg-secondary { background: var(--rsa-gray-200) !important; color: var(--rsa-gray-700) !important; }
.badge.bg-success   { background: var(--rsa-success) !important; }
.badge.bg-warning   { background: var(--rsa-yellow-500) !important; color: var(--rsa-purple-800) !important; }
.badge.bg-danger    { background: var(--rsa-pink-500) !important; }
.badge.bg-info      { background: var(--rsa-purple-100) !important; color: var(--rsa-purple-700) !important; }

/* ============================================================
   AVATARS
   ============================================================ */

.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .875rem;
    letter-spacing: .02em;
    background: var(--rsa-purple-100);
    color: var(--rsa-purple-700);
    flex-shrink: 0;
    text-transform: uppercase;
}
.avatar--lg { width: 64px; height: 64px; font-size: 1.375rem; }
.avatar--xl { width: 76px; height: 76px; font-size: 1.625rem; }
.avatar--swimmer  { background: var(--rsa-purple-100); color: var(--rsa-purple-700); }
.avatar--official { background: var(--rsa-yellow-100); color: var(--rsa-yellow-700); }
.avatar--ring { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--rsa-purple-100); }

/* ============================================================
   REGISTRATION CARDS
   ============================================================ */

.reg-card {
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius);
    overflow: hidden;
    background: #fff;
    transition: box-shadow var(--rsa-base), border-color var(--rsa-base);
}
.reg-card + .reg-card { margin-top: 1rem; }
.reg-card:hover { box-shadow: var(--rsa-shadow-md); border-color: var(--rsa-purple-200); }
.reg-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .85rem;
    padding: .9rem 1rem;
    background: linear-gradient(135deg, var(--rsa-purple-50) 0%, #fff 65%);
    border-bottom: 1px solid var(--rsa-line-soft);
}
.reg-card__date {
    display: grid;
    place-items: center;
    align-content: center;
    min-width: 54px;
    padding: .35rem .4rem;
    border-radius: 10px;
    background: var(--rsa-purple-600);
    color: #fff;
    line-height: 1.05;
    flex-shrink: 0;
}
.reg-card__date .m { font-size: .625rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.reg-card__date .d { font-size: 1.25rem; font-weight: 700; }
.reg-card__main { flex: 1 1 220px; min-width: 0; }
.reg-card__name { font-weight: 650; color: var(--rsa-gray-900); font-size: .9375rem; }
.reg-card__meta { font-size: .78125rem; color: var(--rsa-gray-500); margin-top: .15rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.reg-card__meta + .reg-card__meta { margin-top: .4rem; }
/* Status and payment chips side by side: stacked, their different widths left a ragged edge. */
.reg-card__status { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .3rem; }
/* Once the head wraps on a phone the chips sit under the title, so they line up in a row there.
   A narrower basis keeps the name beside the date block rather than dropping under it. */
@media (max-width: 575.98px) {
    .reg-card__main { flex-basis: 160px; }
    .reg-card__status { justify-content: flex-start; }
}
.reg-card__body { padding: .35rem 1rem 1rem; }
/* The head's own bottom rule already divides the first row: a second line 6px under it read double. */
.reg-card__body > .line-item:first-child { border-top: 0; }
/* Total / paid / outstanding and the pay button, under the line items. */
.reg-card__foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rsa-line);
}

.line-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem 0;
    border-top: 1px solid var(--rsa-line-soft);
}
.line-item__name { font-weight: 600; color: var(--rsa-gray-800); font-size: .875rem; }
.line-item__meta { font-size: .78125rem; color: var(--rsa-gray-500); margin-top: .15rem; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.line-item__amount { text-align: right; font-size: .875rem; white-space: nowrap; margin-left: auto; } /* stays right when it wraps */
.line-item__amount strong { color: var(--rsa-gray-900); }
.line-item__sub { font-size: .75rem; color: var(--rsa-gray-500); }
/* First row at the top of a panel body: the panel head's rule is right above it. */
.panel__body > .line-item:first-child { border-top: 0; padding-top: 0; }

/* A reference in a row of chips (event code, registration ref) at the chips' own size and height,
   rather than scaled off whatever text it sits in (13px beside 11px chips in the event banner). */
.event-hero__chips code,
.reg-card__meta code,
.event-card__meta code {
    font-size: .6875rem;
    line-height: 1.5;
    padding: .2rem .5rem;
    white-space: nowrap;
}

/* Totals block */
.totals {
    border-top: 1px solid var(--rsa-line);
    margin-top: .5rem;
    padding-top: .75rem;
}
/* At the top of a panel body, where there is nothing above it to divide from. */
.totals--flush { border-top: 0; margin-top: 0; padding-top: 0; }
/* A grand total with no rows above it (no credit line): the block's solid rule is its divider, so a
   dashed one straight under it read as a double line. */
.totals > .totals__grand:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.totals__row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: .8125rem;
    padding: .18rem 0;
    color: var(--rsa-gray-600);
}
.totals__row strong { color: var(--rsa-gray-800); font-weight: 600; white-space: nowrap; }
.totals__row span:first-child { min-width: 0; }
.totals__grand {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: baseline;
    white-space: nowrap;
    margin-top: .6rem;
    padding-top: .7rem;
    border-top: 1px dashed var(--rsa-gray-300);
    font-family: var(--rsa-font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--rsa-purple-700);
}

.money-due    { color: var(--rsa-pink-600); font-weight: 650; }
.money-credit { color: var(--rsa-success);  font-weight: 650; }
.money-flat   { color: var(--rsa-gray-500); }

/* ============================================================
   MEMBER CARDS
   ============================================================ */

.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.member-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius-lg);
    background: #fff;
    box-shadow: var(--rsa-shadow-xs);
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: transform var(--rsa-base), box-shadow var(--rsa-base), border-color var(--rsa-base);
}
.member-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--rsa-shadow-md);
    border-color: var(--rsa-purple-200);
}
.member-card__body { flex: 1; min-width: 0; }
.member-card__chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
/* The card is a <button>, so these are <span>s: without display:block they run together on one
   line and the margins and the ellipsis never apply. */
.member-card__name {
    display: block;
    font-weight: 650;
    color: var(--rsa-gray-900);
    font-size: .9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.member-card__meta { display: block; font-size: .78125rem; color: var(--rsa-gray-500); margin-top: .1rem; }
.member-card__quals { display: block; font-size: .75rem; color: var(--rsa-gray-500); margin-top: .5rem; line-height: 1.4; }

/* Add-member call-to-action tile */
.add-tile {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.1rem;
    border: 1.5px dashed var(--rsa-purple-200);
    border-radius: var(--rsa-radius-lg);
    background: var(--rsa-purple-50);
    color: var(--rsa-purple-700);
    transition: border-color var(--rsa-base), background var(--rsa-base), transform var(--rsa-base);
}
.add-tile:hover {
    border-color: var(--rsa-purple-400);
    background: var(--rsa-purple-100);
    color: var(--rsa-purple-800);
    transform: translateY(-2px);
}
.add-tile__icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: #fff;
    color: var(--rsa-purple-600);
    font-size: 1.125rem;
    flex-shrink: 0;
}
.add-tile__title { font-weight: 650; font-size: .9375rem; }
.add-tile__sub { font-size: .78125rem; opacity: .8; }

/* Pick list used on the registration builder */
.pick-card {
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius);
    background: #fff;
    padding: .9rem;
    height: 100%;
    transition: border-color var(--rsa-base), box-shadow var(--rsa-base);
}
.pick-card:hover { border-color: var(--rsa-purple-200); box-shadow: var(--rsa-shadow-sm); }
.pick-card--on { border-color: var(--rsa-purple-300); box-shadow: inset 0 0 0 1px var(--rsa-purple-200); background: #fdfcff; }
/* Cards in a row match heights, except beside an open editor, which would leave its neighbour a tall empty box. */
.row:has(.pick-editor) .pick-card:not(:has(.pick-editor)) { height: auto; }
.pick-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
/* A whole card that is the choice (category upgrade): reads as a card, not a button. */
.pick-card--button { display: block; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.pick-card--button:disabled { cursor: not-allowed; opacity: .6; box-shadow: none; }
.pick-card--button:disabled:hover { border-color: var(--rsa-line); }
.pick-editor {
    margin-top: .75rem;
    padding: .85rem;
    border-radius: var(--rsa-radius-sm);
    background: var(--rsa-purple-50);
    border: 1px solid var(--rsa-purple-100);
}
.pick-editor__session { color: var(--rsa-purple-700); }
.pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: .4rem .75rem;
}

/* ============================================================
   ACTIVITY / LEDGER LIST
   ============================================================ */

.activity { list-style: none; margin: 0; padding: 0; }
.activity__row {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--rsa-line-soft);
    transition: background var(--rsa-fast);
}
.activity__row:last-child { border-bottom: none; }
.activity__row:hover { background: var(--rsa-gray-50); }
.activity__icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: grid; place-items: center;
    font-size: .875rem;
    flex-shrink: 0;
    background: var(--rsa-gray-100);
    color: var(--rsa-gray-500);
}
.activity__icon--charge { background: var(--rsa-pink-50);    color: var(--rsa-pink-600); }
.activity__icon--credit { background: var(--rsa-success-bg); color: var(--rsa-success); }
.activity__icon--note   { background: var(--rsa-purple-50);  color: var(--rsa-purple-600); }
.activity__icon--pending { background: var(--rsa-yellow-50); color: var(--rsa-yellow-600); }
.activity__main { flex: 1; min-width: 0; }
.activity__title { font-size: .875rem; color: var(--rsa-gray-800); font-weight: 550; }
.activity__meta { font-size: .75rem; color: var(--rsa-gray-500); margin-top: .1rem; }
.activity__amount { font-size: .9375rem; font-weight: 650; white-space: nowrap; }
.activity__meta code { white-space: nowrap; }
/* Buttons at the end of a row (an unfinished draft's Continue / Discard). On a phone they drop under
   the text, lined up with it, instead of squeezing it into a column four lines tall. */
.activity__actions { display: flex; flex-wrap: wrap; gap: .5rem; flex-shrink: 0; }
@media (max-width: 575.98px) {
    .activity__row--wrap { flex-wrap: wrap; }
    .activity__row--wrap > .activity__actions { width: 100%; padding-left: calc(32px + .85rem); }
}

/* ============================================================
   TABLES
   ============================================================ */

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    color: var(--rsa-gray-700);
}
.table > thead th {
    background: var(--rsa-gray-50);
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--rsa-gray-500);
    border-bottom: 1px solid var(--rsa-line);
    white-space: nowrap;
}
.table > :not(caption) > * > * { padding: .7rem .85rem; }
/* Positioned, so a visually-hidden heading in a table that scrolls sideways stays inside the scroll box
   instead of stretching the card, and the page, past the screen. */
.table-responsive { position: relative; }
.table > tbody > tr { border-color: var(--rsa-line-soft); }
.table-hover > tbody > tr:hover > * { background: var(--rsa-gray-50); }

/* ============================================================
   ALERTS / NOTICES
   ============================================================ */

.notice {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1.1rem;
    border-radius: var(--rsa-radius);
    font-size: .875rem;
    border: 1px solid transparent;
    margin-bottom: 1.25rem;
}
.notice i { font-size: 1.05rem; line-height: 1.4; flex-shrink: 0; }
/* ...but an icon inside a button in a notice is the button's: the notice's colour hid a lock on a pink button. */
.notice .btn i { font-size: inherit; line-height: inherit; color: inherit !important; }
.notice__body { min-width: 0; flex: 1; }
.notice__title { font-weight: 650; }
.notice--info    { background: var(--rsa-purple-50);  color: var(--rsa-purple-800); border-color: var(--rsa-purple-100); }
.notice--info i  { color: var(--rsa-purple-500); }
.notice--success { background: var(--rsa-success-bg); color: #0b6349; border-color: #b9e6d5; }
.notice--success i { color: var(--rsa-success); }
.notice--warning { background: var(--rsa-yellow-50);  color: #7a5a00; border-color: var(--rsa-yellow-100); }
.notice--warning i { color: var(--rsa-yellow-600); }
.notice--danger  { background: var(--rsa-pink-50);    color: var(--rsa-pink-700); border-color: var(--rsa-pink-100); }
.notice--danger i { color: var(--rsa-pink-500); }
/* A notice only carries a bottom margin, so one that follows a panel needs the rhythm above it too. */
.panel + .notice { margin-top: 1.25rem; }
.notice code { white-space: nowrap; }
/* A spinner in place of the icon ("confirming your payment"): icon-sized, not the 34px page loader. */
.notice > .loading-ring { width: 20px; height: 20px; border-width: 2px; margin-top: .1rem; flex-shrink: 0; }

/* Said once, at the top of whatever page the link led to, when following another club's link
   ended the session. Above the shell rather than inside it: that page could be the admin console,
   the member portal or the public site. */
/* The signed-out notice (SignedOutNotice): a toast drawn with the page, in the toast corner. */
.toast-card.club-signout {
    position: fixed;
    right: 1.25rem;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    z-index: 1299;
    width: min(100vw - 2rem, 390px);
}
body:has(.club-signout) .toasts { bottom: calc(1.25rem + 92px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 575.98px) {
    .toast-card.club-signout { left: .75rem; right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom, 0px)); width: auto; }
}

.alert { border-radius: var(--rsa-radius); border-width: 1px; font-size: .875rem; }
.alert-success { background: var(--rsa-success-bg); color: #0b6349; border-color: #b9e6d5; }
.alert-danger  { background: var(--rsa-pink-50);    color: var(--rsa-pink-700); border-color: var(--rsa-pink-100); }
.alert-warning { background: var(--rsa-yellow-50);  color: #7a5a00; border-color: var(--rsa-yellow-100); }
.alert-info    { background: var(--rsa-purple-50);  color: var(--rsa-purple-800); border-color: var(--rsa-purple-100); }
.alert-secondary { background: var(--rsa-gray-50); color: var(--rsa-gray-600); border-color: var(--rsa-line); }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
}
.empty__icon {
    width: 64px; height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 1.625rem;
    background: var(--rsa-purple-50);
    color: var(--rsa-purple-400);
}
.empty__title { font-size: 1rem; font-weight: 650; color: var(--rsa-gray-700); margin-bottom: .35rem; text-wrap: balance; }
.empty__text { font-size: .875rem; color: var(--rsa-gray-500); max-width: 42ch; margin: 0 auto 1.25rem; text-wrap: pretty; }
.empty__text code { white-space: nowrap; }
/* No action under it: nothing to leave room for. */
.empty__text:last-child { margin-bottom: 0; }
/* A summary page's empty panels (the dashboard stacks two): the same message in less height. */
.empty--sm { padding: 1.75rem 1.5rem; }
.empty--sm .empty__icon { width: 48px; height: 48px; font-size: 1.25rem; margin-bottom: .75rem; }

/* ============================================================
   LOADING
   ============================================================ */

.loading-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: 4rem 1rem;
    color: var(--rsa-gray-500);
    font-size: .875rem;
}
.loading-ring {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 3px solid var(--rsa-purple-100);
    border-top-color: var(--rsa-purple-600);
    animation: rsa-spin .8s linear infinite;
}
@keyframes rsa-spin { to { transform: rotate(360deg); } }

.skeleton {
    border-radius: var(--rsa-radius);
    background: linear-gradient(90deg, var(--rsa-gray-100) 25%, var(--rsa-gray-200) 37%, var(--rsa-gray-100) 63%);
    background-size: 400% 100%;
    animation: rsa-shimmer 1.4s ease infinite;
}
@keyframes rsa-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ============================================================
   MISC
   ============================================================ */

.section-label {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--rsa-gray-400);
    margin-bottom: .5rem;
}

/* Small helpers that pages used to write inline. */
.text-pre-wrap { white-space: pre-wrap; }
.min-w-0 { min-width: 0; }
/* A <button> that should look like the text it holds (the wizard's step markers). */
.button-reset {
    border: 0;
    background: none;
    padding: 0;
    cursor: default;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem 1.5rem;
}
.detail-item { display: flex; align-items: flex-start; gap: .7rem; min-width: 0; }
.detail-item__icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: var(--rsa-purple-50);
    color: var(--rsa-purple-500);
    flex-shrink: 0;
    font-size: .9375rem;
}
.detail-item__label {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--rsa-gray-400);
}
.detail-item__value { font-size: .875rem; color: var(--rsa-gray-800); word-break: break-word; }

.fade-in { animation: rsa-fade-up .3s ease-out both; }
@keyframes rsa-fade-up {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* ============================================================
   UPLOADS
   ============================================================ */

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: 1.5rem 1rem;
    border: 1.5px dashed var(--rsa-gray-300);
    border-radius: var(--rsa-radius);
    background: var(--rsa-gray-50);
    cursor: pointer;
    text-align: center;
    transition: border-color var(--rsa-fast), background var(--rsa-fast);
}
.upload-zone:hover { border-color: var(--rsa-purple-300); background: var(--rsa-purple-50); }
.upload-zone__icon { font-size: 1.6rem; color: var(--rsa-purple-400); }
.upload-zone__text { font-size: .875rem; font-weight: 600; color: var(--rsa-gray-700); }
.upload-zone__hint { font-size: .75rem; color: var(--rsa-gray-500); }
.upload-zone__input {
    margin-top: .75rem;
    max-width: 100%;
    font-size: .8125rem;
    color: var(--rsa-gray-600);
}
/* The browser's own "Choose File" button, dressed to sit in the zone rather than showing raw. */
.upload-zone__input::file-selector-button {
    margin-right: .6rem;
    padding: .4rem .85rem;
    border: 1px solid var(--rsa-purple-100);
    border-radius: var(--rsa-radius-sm);
    background: #fff;
    color: var(--rsa-purple-700);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--rsa-fast), border-color var(--rsa-fast), color var(--rsa-fast);
}
.upload-zone__input::file-selector-button:hover {
    background: var(--rsa-purple-50);
    border-color: var(--rsa-purple-300);
    color: var(--rsa-purple-800);
}
.upload-zone__input:disabled::file-selector-button { opacity: .5; cursor: not-allowed; }

.upload-current {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem .9rem;
    border-radius: var(--rsa-radius-sm);
    background: var(--rsa-success-bg);
    border: 1px solid #b9e6d5;
    margin-bottom: 1rem;
}
.upload-current__icon { color: var(--rsa-success); font-size: 1.15rem; }
.upload-current__body { min-width: 0; font-size: .875rem; }

/* ============================================================
   STICKY FORM ACTIONS
   ============================================================ */

.form-actions {
    position: sticky;
    bottom: env(safe-area-inset-bottom, 0px);
    z-index: 20;
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    margin-top: 1.5rem;
    padding: .85rem 1rem;
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius-lg);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(1.6) blur(10px);
    -webkit-backdrop-filter: saturate(1.6) blur(10px);
    box-shadow: var(--rsa-shadow-md);
}

/* ============================================================
   RESULT / OUTCOME CARDS (payment landing pages)
   ============================================================ */

.result-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.75rem;
}
.result-icon--success { background: var(--rsa-success-bg); color: var(--rsa-success); }
.result-icon--warning { background: var(--rsa-yellow-50);  color: var(--rsa-yellow-600); }
.result-icon--danger  { background: var(--rsa-pink-50);    color: var(--rsa-pink-500); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }

/* ============================================================
   MOTION (Montego-style entrance layer)
   Everything respects the prefers-reduced-motion block above.
   ============================================================ */

/* Ends on "none", not translateY(0): the animation holds its last frame, and any transform left on a
   page block would become the containing block for fixed children (the mobile pay bar, dialogs). */
@keyframes rsa-rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
@keyframes rsa-pop {
    0%   { transform: scale(.6); opacity: 0; }
    60%  { transform: scale(1.06); opacity: 1; }
    100% { transform: none; opacity: 1; }
}

/* Page content rises in on every navigation */
.shell__content > * { animation: rsa-rise .35s cubic-bezier(.2, .7, .3, 1) both; }
.shell__content > *:nth-child(2) { animation-delay: .05s; }
.shell__content > *:nth-child(3) { animation-delay: .1s; }
.shell__content > *:nth-child(4) { animation-delay: .15s; }
.shell__content > *:nth-child(n+5) { animation-delay: .2s; }

/* Stat tiles pop in left-to-right */
.stat-grid > * { animation: rsa-rise .4s cubic-bezier(.2, .7, .3, 1) both; }
.stat-grid > *:nth-child(1) { animation-delay: .08s; }
.stat-grid > *:nth-child(2) { animation-delay: .14s; }
.stat-grid > *:nth-child(3) { animation-delay: .2s; }
.stat-grid > *:nth-child(n+4) { animation-delay: .26s; }

/* List rows stagger softly */
.activity__row,
.member-grid > *,
.reg-card { animation: rsa-rise .32s ease-out both; }
.activity__row:nth-child(1), .member-grid > *:nth-child(1) { animation-delay: .03s; }
.activity__row:nth-child(2), .member-grid > *:nth-child(2) { animation-delay: .06s; }
.activity__row:nth-child(3), .member-grid > *:nth-child(3) { animation-delay: .09s; }
.activity__row:nth-child(4), .member-grid > *:nth-child(4) { animation-delay: .12s; }
.activity__row:nth-child(5), .member-grid > *:nth-child(5) { animation-delay: .15s; }
.activity__row:nth-child(n+6), .member-grid > *:nth-child(n+6) { animation-delay: .18s; }

/* Chips that confirm something (Uploaded, Paid) get a little pop */
.chip--green { animation: rsa-pop .3s ease-out both; }

/* Sidebar nav links cascade on first paint */
.shell__nav .nav-link { animation: rsa-rise .3s ease-out both; }
.shell__nav .nav-link:nth-of-type(1) { animation-delay: .05s; }
.shell__nav .nav-link:nth-of-type(2) { animation-delay: .09s; }
.shell__nav .nav-link:nth-of-type(3) { animation-delay: .13s; }
.shell__nav .nav-link:nth-of-type(4) { animation-delay: .17s; }
.shell__nav .nav-link:nth-of-type(n+5) { animation-delay: .21s; }

/* ============================================================
   PROGRESS (upload flow)
   ============================================================ */

.progress {
    --bs-progress-bg: var(--rsa-purple-100);
    --bs-progress-bar-bg: var(--rsa-purple-600);
    height: 8px;
    border-radius: 999px;
    background: var(--rsa-purple-100);
}
.progress-bar { background-color: var(--rsa-purple-600); }
.progress-bar-striped {
    background-image: linear-gradient(45deg,
        rgba(255, 255, 255, .2) 25%, transparent 25%, transparent 50%,
        rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%, transparent 75%, transparent);
}

/* ============================================================
   SCROLLBARS + LAST POLISH
   ============================================================ */

html {
    scrollbar-width: thin;
    scrollbar-color: var(--rsa-gray-300) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--rsa-gray-300);
    border-radius: 999px;
    border: 2px solid var(--rsa-page-bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--rsa-gray-400); }

.shell__sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .28) transparent;
}
.shell__sidebar::-webkit-scrollbar { width: 6px; }
.shell__sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .24);
    border: 0;
}

/* Chips that act as links feel tappable */
a.chip { transition: box-shadow var(--rsa-fast), border-color var(--rsa-fast), transform var(--rsa-fast); }
a.chip:hover { box-shadow: var(--rsa-shadow-xs); transform: translateY(-1px); }

/* Spinner inherits brand color when used bare */
.spinner-border { --bs-spinner-border-width: .18em; color: var(--rsa-purple-500); }
.btn .spinner-border { color: inherit; }

/* ============================================================
   READABILITY & FUN LAYER (beyond the Montego reference)
   ============================================================ */

/* Money and dates line up everywhere */
.money-due, .money-credit, .money-flat,
.activity__amount, .line-item__amount, .totals,
.stat-tile__value, .reg-card__date {
    font-variant-numeric: tabular-nums;
}

/* Registration cards wear their payment state on the left edge */
.reg-card--due     { border-left: 4px solid var(--rsa-pink-500); }
.reg-card--paid    { border-left: 4px solid var(--rsa-success); }
.reg-card--partial { border-left: 4px solid var(--rsa-yellow-500); }
.reg-card--muted   { border-left: 4px solid var(--rsa-gray-300); }

/* Month separators for long ledgers */
.activity__month {
    position: sticky;
    top: var(--rsa-topbar-h);
    z-index: 5;
    padding: .45rem 1.25rem;
    background: var(--rsa-gray-50);
    border-top: 1px solid var(--rsa-line-soft);
    border-bottom: 1px solid var(--rsa-line-soft);
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--rsa-gray-500);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-variant-numeric: tabular-nums;
}
.activity__month span:last-child { letter-spacing: 0; text-transform: none; font-weight: 600; }

/* Celebration burst — pure CSS, used on "paid / settled" moments */
.confetti {
    position: relative;
    display: inline-block;
}
/* On a result icon the burst must not undo the grid that centres the glyph. */
.result-icon.confetti { display: grid; }
.confetti::before, .confetti::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    pointer-events: none;
    opacity: 0;
    animation: rsa-confetti 1.1s ease-out .25s;
}
.confetti::before {
    background: var(--rsa-pink-500);
    box-shadow:
        -46px -34px 0 var(--rsa-yellow-500),
        42px -46px 0 var(--rsa-purple-400),
        -60px 8px 0 var(--rsa-purple-300),
        54px 2px 0 var(--rsa-pink-400),
        -22px -58px 0 var(--rsa-success),
        20px -62px 0 var(--rsa-yellow-400);
}
.confetti::after {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--rsa-yellow-500);
    box-shadow:
        -38px -50px 0 var(--rsa-pink-400),
        50px -28px 0 var(--rsa-yellow-400),
        -56px -12px 0 var(--rsa-success),
        60px -14px 0 var(--rsa-purple-300),
        -8px -66px 0 var(--rsa-pink-500),
        34px -56px 0 var(--rsa-purple-400);
    animation-delay: .35s;
}
@keyframes rsa-confetti {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(0deg); }
    12%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(1.15) rotate(140deg); }
}

/* Skeleton building blocks (loading that keeps the page's shape) */
.sk { display: block; border-radius: var(--rsa-radius-sm); }
.sk--text  { height: 12px; }
.sk--title { height: 26px; width: 240px; max-width: 60%; }
.sk--chip  { height: 22px; width: 90px; border-radius: 999px; }
.sk--tile  { height: 108px; border-radius: var(--rsa-radius-lg); }
.sk--card  { height: 96px; border-radius: var(--rsa-radius-lg); }
.sk--avatar { width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; }
.sk--button { height: 40px; width: 200px; max-width: 100%; }
.sk--panel { height: 220px; border-radius: var(--rsa-radius-lg); }
.sk--panel-sm { height: 160px; }
.sk--panel-lg { height: 300px; }
.sk--w-180 { width: 180px; max-width: 100%; }
.sk-stack > * + * { margin-top: .6rem; }

/* Mobile action bar — keeps total + primary action in thumb reach */
.mobile-bar {
    display: none;
}
@media (max-width: 1199.98px) {
    .mobile-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 800;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        padding: .65rem clamp(1rem, 3vw, 2rem) calc(.65rem + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, .94);
        backdrop-filter: saturate(1.6) blur(12px);
        -webkit-backdrop-filter: saturate(1.6) blur(12px);
        border-top: 1px solid var(--rsa-line);
        box-shadow: 0 -8px 24px -12px color-mix(in srgb, var(--rsa-purple-600) 25%, transparent);
        animation: rsa-bar-up .3s cubic-bezier(.2, .7, .3, 1) both;
    }
    /* stop page content hiding behind the bar */
    .has-mobile-bar { padding-bottom: 84px; }
}
@keyframes rsa-bar-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.mobile-bar__label { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--rsa-gray-400); }
.mobile-bar__total {
    font-family: var(--rsa-font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--rsa-purple-700);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* info variant for result icons (check-your-email style pages) */
.result-icon--info { background: var(--rsa-purple-50); color: var(--rsa-purple-500); }


/* ============================================================
   NEXT-BEST-ACTION HERO (dashboard)
   One card that answers "what should I do right now?"
   ============================================================ */

.action-hero {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 1.5rem 1.7rem;
    margin-bottom: 1.5rem;
    border-radius: var(--rsa-radius-lg);
    color: #fff;
    overflow: hidden;
    box-shadow: var(--rsa-shadow-md);
    background:
        radial-gradient(90% 140% at 100% 0%, color-mix(in srgb, var(--rsa-pink-500) 30%, transparent) 0%, transparent 55%),
        linear-gradient(135deg, var(--rsa-purple-600) 0%, var(--rsa-purple-800) 100%);
}
.action-hero::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 30px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 28' preserveAspectRatio='none'%3E%3Cpath d='M0 14 Q15 4 30 14 T60 14 T90 14 T120 14 V28 H0 Z' fill='rgba(255,255,255,.10)'/%3E%3C/svg%3E") repeat-x left bottom / 240px 30px;
    animation: rsa-wave 16s linear infinite;
    pointer-events: none;
}
@keyframes rsa-wave { to { background-position-x: 240px; } }

.action-hero__body { position: relative; z-index: 1; flex: 1 1 300px; min-width: 0; }
.action-hero__label {
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--rsa-yellow-400);
    margin-bottom: .3rem;
}
.action-hero__title {
    font-family: var(--rsa-font-display);
    font-size: clamp(1.25rem, 1.1rem + .7vw, 1.625rem);
    font-weight: 700;
    letter-spacing: -.01em;
    color: #fff;
    margin: 0 0 .25rem;
    text-wrap: balance;
}
.action-hero__text { font-size: .875rem; color: rgba(255, 255, 255, .78); margin: 0; max-width: 56ch; text-wrap: pretty; }
.action-hero__cta {
    position: relative;
    z-index: 1;
    background: #fff;
    color: var(--rsa-purple-700);
    border: 0;
    font-weight: 700;
    flex-shrink: 0;
}
.action-hero__cta:hover {
    background: var(--rsa-yellow-400);
    color: var(--rsa-purple-900);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .5);
}
.action-hero--calm {
    background:
        radial-gradient(90% 140% at 100% 0%, color-mix(in srgb, var(--rsa-yellow-500) 22%, transparent) 0%, transparent 55%),
        linear-gradient(135deg, var(--rsa-purple-700) 0%, var(--rsa-purple-900) 100%);
}

/* ============================================================
   FOLDING SECTION (the dashboard's past registrations)
   Eases its height open and shut by growing its one grid row from
   0fr to 1fr, which works both ways without measuring anything.
   Once open it stops clipping, so the cards' hover shadows show.
   ============================================================ */

.reveal {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 320ms cubic-bezier(.2, .7, .3, 1), opacity 320ms cubic-bezier(.2, .7, .3, 1);
}
.reveal.is-open { grid-template-rows: 1fr; opacity: 1; }
.reveal__inner { min-height: 0; overflow: hidden; }
.reveal.is-open .reveal__inner { animation: reveal-unclip 0s linear 320ms forwards; }
@keyframes reveal-unclip { to { overflow: visible; } }
.reveal-toggle i { transition: transform 320ms cubic-bezier(.2, .7, .3, 1); }
.reveal-toggle.is-open i { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
    .reveal, .reveal-toggle i { transition: none; }
    .reveal.is-open .reveal__inner { animation: none; overflow: visible; }
}

/* ============================================================
   TO-DO LIST (dashboard, under the hero)
   Everything else a member should see to: money first, then
   things to finish, then news. Tone sets the edge and icon colour.
   ============================================================ */

.attention { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.attention__item {
    --tone: var(--rsa-purple-600);
    --tone-bg: var(--rsa-purple-50);
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .75rem 1rem;
    background: var(--rsa-surface);
    border: 1px solid var(--rsa-line);
    border-left: 3px solid var(--tone);
    border-radius: var(--rsa-radius);
    box-shadow: var(--rsa-shadow-xs);
}
.attention__item--money { --tone: var(--rsa-pink-600); --tone-bg: var(--rsa-pink-50); }
.attention__item--attention { --tone: var(--rsa-yellow-600); --tone-bg: var(--rsa-yellow-50); }
.attention__icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--tone-bg);
    color: var(--tone);
}
.attention__body { flex: 1; min-width: 0; }
.attention__title { font-weight: 650; font-size: .875rem; color: var(--rsa-gray-900); text-wrap: balance; }
.attention__detail { font-size: .78125rem; color: var(--rsa-gray-500); margin-top: .1rem; text-wrap: pretty; }
.attention__item > .btn { flex-shrink: 0; }
/* On a phone the button drops under the text, lined up with it. */
@media (max-width: 575.98px) {
    .attention__item { flex-wrap: wrap; }
    .attention__body { flex-basis: calc(100% - 34px - .85rem); }
    .attention__item > .btn { margin-left: calc(34px + .85rem); }
}

/* ============================================================
   COUNTDOWN RING (next event)
   ============================================================ */

.count-ring {
    --p: 50;
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: conic-gradient(var(--rsa-yellow-500) calc(var(--p) * 1%), var(--rsa-yellow-100) 0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.count-ring::before {
    content: '';
    position: absolute;
    inset: 6px;
    background: var(--rsa-surface);
    border-radius: 50%;
}
.count-ring__num {
    position: relative;
    font-family: var(--rsa-font-display);
    font-weight: 700;
    font-size: 1.125rem;
    line-height: 1.05;
    color: var(--rsa-gray-900);
    font-variant-numeric: tabular-nums;
}
.count-ring__unit {
    position: relative;
    font-size: .5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--rsa-gray-500);
}

/* ============================================================
   WATER TOUCHES
   ============================================================ */

/* empty-state icons ripple like a drop in a pool */
.empty__icon { position: relative; }
.empty__icon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--rsa-purple-200);
    opacity: 0;
    animation: rsa-ripple 2.8s ease-out infinite;
    pointer-events: none;
}
@keyframes rsa-ripple {
    0%   { opacity: .55; transform: scale(.82); }
    70%  { opacity: 0;   transform: scale(1.28); }
    100% { opacity: 0;   transform: scale(1.28); }
}

/* ============================================================
   PRINT (pay page, ledger — parents keep records)
   ============================================================ */

@media print {
    .shell__sidebar, .shell__topbar, .shell__overlay, .shell__foot,
    .shell__burger, .mobile-bar, .form-actions,
    .action-hero, .btn, .back-link, .page-head__actions,
    .upload-zone, #blazor-error-ui { display: none !important; }

    .shell__main { margin-left: 0 !important; }
    .shell__content { max-width: none !important; padding: 0 !important; }

    body, .shell { background: #fff !important; }
    .panel, .reg-card, .stat-tile {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }
    .activity__row, .line-item { break-inside: avoid; }
    .activity__month { position: static !important; }
    .pay-layout, .reg-layout { display: block !important; }
    .pay-layout > * + *, .reg-layout > * + * { margin-top: 1rem; }

    a { color: inherit !important; text-decoration: none !important; }
}


/* ============================================================
   TOASTS — transient confirmations (errors stay inline)
   A stack in the bottom right (ToastHost), newest nearest the
   corner. White card, an icon in the toast's colour, a bar along
   the bottom that drains as its time runs and holds while the
   pointer is on it. On a phone the stack sits along the bottom
   edge, above the home indicator.
   ============================================================ */

.toasts {
    position: fixed;
    right: 1.25rem;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    z-index: 1300;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    width: min(100vw - 2rem, 390px);
    pointer-events: none;
}
/* The error bar (below) sits in the same corner; the stack moves up while it shows. */
body:has(#blazor-error-ui[style*="block"]) .toasts {
    bottom: calc(1.25rem + 78px + env(safe-area-inset-bottom, 0px));
}
/* A slot folds to nothing as its toast leaves, so the ones above settle rather than jump. */
.toasts__slot {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 240ms cubic-bezier(.4, 0, .2, 1);
}
.toasts__slot.is-leaving { grid-template-rows: 0fr; }
.toasts__slot > .toast-card { min-height: 0; }

.toast-card {
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: .8rem;
    align-items: start;
    padding: .9rem 1rem 1rem;
    background: color-mix(in srgb, var(--rsa-surface) 94%, transparent);
    -webkit-backdrop-filter: saturate(1.5) blur(14px);
    backdrop-filter: saturate(1.5) blur(14px);
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius-lg);
    box-shadow: var(--rsa-shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .7);
    color: var(--rsa-gray-900);
    font-size: .875rem;
    line-height: 1.4;
    animation: rsa-toast-in 360ms cubic-bezier(.2, .8, .3, 1.08) both;
}
.toasts__slot.is-leaving .toast-card { animation: rsa-toast-out 220ms cubic-bezier(.4, 0, 1, 1) forwards; }
@keyframes rsa-toast-in {
    from { opacity: 0; transform: translateY(14px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes rsa-toast-out {
    to { opacity: 0; transform: translateY(6px) scale(.97); }
}

.toast-card__icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
}
.toast-card--success .toast-card__icon { background: var(--rsa-success-bg); color: var(--rsa-success); }
.toast-card--info    .toast-card__icon { background: var(--rsa-purple-50);  color: var(--rsa-purple-600); }
.toast-card--warning .toast-card__icon { background: var(--rsa-yellow-50);  color: var(--rsa-yellow-600); font-size: .9rem; }
.toast-card--danger  .toast-card__icon { background: var(--rsa-pink-50);    color: var(--rsa-pink-600); font-size: .9rem; }

.toast-card__body { min-width: 0; padding-top: .3rem; }
.toast-card__title { font-weight: 650; letter-spacing: -.005em; text-wrap: pretty; }
.toast-card__detail { margin-top: .15rem; color: var(--rsa-gray-600); text-wrap: pretty; }
.toast-card__action {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-top: .45rem;
    font-weight: 650;
    color: var(--rsa-purple-600);
    text-decoration: none;
}
.toast-card__action:hover { color: var(--rsa-purple-800); text-decoration: underline; text-underline-offset: 3px; }
.toast-card__action i { font-size: .85em; transition: transform var(--rsa-fast); }
.toast-card__action:hover i { transform: translateX(2px); }

.toast-card__close {
    appearance: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin: -.2rem -.3rem 0 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--rsa-gray-400);
    font-size: .8rem;
    cursor: pointer;
    transition: background var(--rsa-fast), color var(--rsa-fast);
}
.toast-card__close:hover { background: var(--rsa-gray-100); color: var(--rsa-gray-800); }
.toast-card__close:focus-visible { outline: 2px solid var(--rsa-purple-300); outline-offset: 1px; }

/* The clock, drawn: a bar that empties from the right over the toast's time. */
.toast-card__bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    transform-origin: left;
    background: currentColor;
    opacity: .85;
    animation: rsa-toast-drain var(--toast-ms, 4000ms) linear forwards;
}
.toast-card--success .toast-card__bar { color: var(--rsa-success); }
.toast-card--info    .toast-card__bar { color: var(--rsa-purple-500); }
.toast-card--warning .toast-card__bar { color: var(--rsa-yellow-500); }
.toast-card--danger  .toast-card__bar { color: var(--rsa-pink-500); }
.toast-card:hover .toast-card__bar,
.toast-card:focus-within .toast-card__bar { animation-play-state: paused; }
@keyframes rsa-toast-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 575.98px) {
    .toasts {
        left: .75rem;
        right: .75rem;
        bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
        width: auto;
    }
    .toast-card { border-radius: var(--rsa-radius); }
}
@media (prefers-reduced-motion: reduce) {
    .toast-card { animation: rsa-toast-fade 200ms ease-out both; }
    .toasts__slot.is-leaving .toast-card { animation: rsa-toast-fade 200ms ease-in reverse forwards; }
    .toasts__slot { transition: none; }
    @keyframes rsa-toast-fade { from { opacity: 0; } to { opacity: 1; } }
}

/* ============================================================
   FIRST-RUN CHECKLIST (new accounts on the dashboard)
   ============================================================ */

.starter {
    margin-bottom: 1.5rem;
    border: 1px solid var(--rsa-purple-100);
    border-radius: var(--rsa-radius-lg);
    background:
        radial-gradient(80% 120% at 100% 0%, color-mix(in srgb, var(--rsa-yellow-500) 10%, transparent) 0%, transparent 55%),
        linear-gradient(135deg, var(--rsa-purple-50) 0%, #fff 55%);
    box-shadow: var(--rsa-shadow-sm);
    overflow: hidden;
}
.starter__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1.1rem 1.25rem .6rem;
}
.starter__title {
    font-family: var(--rsa-font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--rsa-gray-900);
    margin: 0;
}
.starter__sub { font-size: .8125rem; color: var(--rsa-gray-500); margin: .15rem 0 0; }
.starter__steps { padding: .4rem .75rem 1rem; display: grid; gap: .25rem; }
.starter__step {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .6rem .6rem;
    border-radius: var(--rsa-radius-sm);
    color: inherit;
    transition: background var(--rsa-fast);
}
a.starter__step:hover { background: rgba(255, 255, 255, .8); color: inherit; }
.starter__dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .8125rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid var(--rsa-gray-300);
    background: #fff;
    color: var(--rsa-gray-400);
}
.starter__step--done .starter__dot {
    border-color: var(--rsa-success);
    background: var(--rsa-success);
    color: #fff;
}
.starter__step--now .starter__dot {
    border-color: var(--rsa-purple-600);
    color: var(--rsa-purple-700);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--rsa-purple-600) 15%, transparent);
    animation: rsa-pulse 2.2s ease-in-out infinite;
}
@keyframes rsa-pulse {
    0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--rsa-purple-600) 15%, transparent); }
    50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--rsa-purple-600) 7%, transparent); }
}
.starter__text { flex: 1; min-width: 0; }
.starter__name { font-size: .875rem; font-weight: 650; color: var(--rsa-gray-800); }
.starter__step--done .starter__name { color: var(--rsa-gray-500); text-decoration: line-through; text-decoration-thickness: 1px; }
.starter__hint { font-size: .78125rem; color: var(--rsa-gray-500); }
.starter__go { color: var(--rsa-gray-400); flex-shrink: 0; }
.starter__step--now .starter__go { color: var(--rsa-purple-600); }

/* ============================================================
   SHARED PAGE SCAFFOLDS (registration, pay, fundraisers)
   Promoted from page-scoped style blocks: the fundraiser pages
   reuse these layouts, so they must exist globally.
   ============================================================ */

    .reg-layout { display: grid; grid-template-columns: 1fr; gap: 1.25rem; align-items: start; }
    @media (min-width: 1200px) {
        .reg-layout { grid-template-columns: minmax(0, 1fr) 340px; }
        .reg-layout__aside { position: sticky; top: calc(var(--rsa-topbar-h) + 1rem); }
    }
    .reg-layout__main > .panel:first-child { margin-top: 0; }

    /* The registration wizard's step markers: the steps already done are buttons back to them. */
    .auth-steps.auth-steps--wizard { margin-bottom: 1.25rem; }
    /* The event card above the steps used to sit flush on the step line. */
    .event-hero { margin-bottom: 1.25rem; }
    .auth-steps__step--done.button-reset { cursor: pointer; }

    .event-hero__inner {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 1rem;
        padding: 1.25rem;
        background: linear-gradient(135deg, var(--rsa-purple-50) 0%, #fff 65%);
    }
    .event-hero__text { flex: 1 1 220px; min-width: 0; }
    .event-hero__name { margin: 0 0 .4rem; font-size: 1.25rem; font-weight: 700; text-wrap: balance; }
    .event-hero__chips { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
    .event-hero__note { font-size: .8125rem; color: var(--rsa-gray-500); margin: .6rem 0 0; }

    /* Quantity stepper on the extras step */
    .qty-row { display: flex; align-items: center; gap: .5rem; margin-top: .85rem; }
    .qty-btn {
        display: inline-grid;
        place-items: center;
        width: 34px; height: 34px;
        border-radius: 9px;
        border: 1px solid var(--rsa-gray-300);
        background: #fff;
        color: var(--rsa-gray-700);
        font-size: .9375rem;
        line-height: 1;
        cursor: pointer;
        transition: background var(--rsa-fast), border-color var(--rsa-fast);
    }
    .qty-btn:hover:not(:disabled) { background: var(--rsa-purple-50); border-color: var(--rsa-purple-300); }
    .qty-btn:disabled { opacity: .45; cursor: not-allowed; }
    .qty-value { min-width: 32px; text-align: center; font-weight: 650; }

    .event-card {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1.1rem;
        border: 1px solid var(--rsa-line);
        border-radius: var(--rsa-radius-lg);
        background: #fff;
        box-shadow: var(--rsa-shadow-xs);
        color: inherit;
        transition: transform var(--rsa-base), box-shadow var(--rsa-base), border-color var(--rsa-base);
    }
    .event-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--rsa-shadow-md);
        border-color: var(--rsa-purple-200);
        color: inherit;
    }
    .event-card__date {
        display: grid;
        place-items: center;
        align-content: center;
        min-width: 54px;
        padding: .4rem;
        border-radius: 10px;
        background: var(--rsa-purple-600);
        color: #fff;
        line-height: 1.05;
        flex-shrink: 0;
    }
    .event-card__date .m { font-size: .625rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
    .event-card__date .d { font-size: 1.25rem; font-weight: 700; }
    .event-card__body { flex: 1; min-width: 0; }
    .event-card__name { display: block; font-weight: 650; color: var(--rsa-gray-900); }
    .event-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .35rem; font-size: .78125rem; color: var(--rsa-gray-500); }
    .event-card__go { color: var(--rsa-gray-400); flex-shrink: 0; }

    /* Two columns from 1200px, the width the mobile pay bar hides at, so there is never a
       second Pay button beside the rail's. */
    .pay-layout { display: grid; grid-template-columns: 1fr; gap: 1.25rem; align-items: start; }
    @media (min-width: 1200px) {
        .pay-layout { grid-template-columns: minmax(0, 1fr) 340px; }
        .pay-layout__aside { position: sticky; top: calc(var(--rsa-topbar-h) + 1rem); }
    }
    .pay-layout__main > .panel:first-child,
    .pay-layout__aside > .panel:first-child { margin-top: 0; }
    .pay-layout__aside > * + * { margin-top: 1.25rem; }

    .pay-amount {
        font-family: var(--rsa-font-display);
        font-size: 1.75rem;
        font-weight: 700;
        line-height: 1.05;
        letter-spacing: -.02em;
        color: var(--rsa-purple-700);
    }
    .pay-amount--xl { font-size: 2.5rem; }
    /* .pay-amount's own colour comes later than the money classes, so it has to be told twice. */
    .pay-amount.money-due    { color: var(--rsa-pink-600); }
    .pay-amount.money-credit { color: var(--rsa-success); }
    .pay-amount.money-flat   { color: var(--rsa-gray-500); }

    .pay-hero { position: relative; overflow: hidden; }
    .pay-hero__stripe {
        height: 5px;
        background: linear-gradient(90deg, var(--rsa-purple-600) 0%, var(--rsa-purple-400) 55%, var(--rsa-yellow-500) 100%);
    }
    .pay-hero__badge {
        position: absolute;
        top: 1rem;
        right: 1rem;
        padding: .2rem .6rem;
        border-radius: 999px;
        background: var(--rsa-purple-50);
        color: var(--rsa-purple-700);
        font-size: .6875rem;
        font-weight: 700;
        letter-spacing: .04em;
    }
    .pay-hero__title { font-size: 1.375rem; font-weight: 700; color: var(--rsa-purple-700); margin: 0 0 .2rem; }
    .pay-marks {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: .75rem;
        flex-wrap: wrap;
        margin-top: 1rem;
        opacity: .9;
    }

/* ============================================================
   PROFILE HERO (/my/profile) — moved from the page's own style block
   ============================================================ */

.profile-hero__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    background:
        radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--rsa-yellow-500) 10%, transparent) 0%, transparent 60%),
        linear-gradient(135deg, var(--rsa-purple-50) 0%, #fff 60%);
}
.profile-hero__text { flex: 1 1 220px; min-width: 0; }
.profile-hero__name { margin: 0; font-size: 1.375rem; font-weight: 700; }
.profile-hero__mail { font-size: .875rem; color: var(--rsa-gray-500); word-break: break-all; }
.profile-hero__chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .65rem; }
.profile-hero__meter { flex: 0 1 240px; min-width: 200px; }
/* On a phone the meter wraps under the name: full width there, not a 240px stub with a gap beside it. */
@media (max-width: 575.98px) {
    .profile-hero__meter { flex-basis: 100%; }
}
.profile-hero__meter-text { font-size: .75rem; color: var(--rsa-gray-500); margin-top: .35rem; }
.profile-meter {
    height: 8px;
    border-radius: 999px;
    background: var(--rsa-purple-100);
    overflow: hidden;
    margin-top: .4rem;
}
.profile-meter span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--rsa-purple-600), var(--rsa-purple-400));
    transition: width var(--rsa-base);
}

/* ============================================================
   PAGE LOADING GUARD (formsmanagerBusy in App.razor)
   While a page loads, a bar runs along the top and the page takes no input; if it's slow, a
   "Loading…" card shows over a faint veil. Below the reconnect dialog (2000), above everything else.
   ============================================================ */
.fm-busy { position: fixed; inset: 0; z-index: 1990; pointer-events: none; }
.fm-busy.is-on { pointer-events: auto; cursor: progress; }
.fm-busy__bar {
    position: absolute; top: 0; left: 0; height: 4px; width: 0; opacity: 0;
    background: linear-gradient(90deg, var(--rsa-purple-500, #2e3192), var(--rsa-yellow-500, #f8b800));
    box-shadow: 0 0 8px rgba(0, 0, 0, .15);
}
/* Quick at first, then slowing, so a long load never looks finished. */
.fm-busy.is-on .fm-busy__bar { opacity: 1; animation: fm-busy-bar 8s cubic-bezier(.08, .7, .2, 1) forwards; }
@keyframes fm-busy-bar { from { width: 0; } 20% { width: 55%; } to { width: 94%; } }
.fm-busy__card {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; align-items: center; gap: .6rem;
    padding: .7rem 1.1rem; border-radius: 12px;
    background: #fff; color: var(--rsa-gray-700, #333); font-size: .875rem; font-weight: 500;
    box-shadow: 0 10px 30px rgba(17, 24, 39, .18);
    opacity: 0; visibility: hidden; transition: opacity .2s ease;
}
.fm-busy__card .spinner-border { color: var(--rsa-purple-500, #2e3192); }
.fm-busy.is-on.is-slow { background: rgba(255, 255, 255, .35); transition: background .2s ease; }
.fm-busy.is-on.is-slow .fm-busy__card { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) {
    .fm-busy.is-on .fm-busy__bar { animation: none; width: 60%; }
}
/* The page-stopped notice (app.css) sits above the busy guard, so its Reload is always reachable. */
#blazor-error-ui { z-index: 2005; }

/* ---------- Adverts (AdvertStrip, on the member dashboard only) ----------
   One row under the dashboard summary, seen on landing without scrolling: each card the advert's
   picture and nothing else, the details being on it, on their website or in the enlarged view.
   A click shows the whole advert or opens the website. */
.showcase { margin: -.5rem 0 1.5rem; }
.showcase__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .4rem;
}
.showcase__label {
    font-size: .625rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--rsa-gray-500);
}
.showcase__tools { display: flex; align-items: center; gap: .25rem; }
.showcase__arrow {
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: 1px solid var(--rsa-line);
    border-radius: 999px;
    background: var(--rsa-surface);
    color: var(--rsa-gray-600);
    font-size: .7rem;
}
.showcase__arrow:hover { color: var(--rsa-purple-600); border-color: var(--rsa-purple-300); }
.showcase__cta { font-size: .75rem; font-weight: 600; margin-left: .35rem; white-space: nowrap; }
.showcase__track {
    display: flex;
    gap: .75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.showcase__track::-webkit-scrollbar { display: none; }
/* The picture is the whole card. A fixed, modest size rather than a share of the row: a wide
   screen shows more of them, not bigger ones. 16:10, a little taller than a business card, so a
   card or a flyer both sit in it in proportion, whole and never stretched or cropped. */
.showcase-card {
    --showcase-h: 8.25rem;
    position: relative;
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: block;
    height: var(--showcase-h);
    aspect-ratio: 16 / 10;
    padding: .3rem;
    background: var(--rsa-surface);
    border: 1px solid var(--rsa-line);
    border-radius: var(--rsa-radius);
    box-shadow: var(--rsa-shadow-xs);
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
@media (min-width: 768px) { .showcase-card { --showcase-h: 9.375rem; } }
.showcase-card:hover { border-color: var(--rsa-purple-300); box-shadow: var(--rsa-shadow-md); transform: translateY(-1px); }
.showcase-card:focus-visible { outline: 2px solid var(--rsa-purple-500); outline-offset: 2px; }
.showcase-card img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: calc(var(--rsa-radius) - .3rem); }
.showcase-card__hint {
    position: absolute;
    right: .4rem;
    bottom: .4rem;
    display: inline-grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--rsa-gray-800) 65%, transparent);
    color: #fff;
    font-size: .62rem;
    opacity: 0;
    transition: opacity .15s;
}
.showcase-card:hover .showcase-card__hint,
.showcase-card:focus-visible .showcase-card__hint { opacity: 1; }
@media (hover: none) { .showcase-card__hint { opacity: .85; } }
.showcase-modal__body { display: grid; gap: 1.25rem; }
@media (min-width: 768px) { .showcase-modal__body { grid-template-columns: minmax(0, 2fr) minmax(12rem, 1fr); align-items: start; } }
.showcase-modal__image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    background: var(--rsa-gray-50);
    border-radius: var(--rsa-radius-sm);
}
.showcase-modal__details { margin: 0; font-size: .875rem; }
.showcase-modal__details dt { font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--rsa-gray-500); margin-top: .75rem; }
.showcase-modal__details dd { margin: .1rem 0 0; overflow-wrap: anywhere; }
.showcase-modal__tagline { font-weight: 600; }
.showcase-modal__address { white-space: pre-line; }

/* The "Advertise here" form: the honeypot is off screen, not display:none, which some bots skip. */
.advertise-form { max-width: 46rem; }
.advertise-form__trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* The admin list's thumbnail and the form's preview. */
.showcase-thumb { width: 5.5rem; aspect-ratio: 7 / 4; object-fit: contain; background: var(--rsa-gray-50); border: 1px solid var(--rsa-line); border-radius: 6px; }
.showcase-preview { max-width: 100%; }
.showcase-preview .showcase-card { cursor: default; }
