/* ==========================================================================
   DIAGNODE PATIENT PORTAL — portal-theme.css
   Phase 1. The complete design system, promoted from the Phase 0 mockup.

   Section numbering matches design-system-mockup.html so the two can be
   diffed side by side. Sections marked [NEW] did not exist in the mockup and
   are called out in the Phase 1 notes.

   No Bootstrap. No preprocessor. No JS-driven theming.
   Loaded by all three layouts. The layout injects four custom properties in
   an inline <style> block; everything below derives from them.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TENANT CONTRACT
   The ONLY values the server writes. Defaults here are the platform fallback
   used when a tenant has no branding colour on record.
   -------------------------------------------------------------------------- */
:root {
    --brand: #0A66A8; /* tenant primary                                   */
    --brand-on: #ffffff; /* readable foreground ON --brand (server-computed) */
    --brand-2: #0A66A8; /* tenant secondary — accents only, never actions   */
    --brand-2-on: #ffffff;
}

/* --------------------------------------------------------------------------
   2. DERIVED BRAND RAMP  (color-mix — no preprocessor, no JS)
   -------------------------------------------------------------------------- */
:root {
    --brand-50: color-mix(in oklab, var(--brand) 6%, #ffffff);
    --brand-100: color-mix(in oklab, var(--brand) 13%, #ffffff);
    --brand-200: color-mix(in oklab, var(--brand) 26%, #ffffff);
    --brand-700: color-mix(in oklab, var(--brand) 86%, #000000);
    --brand-800: color-mix(in oklab, var(--brand) 62%, #12181d);
    --brand-ring: color-mix(in oklab, var(--brand) 32%, transparent);
}

/* --------------------------------------------------------------------------
   3. NEUTRALS + SURFACES
   Surfaces carry a 3–8% brand tint so a blue clinic and a green clinic feel
   like different products, not the same product with a different button.
   -------------------------------------------------------------------------- */
:root {
    --ink: #111820;
    --ink-2: #414d5a;
    --ink-3: #5c6875; /* 5.1:1 on --surface */
    --ink-invert: #ffffff;
    --bg: color-mix(in oklab, var(--brand) 3%, #f5f7f9);
    --surface: #ffffff;
    --surface-2: color-mix(in oklab, var(--brand) 4%, #f7f9fb);
    --surface-3: color-mix(in oklab, var(--brand) 8%, #f2f5f8);
    --line: color-mix(in oklab, var(--brand) 7%, #e3e8ed);
    --line-strong: color-mix(in oklab, var(--brand) 10%, #ccd4dc);
}

/* --------------------------------------------------------------------------
   4. SEMANTIC COLOURS — fixed, never tenant-themed.
   A cancellation must read as destructive even in a red-branded clinic.
   -------------------------------------------------------------------------- */
:root {
    --success: #10714c;
    --success-ink: #0b5639;
    --success-bg: #e7f5ef;
    --success-line: #b6e0cd;
    --danger: #c02b21;
    --danger-ink: #96201a;
    --danger-bg: #fdeceb;
    --danger-line: #f4c2bd;
    --warning: #8a5a00;
    --warning-ink: #7a4f00;
    --warning-bg: #fdf3d8;
    --warning-line: #f0dca4;
    --info: #1a5f96;
    --info-ink: #144a76;
    --info-bg: #e8f2fa;
    --info-line: #bcd9ef;
}

/* --------------------------------------------------------------------------
   5. TYPE, SPACE, RADIUS, ELEVATION, MOTION
   -------------------------------------------------------------------------- */
:root {
    --font-display: "Fraunces","Iowan Old Style",Georgia,serif;
    --font-ui: "Public Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    --fs-meta: 14px;
    --fs-body: 16px;
    --fs-lead: 18px;
    --fs-h4: 20px;
    --fs-h3: 24px;
    --fs-h2: 30px;
    --fs-h1: 38px;
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --r-pill: 999px;
    --sh-1: 0 1px 2px rgb(16 24 32 / .05), 0 1px 3px rgb(16 24 32 / .05);
    --sh-2: 0 2px 4px rgb(16 24 32 / .04), 0 8px 20px -6px rgb(16 24 32 / .10);
    --sh-3: 0 24px 60px -18px rgb(16 24 32 / .28), 0 4px 12px rgb(16 24 32 / .08);
    --dur: 180ms;
    --ease: cubic-bezier(.2,.6,.25,1);
    --shell-nav-w: 268px; /* [NEW] side nav width, referenced by the shell grid */
}

*, *::before, *::after {
    box-sizing: border-box
}

html {
    -webkit-text-size-adjust: 100%;
    height: 100%
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font: 400 var(--fs-body)/1.55 var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -.015em;
    font-optical-sizing: auto
}

h1 {
    font-size: var(--fs-h1)
}

h2 {
    font-size: var(--fs-h2)
}

h3 {
    font-size: var(--fs-h3)
}

h4 {
    font-size: var(--fs-h4)
}

p {
    margin: 0
}

a {
    color: var(--brand-800)
}

button {
    font-family: inherit
}

img {
    max-width: 100%;
    height: auto
}

:focus-visible {
    outline: 3px solid var(--brand-ring);
    outline-offset: 2px;
    border-radius: 4px
}

[hidden] {
    display: none !important
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0
}

.num {
    font-variant-numeric: tabular-nums
}

/* [NEW] skip link — every layout opens with one */
.skip {
    position: absolute;
    left: var(--sp-4);
    top: -60px;
    z-index: 100;
    padding: 12px var(--sp-4);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--sh-2);
    transition: top var(--dur) var(--ease);
}

    .skip:focus {
        top: var(--sp-4)
    }

/* [NEW] tiny layout utilities used by the views. Deliberately few — this is a
   component system, not a utility framework. */
.stack > * + * {
    margin-top: var(--sp-4)
}

.stack--lg > * + * {
    margin-top: var(--sp-6)
}

.text-center {
    text-align: center
}

.muted {
    color: var(--ink-3)
}

.meta {
    font-size: var(--fs-meta);
    color: var(--ink-3)
}

/* --------------------------------------------------------------------------
   6. BUTTONS — primary / secondary / tertiary / destructive
   -------------------------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 48px;
    min-width: 48px;
    padding: 0 var(--sp-5);
    border: 1.5px solid transparent;
    border-radius: var(--r-md);
    font: 600 16px/1 var(--font-ui);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

    .btn:active:not(:disabled) {
        transform: translateY(1px)
    }

    .btn i {
        font-size: 15px
    }

.btn--primary {
    background: var(--brand);
    color: var(--brand-on);
    box-shadow: var(--sh-1)
}

    .btn--primary:hover:not(:disabled) {
        background: var(--brand-700)
    }

.btn--secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line-strong);
    box-shadow: var(--sh-1)
}

    .btn--secondary:hover:not(:disabled) {
        border-color: var(--brand);
        background: var(--brand-50)
    }

.btn--tertiary {
    background: transparent;
    color: var(--brand-800);
    padding-inline: var(--sp-3)
}

    .btn--tertiary:hover:not(:disabled) {
        background: var(--brand-50)
    }

.btn--danger {
    background: var(--danger);
    color: #fff;
    box-shadow: var(--sh-1)
}

    .btn--danger:hover:not(:disabled) {
        background: var(--danger-ink)
    }

.btn--danger-quiet {
    background: var(--surface);
    color: var(--danger-ink);
    border-color: var(--danger-line)
}

    .btn--danger-quiet:hover:not(:disabled) {
        background: var(--danger-bg)
    }

.btn--sm {
    min-height: 40px;
    font-size: 15px;
    padding-inline: var(--sp-4)
}

.btn--lg {
    min-height: 56px;
    font-size: 17px;
    padding-inline: var(--sp-6)
}

.btn--block {
    width: 100%
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none
}

.btn[aria-busy="true"] {
    cursor: progress;
    pointer-events: none
}

    .btn[aria-busy="true"] .btn__label,
    .btn[aria-busy="true"] > i {
        visibility: hidden
    }

    .btn[aria-busy="true"]::after {
        content: "";
        position: absolute;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        border: 2.5px solid currentColor;
        border-top-color: transparent;
        animation: spin .7s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* Sticky mobile action bar (wizard steps, standalone pay page) */
.actionbar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-4);
    padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
    background: color-mix(in oklab, var(--surface) 88%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
}

    .actionbar .btn {
        flex: 1
    }

/* --------------------------------------------------------------------------
   7. FORMS — labels, hints, native controls, unobtrusive-validation classes
   -------------------------------------------------------------------------- */
.field {
    display: grid;
    gap: 6px;
    margin-bottom: var(--sp-5);
    align-content: start
}

.field__label {
    font: 600 15px/1.35 var(--font-ui);
    color: var(--ink)
}

    .field__label .req {
        color: var(--danger);
        margin-left: 2px
    }

    .field__label .opt {
        color: var(--ink-3);
        font-weight: 400
    }

.field__hint {
    font-size: var(--fs-meta);
    color: var(--ink-3)
}

.control {
    width: 100%;
    min-height: 52px;
    padding: 13px 14px;
    font: 400 16px/1.4 var(--font-ui);
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--r-md);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

    .control::placeholder {
        color: #8d97a2
    }

    .control:hover:not(:disabled):not([readonly]) {
        border-color: color-mix(in oklab, var(--brand) 30%, var(--line-strong))
    }

    .control:focus {
        outline: none;
        border-color: var(--brand);
        box-shadow: 0 0 0 4px var(--brand-ring)
    }

    .control:disabled, .control[readonly] {
        background: var(--surface-3);
        color: var(--ink-3);
        cursor: not-allowed
    }

textarea.control {
    min-height: 104px;
    resize: vertical
}
/* native date/month/time controls: normalise Chrome's inner padding + indicator */
.control[type="date"], .control[type="month"] {
    appearance: none;
    -webkit-appearance: none
}

    .control[type="date"]::-webkit-calendar-picker-indicator,
    .control[type="month"]::-webkit-calendar-picker-indicator {
        opacity: .55;
        cursor: pointer
    }

.select {
    position: relative;
    display: block
}

    .select select {
        appearance: none;
        padding-right: 44px
    }

    .select::after {
        content: "\f078";
        font: 900 13px/1 "Font Awesome 6 Free";
        color: var(--ink-3);
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
    }

.field--inline-icon {
    position: relative
}

    .field--inline-icon .control {
        padding-left: 44px
    }

    .field--inline-icon > i {
        position: absolute;
        left: 16px;
        top: calc(50% + 2px);
        transform: translateY(-50%);
        color: var(--ink-3)
    }

/* [NEW] form sections + two-column field grid.
   The mockup only ever showed short auth forms. Register is a long form and
   needs grouping and a desktop two-up, or it becomes a 20-field scroll. */
.formsec {
    border: 0;
    margin: 0 0 var(--sp-8);
    padding: 0
}

    .formsec:last-of-type {
        margin-bottom: var(--sp-5)
    }

.formsec__legend {
    display: block;
    width: 100%;
    padding: 0 0 var(--sp-2);
    margin-bottom: var(--sp-5);
    border-bottom: 1px solid var(--line);
    font: 600 var(--fs-h4)/1.2 var(--font-display);
    color: var(--ink);
}

.formsec__intro {
    margin: -12px 0 var(--sp-5);
    font-size: 15px;
    color: var(--ink-3)
}
/* align-items:start is load-bearing, not cosmetic. Grid items stretch to the
   row height by default, and .field is itself a grid — so a field with no hint
   sitting beside one with a two-line hint would absorb the difference into its
   own auto rows, growing the input and knocking it out of line with its
   neighbour. Start-aligning the fields keeps every control on the same
   baseline regardless of what sits underneath it. */
.fieldgrid {
    display: grid;
    gap: 0 var(--sp-5);
    align-items: start
}

@media (min-width:640px) {
    .fieldgrid {
        grid-template-columns: 1fr 1fr
    }

        .fieldgrid > .field--full {
            grid-column: 1 / -1
        }
}

.field--full {
    grid-column: 1 / -1
}

/* validation — class names emitted by jquery.validate.unobtrusive */
.control.input-validation-error {
    border-color: var(--danger);
    background: color-mix(in oklab, var(--danger-bg) 60%, #fff)
}

    .control.input-validation-error:focus {
        box-shadow: 0 0 0 4px color-mix(in oklab, var(--danger) 25%, transparent)
    }

.field-validation-error {
    display: flex;
    gap: 7px;
    align-items: flex-start;
    font-size: var(--fs-meta);
    font-weight: 500;
    color: var(--danger-ink);
}

    .field-validation-error::before {
        content: "\f06a";
        font: 900 14px/1.45 "Font Awesome 6 Free";
        flex: none
    }

.field-validation-valid {
    display: none
}

.validation-summary-valid {
    display: none
}

.validation-summary-errors {
    padding: var(--sp-4);
    margin-bottom: var(--sp-5);
    background: var(--danger-bg);
    border: 1px solid var(--danger-line);
    border-left: 4px solid var(--danger);
    border-radius: var(--r-md);
    color: var(--danger-ink);
}

    .validation-summary-errors ul {
        margin: 6px 0 0;
        padding-left: 20px;
        font-size: 15px
    }

        .validation-summary-errors ul li {
            margin-top: 3px
        }

    .validation-summary-errors::before {
        content: "\f071  ";
        font: 900 14px/1 "Font Awesome 6 Free"
    }
/* unobtrusive puts the summary <span> inline; ours is a block region */
.field-validation-error:empty {
    display: none
}

/* checkbox / radio / switch */
.choice {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-start;
    min-height: 44px;
    padding: 10px 0;
    cursor: pointer
}

    .choice input[type=checkbox], .choice input[type=radio] {
        flex: none;
        width: 22px;
        height: 22px;
        margin: 1px 0 0;
        accent-color: var(--brand);
        cursor: pointer;
    }

.choice__text {
    font-size: 16px;
    color: var(--ink-2)
}

    .choice__text strong {
        color: var(--ink);
        font-weight: 600
    }

.switch {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 44px;
    cursor: pointer
}

    .switch input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0
    }

.switch__track {
    flex: none;
    width: 52px;
    height: 31px;
    border-radius: var(--r-pill);
    background: #c3ccd5;
    position: relative;
    transition: background var(--dur) var(--ease);
}

    .switch__track::after {
        content: "";
        position: absolute;
        inset: 3px auto 3px 3px;
        width: 25px;
        border-radius: 50%;
        background: #fff;
        box-shadow: var(--sh-1);
        transition: transform var(--dur) var(--ease);
    }

.switch input:checked + .switch__track {
    background: var(--brand)
}

    .switch input:checked + .switch__track::after {
        transform: translateX(21px)
    }

.switch input:focus-visible + .switch__track {
    outline: 3px solid var(--brand-ring);
    outline-offset: 2px
}

.switch__label {
    font-size: 16px;
    color: var(--ink-2)
}

/* OTP */
.otp {
    display: flex;
    gap: var(--sp-2);
    justify-content: center
}

    .otp input {
        width: 48px;
        height: 60px;
        text-align: center;
        font: 600 24px/1 var(--font-ui);
        font-variant-numeric: tabular-nums;
        color: var(--ink);
        border: 1.5px solid var(--line-strong);
        border-radius: var(--r-md);
        background: var(--surface);
        transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
    }

        .otp input:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 4px var(--brand-ring)
        }

.otp--error input {
    border-color: var(--danger);
    background: color-mix(in oklab, var(--danger-bg) 60%, #fff)
}

@media (max-width:359px) {
    .otp input {
        width: 42px;
        height: 54px;
        font-size: 21px
    }

    .otp {
        gap: 6px
    }
}

/* --------------------------------------------------------------------------
   8. BADGES, PILLS, INLINE NOTICES
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: var(--r-pill);
    font: 600 13px/1.3 var(--font-ui);
    letter-spacing: .01em;
    border: 1px solid transparent;
    white-space: nowrap;
}

    .badge i {
        font-size: 11px
    }

.badge--brand {
    background: var(--brand-100);
    color: var(--brand-800);
    border-color: var(--brand-200)
}

.badge--success {
    background: var(--success-bg);
    color: var(--success-ink);
    border-color: var(--success-line)
}

.badge--danger {
    background: var(--danger-bg);
    color: var(--danger-ink);
    border-color: var(--danger-line)
}

.badge--warning {
    background: var(--warning-bg);
    color: var(--warning-ink);
    border-color: var(--warning-line)
}

.badge--info {
    background: var(--info-bg);
    color: var(--info-ink);
    border-color: var(--info-line)
}

.badge--neutral {
    background: var(--surface-3);
    color: var(--ink-2);
    border-color: var(--line)
}

.notice {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: var(--r-md);
    background: var(--surface-2);
    font-size: 15px;
    color: var(--ink-2);
}

    .notice i {
        flex: none;
        margin-top: 2px;
        font-size: 16px
    }

    .notice strong {
        display: block;
        color: var(--ink);
        font-weight: 600;
        margin-bottom: 2px
    }

.notice--info {
    background: var(--info-bg);
    border-color: var(--info-line);
    border-left-color: var(--info);
    color: var(--info-ink)
}

.notice--warning {
    background: var(--warning-bg);
    border-color: var(--warning-line);
    border-left-color: var(--warning);
    color: var(--warning-ink)
}

.notice--danger {
    background: var(--danger-bg);
    border-color: var(--danger-line);
    border-left-color: var(--danger);
    color: var(--danger-ink)
}

.notice--success {
    background: var(--success-bg);
    border-color: var(--success-line);
    border-left-color: var(--success);
    color: var(--success-ink)
}

    .notice--info strong, .notice--warning strong, .notice--danger strong, .notice--success strong {
        color: inherit
    }

.notice a {
    color: inherit;
    font-weight: 600
}

/* --------------------------------------------------------------------------
   9. CARD + DATE TILE
   The date tile is the system's signature: Fraunces numerals in a soft square.
   It appears on the appointment card, the picker rail and the history rows so
   "when" is always read the same way, at a glance, at any age.
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1)
}

.card__body {
    padding: var(--sp-5)
}

.card__head {
    padding: var(--sp-5);
    border-bottom: 1px solid var(--line)
}

.card__foot {
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 0 0 var(--r-lg) var(--r-lg)
}

.datetile {
    flex: none;
    width: 60px;
    padding: 8px 0 10px;
    text-align: center;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.datetile__dow {
    display: block;
    font: 700 11px/1 var(--font-ui);
    letter-spacing: .10em;
    text-transform: uppercase;
    color: var(--ink-3)
}

.datetile__num {
    display: block;
    font: 600 28px/1.1 var(--font-display);
    font-variant-numeric: lining-nums tabular-nums;
    color: var(--ink);
    margin: 3px 0 1px
}

.datetile__mon {
    display: block;
    font: 600 12px/1 var(--font-ui);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-3)
}

.datetile--hot {
    background: var(--brand);
    border-color: var(--brand)
}

    .datetile--hot .datetile__dow, .datetile--hot .datetile__mon {
        color: color-mix(in oklab, var(--brand-on) 78%, transparent)
    }

    .datetile--hot .datetile__num {
        color: var(--brand-on)
    }

.datetile--muted {
    background: var(--surface-2)
}

    .datetile--muted .datetile__num {
        color: var(--ink-3)
    }

/* --------------------------------------------------------------------------
   10. APPOINTMENT CARD — the most reused component in the system
   -------------------------------------------------------------------------- */
.appt {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    overflow: hidden;
    container-type: inline-size;
}

    .appt::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 4px;
        background: var(--line-strong)
    }

.appt--imminent {
    border-color: var(--brand-200);
    box-shadow: var(--sh-2)
}

    .appt--imminent::before {
        background: var(--brand)
    }

.appt--awaiting::before {
    background: var(--warning)
}

.appt--past::before, .appt--cancelled::before {
    background: var(--line-strong)
}

.appt--cancelled {
    background: var(--surface-2)
}

.appt__inner {
    padding: var(--sp-5) var(--sp-5) var(--sp-5) calc(var(--sp-5) + 4px)
}

.appt__top {
    display: flex;
    gap: var(--sp-4);
    align-items: flex-start
}

.appt__when {
    min-width: 0
}

.appt__eyebrow {
    display: block;
    font: 700 12px/1 var(--font-ui);
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--brand-800);
    margin-bottom: 7px
}

.appt--past .appt__eyebrow, .appt--cancelled .appt__eyebrow {
    color: var(--ink-3)
}

.appt__time {
    font: 600 22px/1.2 var(--font-display);
    color: var(--ink);
    font-variant-numeric: lining-nums
}

.appt__date {
    margin-top: 3px;
    font-size: 16px;
    color: var(--ink-2)
}

.appt__status {
    margin-left: auto
}

.appt__meta {
    list-style: none;
    display: grid;
    gap: 10px;
    margin: var(--sp-5) 0 0;
    padding: 0
}

    .appt__meta li {
        display: flex;
        gap: 11px;
        align-items: baseline;
        font-size: 16px;
        color: var(--ink-2)
    }

    .appt__meta i {
        flex: none;
        width: 18px;
        text-align: center;
        color: var(--ink-3);
        font-size: 15px
    }

    .appt__meta b {
        font-weight: 600;
        color: var(--ink)
    }

.appt__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    margin-top: var(--sp-5)
}

    .appt__actions .btn {
        flex: 1 1 100%
    }

.appt__note {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin-top: var(--sp-4);
    padding: 11px 13px;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    font-size: var(--fs-meta);
    color: var(--ink-2);
}

    .appt__note i {
        flex: none;
        margin-top: 2px;
        color: var(--ink-3)
    }

@container (min-width:440px) {
    .appt__actions .btn {
        flex: 0 0 auto
    }

    .appt__meta {
        grid-template-columns: 1fr 1fr;
        gap: 10px var(--sp-5)
    }
}

.appt--lg .appt__time {
    font-size: 28px
}

.appt--lg .appt__inner {
    padding: var(--sp-6) var(--sp-6) var(--sp-6) calc(var(--sp-6) + 4px)
}

/* --------------------------------------------------------------------------
   11. DATE + TIME-SLOT PICKER  (replaces FullCalendar)
   Date rail -> day panel -> practitioner block -> period-grouped time chips.
   All sizing is container-driven so the same module works in the wizard,
   in reschedule, and inside a 320px viewport.
   Markup is produced by wwwroot/js/ui/picker.js in Phase 2.
   -------------------------------------------------------------------------- */
.picker {
    container-type: inline-size;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    overflow: hidden
}

.picker__filters {
    display: grid;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-bottom: 1px solid var(--line);
    background: var(--surface-2)
}

    .picker__filters .field {
        margin: 0
    }

.chips {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap
}

.chip {
    min-height: 44px;
    padding: 0 var(--sp-4);
    border-radius: var(--r-pill);
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    font: 600 15px/1 var(--font-ui);
    color: var(--ink-2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all var(--dur) var(--ease);
}

    .chip:hover {
        border-color: var(--brand);
        color: var(--ink)
    }

    .chip[aria-pressed="true"] {
        background: var(--brand);
        border-color: var(--brand);
        color: var(--brand-on)
    }

.rail {
    display: flex;
    align-items: stretch;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-3);
    border-bottom: 1px solid var(--line)
}

.rail__nav {
    flex: none;
    width: 44px;
    min-height: 44px;
    align-self: center;
    border-radius: var(--r-md);
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
}

    .rail__nav:hover:not(:disabled) {
        border-color: var(--brand);
        color: var(--brand-800)
    }

    .rail__nav:disabled {
        opacity: .4;
        cursor: not-allowed
    }

.rail__track {
    display: flex;
    gap: var(--sp-2);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 2px;
    flex: 1;
}

    .rail__track::-webkit-scrollbar {
        display: none
    }

.day {
    scroll-snap-align: start;
    flex: 0 0 auto;
    width: 74px;
    min-height: 88px;
    padding: 9px 4px 8px;
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    cursor: pointer;
    text-align: center;
    transition: all var(--dur) var(--ease);
}

    .day:hover:not(:disabled) {
        border-color: var(--brand);
        background: var(--brand-50)
    }

.day__dow {
    display: block;
    font: 700 11px/1 var(--font-ui);
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-3)
}

.day__num {
    display: block;
    font: 600 24px/1.15 var(--font-display);
    font-variant-numeric: lining-nums tabular-nums;
    margin: 4px 0 2px
}

.day__mon {
    display: block;
    font: 600 11px/1 var(--font-ui);
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-3)
}

.day__avail {
    display: block;
    margin-top: 7px;
    font: 600 12px/1 var(--font-ui);
    color: var(--success-ink)
}

.day[aria-pressed="true"] {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-on)
}

    .day[aria-pressed="true"] .day__dow, .day[aria-pressed="true"] .day__mon, .day[aria-pressed="true"] .day__avail {
        color: color-mix(in oklab, var(--brand-on) 82%, transparent)
    }

.day:disabled {
    cursor: not-allowed;
    background: var(--surface-2);
    color: var(--ink-3)
}

    .day:disabled .day__avail {
        color: var(--ink-3)
    }

.picker__body {
    padding: var(--sp-4)
}

.picker__daytitle {
    display: flex;
    align-items: baseline;
    gap: var(--sp-3);
    flex-wrap: wrap;
    margin-bottom: var(--sp-4)
}

    .picker__daytitle h4 {
        font-size: 19px
    }

    .picker__daytitle span {
        font-size: var(--fs-meta);
        color: var(--ink-3)
    }

.prac {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--sp-4);
    margin-bottom: var(--sp-3)
}

.prac__head {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4)
}

