// =============================================================================
// Public booking page and widget
//
// Standalone. It shares no stylesheet with the clinical application, because it
// runs on a patient's phone from a link on somebody else's website and must not
// carry Bootstrap, the sidebar, the tables or the theme layer to ask four
// questions.
//
// Two variables come from the administrator and are set on :root by the view —
// --bk-primary and --bk-radius. Everything else derives from them, so a clinic
// changing its accent moves the whole page rather than one button.
// =============================================================================

:root {
    --bk-primary: #4f46e5;
    --bk-primary-2: #6366f1;
    --bk-radius: 16px;

    --bk-bg: #f8fafc;
    --bk-surface: #ffffff;
    --bk-border: #e5e7eb;
    --bk-text: #111827;
    --bk-muted: #6b7280;
    --bk-success: #10b981;
    --bk-danger: #ef4444;

    --bk-shadow-sm: 0 1px 2px rgb(17 24 39 / 5%);
    --bk-shadow: 0 4px 16px -6px rgb(17 24 39 / 10%), 0 1px 3px rgb(17 24 39 / 5%);
    --bk-shadow-lg: 0 18px 40px -18px rgb(17 24 39 / 22%);

    --bk-ease: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

// The clinic picks light, dark, or "follow whatever the visitor's device says".
// Auto is the default because the widget lands inside somebody else's page and
// guessing wrong is more jarring there than on a page of our own.
@mixin dark-tokens {
    --bk-bg: #0b1120;
    --bk-surface: #131c31;
    --bk-border: #24304a;
    --bk-text: #e8edf7;
    --bk-muted: #9aa8bf;

    --bk-shadow-sm: none;
    --bk-shadow: 0 4px 16px -6px rgb(0 0 0 / 50%);
    --bk-shadow-lg: 0 18px 40px -18px rgb(0 0 0 / 60%);
}

[data-theme="dark"] { @include dark-tokens; }

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] { @include dark-tokens; }
}

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

/*
 * `hidden` must actually hide.
 *
 * The attribute only carries a user-agent `display: none`, which any author
 * rule setting `display` outranks — so `.bk-btn { display: inline-flex }` left
 * the Back and Confirm buttons on screen through every step even though the
 * script had hidden them correctly. Stated once, here, rather than remembered
 * at each of the dozen places that toggle a component the script controls.
 */
[hidden] { display: none !important; }

.bk-body {
    margin: 0;
    // The action bar is sticky rather than fixed, so it no longer needs a
    // reserved strip of padding beneath it — the footer follows it in flow and
    // the bar simply comes to rest above it at the bottom of the scroll.
    padding: 2rem 1.25rem 2.5rem;
    background: var(--bk-bg);
    color: var(--bk-text);
    // Arial, like the rest of the product. The page is not permitted to fetch
    // a font either way: a booking form must not wait on a third party, and
    // the CSP forbids the origin anyway.
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

// Inside an iframe the host page supplies the margin and the background; ours
// would show as a band of the wrong colour around the widget.
.bk-body--embedded {
    padding: 0 0 1rem;
    background: transparent;
}

.bk-shell {
    max-width: 78rem;
    margin: 0 auto;
    width: 100%;
}

/*
 * Fill the viewport, so the action bar and the footer are always the bottom of
 * the page.
 *
 * Without this a short step — one clinician in the list, say — leaves the page
 * ending halfway up the screen with the buttons and the footer stranded in the
 * middle and a band of empty background below them. The slack is given to the
 * layout row instead, which pushes the pair down where they belong.
 *
 * `dvh` rather than `vh` because on mobile Safari `100vh` is the height the
 * viewport has *without* the address bar, which overshoots and reintroduces the
 * scroll this is meant to remove.
 *
 * Never applied to the widget: the embed sizes itself from scrollHeight, and a
 * shell forced to viewport height would report the visitor's screen instead of
 * the content, leaving a tall empty frame on the host's page.
 */
.bk-body:not(.bk-body--embedded) {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;

    .bk-shell {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
    }

    .bk-layout { flex: 1 1 auto; }
}

svg { width: 1em; height: 1em; }

// ---- Page head --------------------------------------------------------------

.bk-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.bk-head__clinic {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bk-primary);
}

