/* ============================================================================
   UDS Member Site — design system (CHG-115, CD281).

   Brand colours and fonts come from brand.css (the Core Portal's tokens: navy
   #01054c, red #e51d3a, Poppins / Roboto). This file is everything else, and it
   is GLOBAL on purpose: one set of components every page uses, so pages look and
   behave the same and a page author writes markup, not CSS. Page-specific rules
   go in that page's own .razor.css.

   Principles
   - Mobile first. Every rule works at 360px; wider screens add columns.
   - One capability on every device: nothing is hidden on a phone, only re-flowed
     (tables become cards, the side menu becomes a drawer).
   - Touch targets are at least 44px. Focus is always visible.
   - Colour is never the only signal (badges carry text, errors carry an icon/text).
   - Motion is small and respects prefers-reduced-motion.

   Contents: tokens · base · shell · buttons · forms · cards · page head ·
   tables · badges · notices · stepper · dialog · lists · states · utilities
   ============================================================================ */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
    --m-bg:        #f4f5f9;
    --m-surface:   #ffffff;
    --m-surface-2: #f8f9fc;
    --m-ink:       #1b1e2b;
    --m-muted:     #5a6072;
    --m-line:      #e2e5ee;
    --m-line-strong: #c9cedb;

    --m-navy:      var(--uds-navy, #01054c);
    --m-navy-deep: var(--uds-navy-deep, #00044b);
    --m-red:       var(--uds-red, #e51d3a);
    --m-cta:       var(--uds-cta, #ea1e00);

    --m-ok:        #12784a;   --m-ok-bg:   #e6f5ee;
    --m-warn:      #8a5a00;   --m-warn-bg: #fff4d9;
    --m-bad:       #b3142d;   --m-bad-bg:  #fdecef;
    --m-info:      #1d4f91;   --m-info-bg: #e8f0fb;

    --m-radius:    10px;
    --m-radius-sm: 6px;
    --m-shadow:    0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --m-shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
    --m-focus:     0 0 0 3px rgba(229, 29, 58, .28);

    --m-s1: .25rem; --m-s2: .5rem; --m-s3: .75rem; --m-s4: 1rem; --m-s5: 1.5rem; --m-s6: 2rem;

    --m-side-w:    16.5rem;
    --m-top-h:     3.75rem;
    --m-tab-h:     3.9rem;
    --m-control-h: 2.75rem;      /* 44px touch target */
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--m-bg);
    color: var(--m-ink);
    font-size: 1rem;
    line-height: 1.5;
}

img { max-width: 100%; }

h1, h2, h3, h4 { margin: 0 0 var(--m-s3); line-height: 1.25; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 var(--m-s3); }

a { text-underline-offset: 2px; }

:focus-visible { outline: none; box-shadow: var(--m-focus); border-radius: var(--m-radius-sm); }
h1:focus, main:focus { outline: none; box-shadow: none; }

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

.skip-link {
    position: absolute; left: var(--m-s3); top: -4rem; z-index: 3000;
    background: var(--m-navy); color: #fff; padding: var(--m-s2) var(--m-s4); border-radius: var(--m-radius-sm);
}
.skip-link:focus { top: var(--m-s3); color: #fff; }

.icon { flex: 0 0 auto; vertical-align: -0.2em; }

/* ── Shell ──────────────────────────────────────────────────────────────── */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; }

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }

.side {
    position: fixed; inset: 0 auto 0 0; z-index: 1200;
    width: min(var(--m-side-w), 86vw);
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--m-navy) 0%, var(--m-navy-deep) 100%);
    color: #fff;
    transform: translateX(-102%);
    transition: transform .22s ease;
    overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .28) transparent;
    padding-bottom: env(safe-area-inset-bottom);
}
.nav-toggle:checked ~ .side { transform: none; box-shadow: var(--m-shadow-lg); }