.avatar {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-100);
    color: var(--brand-800);
    font: 700 15px/1 var(--font-ui);
    border: 1px solid var(--brand-200);
}

.prac__name {
    font: 600 17px/1.25 var(--font-ui);
    color: var(--ink)
}

.prac__spec {
    font-size: var(--fs-meta);
    color: var(--ink-3)
}

.prac__info {
    margin-left: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-3);
    cursor: pointer;
    flex: none;
}

    .prac__info:hover {
        border-color: var(--brand);
        color: var(--brand-800)
    }

.period {
    margin-bottom: var(--sp-4)
}

    .period:last-child {
        margin-bottom: 0
    }

.period__label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    font: 700 12px/1 var(--font-ui);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-3);
}

    .period__label i {
        color: var(--brand-800)
    }

.slots {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(92px,1fr));
    gap: var(--sp-2)
}

.slot {
    min-height: 48px;
    padding: 0 6px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font: 600 16px/1 var(--font-ui);
    font-variant-numeric: tabular-nums;
    transition: all var(--dur) var(--ease);
}

    .slot:hover {
        border-color: var(--brand);
        background: var(--brand-50)
    }

    .slot[aria-pressed="true"] {
        background: var(--brand);
        border-color: var(--brand);
        color: var(--brand-on);
        box-shadow: var(--sh-2)
    }