.bk-head__title {
    margin: 0.25rem 0 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.bk-head__intro {
    margin: 0.375rem 0 0;
    color: var(--bk-muted);
}

.bk-eta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    padding: 0.75rem 1.125rem;
    background: var(--bk-surface);
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    box-shadow: var(--bk-shadow-sm);
}

.bk-eta__icon {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    font-size: 1.125rem;
    color: var(--bk-primary);
    background: color-mix(in srgb, var(--bk-primary) 12%, transparent);
}

.bk-eta__label { display: block; font-size: 0.8125rem; color: var(--bk-muted); }
.bk-eta__value { display: block; font-size: 0.875rem; color: var(--bk-primary); }

// ---- Stepper ----------------------------------------------------------------

.bk-stepper {
    padding: 1.5rem 1.75rem 1.25rem;
    margin-bottom: 1.5rem;
    background: var(--bk-surface);
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    box-shadow: var(--bk-shadow-sm);
}

.bk-stepper__list {
    display: flex;
    align-items: flex-start;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bk-stepper__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 0;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--bk-muted);

    // The connector. Drawn from each step to the previous one rather than as
    // separate elements, so it cannot fall out of step with the list.
    &:not(:first-child)::before {
        content: "";
        position: absolute;
        inset-inline-end: 50%;
        inset-inline-start: -50%;
        top: 1.25rem;
        height: 2px;
        background: var(--bk-border);
        transition: background-color var(--bk-ease);
    }

    &[data-done]::before,
    &[data-current]::before { background: var(--bk-primary); }
}

.bk-stepper__dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 2px solid var(--bk-border);
    background: var(--bk-surface);
    font-size: 0.875rem;
    font-weight: 700;
    transition: all var(--bk-ease);
}

.bk-stepper__tick { display: none; width: 1rem; height: 1rem; }

.bk-stepper__item[data-current] {
    color: var(--bk-text);

    .bk-stepper__dot {
        color: #fff;
        border-color: transparent;
        background-image: linear-gradient(135deg, var(--bk-primary), var(--bk-primary-2));
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--bk-primary) 15%, transparent);
    }
}

.bk-stepper__item[data-done] {
    color: var(--bk-text);

    .bk-stepper__dot {
        color: var(--bk-success);
        border-color: var(--bk-success);
        background: color-mix(in srgb, var(--bk-success) 12%, var(--bk-surface));
    }

    .bk-stepper__num { display: none; }
    .bk-stepper__tick { display: block; }
}

// Below this the labels stop fitting side by side; the numbered dots still say
// how far along the visitor is.
@media (max-width: 639.98px) {
    .bk-stepper { padding: 1.25rem 1rem 1rem; }
    .bk-stepper__label { font-size: 0.6875rem; }
    .bk-stepper__dot { width: 2rem; height: 2rem; }
    .bk-stepper__item:not(:first-child)::before { top: 1rem; }
}

// ---- Layout -----------------------------------------------------------------

.bk-layout {
    display: grid;
    gap: 1.5rem;
    align-items: start;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1080px) {
    .bk-layout { grid-template-columns: minmax(0, 1fr) 22rem; }

    .bk-aside {
        position: sticky;
        top: 1.5rem;
    }
}

.bk-main { min-width: 0; }

.bk-card {
    background: var(--bk-surface);
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    box-shadow: var(--bk-shadow);
    overflow: hidden;
    // Each step replaces the last in the same place; without this the swap is a
    // hard cut that reads as the page reloading.
    animation: bk-fade var(--bk-ease) both;
}

@keyframes bk-fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.bk-card__head {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--bk-border);
}

.bk-card__head--split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.bk-card__title { margin: 0; font-size: 1.0625rem; font-weight: 700; }
.bk-card__sub { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--bk-muted); }
.bk-card__body { padding: 1.5rem; }

// ---- Search -----------------------------------------------------------------

.bk-search {
    position: relative;
    margin-bottom: 1.25rem;

    svg {
        position: absolute;
        inset-inline-start: 1rem;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.125rem;
        color: var(--bk-muted);
        pointer-events: none;
    }

    input {
        width: 100%;
        min-height: 3rem;
        padding: 0.75rem 1rem 0.75rem 2.875rem;
        font: inherit;
        font-size: 1rem;
        color: var(--bk-text);
        background: var(--bk-surface);
        border: 1.5px solid var(--bk-border);
        border-radius: calc(var(--bk-radius) * 0.75);
        transition: border-color var(--bk-ease), box-shadow var(--bk-ease);

        &:focus {
            outline: none;
            border-color: var(--bk-primary);
            box-shadow: 0 0 0 4px color-mix(in srgb, var(--bk-primary) 15%, transparent);
        }
    }
}