.scrim {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(9, 12, 32, .5);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.nav-toggle:checked ~ .scrim { opacity: 1; pointer-events: auto; }

/* The logo is centred and given room; on a phone the close button sits in the corner,
   out of the logo's way. */
.side-head {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    padding: var(--m-s5) var(--m-s4) var(--m-s4);
    border-bottom: 1px solid rgba(255, 255, 255, .14);
    margin-bottom: var(--m-s3);
}
.side-logo { display: block; }
.side-logo img { height: 4.5rem; width: auto; max-width: 100%; display: block; margin: 0 auto; }
.side-close {
    position: absolute; top: var(--m-s2); right: var(--m-s2);
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--m-control-h); height: var(--m-control-h);
    border-radius: 50%; cursor: pointer; color: #fff;
}
.side-close:hover { background: rgba(255, 255, 255, .12); }

.side-nav { flex: 1; padding: 0 var(--m-s2) var(--m-s3); }
.side-foot { padding: var(--m-s2); border-top: 1px solid rgba(255, 255, 255, .14); }

.nav-section {
    margin: var(--m-s4) var(--m-s3) var(--m-s1);
    font-family: var(--uds-font-head); font-size: .7rem; font-weight: 600;
    letter-spacing: .09em; text-transform: uppercase; color: rgba(255, 255, 255, .55);
}

.nav-item {
    display: flex; align-items: center; gap: var(--m-s3);
    min-height: var(--m-control-h);
    padding: var(--m-s2) var(--m-s3);
    border-radius: var(--m-radius-sm);
    color: rgba(255, 255, 255, .88); text-decoration: none;
    font-size: .95rem;
    border-left: 3px solid transparent;
}
.nav-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .16); color: #fff; border-left-color: var(--m-red); font-weight: 500; }
.nav-quiet { color: rgba(255, 255, 255, .6); font-size: .85rem; }
.nav-button { width: 100%; background: none; border: 0; border-left: 3px solid transparent; cursor: pointer; font: inherit; font-size: .95rem; text-align: left; }
.signout-form { margin: 0; }

.frame { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 900;
    display: flex; align-items: center; gap: var(--m-s3);
    min-height: var(--m-top-h);
    padding: var(--m-s2) var(--m-s4);
    background: var(--m-surface);
    border-bottom: 1px solid var(--m-line);
}
.topbar-menu {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--m-control-h); height: var(--m-control-h); margin-left: calc(var(--m-s2) * -1);
    border-radius: 50%; cursor: pointer; color: var(--m-navy);
}
.topbar-menu:hover { background: var(--m-bg); }
.topbar-logo img { height: 2rem; width: auto; display: block; }
.topbar-title {
    flex: 1; min-width: 0; margin: 0;
    font-size: 1.05rem; font-weight: 600; color: var(--m-navy);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-track { display: none; align-items: center; gap: var(--m-s2); }
.topbar-track input { width: 11rem; height: 2.25rem; min-height: 0; }

.user-chip { display: inline-flex; align-items: center; gap: var(--m-s2); text-decoration: none; color: var(--m-ink); min-height: var(--m-control-h); }
.user-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem; border-radius: 50%;
    background: var(--m-navy); color: #fff; font-family: var(--uds-font-head); font-weight: 600;
}
.user-text { display: none; flex-direction: column; line-height: 1.15; }
.user-name { font-size: .88rem; font-weight: 500; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-id { font-size: .76rem; color: var(--m-muted); }

.content {
    flex: 1; width: 100%; max-width: 78rem; margin: 0 auto;
    padding: var(--m-s4) var(--m-s4) calc(var(--m-tab-h) + var(--m-s5));
}

.site-foot {
    display: flex; flex-wrap: wrap; gap: var(--m-s2) var(--m-s4); justify-content: space-between;
    padding: var(--m-s3) var(--m-s4) calc(var(--m-tab-h) + var(--m-s3));
    font-size: .8rem; color: var(--m-muted);
    border-top: 1px solid var(--m-line);
}
.foot-links { display: inline-flex; flex-wrap: wrap; gap: var(--m-s4); }
.site-foot a { color: var(--m-muted); }

.tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 1000;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--m-tab-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--m-surface); border-top: 1px solid var(--m-line);
    box-shadow: 0 -2px 10px rgba(16, 24, 40, .06);
}
.tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--m-muted); text-decoration: none; font-size: .68rem; cursor: pointer;
    min-width: 0;
}
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab.active { color: var(--m-red); font-weight: 600; }