.prac--empty {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: 15px
}

.picker__summary {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: var(--sp-3);
    align-items: center;
    flex-wrap: wrap;
    padding: var(--sp-4);
    border-top: 1px solid var(--line);
    background: color-mix(in oklab, var(--surface) 90%, transparent);
    backdrop-filter: blur(8px);
}

    .picker__summary p {
        font-size: 15px;
        color: var(--ink-2)
    }

    .picker__summary b {
        color: var(--ink);
        font-weight: 600
    }

    .picker__summary .btn {
        margin-left: auto
    }

@container (min-width:620px) {
    .picker__filters {
        grid-template-columns: minmax(240px,1fr) auto;
        align-items: end
    }

    .slots {
        grid-template-columns: repeat(auto-fill,minmax(104px,1fr))
    }

    .day {
        width: 82px
    }
}

@container (max-width:400px) {
    .picker__summary .btn {
        margin-left: 0;
        width: 100%
    }
}

/* --------------------------------------------------------------------------
   12. PORTAL SHELL + SIDE NAVIGATION  (_LayoutPortal)
   Off-canvas drawer below 1024px, fixed rail at and above it. The item list
   is a plain <ul> that scrolls independently of the patient block, so a tenth
   item is one <li> and no layout changes.

   CHANGED FROM MOCKUP: the mockup demoed this with a container query at 900px
   so the drawer was visible on a desktop page. In the real layout it is a
   media query at 1024px, per the agreed breakpoints.
   -------------------------------------------------------------------------- */