[dir="rtl"] .bk-search input { padding: 0.75rem 2.875rem 0.75rem 1rem; }

// ---- Clinician cards --------------------------------------------------------

.bk-cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.bk-doc {
    display: grid;
    gap: 0.875rem;
    padding: 1.125rem;
    text-align: start;
    font: inherit;
    color: inherit;
    background: var(--bk-surface);
    border: 1.5px solid var(--bk-border);
    border-radius: var(--bk-radius);
    cursor: pointer;
    transition: border-color var(--bk-ease), box-shadow var(--bk-ease), transform var(--bk-ease);
    grid-template-columns: auto 1fr;

    &:hover {
        transform: translateY(-2px);
        border-color: color-mix(in srgb, var(--bk-primary) 45%, var(--bk-border));
        box-shadow: var(--bk-shadow-lg);
    }

    &:focus-visible {
        outline: 2px solid var(--bk-primary);
        outline-offset: 2px;
    }

    &[data-chosen] {
        border-color: var(--bk-primary);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--bk-primary) 18%, transparent);
    }
}

.bk-doc__avatar {
    display: grid;
    place-items: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    background-image: linear-gradient(135deg, var(--bk-primary), var(--bk-primary-2));
}

.bk-doc__body { min-width: 0; }

.bk-doc__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.bk-doc__name { font-size: 1rem; font-weight: 700; }
.bk-doc__spec { display: block; font-size: 0.875rem; color: var(--bk-primary); font-weight: 600; }
.bk-doc__meta { display: block; font-size: 0.8125rem; color: var(--bk-muted); }

.bk-badge {
    flex: 0 0 auto;
    padding: 0.1875rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #047857;
    background: color-mix(in srgb, var(--bk-success) 14%, transparent);
}

.bk-doc__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    padding-top: 0.875rem;
    margin-top: 0.125rem;
    border-top: 1px solid var(--bk-border);
    font-size: 0.75rem;
    color: var(--bk-muted);

    strong { display: block; font-size: 0.875rem; color: var(--bk-text); }
}

.bk-doc__next strong { color: var(--bk-primary); }

// ---- Date and time ----------------------------------------------------------

.bk-when {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 860px) {
    .bk-when { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); }

    .bk-when__calendar {
        border-inline-end: 1px solid var(--bk-border);
    }
}

.bk-cal { padding: 1.25rem; }

.bk-cal__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.bk-cal__month { margin: 0; font-weight: 700; }

.bk-cal__nav {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--bk-border);
    border-radius: 0.625rem;
    background: var(--bk-surface);
    color: var(--bk-muted);
    cursor: pointer;
    transition: all var(--bk-ease);

    &:hover { color: var(--bk-primary); border-color: var(--bk-primary); }
}

.bk-cal__row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.125rem;
}

.bk-cal__wd {
    padding: 0.375rem 0;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--bk-muted);
}

.bk-cal__day {
    position: relative;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0.625rem;
    background: transparent;
    color: var(--bk-text);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--bk-ease), color var(--bk-ease);

    // The availability dot. Under the number rather than replacing it, so the
    // date is still readable at a glance.
    &[data-free]::after {
        content: "";
        position: absolute;
        bottom: 0.3125rem;
        width: 0.25rem;
        height: 0.25rem;
        border-radius: 50%;
        background: var(--bk-success);
    }

    &[data-free]:hover { background: color-mix(in srgb, var(--bk-primary) 10%, transparent); }

    &:disabled {
        color: color-mix(in srgb, var(--bk-muted) 55%, transparent);
        cursor: not-allowed;
    }

    &[data-outside] { opacity: 0.4; }

    &[data-today] { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--bk-primary) 40%, transparent); }

    &[data-chosen] {
        color: #fff;
        background-image: linear-gradient(135deg, var(--bk-primary), var(--bk-primary-2));

        &::after { background: #fff; }
    }

    &:focus-visible { outline: 2px solid var(--bk-primary); outline-offset: 1px; }
}

.bk-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0 0;
    padding: 0.875rem 0 0;
    border-top: 1px solid var(--bk-border);
    list-style: none;
    font-size: 0.75rem;
    color: var(--bk-muted);

    li { display: inline-flex; align-items: center; gap: 0.375rem; }
}