/* Signed-out pages have no tab bar: give the space back. */
.shell:not(:has(.tabbar)) .content { padding-bottom: var(--m-s5); }
.shell:not(:has(.tabbar)) .site-foot { padding-bottom: var(--m-s3); }

@media (min-width: 64rem) {
    .side { position: sticky; top: 0; height: 100vh; transform: none; flex: 0 0 var(--m-side-w); width: var(--m-side-w); box-shadow: none; }
    .side-close, .scrim, .topbar-menu, .topbar-logo, .tabbar { display: none; }
    .topbar { padding: var(--m-s2) var(--m-s5); }
    .topbar-title { font-size: 1.2rem; }
    .topbar-track { display: inline-flex; }
    .user-text { display: inline-flex; }
    .content { padding: var(--m-s5) var(--m-s5) var(--m-s6); }
    .site-foot { padding: var(--m-s3) var(--m-s5); }
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--m-s2);
    min-height: var(--m-control-h); padding: 0 var(--m-s4);
    border: 1px solid transparent; border-radius: var(--m-radius-sm);
    font-family: var(--uds-font-head); font-size: .92rem; font-weight: 500; line-height: 1.2;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--m-navy); color: #fff; border-color: var(--m-navy); }
.btn-primary:hover:not(:disabled) { background: #0a1170; color: #fff; }

.btn-accent { background: var(--m-red); color: #fff; border-color: var(--m-red); }
.btn-accent:hover:not(:disabled) { background: #c81530; color: #fff; }

.btn-ghost { background: var(--m-surface); color: var(--m-navy); border-color: var(--m-line-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--m-surface-2); border-color: var(--m-navy); color: var(--m-navy); }

.btn-danger { background: var(--m-surface); color: var(--m-bad); border-color: #e9b3bc; }
.btn-danger:hover:not(:disabled) { background: var(--m-bad-bg); color: var(--m-bad); }

.btn-link { background: none; border: 0; padding: 0 var(--m-s1); min-height: var(--m-control-h); color: var(--m-red); }
.btn-link:hover { text-decoration: underline; }

.btn-sm { min-height: 2.25rem; padding: 0 var(--m-s3); font-size: .85rem; }
.btn-block { width: 100%; }
.btn-icon { width: var(--m-control-h); padding: 0; }

.btn .spinner, .spinner {
    width: 1rem; height: 1rem; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: m-spin .7s linear infinite;
}
@keyframes m-spin { to { transform: rotate(360deg); } }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-grid { display: grid; gap: var(--m-s3) var(--m-s4); grid-template-columns: 1fr; }
@media (min-width: 40rem) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) {
    .form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.form-grid > .wide { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: var(--m-s1); min-width: 0; }
.field > label, .field-label { font-size: .86rem; font-weight: 500; color: var(--m-ink); }
.field .req { color: var(--m-red); margin-left: 2px; }
.field .hint { font-size: .8rem; color: var(--m-muted); }
.field .error, .validation-message { font-size: .82rem; color: var(--m-bad); }

input:not([type]), input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=url],
select, textarea {
    width: 100%; min-height: var(--m-control-h);
    padding: var(--m-s2) var(--m-s3);
    background: var(--m-surface); color: var(--m-ink);
    border: 1px solid var(--m-line-strong); border-radius: var(--m-radius-sm);
    font: inherit; font-size: 1rem;      /* 16px: stops iOS zooming the page on focus */
}
textarea { min-height: 5.5rem; resize: vertical; }
select { appearance: auto; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--m-navy); box-shadow: var(--m-focus); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--m-surface-2); color: var(--m-muted); }
input.invalid, select.invalid, textarea.invalid, .field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--m-bad); }
.valid.modified:not([type=checkbox]) { outline: none; }
.invalid { outline: none; }