.shell {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100dvh;
    background: var(--bg)
}

.sidenav {
    display: flex;
    flex-direction: column;
    width: var(--shell-nav-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.sidenav__brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-5);
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex: none;
    background: var(--brand);
    color: var(--brand-on);
    font: 700 16px/1 var(--font-ui);
    overflow: hidden;
}
/* Tenant logos are almost never square — most clinic marks are wordmarks. The
   square tile is right for the initials fallback and wrong for an image, which
   gets letterboxed into a strip. So an image logo is constrained by HEIGHT and
   lets its width follow, with a per-context cap so a very wide mark cannot
   push the nav or the top bar out of shape. */
.logo--img {
    width: auto;
    height: 40px;
    max-width: 150px;
    background: none;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

    .logo--img img {
        width: auto;
        max-width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: left center
    }

.sidenav__brand .logo--img {
    max-width: 132px
}

.topbar .logo--img {
    height: 32px;
    max-width: 112px
}

.authcard__brand .logo--img {
    height: 56px;
    max-width: 210px
}

    .authcard__brand .logo--img img {
        object-position: center
    }

.sidenav__brand b {
    display: block;
    font: 600 17px/1.2 var(--font-display);
    letter-spacing: -.01em
}

.sidenav__brand span {
    display: block;
    font-size: 12px;
    color: var(--ink-3);
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 600
}

.sidenav__list {
    list-style: none;
    margin: 0;
    padding: var(--sp-3);
    flex: 1;
    overflow-y: auto;
    display: grid;
    gap: 2px;
    align-content: start
}

.navitem {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 48px;
    padding: 0 var(--sp-3);
    border-radius: var(--r-md);
    color: var(--ink-2);
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

    .navitem i {
        width: 22px;
        text-align: center;
        font-size: 16px;
        color: var(--ink-3)
    }

    .navitem:hover {
        background: var(--surface-3);
        color: var(--ink)
    }

    .navitem[aria-current="page"] {
        background: var(--brand-100);
        color: var(--brand-800);
        font-weight: 600
    }

        .navitem[aria-current="page"] i {
            color: var(--brand-800)
        }

.navitem__count {
    margin-left: auto;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-3)
}

.sidenav__foot {
    padding: var(--sp-4);
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: var(--sp-3)
}

    .sidenav__foot .avatar {
        width: 38px;
        height: 38px;
        font-size: 13px
    }

.sidenav__who {
    min-width: 0;
    flex: 1
}

    .sidenav__who b {
        display: block;
        font-size: 15px;
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

    .sidenav__who span {
        display: block;
        font-size: 13px;
        color: var(--ink-3)
    }

.topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    padding-top: calc(var(--sp-3) + env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

    .topbar b {
        font-family: var(--font-display);
        font-size: 17px
    }

    .topbar .logo {
        width: 34px;
        height: 34px;
        font-size: 13px;
        border-radius: 9px
    }

.iconbtn {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: var(--r-md);
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    flex: none;
}

    .iconbtn:hover {
        border-color: var(--brand);
        color: var(--brand-800)
    }

.shell__col {
    display: flex;
    flex-direction: column;
    min-width: 0
}

.shell__main {
    flex: 1;
    padding: var(--sp-5);
    min-width: 0;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto
}

.shell__foot {
    padding: var(--sp-5);
    padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
    font-size: var(--fs-meta);
    color: var(--ink-3);
    display: flex;
    gap: var(--sp-2) var(--sp-5);
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

    .shell__foot a {
        color: var(--ink-2)
    }

.shell__scrim {
    display: none
}

/* [NEW] page header used by every portal view */
.pagehead {
    margin-bottom: var(--sp-6)
}

    .pagehead h1 {
        font-size: var(--fs-h2)
    }

    .pagehead p {
        margin-top: 6px;
        color: var(--ink-2)
    }

@media (min-width:1024px) {
    .shell {
        grid-template-columns: var(--shell-nav-w) 1fr
    }

        .shell > .topbar {
            display: none
        }

    .shell__col > .topbar {
        display: none
    }

    .shell__main {
        padding: var(--sp-8)
    }

    .sidenav {
        position: sticky;
        top: 0;
        height: 100dvh
    }
}

@media (max-width:1023px) {
    .shell {
        position: relative;
        overflow-x: clip
    }

    .sidenav {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 220ms var(--ease);
        box-shadow: var(--sh-3);
        max-width: 88vw;
    }

    .shell.is-open .sidenav {
        transform: none
    }

    .shell.is-open .shell__scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 30;
        background: rgb(10 18 26 / .45)
    }

    body.is-locked {
        overflow: hidden
    }
}

/* --------------------------------------------------------------------------
   13. WIZARD STEPPER — 5 or 6 steps, no layout change
   -------------------------------------------------------------------------- */
.stepper {
    container-type: inline-size;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--sp-4) var(--sp-5)
}

.stepper__compact {
    display: block
}

.stepper__count {
    font: 700 12px/1 var(--font-ui);
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-3)
}

.stepper__now {
    margin: 6px 0 12px;
    font: 600 21px/1.2 var(--font-display)
}

.stepper__bar {
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    overflow: hidden
}

    .stepper__bar i {
        display: block;
        height: 100%;
        border-radius: inherit;
        background: var(--brand);
        transition: width 300ms var(--ease)
    }

.stepper__full {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0
}

.step__dot {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 2px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-3);
    font: 700 14px/1 var(--font-ui);
}