.bk-legend__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;

    &--free { background: var(--bk-success); }
    &--sel { background: var(--bk-primary); }
    &--none { background: color-mix(in srgb, var(--bk-muted) 45%, transparent); }
}

.bk-tz {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--bk-border);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--bk-muted);
}

.bk-slots { padding: 1.25rem 1.5rem 1.5rem; }

.bk-slots__head {
    margin: 1.25rem 0 0.625rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--bk-muted);

    &:first-child { margin-top: 0; }
}

.bk-slots__grid {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
}

.bk-slot {
    // Comfortably above the 44px a phone needs; this is the control a patient
    // taps standing up, one-handed.
    min-height: 2.875rem;
    padding: 0.5rem;
    border: 1.5px solid var(--bk-border);
    border-radius: calc(var(--bk-radius) * 0.6);
    background: var(--bk-surface);
    color: var(--bk-text);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: all var(--bk-ease);

    &:hover { border-color: var(--bk-primary); color: var(--bk-primary); }

    &[data-chosen] {
        color: #fff;
        border-color: transparent;
        background-image: linear-gradient(135deg, var(--bk-primary), var(--bk-primary-2));
    }

    &:focus-visible { outline: 2px solid var(--bk-primary); outline-offset: 2px; }
}

// ---- Form -------------------------------------------------------------------

.bk-grid {
    display: grid;
    gap: 1.125rem;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.bk-field {
    display: flex;
    flex-direction: column;
    gap: 0.4375rem;
    min-width: 0;
}

.bk-field--wide { grid-column: 1 / -1; }

.bk-field__label {
    font-size: 0.875rem;
    font-weight: 600;

    i { color: var(--bk-danger); font-style: normal; }
    em { font-style: normal; font-weight: 500; color: var(--bk-muted); }
}

.bk-input {
    position: relative;
    display: block;

    > svg {
        position: absolute;
        inset-inline-start: 0.875rem;
        top: 0.9375rem;
        font-size: 1.0625rem;
        color: var(--bk-muted);
        pointer-events: none;
    }

    input,
    select,
    textarea {
        width: 100%;
        // 16px, because anything smaller makes iOS Safari zoom the page on
        // focus — which on a booking form reads as the site being broken.
        font: inherit;
        font-size: 1rem;
        padding: 0.75rem 0.875rem;
        color: var(--bk-text);
        background: var(--bk-surface);
        border: 1.5px solid var(--bk-border);
        border-radius: calc(var(--bk-radius) * 0.6);
        transition: border-color var(--bk-ease), box-shadow var(--bk-ease);

        &::placeholder { color: color-mix(in srgb, var(--bk-muted) 80%, transparent); }

        &:focus {
            outline: none;
            border-color: var(--bk-primary);
            box-shadow: 0 0 0 4px color-mix(in srgb, var(--bk-primary) 15%, transparent);
        }
    }

    > svg ~ input { padding-inline-start: 2.75rem; }

    textarea { resize: vertical; min-height: 6rem; }
}

.bk-counter {
    position: absolute;
    inset-inline-end: 0.75rem;
    bottom: 0.625rem;
    font-size: 0.75rem;
    color: var(--bk-muted);
}

// Off-screen rather than display:none — some bots skip fields that are not
// rendered at all, and this one is meant to be filled in.
.bk-pot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.bk-terms {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--bk-border);
    font-size: 0.875rem;
    color: var(--bk-muted);

    input { margin-top: 0.25rem; width: 1.0625rem; height: 1.0625rem; accent-color: var(--bk-primary); }
    a { color: var(--bk-primary); }
}

// ---- Review -----------------------------------------------------------------

.bk-review { padding: 0.5rem 1.5rem; }

.bk-review__row {
    display: grid;
    align-items: center;
    gap: 1rem;
    padding: 1.125rem 0;
    border-bottom: 1px solid var(--bk-border);
    grid-template-columns: minmax(6rem, 9rem) 1fr auto;

    &:last-child { border-bottom: 0; }
}

.bk-review__label { font-size: 0.8125rem; font-weight: 700; color: var(--bk-muted); }
.bk-review__body { min-width: 0; }
.bk-review__main { margin: 0; font-weight: 650; }
.bk-review__sub { margin: 0.125rem 0 0; font-size: 0.875rem; color: var(--bk-muted); }