.check { display: flex; align-items: flex-start; gap: var(--m-s2); min-height: var(--m-control-h); padding: var(--m-s2) 0; cursor: pointer; }
.check input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; accent-color: var(--m-navy); flex: 0 0 auto; }

.input-group { display: flex; gap: var(--m-s2); }
.input-group > input, .input-group > select { flex: 1; min-width: 0; }

.form-actions { display: flex; flex-wrap: wrap; gap: var(--m-s3); margin-top: var(--m-s4); }
.form-actions.end { justify-content: flex-end; }

/* The main action stays reachable on a phone: pin it above the tab bar. */
.action-bar {
    position: sticky; bottom: calc(var(--m-tab-h) + env(safe-area-inset-bottom)); z-index: 500;
    display: flex; flex-wrap: wrap; gap: var(--m-s3); justify-content: flex-end;
    margin: var(--m-s4) calc(var(--m-s4) * -1) 0; padding: var(--m-s3) var(--m-s4);
    background: rgba(255, 255, 255, .96); border-top: 1px solid var(--m-line);
    backdrop-filter: blur(6px);
}
.action-bar .btn { flex: 1; }
@media (min-width: 64rem) {
    .action-bar { position: static; margin: var(--m-s4) 0 0; padding: 0; background: none; border: 0; backdrop-filter: none; }
    .action-bar .btn { flex: 0 0 auto; }
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--m-surface); border: 1px solid var(--m-line);
    border-radius: var(--m-radius); box-shadow: var(--m-shadow);
    margin-bottom: var(--m-s4);
}
.card-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--m-s2) var(--m-s3);
    padding: var(--m-s3) var(--m-s4); border-bottom: 1px solid var(--m-line);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1.02rem; }
.card-body { padding: var(--m-s4); }
.card-foot { padding: var(--m-s3) var(--m-s4); border-top: 1px solid var(--m-line); background: var(--m-surface-2); border-radius: 0 0 var(--m-radius) var(--m-radius); }

.card-grid { display: grid; gap: var(--m-s3); grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }

.action-card {
    display: flex; align-items: flex-start; gap: var(--m-s3);
    padding: var(--m-s4); min-height: 4.75rem;
    background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-radius);
    box-shadow: var(--m-shadow); text-decoration: none; color: var(--m-ink);
    transition: border-color .15s ease, transform .15s ease;
}
.action-card:hover { border-color: var(--m-navy); color: var(--m-ink); transform: translateY(-1px); }
.action-card .icon-wrap {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 2.5rem; height: 2.5rem; border-radius: var(--m-radius-sm);
    background: rgba(1, 5, 76, .07); color: var(--m-navy);
}
.action-card strong { display: block; font-family: var(--uds-font-head); font-weight: 600; font-size: .95rem; color: var(--m-navy); }
.action-card small { color: var(--m-muted); font-size: .82rem; }