.step__label {
    font-size: 15px;
    color: var(--ink-3);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.step__line {
    flex: 1;
    height: 2px;
    background: var(--line-strong);
    min-width: 12px
}

.step.is-done .step__dot {
    background: var(--success);
    border-color: var(--success);
    color: #fff
}

.step.is-done .step__label {
    color: var(--ink-2)
}

.step.is-current .step__dot {
    border-color: var(--brand);
    background: var(--brand);
    color: var(--brand-on);
    box-shadow: 0 0 0 4px var(--brand-ring)
}

.step.is-current .step__label {
    color: var(--ink);
    font-weight: 700
}

@container (min-width:720px) {
    .stepper__compact {
        display: none
    }

    .stepper__full {
        display: flex;
        align-items: center;
        gap: 8px
    }
}

/* --------------------------------------------------------------------------
   14. DIALOG (native <dialog>) — sheet on mobile, destructive variant
   -------------------------------------------------------------------------- */
dialog.modal {
    width: min(520px, calc(100% - 32px));
    padding: 0;
    border: none;
    border-radius: var(--r-xl);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--sh-3);
    overflow: hidden;
}

    dialog.modal::backdrop {
        background: rgb(8 15 22 / .55)
    }

.modal__head {
    padding: var(--sp-6) var(--sp-6) 0;
    text-align: center
}

.modal__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--sp-4);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-100);
    color: var(--brand-800);
    font-size: 22px;
}

.modal__icon--danger {
    background: var(--danger-bg);
    color: var(--danger)
}

.modal__body {
    padding: var(--sp-4) var(--sp-6) var(--sp-6);
    text-align: center
}

    .modal__body p {
        color: var(--ink-2);
        font-size: 16px
    }

.modal__facts {
    list-style: none;
    margin: var(--sp-5) 0 0;
    padding: var(--sp-4);
    text-align: left;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    display: grid;
    gap: 9px;
}

    .modal__facts li {
        display: flex;
        gap: var(--sp-4);
        font-size: 15px
    }

    .modal__facts dt, .modal__facts .k {
        flex: none;
        width: 104px;
        color: var(--ink-3)
    }

    .modal__facts .v {
        font-weight: 600;
        color: var(--ink)
    }

.modal__foot {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-6) var(--sp-6)
}

    .modal__foot .btn {
        flex: 1
    }

@media (max-width:640px) {
    dialog.modal {
        width: 100%;
        max-width: none;
        margin: auto auto 0;
        border-radius: var(--r-xl) var(--r-xl) 0 0
    }

    .modal__foot {
        flex-direction: column-reverse;
        padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom))
    }

    dialog.modal--sheet {
        height: 100dvh;
        max-height: none;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column
    }

        dialog.modal--sheet .modal__body {
            flex: 1;
            overflow: auto
        }

        dialog.modal--sheet .modal__head {
            padding-top: var(--sp-10)
        }
}

/* --------------------------------------------------------------------------
   15. TOASTS (replaces toastr)
   -------------------------------------------------------------------------- */
.toasts {
    position: fixed;
    z-index: 90;
    display: grid;
    gap: 10px;
    width: min(380px, calc(100% - 24px));
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
}

@media (min-width:768px) {
    .toasts {
        top: 16px;
        bottom: auto;
        right: 16px
    }
}

.toast {
    display: flex;
    gap: var(--sp-3);
    padding: 14px var(--sp-4);
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--ink-3);
    box-shadow: var(--sh-2);
    animation: toast-in 220ms var(--ease);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.98)
    }
}

.toast i {
    flex: none;
    margin-top: 2px
}

.toast b {
    display: block;
    font-size: 15px;
    font-weight: 600
}

.toast p {
    font-size: var(--fs-meta);
    color: var(--ink-2)
}

.toast button {
    margin-left: auto;
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--ink-3);
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
    min-width: 32px;
    min-height: 32px
}

.toast--success {
    border-left-color: var(--success)
}

    .toast--success > i {
        color: var(--success)
    }

.toast--error {
    border-left-color: var(--danger)
}

    .toast--error > i {
        color: var(--danger)
    }

.toast--warning {
    border-left-color: var(--warning)
}

    .toast--warning > i {
        color: var(--warning)
    }

.toast--info {
    border-left-color: var(--info)
}

    .toast--info > i {
        color: var(--info)
    }

/* --------------------------------------------------------------------------
   16. SKELETONS (replaces blockUI)
   -------------------------------------------------------------------------- */
.sk {
    border-radius: var(--r-sm);
    background: linear-gradient(90deg,var(--surface-3) 25%,var(--surface-2) 37%,var(--surface-3) 63%);
    background-size: 400% 100%;
    animation: sk 1.4s ease infinite;
    height: 14px;
}

@keyframes sk {
    0% {
        background-position: 100% 50%
    }

    100% {
        background-position: 0 50%
    }
}

.sk--title {
    height: 22px;
    width: 55%
}

.sk--line {
    margin-top: 10px
}

.sk--w70 {
    width: 70%
}

.sk--w40 {
    width: 40%
}

.sk--tile {
    height: 88px;
    width: 74px;
    border-radius: var(--r-md);
    flex: none
}

.sk--chip {
    height: 48px;
    border-radius: var(--r-md)
}

/* --------------------------------------------------------------------------
   17. PAYMENT BLOCK
   #payment-element is left exactly as Stripe expects it — no padding, no
   border, no transform on the container itself. Chrome sits on .pay__body.
   -------------------------------------------------------------------------- */
.pay {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--sh-1);
    overflow: hidden
}

.pay__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: var(--sp-4) var(--sp-5);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line)
}

    .pay__head i {
        color: var(--success)
    }

    .pay__head b {
        font-size: 16px;
        font-weight: 600
    }

.pay__amounts {
    list-style: none;
    margin: 0;
    padding: var(--sp-5);
    display: grid;
    gap: 11px;
    border-bottom: 1px solid var(--line)
}

    .pay__amounts li {
        display: flex;
        justify-content: space-between;
        gap: var(--sp-4);
        font-size: 16px;
        color: var(--ink-2)
    }

    .pay__amounts .total {
        padding-top: 11px;
        border-top: 1px solid var(--line);
        font-size: 19px;
        color: var(--ink);
        font-weight: 600
    }

        .pay__amounts .total span:last-child {
            font-family: var(--font-display);
            font-size: 24px
        }

.pay__body {
    padding: var(--sp-5);
    min-width: 0
}

    .pay__body > * {
        max-width: 100%
    }