@media (max-width: 639.98px) {
    .bk-review__row { grid-template-columns: 1fr auto; }
    .bk-review__label { grid-column: 1 / -1; }
}

.bk-notice {
    display: flex;
    gap: 0.875rem;
    margin: 0.5rem 1.5rem 1.5rem;
    padding: 1.125rem;
    border-radius: var(--bk-radius);
    background: color-mix(in srgb, var(--bk-primary) 7%, transparent);
}

.bk-notice__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: #fff;
    font-size: 1rem;
    background: var(--bk-primary);
}

.bk-notice__title { margin: 0 0 0.375rem; font-weight: 700; font-size: 0.9375rem; }

.bk-notice__list {
    margin: 0;
    padding-inline-start: 1.125rem;
    font-size: 0.875rem;
    color: var(--bk-muted);

    li + li { margin-top: 0.25rem; }
}

// ---- Summary rail -----------------------------------------------------------

.bk-summary { animation: none; }

.bk-summary__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--bk-border);
}

.bk-summary__icon {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    font-size: 1.125rem;
    color: var(--bk-primary);
    background: color-mix(in srgb, var(--bk-primary) 12%, transparent);
}

.bk-summary__title { margin: 0; font-size: 1rem; font-weight: 700; }
.bk-summary__body { padding: 1.25rem 1.5rem; }
.bk-summary__empty { margin: 0; font-size: 0.875rem; color: var(--bk-muted); }

.bk-summary__who {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--bk-border);
}

.bk-summary__avatar {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    font-weight: 700;
    color: #fff;
    background-image: linear-gradient(135deg, var(--bk-primary), var(--bk-primary-2));
}

.bk-summary__name { margin: 0; font-weight: 700; }
.bk-summary__spec { margin: 0; font-size: 0.8125rem; color: var(--bk-muted); }

.bk-summary__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.625rem 0;
    font-size: 0.875rem;

    & + & { border-top: 1px solid var(--bk-border); }
}

.bk-summary__label { color: var(--bk-muted); }
.bk-summary__value { font-weight: 650; text-align: end; }

.bk-trust {
    display: flex;
    gap: 0.75rem;
    margin: 0 1.5rem 1.5rem;
    padding: 1rem;
    border-radius: calc(var(--bk-radius) * 0.75);
    background: color-mix(in srgb, var(--bk-success) 8%, transparent);
}

.bk-trust__icon {
    flex: 0 0 auto;
    font-size: 1.125rem;
    color: var(--bk-success);
}

.bk-trust__title { margin: 0; font-size: 0.875rem; font-weight: 700; }
.bk-trust__text { margin: 0.125rem 0 0; font-size: 0.8125rem; color: var(--bk-muted); }

// ---- Confirmation -----------------------------------------------------------

.bk-done { text-align: center; padding: 3rem 1.5rem; }

.bk-done__mark {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    font-size: 2rem;
    color: #fff;
    background: var(--bk-success);
    animation: bk-pop 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes bk-pop {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.bk-done__text { margin: 0 auto 1.5rem; max-width: 28rem; color: var(--bk-muted); }

.bk-done__ref {
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    padding: 1rem 2rem;
    border: 1px dashed var(--bk-border);
    border-radius: var(--bk-radius);

    span { font-size: 0.75rem; color: var(--bk-muted); }
    strong { font-size: 1.375rem; letter-spacing: 0.04em; }
}

.bk-done__phone { margin: 1.5rem 0 0; font-size: 0.875rem; color: var(--bk-muted); }

// ---- Empty, error, skeleton --------------------------------------------------

.bk-empty {
    margin: 0;
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.9375rem;
    color: var(--bk-muted);
}

.bk-error {
    margin: 1rem 0 0;
    padding: 0.875rem 1.125rem;
    border: 1px solid color-mix(in srgb, var(--bk-danger) 45%, transparent);
    border-radius: calc(var(--bk-radius) * 0.6);
    background: color-mix(in srgb, var(--bk-danger) 8%, transparent);
    color: #b91c1c;
    font-size: 0.875rem;
}

[data-theme="dark"] .bk-error { color: #fca5a5; }

.bk-skeleton {
    border-radius: calc(var(--bk-radius) * 0.6);
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--bk-muted) 10%, transparent) 25%,
        color-mix(in srgb, var(--bk-muted) 18%, transparent) 37%,
        color-mix(in srgb, var(--bk-muted) 10%, transparent) 63%
    );
    background-size: 400% 100%;
    animation: bk-shimmer 1.4s ease infinite;

    &--card { height: 8.5rem; }
    &--slot { height: 2.875rem; }
    &--cal { height: 17rem; }
}