/* ── Page head ──────────────────────────────────────────────────────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--m-s3); margin-bottom: var(--m-s4); }
.page-head h2 { margin: 0; }
.page-head .lede { margin: var(--m-s1) 0 0; color: var(--m-muted); font-size: .92rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--m-s2); }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--m-s3); margin-bottom: var(--m-s4); }
.toolbar .field { flex: 1 1 11rem; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
/* Wrap every table in .table-wrap. Add .table-cards to turn rows into cards on a
   phone: give each <td> a data-label and it shows as "Label  value". */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
    text-align: left; font-family: var(--uds-font-head); font-size: .76rem; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase; color: var(--m-muted);
    padding: var(--m-s3) var(--m-s3); border-bottom: 1px solid var(--m-line-strong); white-space: nowrap;
}
.table td { padding: var(--m-s3) var(--m-s3); border-bottom: 1px solid var(--m-line); vertical-align: top; }
.table tbody tr:hover { background: var(--m-surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table tr.is-selected { background: rgba(1, 5, 76, .05); }

@media (max-width: 47.99rem) {
    .table-cards thead { position: absolute; left: -9999px; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr {
        margin-bottom: var(--m-s3); padding: var(--m-s2) var(--m-s3);
        background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-radius);
    }
    .table-cards td {
        display: flex; justify-content: space-between; gap: var(--m-s4);
        padding: var(--m-s2) 0; border-bottom: 1px dashed var(--m-line); text-align: right;
    }
    .table-cards td:last-child { border-bottom: 0; }
    .table-cards td::before {
        content: attr(data-label); flex: 0 0 auto; text-align: left;
        font-size: .78rem; font-weight: 600; color: var(--m-muted); text-transform: uppercase; letter-spacing: .03em;
    }
    .table-cards td:not([data-label])::before, .table-cards td[data-label=""]::before { content: none; }
    .table-cards td.actions { justify-content: flex-end; }
}

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--m-s3); padding: var(--m-s3) var(--m-s4); font-size: .88rem; color: var(--m-muted); }
.pager-buttons { display: inline-flex; gap: var(--m-s2); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: var(--m-s1);
    padding: .15rem .55rem; border-radius: 999px;
    font-size: .74rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
    background: var(--m-line); color: var(--m-muted);
}
.badge-ok { background: var(--m-ok-bg); color: var(--m-ok); }
.badge-warn { background: var(--m-warn-bg); color: var(--m-warn); }
.badge-bad { background: var(--m-bad-bg); color: var(--m-bad); }
.badge-info { background: var(--m-info-bg); color: var(--m-info); }
.badge-navy { background: rgba(1, 5, 76, .09); color: var(--m-navy); }