.pay__trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: var(--sp-4);
    font-size: var(--fs-meta);
    color: var(--ink-3);
    border-top: 1px solid var(--line);
    background: var(--surface-2)
}

/* --------------------------------------------------------------------------
   18. BOOKING HISTORY — rows on desktop, cards on mobile. Never a table.
   -------------------------------------------------------------------------- */
.history {
    container-type: inline-size;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--sp-3)
}

.hrow {
    display: grid;
    gap: var(--sp-3);
    padding: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
}

.hrow__main {
    display: flex;
    gap: var(--sp-4);
    align-items: center
}

.hrow__what {
    min-width: 0;
    flex: 1
}

    .hrow__what b {
        display: block;
        font-size: 17px;
        font-weight: 600
    }

    .hrow__what span {
        display: block;
        font-size: 15px;
        color: var(--ink-3)
    }

.hrow__side {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap
}

.hrow__fee {
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums
}

.hrow__acts {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap
}

    .hrow__acts .btn {
        flex: 1 1 auto
    }

@container (min-width:700px) {
    .hrow {
        grid-template-columns: 1fr auto;
        align-items: center
    }

    .hrow__side {
        justify-content: flex-end
    }

    .hrow__acts .btn {
        flex: 0 0 auto
    }
}

/* --------------------------------------------------------------------------
   19. STATES — empty, error, expired, success
   -------------------------------------------------------------------------- */
.state {
    text-align: center;
    padding: var(--sp-10) var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg)
}

.state__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--sp-5);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 28px;
    background: var(--brand-100);
    color: var(--brand-800)
}

.state__icon--warning {
    background: var(--warning-bg);
    color: var(--warning)
}

.state__icon--danger {
    background: var(--danger-bg);
    color: var(--danger)
}

.state__icon--success {
    background: var(--success-bg);
    color: var(--success)
}

.state h3 {
    margin-bottom: 10px
}

.state p {
    max-width: 44ch;
    margin: 0 auto var(--sp-5);
    color: var(--ink-2)
}

.state__acts {
    display: flex;
    gap: var(--sp-3);
    justify-content: center;
    flex-wrap: wrap
}

.ref {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px var(--sp-4);
    margin-bottom: var(--sp-5);
    background: var(--surface-3);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    font-size: 15px;
    color: var(--ink-2);
}

    .ref b {
        font: 600 18px/1 var(--font-display);
        letter-spacing: .04em;
        color: var(--ink)
    }

/* --------------------------------------------------------------------------
   20. POPOVER (native API) — practitioner bio, fee explainer
   -------------------------------------------------------------------------- */
[popover].pop {
    width: min(320px, calc(100% - 32px));
    padding: var(--sp-5);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-3);
    background: var(--surface);
    color: var(--ink);
}

    [popover].pop::backdrop {
        background: rgb(8 15 22 / .35)
    }

    [popover].pop h4 {
        font-size: 17px;
        margin-bottom: 8px
    }

    [popover].pop p {
        font-size: 15px;
        color: var(--ink-2)
    }

    [popover].pop .btn {
        margin-top: var(--sp-4)
    }

@supports (anchor-name:--a) {
    [popover].pop {
        position-area: block-end span-inline-start;
        margin: 8px 0 0
    }
}

/* --------------------------------------------------------------------------
   21. AUTH / STANDALONE CARD SHELLS  (_LayoutAuth, _LayoutStandalone)
   -------------------------------------------------------------------------- */
.authwrap {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: var(--sp-6) var(--sp-4);
    padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
    background: var(--bg);
}
/* Vertically centred when the card is shorter than the viewport, top-aligned
   when it isn't. `safe center` is what makes the second case work: plain
   `center` would push the top of a tall card (Register) above the scroll
   origin, making the first fields unreachable.

   Horizontal centring is done by margin-inline:auto on .authcard rather than
   by an alignment property on an ancestor, so it cannot be thrown off by how
   a browser sizes the intermediate boxes. */
.authwrap__inner {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: safe center;
    width: 100%
}

    .authwrap__inner > main {
        width: 100%
    }

.authcard {
    width: min(440px,100%);
    margin-inline: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-2);
    overflow: hidden
}
/* [NEW] wide variant — Register is a full patient form and does not fit 440px */
.authcard--wide {
    width: min(760px,100%)
}
/* Anything else dropped straight into an auth/standalone <main> — success and
   expired-link states, for instance — centres on the same rail as the card. */
.authwrap__inner > main > .state {
    width: min(440px,100%);
    margin-inline: auto
}

.authcard__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: var(--sp-6) var(--sp-5) var(--sp-4);
    text-align: center
}

    .authcard__brand .logo {
        width: 52px;
        height: 52px;
        border-radius: 14px;
        font-size: 19px
    }

    .authcard__brand b {
        font-family: var(--font-display);
        font-size: 18px;
        font-weight: 600
    }

.authcard__body {
    padding: 0 var(--sp-5) var(--sp-6)
}

.authcard__foot {
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    text-align: center;
    font-size: var(--fs-meta);
    color: var(--ink-3)
}

.authcard h3 {
    text-align: center;
    margin-bottom: 8px
}

.authcard__sub {
    text-align: center;
    color: var(--ink-2);
    font-size: 16px;
    margin-bottom: var(--sp-6)
}

.authcard__alt {
    text-align: center;
    margin-top: var(--sp-5);
    font-size: 15px;
    color: var(--ink-2)
}

.trustrow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-4);
    flex-wrap: wrap;
    margin-top: var(--sp-4);
    font-size: 13px;
    color: var(--ink-3)
}

    .trustrow span {
        display: inline-flex;
        align-items: center;
        gap: 6px
    }