@keyframes bk-shimmer {
    from { background-position: 100% 50%; }
    to { background-position: 0 50%; }
}

// ---- Action bar --------------------------------------------------------------

.bk-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    // Bleeds into the body padding so the bar reads as a floor for the page
    // rather than as a card that happens to be last.
    margin: 1.5rem -1.25rem 0;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--bk-border);
    background: color-mix(in srgb, var(--bk-surface) 92%, transparent);
    backdrop-filter: blur(10px);
}

.bk-body--embedded .bk-actions { margin-inline: 0; }

.bk-actions__start,
.bk-actions__end {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.bk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0 1.5rem;
    border: 1.5px solid transparent;
    border-radius: calc(var(--bk-radius) * 0.6);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    transition: all var(--bk-ease);

    &:disabled { opacity: 0.5; cursor: not-allowed; }
    &:focus-visible { outline: 2px solid var(--bk-primary); outline-offset: 2px; }
}

.bk-btn--primary {
    color: #fff;
    background-image: linear-gradient(135deg, var(--bk-primary), var(--bk-primary-2));
    box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--bk-primary) 60%, transparent);

    &:not(:disabled):hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--bk-primary) 70%, transparent);
    }

    &:not(:disabled):active { transform: none; }
}

.bk-btn--ghost {
    color: var(--bk-text);
    border-color: var(--bk-border);
    background: var(--bk-surface);

    &:hover { border-color: var(--bk-primary); color: var(--bk-primary); }
}

.bk-btn--quiet {
    color: var(--bk-danger);
    background: transparent;

    &:hover { background: color-mix(in srgb, var(--bk-danger) 8%, transparent); }
}

.bk-btn--edit {
    min-height: 2.25rem;
    padding: 0 0.875rem;
    font-size: 0.8125rem;
    color: var(--bk-primary);
    border-color: var(--bk-border);
    background: var(--bk-surface);

    &:hover { border-color: var(--bk-primary); }
}

// A submitting button says so rather than merely going grey — this is the one
// press in the flow with a consequence, and it is where a slow connection makes
// people press twice.
.bk-btn.is-busy {
    position: relative;
    color: transparent;

    &::after {
        content: "";
        position: absolute;
        width: 1.125rem;
        height: 1.125rem;
        border: 2px solid rgb(255 255 255 / 40%);
        border-top-color: #fff;
        border-radius: 50%;
        animation: bk-spin 700ms linear infinite;
    }
}

@keyframes bk-spin { to { transform: rotate(360deg); } }

@media (max-width: 559.98px) {
    .bk-actions__start,
    .bk-actions__end { flex: 1 1 100%; }

    .bk-actions__end .bk-btn { flex: 1 1 auto; }
}

// ---- Footer ------------------------------------------------------------------
//
// The same two lines the sign-in screen carries, rebuilt in this page's own
// tokens — the booking bundle has no Tailwind and no icon component, and pulling
// either in for a footer would cost more than the footer is worth.

.bk-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.75rem;
    font-size: 0.75rem;
    color: var(--bk-muted);

    p { margin: 0; }
}

.bk-footer__copy {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;

    svg {
        font-size: 0.875rem;
        color: color-mix(in srgb, var(--bk-muted) 70%, transparent);
    }
}

.bk-footer__vendor {
    a,
    strong {
        font-weight: 600;
        color: var(--bk-primary);
        text-decoration: none;
        transition: opacity var(--bk-ease);
    }

    a:hover { opacity: 0.8; }
}

// Centred once the two halves stop sharing a line, so neither is left hanging
// off one edge.
@media (max-width: 559.98px) {
    .bk-footer {
        justify-content: center;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bk-card,
    .bk-done__mark,
    .bk-skeleton { animation: none; }

    .bk-doc,
    .bk-slot,
    .bk-btn,
    .bk-cal__day,
    .bk-stepper__dot,
    .bk-input input,
    .bk-input select,
    .bk-input textarea { transition: none; }

    .bk-doc:hover,
    .bk-btn--primary:hover { transform: none; }
}