/* ── Notices ────────────────────────────────────────────────────────────── */
.notice {
    display: flex; gap: var(--m-s3); align-items: flex-start;
    padding: var(--m-s3) var(--m-s4); margin-bottom: var(--m-s4);
    border: 1px solid var(--m-line); border-left-width: 4px; border-radius: var(--m-radius-sm);
    background: var(--m-surface); font-size: .93rem;
}
.notice > :last-child { margin-bottom: 0; }
.notice-info { border-left-color: var(--m-info); background: var(--m-info-bg); color: #163a69; }
.notice-success { border-left-color: var(--m-ok); background: var(--m-ok-bg); color: #0c5936; }
.notice-warn { border-left-color: #c98a00; background: var(--m-warn-bg); color: #6b4600; }
.notice-error { border-left-color: var(--m-bad); background: var(--m-bad-bg); color: #8a1023; }

/* ── Stepper ────────────────────────────────────────────────────────────── */
.stepper { display: flex; gap: var(--m-s2); list-style: none; margin: 0 0 var(--m-s4); padding: 0; overflow-x: auto; }
.stepper li {
    flex: 1 1 0; min-width: 5.5rem;
    display: flex; align-items: center; gap: var(--m-s2);
    padding: var(--m-s2) var(--m-s3);
    border-bottom: 3px solid var(--m-line); color: var(--m-muted); font-size: .86rem; white-space: nowrap;
}
.stepper .step-no {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 1.6rem; height: 1.6rem; border-radius: 50%;
    background: var(--m-line); color: var(--m-muted); font-size: .8rem; font-weight: 600;
}
.stepper li.is-current { border-bottom-color: var(--m-red); color: var(--m-navy); font-weight: 600; }
.stepper li.is-current .step-no { background: var(--m-red); color: #fff; }
.stepper li.is-done { border-bottom-color: var(--m-navy); color: var(--m-navy); }
.stepper li.is-done .step-no { background: var(--m-navy); color: #fff; }
.stepper button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: var(--m-s2); }

/* Phone: five labels do not fit one row. The current step keeps its label; the others
   shrink to their number (the label stays in the markup for screen readers). */
@media (max-width: 47.99rem) {
    .stepper { overflow-x: visible; }
    .stepper li { flex: 0 0 auto; min-width: 0; font-size: 0; padding: var(--m-s2); }
    .stepper li .step-no { font-size: .8rem; }
    .stepper li.is-current { flex: 1 1 auto; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; }
}

/* ── Dialog ─────────────────────────────────────────────────────────────── */
.dialog-backdrop {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(9, 12, 32, .55);
}
.dialog {
    width: 100%; max-width: 32rem; max-height: 92dvh; overflow-y: auto;
    background: var(--m-surface); border-radius: var(--m-radius) var(--m-radius) 0 0;
    box-shadow: var(--m-shadow-lg); padding: var(--m-s4) var(--m-s4) calc(var(--m-s4) + env(safe-area-inset-bottom));
}
.dialog.wide { max-width: 52rem; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--m-s3); margin-bottom: var(--m-s3); }
.dialog-head h2 { margin: 0; font-size: 1.1rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: var(--m-s3); justify-content: flex-end; margin-top: var(--m-s4); }
@media (min-width: 40rem) {
    .dialog-backdrop { align-items: center; padding: var(--m-s4); }
    .dialog { border-radius: var(--m-radius); padding: var(--m-s5); }
}

/* ── Lists & definition rows ────────────────────────────────────────────── */
.facts { display: grid; grid-template-columns: 1fr; gap: var(--m-s1) var(--m-s4); margin: 0; }
.facts dt { font-size: .78rem; font-weight: 600; color: var(--m-muted); text-transform: uppercase; letter-spacing: .03em; }
.facts dd { margin: 0 0 var(--m-s2); }
@media (min-width: 40rem) { .facts { grid-template-columns: max-content 1fr; } .facts dd { margin: 0; } }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: var(--m-s3); padding: var(--m-s3) var(--m-s4); border-bottom: 1px solid var(--m-line); }
.list > li:last-child { border-bottom: 0; }

/* ── States ─────────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: var(--m-s6) var(--m-s4); color: var(--m-muted); }
.empty .icon { color: var(--m-line-strong); margin-bottom: var(--m-s2); }
.empty strong { display: block; color: var(--m-ink); font-family: var(--uds-font-head); margin-bottom: var(--m-s1); }

.skeleton {
    display: block; height: 1rem; border-radius: var(--m-radius-sm);
    background: linear-gradient(90deg, #e9ecf3 25%, #f4f6fa 37%, #e9ecf3 63%); background-size: 400% 100%;
    animation: m-shimmer 1.3s ease infinite; margin-bottom: var(--m-s2);
}
@keyframes m-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

.loading { display: flex; align-items: center; gap: var(--m-s3); padding: var(--m-s5); color: var(--m-muted); }

/* ── Sign-in style centred card (login, register, recover, e-mailed links) ─ */
.center-card { max-width: 28rem; margin: var(--m-s4) auto; }
.center-card.wide { max-width: 44rem; }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.muted { color: var(--m-muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .92em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack { display: flex; flex-direction: column; gap: var(--m-s3); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--m-s3); }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: var(--m-s4); } .mb-4 { margin-bottom: var(--m-s4); }
.divider { border: 0; border-top: 1px solid var(--m-line); margin: var(--m-s4) 0; }

/* ── Framework bits ─────────────────────────────────────────────────────── */
.browser-warning {
    display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 4000;
    padding: .9rem 1.25rem; background: var(--m-bad-bg); color: #8a1c1c;
    border-bottom: 3px solid var(--m-red); font-size: .95rem; line-height: 1.45;
}

#blazor-error-ui {
    color-scheme: light only; display: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 4000;
    padding: .7rem 1.25rem; background: var(--m-warn-bg); color: #6b4600;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, .2);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .9rem; top: .55rem; }

.blazor-error-boundary { background: var(--m-bad); color: #fff; padding: 1rem; border-radius: var(--m-radius-sm); }
.blazor-error-boundary::after { content: "Something went wrong on this page."; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
    .side, .topbar, .tabbar, .site-foot, .uds-stripe, .action-bar, .page-actions, .scrim { display: none !important; }
    .content { padding: 0; max-width: none; }
    .card { box-shadow: none; }
    body { background: #fff; }
}