/* [NEW] page-level footer under the auth/standalone card */
.authfoot {
    margin-top: var(--sp-6);
    text-align: center;
    font-size: var(--fs-meta);
    color: var(--ink-3);
    display: flex;
    gap: var(--sp-2) var(--sp-5);
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

    .authfoot a {
        color: var(--ink-2)
    }

@media (min-width:640px) {
    .authcard__body {
        padding: 0 var(--sp-6) var(--sp-6)
    }

    .authcard__brand {
        padding-inline: var(--sp-6)
    }
}

/* --------------------------------------------------------------------------
   23. COMBOBOX — server-backed search field  [NEW]
   Replaces Select2 for the suburb lookup. Markup comes from the view; the
   behaviour is ui/combobox.js. Sized for a thumb: 52px input, 52px rows.
   -------------------------------------------------------------------------- */
.cbx {
    position: relative
}

.cbx__input {
    padding-right: 76px
}

.cbx__clear {
    position: absolute;
    top: 0;
    right: 38px;
    width: 38px;
    height: 52px;
    display: grid;
    place-items: center;
    border: 0;
    background: none;
    color: var(--ink-3);
    cursor: pointer;
    font-size: 14px;
}

    .cbx__clear:hover {
        color: var(--ink)
    }

.cbx__icon {
    position: absolute;
    top: 0;
    right: 6px;
    width: 32px;
    height: 52px;
    display: grid;
    place-items: center;
    color: var(--ink-3);
    pointer-events: none;
    font-size: 14px;
}

.cbx.is-loading .cbx__icon::before {
    content: "";
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    border-top-color: var(--brand);
    animation: spin .7s linear infinite;
}

.cbx.is-loading .cbx__icon > i {
    display: none
}

.cbx__panel {
    display: none;
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    box-shadow: var(--sh-3);
    padding: 6px;
}

.cbx.is-open .cbx__panel {
    display: block
}

.cbx__opt {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    justify-content: space-between;
    min-height: 52px;
    padding: 10px var(--sp-3);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 16px;
    color: var(--ink);
}

    .cbx__opt:hover {
        background: var(--surface-3)
    }

    .cbx__opt[aria-selected="true"] {
        background: var(--brand-100);
        color: var(--brand-800)
    }

    .cbx__opt mark {
        background: transparent;
        color: inherit;
        font-weight: 700;
        text-decoration: underline;
        text-underline-offset: 2px
    }

.cbx__opt-main {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.cbx__opt-meta {
    flex: none;
    font-size: var(--fs-meta);
    color: var(--ink-3);
    font-variant-numeric: tabular-nums
}

.cbx__opt[aria-selected="true"] .cbx__opt-meta {
    color: inherit
}

.cbx__empty {
    padding: var(--sp-4) var(--sp-3);
    font-size: 15px;
    color: var(--ink-3)
}

@media (max-width:479px) {
    /* Long suburb names must not push the postcode off-screen at 320px. */
    .cbx__opt {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        padding-block: 8px
    }

    .cbx__opt-main {
        white-space: normal
    }
}

/* --------------------------------------------------------------------------
   22. REDUCED MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion:reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important
    }

    .sk {
        animation: none;
        background: var(--surface-3)
    }
}
/* ==========================================================================
   PHASE 2 ADDITIONS TO portal-theme.css
   --------------------------------------------------------------------------
   Append this block verbatim to portal-theme.css, immediately after section 11
   (DATE + TIME-SLOT PICKER). It is delivered separately only because I do not
   hold the deployed portal-theme.css and will not guess at its current
   contents; it is a complete, self-contained block, not a diff.

   Five additions. No new design tokens. No changes to any existing rule except
   one amendment to .slot, called out below.
   ========================================================================== */

/* --------------------------------------------------------------------------
   11a. SLOT CHIP — BUSY STATE
   A slot chip acquires a server-side hold on tap. It is a network round trip,
   and without an affordance the patient taps a second time. .btn already has
   this treatment; .slot needs the same, and cannot reuse it because .slot is
   not a .btn and its label is a bare text node with nothing to hide.

   AMENDS the existing .slot rule: `position: relative` is added so ::after
   can be centred. Nothing else about .slot changes.
   -------------------------------------------------------------------------- */
.slot {
    position: relative;
}

    .slot[aria-busy="true"] {
        cursor: progress;
        pointer-events: none;
    }

        .slot[aria-busy="true"] .slot__label {
            visibility: hidden;
        }

        .slot[aria-busy="true"]::after {
            content: "";
            position: absolute;
            top: calc(50% - 9px);
            left: calc(50% - 9px);
            width: 18px;
            height: 18px;
            border-radius: 50%;
            border: 2.5px solid currentColor;
            border-top-color: transparent;
            animation: spin .7s linear infinite; /* existing keyframes, section 6 */
        }

/* --------------------------------------------------------------------------
   11b. TIMEZONE BANNER
   Every time on screen belongs to the zone the patient selected, and the zone
   is stated once, above the times, rather than repeated on forty chips. At
   320px a per-chip marker does not fit; a banner is also impossible to mistake
   for part of a time value.

   NOTE: not sticky. .picker sets `overflow: hidden` to clip its rounded
   corners, which makes it a scroll container and scopes any sticky child to
   the picker's own box — so `position: sticky` here does nothing. Pinning the
   banner means removing that clip, which is a structural change to the
   component. The zone is restated in the sticky summary bar and again in the
   confirmation dialog, so it is never more than one glance away.
   -------------------------------------------------------------------------- */
.picker__zone {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    font: 500 14px/1.3 var(--font-ui);
    color: var(--ink-2);
}

    .picker__zone i {
        flex: none;
        color: var(--ink-3);
    }

/* --------------------------------------------------------------------------
   11c. PRACTITIONER PHOTO
   .avatar is an initials chip (grid + place-items). PRAC_IMG is a real URL of
   unknown aspect ratio, so as an <img> it needs cropping. The background is
   retained so a slow-loading image does not flash a white hole.
   Practitioners without a photo, and dead URLs, fall back to initials in JS.
   -------------------------------------------------------------------------- */
img.avatar {
    object-fit: cover;
    background: var(--brand-100);
}

/* --------------------------------------------------------------------------
   11d. STATES AND NOTICES INSIDE THE PICKER BODY
   .state is a standalone panel with its own border and background. Nested in
   the picker it would read as a card inside a card, so the chrome is dropped
   and only the layout is kept. No new class — the context does the work.
   -------------------------------------------------------------------------- */
.picker__body > .state {
    border: none;
    background: transparent;
    padding: var(--sp-8) var(--sp-2);
}

.picker__body > .notice {
    margin-bottom: var(--sp-4);
}

.picker__body > .sk + .slots {
    margin-top: var(--sp-5);
}

/* --------------------------------------------------------------------------
   11f. FILTERS ON A NARROW CONTAINER
   Four period chips need ~444px on one line. Below that they wrapped to two
   rows on a 390px phone and three on a 320px one — 148px of vertical space
   for a secondary filter, spent before the patient has seen a single
   appointment time. At 320px that pushed the first slot below the fold.

   One row that scrolls instead. Same treatment .rail__track already uses, so
   the gesture is consistent within the component. Nothing here changes at
   620px and above, where the chips fit on one line anyway.

   Scoped to .picker__filters so .chips stays wrapping wherever else it is used.
   -------------------------------------------------------------------------- */
@container (max-width: 619px) {
    .picker__filters .chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        padding: 2px; /* room for the focus ring, which is outset */
        margin: -2px;
    }

        .picker__filters .chips::-webkit-scrollbar {
            display: none;
        }

    .picker__filters .chip {
        flex: none;
        scroll-snap-align: start;
    }
}

/* --------------------------------------------------------------------------
   11e. SUMMARY BAR — THREE CHILDREN
   The bar now carries a restatement, a "Reserved" badge and the action.
   .picker__summary .btn already takes `margin-left: auto`; the badge just
   needs to stop shrinking, and at container widths under 400px the three
   items stack rather than crushing the restatement to two words per line.
   -------------------------------------------------------------------------- */
.picker__summary .badge {
    flex: none;
}

@container (max-width: 400px) {
    .picker__summary p {
        flex: 1 1 100%;
    }
}
/* --------------------------------------------------------------------------
   24. FILE UPLOAD  [NEW — Phase 2b]

   Replaces Dropzone. Two consumers with different limits, one component:
     referral pages — 4 files, 15 MB each   (matches ReadReferralData)
     condition images — 5 files, 5 MB each

   Worth recording what this is NOT: it does not upload. Dropzone never did
   either — autoProcessQueue was false and the form's action was
   javascript:void(0), so the files only ever left the browser inside the
   ConfirmBookingProcess POST. This component holds File objects and hands
   them to that same POST. There is therefore no per-file progress bar,
   because no per-file request exists. Progress belongs on the booking POST.
   -------------------------------------------------------------------------- */
.uploader {
    display: grid;
    gap: var(--sp-4)
}

/* The drop target is a <label> wrapping a visually-hidden <input type=file>,
   so click, Tab and Enter all work with no JS and no role juggling. */
.uploader__drop {
    display: grid;
    place-items: center;
    gap: var(--sp-2);
    min-height: 132px;
    padding: var(--sp-6) var(--sp-4);
    text-align: center;
    cursor: pointer;
    background: var(--surface-2);
    border: 2px dashed var(--line-strong);
    border-radius: var(--r-lg);
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

    .uploader__drop:hover {
        border-color: var(--brand);
        background: color-mix(in oklab, var(--brand) 4%, var(--surface-2))
    }

    /* :focus-within so the ring follows the hidden input's focus. */
    .uploader__drop:focus-within {
        outline: none;
        border-color: var(--brand);
        box-shadow: 0 0 0 4px var(--brand-ring)
    }

    .uploader__drop.is-dragover {
        border-color: var(--brand);
        border-style: solid;
        background: color-mix(in oklab, var(--brand) 8%, var(--surface-2))
    }

    .uploader__drop input[type=file] {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0
    }

    .uploader__drop i {
        font-size: 26px;
        color: var(--brand)
    }

    .uploader__drop b {
        font-size: 16px;
        font-weight: 600;
        color: var(--ink)
    }

.uploader__hint {
    font-size: var(--fs-meta);
    color: var(--ink-3)
}

/* Disabled once the file limit is reached — still readable, not a dead grey
   box with no explanation. The count line says why. */
.uploader--full .uploader__drop {
    cursor: not-allowed;
    border-style: solid;
    border-color: var(--line);
    background: var(--surface-3)
}

    .uploader--full .uploader__drop i,
    .uploader--full .uploader__drop b {
        color: var(--ink-3)
    }

.uploader__count {
    font-size: var(--fs-meta);
    font-weight: 500;
    color: var(--ink-3)
}

.uploader__list {
    display: grid;
    gap: var(--sp-3);
    margin: 0;
    padding: 0;
    list-style: none
}

.uploader__item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1)
}

.uploader__thumb {
    flex: none;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    color: var(--ink-3);
    font-size: 20px
}

    .uploader__thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block
    }

.uploader__meta {
    flex: 1;
    min-width: 0
}

.uploader__name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.uploader__size {
    display: block;
    font-size: var(--fs-meta);
    color: var(--ink-3);
    font-variant-numeric: tabular-nums
}

.uploader__remove {
    flex: none;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

    .uploader__remove:hover {
        color: var(--danger-ink);
        border-color: var(--danger-line);
        background: var(--danger-bg)
    }

    .uploader__remove:focus-visible {
        outline: none;
        border-color: var(--danger);
        box-shadow: 0 0 0 4px color-mix(in oklab, var(--danger) 22%, transparent)
    }

@media (max-width:400px) {
    .uploader__drop {
        min-height: 116px;
        padding: var(--sp-5) var(--sp-3)
    }

    .uploader__thumb {
        width: 44px;
        height: 44px
    }
}
/* ==========================================================================
   PHASE 2b ADDITION TO portal-theme.css
   --------------------------------------------------------------------------
   Append after section 24 (FILE UPLOAD). Two additions, no new tokens, no
   existing rule changed.
   ========================================================================== */

/* --------------------------------------------------------------------------
   25. TICK LIST — icon, heading, explanation

   The booking confirmation needs a "what happens next" list: three items, each
   an icon with a short heading and a line of explanation. Nothing in the system
   covers that shape. .notice is a single bordered block and three stacked
   notices read as three warnings; .pay__amounts and .modal__facts are
   two-column key/value rows with no room for a sentence.

   Reused by the cancel and reschedule confirmations in Phase 4, which need the
   same shape.
   -------------------------------------------------------------------------- */
.ticklist {
    display: grid;
    gap: var(--sp-4);
    margin: 0;
    padding: 0;
    list-style: none
}

    .ticklist li {
        display: flex;
        align-items: flex-start;
        gap: var(--sp-3)
    }

    .ticklist i {
        flex: none;
        width: 24px;
        margin-top: 3px;
        font-size: 16px;
        text-align: center;
        color: var(--brand)
    }

    .ticklist strong {
        display: block;
        margin-bottom: 2px;
        font-weight: 600;
        color: var(--ink)
    }

    .ticklist li > div {
        font-size: 15px;
        line-height: 1.5;
        color: var(--ink-2)
    }

/* --------------------------------------------------------------------------
   25a. STATE HEADING AT h1

   .state styles h3, because every existing use of it sits inside a page that
   already has an h1. The booking confirmation IS the page, so its heading has
   to be an h1 for document structure and screen-reader navigation. This gives
   that h1 the same treatment rather than making the markup lie about hierarchy.
   -------------------------------------------------------------------------- */
.state .state__title {
    font-size: var(--fs-h2);
    margin-bottom: 10px
}


/* --------------------------------------------------------------------------
   25b. TICK LIST, PLAIN VARIANT
 
   The referral step lists the corrections extraction made to what the patient
   typed. Same list shape as .ticklist, but nested inside a .notice, so it
   drops the icon column and tightens the spacing rather than sitting in the
   notice looking like a second component.
   -------------------------------------------------------------------------- */
.ticklist--plain {
    gap: 2px;
    margin: 6px 0
}

    .ticklist--plain li {
        display: list-item;
        margin-left: 18px;
        list-style: disc;
        font-size: 15px;
        line-height: 1.5
    }

    .ticklist--plain span {
        color: var(--ink-3)
    }

/* --------------------------------------------------------------------------
   25c. INLINE SPINNER
 
   Standalone, for a notice that reports work in progress — the referral
   extraction line on step 3, and the same shape in Phase 4.
 
   .btn and .slot already spin, but both do it with an ::after on themselves
   and hide their own label to make room, which is no use inside a notice
   that has to keep its text. currentColor means it takes the tone of
   whichever notice variant wraps it.
   -------------------------------------------------------------------------- */
.spinner {
    flex: none;
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2.5px solid currentColor;
    border-top-color: transparent;
    animation: spin .7s linear infinite; /* existing keyframes, section 6 */
}

@media (prefers-reduced-motion: reduce) {
    /* Still legible as "busy", without the rotation. */
    .spinner {
        animation: none;
        border-top-color: currentColor;
        opacity: .45
    }
}
/* ==========================================================================
   APPEND TO portal-theme.css — Phase 3

   One block. Nothing else in this phase needed CSS: the appointment card,
   history rows, badges, states, skeletons and buttons were all already there.
   ========================================================================== */

/* --------------------------------------------------------------------------
   26. LIST GROUP HEADING  [NEW]

   The system has .pagehead for a page title and .card__head for a header
   INSIDE a card. Neither covers a heading sitting above an unwrapped list,
   which is what "Awaiting payment", "Upcoming" and "Past" are. Wrapping each
   group in a .card to borrow .card__head would nest cards inside cards, which
   is wrong both visually and semantically.

   A global h2 is --fs-h2 (30px), the same size .pagehead h1 renders at, so a
   group heading has to step down or it competes with the page title.
   -------------------------------------------------------------------------- */
.grouphead {
    display: flex;
    align-items: baseline;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

    .grouphead h2 {
        font-size: var(--fs-h4)
    }

/* Pushes a "view all" link to the end of the row without a spacer element.
       Also applies to a .btn, so either can sit there. */
.grouphead__more {
    margin-left: auto;
    font-size: var(--fs-meta);
    font-weight: 600;
    white-space: nowrap;
}

    .grouphead__more i {
        margin-left: 5px;
        font-size: 12px
    }

/* Groups need more air between them than .stack--lg gives, because each one
   ends in a list rather than a single block — 24px reads as "part of the same
   list" where 40px reads as "a new group". */
.groups > section + section {
    margin-top: var(--sp-10)
}

@media (max-width:480px) {
    /* At 320px a long heading plus a count plus "View all 12" will not fit on
       one line. Wrapping is correct; squeezing is not. */
    .grouphead {
        flex-wrap: wrap
    }

    .grouphead__more {
        margin-left: 0;
        flex-basis: 100%
    }
}

/* --------------------------------------------------------------------------
   27. RECEIPT DOCUMENT  [NEW]

   The receipt is a framed HTML document with its own styles, so nothing in the
   design system covers it: .card would wrap it in a surface that fights the
   document's own white page, and there is no existing rule for an <iframe>.

   The frame's background is a hard #fff rather than var(--surface), and that is
   deliberate. It is a printed document, not a portal surface — it stays white in
   dark mode because that is what it looks like on paper and what it will look
   like when saved as a PDF.
   -------------------------------------------------------------------------- */
.receipt {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4)
}

.receipt__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-3)
}

/* Pushes the reference to the end of the row without a spacer element, and
       drops below the buttons rather than squeezing them at 320px. */
.receipt__ref {
    margin-left: auto;
    font-size: var(--fs-meta);
    color: var(--ink-2);
    white-space: nowrap
}

@media (max-width:480px) {
    .receipt__ref {
        margin-left: 0;
        flex-basis: 100%
    }

    /* Print is the primary action on a phone; full width beats a 44px target
       sharing a row with two others. */
    .receipt__bar .btn {
        flex: 1 1 100%
    }
}

.receipt__frame {
    display: block;
    width: 100%;
    min-height: 420px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: #fff;
    box-shadow: var(--sh-sm)
}

/* Printing from the page itself (rather than the frame) should still produce
   something sensible: chrome out, document only. */
@media print {
    .receipt__bar,
    .pagehead {
        display: none !important
    }

    .receipt__frame {
        border: 0;
        box-shadow: none;
        border-radius: 0
    }
}
