/* ============================================================
   main.css - BQS Global Stylesheet ("Subway" design)
   ============================================================
   Everything shared across the app lives here: tokens for the light
   and dark themes, the tile wall, the station-sign navbar, buttons,
   forms, cards, badges, pet bullets, the line map, the tab bar (and
   its phone bottom bar with the More sheet), modals, chat, the train
   loader, the footer band and the sign-in pages.

   Pages may add their own rules in {% block extra_css %} (base.html),
   which loads AFTER this file. A page must never redeclare a selector
   defined here: the later copy silently wins.

   Themes: light is :root. Dark applies in two cases, always written as
   a pair of selectors:
     1. the system is dark and the user has not forced light
        @media (prefers-color-scheme: dark) { html:not([data-theme="light"]) }
     2. the user chose dark with the toggle
        html[data-theme="dark"]
   ============================================================ */


/* ── TOKENS ──────────────────────────────────────────────────
   ---------------------------------------------------------- */
:root {
    /* the three trains */
    --b-orange: #FF6319;
    --q-yellow: #FCCC0A;
    --s-grey:   #808183;

    /* the sign: real black in both themes */
    --sign:          #000000;
    --on-sign:       #FFFFFF;
    --on-sign-muted: #C9CBCE;

    --font: Arimo, "Helvetica Neue", Helvetica, Arial, sans-serif;
    --radius: 3px;
    --navbar-height: 64px;
    --tile-size: 96px 96px;
    --tabbar-height: 69px; /* phone bottom bar, border + padding included, safe area excluded */

    /* pet route colours (4.6): outside the brand trio and the status dots */
    --pet-0: #009C9A;
    --pet-1: #E0559A;
    --pet-2: #7B5BC9;
    --pet-3: #2E9BD6;
    --pet-4: #7C8C1F;
    --pet-5: #8A3D74;
    --pet-6: #B39DDB;
    --pet-7: #4CB58C;

    /* light theme: a white-tiled station wall */
    --sign-edge:    transparent;
    --page:         #F5F6F7;
    --surface:      #FFFFFF;
    --ink:          #000000;
    --muted:        #55585C;
    --line:         #D3D6DA;
    --tint:         #EEF0F2;
    --field-border: #808183;
    --danger-text:  #C4261F;
    --focus:        #0039A6;
    --btn-primary-border: #000000;
    --star-stroke:  1.1px #000000;

    /* status dots: other lines on the map, so they never read as B, Q or S */
    --st-accepted:    #0039A6;
    --st-in-progress: #00933C;
    /* green used as TEXT (or a text-bearing border): passes 4.5:1 on surface, tint, page */
    --success-text:   #007A33;
    --st-stopped:     #EE352E;

    /* glazed tile, light */
    --tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96' preserveAspectRatio='none'%3E%3Crect x='0' y='0' width='96' height='96' fill='%23F4F6F8'/%3E%3Crect x='0' y='0' width='96' height='2' fill='%23C3C9D1'/%3E%3Crect x='0' y='48' width='96' height='2' fill='%23C3C9D1'/%3E%3Crect x='0' y='0' width='2' height='48' fill='%23C3C9D1'/%3E%3Crect x='48' y='48' width='2' height='48' fill='%23C3C9D1'/%3E%3Crect x='2' y='2' width='94' height='1' fill='%23FFFFFF' fill-opacity='0.95'/%3E%3Crect x='2' y='2' width='1' height='46' fill='%23FFFFFF' fill-opacity='0.95'/%3E%3Crect x='2' y='47' width='94' height='1' fill='%23000000' fill-opacity='0.09'/%3E%3Crect x='95' y='2' width='1' height='46' fill='%23000000' fill-opacity='0.09'/%3E%3Crect x='50' y='50' width='46' height='1' fill='%23FFFFFF' fill-opacity='0.95'/%3E%3Crect x='50' y='50' width='1' height='46' fill='%23FFFFFF' fill-opacity='0.95'/%3E%3Crect x='50' y='95' width='46' height='1' fill='%23000000' fill-opacity='0.09'/%3E%3Crect x='0' y='50' width='48' height='1' fill='%23FFFFFF' fill-opacity='0.95'/%3E%3Crect x='0' y='95' width='48' height='1' fill='%23000000' fill-opacity='0.09'/%3E%3Crect x='47' y='50' width='1' height='46' fill='%23000000' fill-opacity='0.09'/%3E%3C/svg%3E");

    /* the street scene: day art in light, the night version in dark (same
       size and composition, so every crop position works in both) */
    --scene-full: url('/static/img/scene-full.webp');
    --scene-wide: url('/static/img/scene-wide.webp');
    --scene-wide-2x: url('/static/img/scene-wide-2x.webp');
    --scene-band: url('/static/img/scene-band.webp');
    --scene-fill: #4F8A83; /* flat colour behind the band while it loads */
    --scene-stage-fill: #64ACB4; /* sky colour, shown only while the scene image loads */

    /* train loader colours (subset of the mural palette) */
    --m-line: #808183;
    --m-line-stop: #FFFFFF;
    --m-car: #B9C0C8;
    --m-car-edge: #868E97;
    --m-car-glass: #2C3A4C;
    --m-car-lit: #EEF0EA;
    --m-lit: var(--m-car-glass);
    --m-wheel: #1F2226;
    --m-headlight: #FFFFFF;
    --m-uniform: #1F2A44;
    --m-cap: #1F2A44;
    --m-cap-band: #000000;
    --tongue: #E0559A;
    --cat-train-b: #1E1F22;
    --cat-train-a: #E7A9B8;
    --cat-train-e: #8DCB6A;
    --dog-conductor-b: #8C939B;
    --dog-conductor-a: #2A2D33;
    --dog-conductor-e: #1E1F22;

    /* spacing scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* type scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
}

/* dark theme: the sign itself (system preference, unless forced light) */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        color-scheme: dark;
        --sign-edge:    #36383C;
        --page:         #0E0E0F;
        --surface:      #1A1A1C;
        --ink:          #FFFFFF;
        --muted:        #B4B7BB;
        --line:         #36383C;
        --tint:         #242528;
        --field-border: #808183;
        --danger-text:  #FF6B63;
        --focus:        #FCCC0A;
        --btn-primary-border: #FCCC0A;
        --star-stroke:  0 transparent;
        --st-accepted:    #5B9BFF;
        --st-in-progress: #2DBE60;
        --success-text:   #2DBE60;
        --st-stopped:     #FF5A52;
        --tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96' preserveAspectRatio='none'%3E%3Crect x='0' y='0' width='96' height='96' fill='%23111214'/%3E%3Crect x='0' y='0' width='96' height='2' fill='%232E3136'/%3E%3Crect x='0' y='48' width='96' height='2' fill='%232E3136'/%3E%3Crect x='0' y='0' width='2' height='48' fill='%232E3136'/%3E%3Crect x='48' y='48' width='2' height='48' fill='%232E3136'/%3E%3Crect x='2' y='2' width='94' height='1' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='2' y='2' width='1' height='46' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='2' y='47' width='94' height='1' fill='%23000000' fill-opacity='0.6'/%3E%3Crect x='95' y='2' width='1' height='46' fill='%23000000' fill-opacity='0.6'/%3E%3Crect x='50' y='50' width='46' height='1' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='50' y='50' width='1' height='46' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='50' y='95' width='46' height='1' fill='%23000000' fill-opacity='0.6'/%3E%3Crect x='0' y='50' width='48' height='1' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='0' y='95' width='48' height='1' fill='%23000000' fill-opacity='0.6'/%3E%3Crect x='47' y='50' width='1' height='46' fill='%23000000' fill-opacity='0.6'/%3E%3C/svg%3E");
        --scene-full: url('/static/img/scene-full-night.webp');
        --scene-wide: url('/static/img/scene-wide-night.webp');
        --scene-wide-2x: url('/static/img/scene-wide-night-2x.webp');
        --scene-band: url('/static/img/scene-band-night.webp');
        --scene-fill: #30282B; /* sampled: the night band's dominant dark (track bed) */
        --scene-stage-fill: #141C34; /* sky colour, shown only while the scene image loads */
        --m-line-stop: #1A1A1C;
        --m-car: #5A6069;
        --m-car-edge: #3B4047;
        --m-car-glass: #11161D;
        --m-car-lit: #F2CF8A;
        --m-lit: #F2CF8A;
        --m-wheel: #000000;
        --m-headlight: #FFF3C4;
        --m-uniform: #14161A;
        --m-cap: #14161A;
        --m-cap-band: #14161A;
        --tongue: #14161A;
    }
}
/* dark theme: chosen with the toggle */
html[data-theme="dark"] {
    color-scheme: dark;
    --sign-edge:    #36383C;
    --page:         #0E0E0F;
    --surface:      #1A1A1C;
    --ink:          #FFFFFF;
    --muted:        #B4B7BB;
    --line:         #36383C;
    --tint:         #242528;
    --field-border: #808183;
    --danger-text:  #FF6B63;
    --focus:        #FCCC0A;
    --btn-primary-border: #FCCC0A;
    --star-stroke:  0 transparent;
    --st-accepted:    #5B9BFF;
    --st-in-progress: #2DBE60;
    --success-text:   #2DBE60;
    --st-stopped:     #FF5A52;
    --tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96' preserveAspectRatio='none'%3E%3Crect x='0' y='0' width='96' height='96' fill='%23111214'/%3E%3Crect x='0' y='0' width='96' height='2' fill='%232E3136'/%3E%3Crect x='0' y='48' width='96' height='2' fill='%232E3136'/%3E%3Crect x='0' y='0' width='2' height='48' fill='%232E3136'/%3E%3Crect x='48' y='48' width='2' height='48' fill='%232E3136'/%3E%3Crect x='2' y='2' width='94' height='1' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='2' y='2' width='1' height='46' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='2' y='47' width='94' height='1' fill='%23000000' fill-opacity='0.6'/%3E%3Crect x='95' y='2' width='1' height='46' fill='%23000000' fill-opacity='0.6'/%3E%3Crect x='50' y='50' width='46' height='1' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='50' y='50' width='1' height='46' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='50' y='95' width='46' height='1' fill='%23000000' fill-opacity='0.6'/%3E%3Crect x='0' y='50' width='48' height='1' fill='%23FFFFFF' fill-opacity='0.09'/%3E%3Crect x='0' y='95' width='48' height='1' fill='%23000000' fill-opacity='0.6'/%3E%3Crect x='47' y='50' width='1' height='46' fill='%23000000' fill-opacity='0.6'/%3E%3C/svg%3E");
    --scene-full: url('/static/img/scene-full-night.webp');
    --scene-wide: url('/static/img/scene-wide-night.webp');
    --scene-wide-2x: url('/static/img/scene-wide-night-2x.webp');
    --scene-band: url('/static/img/scene-band-night.webp');
    --scene-fill: #30282B; /* sampled: the night band's dominant dark (track bed) */
    --scene-stage-fill: #141C34; /* sky colour, shown only while the scene image loads */
    --m-line-stop: #1A1A1C;
    --m-car: #5A6069;
    --m-car-edge: #3B4047;
    --m-car-glass: #11161D;
    --m-car-lit: #F2CF8A;
    --m-lit: #F2CF8A;
    --m-wheel: #000000;
    --m-headlight: #FFF3C4;
    --m-uniform: #14161A;
    --m-cap: #14161A;
    --m-cap-band: #14161A;
    --tongue: #14161A;
}


/* ── RESET & BASE ────────────────────────────────────────────
   ---------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    color-scheme: light;
    font-size: 16px;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* Page shell: a flex column, so the footer band sits at the foot of
   short pages and the content area takes the rest. The wall behind
   everything is glazed tile. */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: var(--font);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--ink);
    background: var(--page) var(--tile);
    background-size: var(--tile-size);
}

a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
}

    a:hover {
        text-decoration-thickness: 3px;
    }

button { font: inherit; }

img {
    max-width: 100%;
    display: block;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.main-content {
    flex: 1 0 auto;
    padding-top: var(--navbar-height);
}

.auth-page .main-content {
    display: flex;
    flex-direction: column;
    padding-top: 0;
}

/* Icons: <svg class="icon"><use href="#i-NAME"></use></svg> (main.js icon()) */
.icon {
    width: 1.25em;
    height: 1.25em;
    flex: none;
    vertical-align: -0.2em;
}


/* ── ROUTE BULLETS ───────────────────────────────────────────
   The round line badges: brand B / Q / S and the pet bullets.
   ---------------------------------------------------------- */
.route-bullet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75em;
    height: 1.75em;
    flex: none;
    border-radius: 50%;
    font-weight: 700;
    line-height: 1;
    color: #000000;
}

.route-bullet--b { background: var(--b-orange); }
.route-bullet--q { background: var(--q-yellow); }
.route-bullet--s { background: var(--s-grey); }


/* ── NAVBAR: the station sign ────────────────────────────────
   ---------------------------------------------------------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 8px 32px 0;
    background: var(--sign);
    color: var(--on-sign);
    border-bottom: 1px solid var(--sign-edge);
    --focus: #FCCC0A;
}

    .navbar::before { /* the thin white rule near the top edge */
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: 6px;
        height: 2px;
        background: var(--on-sign);
    }

.nav-brand { min-width: 0; }

.brand-link {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--on-sign);
}

    .brand-link:hover .brand-name { text-decoration: underline; text-underline-offset: 4px; }

.brand-icon {
    display: flex;
    gap: 5px;
    font-size: 1rem;
}

.brand-name {
    font-size: 1.1875rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 8px;
    margin-right: auto;
    padding-left: 12px;
}

.nav-link {
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--on-sign-muted);
    text-decoration: none;
    white-space: nowrap;
}

    .nav-link:hover {
        color: var(--on-sign);
        text-decoration: underline;
        text-underline-offset: 4px;
    }

.nav-right {
    position: relative; /* anchors the notification panel */
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-username {
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: nowrap;
}

    .nav-username:empty { display: none; }

.theme-toggle,
.bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: none;
    color: var(--on-sign);
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
}

    @media (hover: hover) {
        .theme-toggle:hover,
        .bell-btn:hover { background: var(--q-yellow); color: #000000; }
    }

    .theme-toggle .icon,
    .bell-btn .icon {
        width: 22px;
        height: 22px;
        vertical-align: 0;
    }

/* moon in light (switch to dark), sun in dark (switch to light) */
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
    html:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.bell-badge { /* unread count as a small B bullet */
    position: absolute;
    top: 1px;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--b-orange);
    color: #000000;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
}

.logout-btn {
    padding: 7px 14px;
    background: none;
    color: var(--on-sign);
    border: 1.5px solid #6A6C70;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

    @media (hover: hover) {
        .logout-btn:hover { background: var(--q-yellow); color: #000000; border-color: var(--q-yellow); }
    }

/* Desktop: the bar stays full-bleed; its items line up with the 1120px
   content column. Brand left, role link centred, controls right. */
@media (min-width: 761px) {
    .navbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 32px;
        padding: 8px max(32px, calc((100% - 1056px) / 2)) 0;
    }

    .nav-links { margin: 0; padding: 0; justify-self: center; }
    .nav-link { padding: 10px 16px; }
    .nav-right { justify-self: end; gap: 10px; }
    .theme-toggle, .bell-btn { width: 44px; height: 44px; }

    .nav-username {
        padding: 0 6px 0 14px;
        margin-left: 4px;
        border-left: 1px solid #3A3B3F;
        line-height: 28px;
    }

    .logout-btn { padding: 10px 18px; }

    /* Any name length, by construction: the two side tracks are equal
       (minmax(0, 1fr)), so the role link stays centred; .nav-right fills
       its track exactly and the name is the one item allowed to shrink
       (ellipsis), so the controls can never grow past the 32px grid gap
       into the link. The brand text shrinks the same way on its side. */
    .nav-brand,
    .brand-link { min-width: 0; }

    .brand-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-right {
        justify-self: stretch;
        justify-content: flex-end;
        min-width: 0;
    }

    .nav-right > .theme-toggle,
    .nav-right > .bell-btn,
    .nav-right > .logout-btn { flex: none; }

    .nav-username {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Narrow desktop: three full tracks do not fit. The sign drops to what the
   phone shows (bullets, role link, toggle, bell, Log out); the name is still
   on the account page. */
@media (min-width: 761px) and (max-width: 959px) {
    .navbar .brand-name,
    .navbar .nav-username { display: none; }
}


/* ── NOTIFICATION PANEL ──────────────────────────────────────
   The dropdown under the bell.
   ---------------------------------------------------------- */
.notification-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 120;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: var(--surface);
    color: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    --focus: #0039A6;
}

html[data-theme="dark"] .notification-panel { --focus: #FCCC0A; }
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .notification-panel { --focus: #FCCC0A; }
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 2px solid var(--ink);
    font-weight: 700;
}

.mark-read-btn {
    font-size: 0.875rem;
}

.notification-list {
    max-height: min(420px, calc(100vh - var(--navbar-height) - 90px));
    overflow-y: auto;
}

.notification-item {
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    font-size: 0.9375rem;
    line-height: 1.4;
    min-height: 44px;
    color: var(--muted);
}

    .notification-item:first-child { border-top: 0; }

    .notification-item.unread {
        color: var(--ink);
        font-weight: 700;
    }

.notification-date {
    display: block;
    margin-top: 4px;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--muted);
}

.notif-new {
    display: inline-block;
    margin-right: 8px;
    padding: 1px 6px;
    background: var(--ink);
    color: var(--surface);
    border-radius: 2px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    vertical-align: 1px;
}

.no-notifications {
    padding: 20px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9375rem;
}


/* ── BUTTONS ─────────────────────────────────────────────────
   Flat sign blocks: no shadows, no lift on hover.
   ---------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

    .btn:hover { text-decoration: none; }

    .btn:disabled,
    .btn[aria-disabled="true"] {
        opacity: 0.55;
        cursor: not-allowed;
    }

.btn-sm {
    padding: 8px 14px;
    font-size: 0.875rem;
}

/* full-width form buttons stand as tall as the fields above them (50px,
   login-final.html); other buttons keep the dashboard's 1.2 line height */
.btn-full { width: 100%; line-height: 1.5; }

.btn-primary {
    background: var(--q-yellow);
    color: #000000;
    border-color: var(--btn-primary-border);
}

    @media (hover: hover) {
        .btn-primary:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--b-orange); color: #000000; }
    }

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--ink);
}

    @media (hover: hover) {
        .btn-secondary:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--q-yellow); color: #000000; }
    }

.btn-danger {
    background: var(--surface);
    color: var(--danger-text);
    border-color: var(--danger-text);
}

    .btn-danger:hover:not(:disabled) { background: var(--danger-text); color: var(--surface); }

.btn-success {
    background: var(--surface);
    color: var(--success-text);
    border-color: var(--success-text);
}

    .btn-success:hover:not(:disabled) { background: var(--success-text); color: var(--surface); }

/* text-only, for tertiary actions ("Mark all read") */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    background: none;
    color: var(--ink);
    border: 0;
    border-radius: var(--radius);
    font-family: var(--font);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

    @media (hover: hover) {
        .btn-ghost:hover:not(:disabled):not([aria-disabled="true"]) {
            background: var(--q-yellow);
            color: #000000;
            text-decoration: none;
        }
    }

.btn.btn-ghost { padding: 8px 6px; }

/* spinner inside a button while it works */
.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    pointer-events: none;
    opacity: 0.8;
}


/* ── FORMS ───────────────────────────────────────────────────
   ---------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-label {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--ink);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 11px 14px;
    font: inherit; /* Arimo 1rem / 1.5, as both mockups */
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--field-border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

    .form-input::placeholder,
    .form-textarea::placeholder {
        color: var(--muted);
        opacity: 1;
    }

    .form-input:hover, .form-input:focus,
    .form-select:hover, .form-select:focus,
    .form-textarea:hover, .form-textarea:focus {
        border-color: var(--ink);
    }

/* single-line fields are all one height (48px, the mockups' field) */
.form-input,
.form-select { min-height: 48px; }

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-input.error { border-color: var(--danger-text); }

.form-error {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--danger-text);
    margin-top: 2px;
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 16px;
}

/* a checkbox (or radio) and its text, side by side */
.check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    font-weight: 400;
    cursor: pointer;
}

    .check-label input {
        width: 18px;
        height: 18px;
        flex: none;
        accent-color: var(--ink);
    }

/* a numbered heading inside a long form ("Step 1, personal information") */
.form-step {
    margin: 28px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-size: 1.0625rem;
    font-weight: 700;
}

    .form-step:first-of-type { margin-top: 4px; }


/* ── ALERTS ──────────────────────────────────────────────────
   Service-advisory notices: a black block with an icon, then the
   panel. The icon is CSS, so showError() keeps setting textContent.
   ---------------------------------------------------------- */
.alert {
    position: relative;
    margin-bottom: 20px;
    padding: 14px 16px 14px 68px;
    min-height: 52px;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.4;
    border-radius: var(--radius);
}

    .alert::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 52px;
        border-radius: var(--radius) 0 0 var(--radius);
        background-color: #000000;
        background-position: center;
        background-size: 26px;
        background-repeat: no-repeat;
    }

.alert-error {
    background: var(--q-yellow);
    color: #000000;
}

    .alert-error::before {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 2.5 20h19z' fill='%23FCCC0A'/%3E%3Cpath d='M12 9.5v5' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='17.3' r='1.3' fill='%23000'/%3E%3C/svg%3E");
    }

.alert-success {
    background: var(--tint);
    color: var(--ink);
    border: 1px solid var(--line);
}

    .alert-success::before {
        top: -1px;
        bottom: -1px;
        left: -1px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.5 12.8l4.8 4.7L19.5 7.2' fill='none' stroke='%232DBE60' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    }


/* ── CARDS ───────────────────────────────────────────────────
   ---------------------------------------------------------- */
.card {
    padding: 28px 32px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--ink);
}

    .card-header .text-sm { margin: 0; }

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--ink);
}


/* ── STATUS BADGES ───────────────────────────────────────────
   Dot plus text, never colour alone. Labels come in sentence case.
   ---------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
    padding: 4px 11px 4px 9px;
    background: var(--tint);
    color: var(--ink);
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

    .badge::before {
        content: "";
        width: 10px;
        height: 10px;
        border-radius: 50%;
        flex: none;
        background: var(--ink);
    }

.badge-pending::before { background: transparent; border: 2.5px solid var(--ink); }
/* diamond, so accepted differs from the round dots by shape too */
.badge-accepted::before { background: var(--st-accepted); border-radius: 2px; transform: rotate(45deg) scale(0.85); }
.badge-in_progress::before,
.badge-active::before { background: var(--st-in-progress); }
.badge-completed::before { background: var(--ink); }
.badge-declined::before,
.badge-cancelled::before,
.badge-rejected::before { background: var(--st-stopped); }


/* ── PETS ARE THE ROUTES ─────────────────────────────────────
   Each pet rides under its own route bullet (main.js petBullet()).
   ---------------------------------------------------------- */
.pet-bullet { font-size: 0.75em; }
.pet-bullet--c0 { background: var(--pet-0); color: #000000; }
.pet-bullet--c1 { background: var(--pet-1); color: #000000; }
.pet-bullet--c2 { background: var(--pet-2); color: #FFFFFF; }
.pet-bullet--c3 { background: var(--pet-3); color: #000000; }
.pet-bullet--c4 { background: var(--pet-4); color: #000000; }
.pet-bullet--c5 { background: var(--pet-5); color: #FFFFFF; }
.pet-bullet--c6 { background: var(--pet-6); color: #000000; }
.pet-bullet--c7 { background: var(--pet-7); color: #000000; }

.pet-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 6px;
    font-weight: 400;
    font-size: 1rem;
}

.pet-tag {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3em;
    white-space: nowrap;
}

    .pet-tag .pet-bullet { align-self: center; }

/* the line map's "you are here": a small car carrying the pets */
.pet-car {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: var(--stop-row, 32px);
    padding: 0 5px;
    background: var(--surface);
    border: 3px solid var(--ink);
    border-radius: 9px;
}

    .pet-car .pet-bullet { font-size: 0.6875rem; width: 20px; height: 20px; }

/* the now board: the pets riding with the sitter */
.now-board-pets { display: inline-flex; flex: none; gap: 3px; }
.now-board-pets .pet-bullet { font-size: 0.6875rem; width: 20px; height: 20px; }


/* ── THE LINE MAP ────────────────────────────────────────────
   Booking progress as four stops (main.js lineMap()).
   ---------------------------------------------------------- */
.line-map {
    --stop-row: 32px;
    --track: 6px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    list-style: none;
    padding-top: 4px;
}

.stop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

    .stop + .stop::before { /* the track arriving at this stop */
        content: "";
        position: absolute;
        right: 50%;
        width: 100%;
        top: calc((var(--stop-row) - var(--track)) / 2);
        height: var(--track);
        background: var(--s-grey);
    }

    .stop.is-passed::before,
    .stop.is-current::before { background: var(--b-orange); }

.stop-dot { /* a stop still ahead */
    position: relative;
    z-index: 1;
    width: 14px;
    height: 14px;
    margin: calc((var(--stop-row) - 14px) / 2) 0;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--s-grey);
}

.stop.is-passed .stop-dot { background: var(--ink); border-color: var(--ink); }

.stop.is-current .stop-dot { /* you are here: a Q bullet */
    width: 24px;
    height: 24px;
    margin: calc((var(--stop-row) - 24px) / 2) 0;
    background: var(--q-yellow);
    border: 3px solid var(--ink);
}

.stop.is-current.is-terminal .stop-dot { /* end of the line */
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    border-color: var(--ink);
    color: var(--surface);
}

.stop-dot .icon { width: 14px; height: 14px; vertical-align: 0; }

.line-map .stop.is-current .stop-dot.stop-dot--pets {
    display: block;
    width: auto;
    height: auto;
    margin: 0;
    background: none;
    border: 0;
    border-radius: 0;
    color: inherit;
}

.stop-name {
    font-size: 0.8125rem;
    line-height: 1.25;
    color: var(--muted);
}

.stop.is-passed .stop-name { color: var(--ink); }
.stop.is-current .stop-name { color: var(--ink); font-weight: 700; }

.stop-here {
    margin-top: -4px;
    font-size: 0.75rem;
    line-height: 1.25;
    color: var(--muted);
    white-space: nowrap;
}

.stop:first-child .stop-here { align-self: flex-start; }
.stop:last-child .stop-here { align-self: flex-end; }


/* ── BOOKING CARDS ───────────────────────────────────────────
   Details on the left, the line map on the right.
   ---------------------------------------------------------- */
.booking-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
    gap: 20px 48px;
    align-items: start;
    padding: 24px 0;
}

    .booking-card + .booking-card { border-top: 1px solid var(--line); }

/* no line map (past, declined, cancelled): one column */
.booking-card--no-map { grid-template-columns: minmax(0, 1fr); }

.booking-card-main { min-width: 0; }

.booking-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
}

.booking-card-title-wrap { min-width: 0; }

.booking-card-title {
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.booking-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
    margin-top: 8px;
    font-size: 0.9375rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

    /* Divider before every item, pulled 1px outside the box so the one
       that starts each line (the first, or the first after a wrap) is
       clipped away: a wrapped line never begins with a stray rule. The
       -14px on the box puts the first item's text back on the column edge;
       spacing between items is the mockup's 14px | 14px. */
    .booking-card-meta {
        overflow: hidden;
        margin-left: -14px;
    }

    .booking-card-meta > span {
        margin-left: -1px;
        margin-right: 15px;
        padding-left: 14px;
        border-left: 1px solid var(--line);
    }

    .booking-card-meta strong { color: var(--ink); font-weight: 700; }

.booking-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.booking-pay {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
}

    .booking-pay .icon { width: 16px; height: 16px; vertical-align: 0; }

.booking-pay--muted { font-weight: 400; color: var(--muted); }

.booking-pay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

    .booking-pay-actions + .booking-pay { margin-top: 8px; }

/* Current / Past switch: same sign language as the tab bar */
.booking-scope {
    display: inline-flex;
    gap: 3px;
    margin-top: 16px;
    padding: 3px;
    background: transparent;
    border: 1.5px solid var(--ink);
    border-radius: var(--radius);
}

.card-header + .booking-scope { margin-top: 0; }

.booking-scope-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-height: 44px;
    padding: 8px 20px;
    background: transparent;
    color: var(--ink);
    border: 0;
    border-radius: 2px;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
}

    @media (hover: hover) {
        .booking-scope-btn:not([aria-pressed="true"]):not(:disabled):hover { background: var(--q-yellow); color: #000000; }
    }
    .booking-scope-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

.booking-scope-note { font-weight: 400; }


/* ── DASHBOARD PAGE ──────────────────────────────────────────
   ---------------------------------------------------------- */
.dashboard-container {
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
    padding: 44px 32px 72px;
}

.dashboard-top { margin-bottom: 36px; }

    .dashboard-top .mb-lg { margin: 20px 0 0; }

.dashboard-header { margin-bottom: 22px; }

.dashboard-title {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.dashboard-subtitle {
    margin-top: 8px;
    font-size: 1.0625rem;
    color: var(--muted);
}

/* Station-sign greeting: the greeting and the "happening now" board in
   one black sign. .is-solo = no board, one column. */
.welcome-sign {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
    background: var(--sign);
    color: var(--on-sign);
    border: 1px solid var(--sign-edge);
    border-radius: var(--radius);
    --focus: #FCCC0A;
}

    .welcome-sign::before { /* the thin white rule, as on the navbar */
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: 6px;
        height: 2px;
        background: var(--on-sign);
    }

.welcome-sign.is-solo { grid-template-columns: minmax(0, 1fr); }

.welcome-sign .dashboard-header { align-self: center; margin: 0; padding: 36px 32px 26px; }
.welcome-sign .dashboard-title { color: var(--on-sign); }
.welcome-sign .dashboard-subtitle { color: var(--on-sign-muted); }

/* "Happening now" as a platform arrival board */
.now-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    padding: 12px 16px 14px;
    background: var(--sign);
    color: var(--on-sign);
    border: 1px solid var(--sign-edge);
    border-radius: var(--radius);
}

.welcome-sign .now-board {
    align-self: center;
    margin: 26px 0 18px;
    padding: 2px 24px 4px;
    background: none;
    border: 0;
    border-left: 1px solid #3A3B3F;
    border-radius: 0;
}

.now-board-status {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--on-sign-muted);
}

    .now-board-status::before {
        content: "";
        width: 10px;
        height: 10px;
        border-radius: 50%;
        flex: none;
        background: #2DBE60;
    }

.now-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 14px;
    align-items: center;
    padding-top: 7px;
    border-top: 1px solid #3A3B3F;
}

.now-board-main {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.now-board-time {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    color: var(--q-yellow);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* Grid layout for dashboard cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}


/* ── TAB BAR: a wayfinding sign ──────────────────────────────
   Desktop: a black strip under the greeting. Phone: the same element
   pinned to the bottom of the screen (see the phone section).
   Bars with more than five tabs add .tab-bar--more, a #tabMoreSheet
   holding the overflow tabs, and #tabMoreBtn (main.js initTabMore()).
   ---------------------------------------------------------- */
.tab-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px 2px;
    padding: 5px;
    background: var(--sign);
    border: 1px solid var(--sign-edge);
    border-radius: var(--radius);
    --focus: #FCCC0A;
}

.tab-btn {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    background: none;
    color: var(--on-sign);
    border: 0;
    border-radius: 2px;
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.5;
    cursor: pointer;
    white-space: nowrap;
}

    @media (hover: hover) {
        .tab-btn:not(.active):hover { background: var(--q-yellow); color: #000000; }
    }

    .tab-btn.active {
        background: #FFFFFF;
        color: #000000;
    }

.tab-icon {
    display: none;
    width: 22px;
    height: 22px;
    vertical-align: 0;
}

.tab-text-short { display: none; }

.tab-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--b-orange);
    color: #000000;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

    .tab-unread-badge:empty { display: none; }

.tab-more-btn { display: none; }

@media (min-width: 761px) {
    /* the overflow tabs join the strip in today's order */
    .tab-more-sheet { display: contents; }
    .tab-bar--more .tab-btn { order: var(--tab-order, 0); }
    .tab-more-btn { display: none; }
}

/* narrow desktop: bars with More switch to their short labels until the
   full labels fit one row (sitter measured: full labels fit from 1044px) */
@media (min-width: 761px) and (max-width: 1043px) {
    .tab-bar--more .tab-btn { padding: 11px 13px; }
    .tab-bar--more .tab-text {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .tab-bar--more .tab-text-short { display: inline; }
}


/* ── NARROW DESKTOP (761-1023px): two-column blocks stack ─────
   Below 1024px a booking card cannot hold a comfortable details column
   (322px at 900, 382 at 960) beside the 400px line map, and the greeting cannot share
   the station sign with the 480px now board. Both stack the way the phone
   layout does: map under the card body, now board under the greeting.
   From 1024px up nothing changes (details column 446px at 1024).
   ---------------------------------------------------------- */
@media (min-width: 761px) and (max-width: 1023px) {
    .booking-card { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .booking-card > .line-map { width: 100%; max-width: 400px; }

    .welcome-sign { grid-template-columns: minmax(0, 1fr); }
    .welcome-sign .now-board {
        margin: 0 32px;
        padding: 12px 0 16px;
        border-left: 0;
        border-top: 1px solid #3A3B3F;
    }
}


/* ── MODAL ───────────────────────────────────────────────────
   ---------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
}

/* shared default width; zero specificity, so any page rule
   (.wizard-card, #rejectModal .modal-card, ...) overrides it */
:where(.modal-card) { max-width: 480px; }

.modal-card {
    position: relative;
    width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 28px 32px 24px;
    background: var(--surface);
    color: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: var(--radius);
}

.modal-header {
    margin-bottom: 16px;
    padding: 0 44px 12px 0;
    border-bottom: 2px solid var(--ink);
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    color: var(--ink);
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
}

    @media (hover: hover) {
        .modal-close:hover { background: var(--q-yellow); color: #000000; border-color: var(--q-yellow); }
    }
    .modal-close .icon { width: 22px; height: 22px; vertical-align: 0; }


/* ── CHAT ────────────────────────────────────────────────────
   ---------------------------------------------------------- */
.chat-layout {
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.chat-sidebar,
.chat-main { min-width: 0; }

.chat-sidebar.card,
.chat-main.card { padding: 0; }

.chat-sidebar .card-header { margin: 0; padding: 20px 20px 12px; }

.conversation-item {
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    cursor: pointer;
}

    .conversation-item:hover { background: var(--tint); }

    .conversation-item.active {
        background: var(--ink);
        color: var(--surface);
    }

    .conversation-item h4 {
        font-size: 0.9375rem;
        font-weight: 700;
        margin-bottom: 2px;
    }

    .conversation-item p {
        font-size: 0.8125rem;
        color: var(--muted);
    }

    .conversation-item.active p { color: var(--surface); opacity: 0.8; }

.chat-header {
    padding: 16px 20px;
    border-bottom: 2px solid var(--ink);
    font-size: 1.0625rem;
    font-weight: 700;
}

.chat-messages {
    height: 380px;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* One row per message: the row is the flex item, so alignment is here */
.message-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

    .message-row.mine { align-items: flex-end; }

.message-sender {
    margin-bottom: 2px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
}

    .message-sender.mine { text-align: right; }

.message-bubble {
    max-width: 75%;
    padding: 9px 14px;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

    .message-bubble.mine {
        align-self: flex-end;
        background: var(--sign);
        color: var(--on-sign);
        border: 1px solid var(--sign-edge);
    }

    .message-bubble.theirs {
        align-self: flex-start;
        background: var(--tint);
        color: var(--ink);
    }

    .message-bubble img {
        max-width: 220px;
        margin-top: 4px;
        border-radius: 2px;
    }

    /* Video messages: the player fills the bubble, black behind letterboxing */
    .message-bubble video {
        display: block;
        width: 320px;
        max-width: 100%;
        max-height: 360px;
        margin-top: 4px;
        border-radius: var(--radius);
        background: #000;
    }

    .message-video-length {
        display: block;
        margin-top: 4px;
        font-size: 0.75rem;
        font-weight: 700;
        opacity: 0.8;
    }

    .message-video-gone {
        font-style: italic;
        opacity: 0.8;
    }

    /* "Sending video..." while an upload runs (sendVideo) */
    .message-pending .message-bubble {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .message-pending .spinner {
        border-color: transparent;
        border-top-color: currentColor;
        border-right-color: currentColor;
    }

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
}

    .chat-input-area .form-input { flex: 1; min-width: 0; }

    /* Phone: the text field takes its own full-width row, the buttons sit below it */
    @media (max-width: 760px) {
        .chat-input-area { flex-wrap: wrap; }
        .chat-input-area .form-input { flex: 1 0 100%; }
    }

    /* An upload is running: the file-picker labels go inert with the inputs */
    .chat-input-area.is-busy label.btn {
        opacity: 0.5;
        pointer-events: none;
    }

/* "Select a conversation" pane, before a thread is opened */
.chat-placeholder {
    min-height: 400px;
    padding: 16px;
    text-align: center;
}


/* ── PROFILE PHOTO ───────────────────────────────────────────
   ---------------------------------------------------------- */
.photo-upload-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.profile-photo-preview {
    position: relative;
    width: 104px;
    height: 104px;
    flex: none;
}

.profile-photo-img {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--ink);
}

.photo-placeholder {
    width: 104px;
    height: 104px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--tint);
    border: 2px dashed var(--field-border);
    color: var(--muted);
}

    .photo-placeholder .icon { width: 40px; height: 40px; }


/* ── LOADING ─────────────────────────────────────────────────
   Sections: the subway car rolling along the line (showSpinner()).
   Buttons and the payment modal: a small ring (.spinner).
   ---------------------------------------------------------- */
.spinner-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 48px 16px 40px;
    color: var(--muted);
    font-size: 0.9375rem;
}

.spinner {
    display: inline-block;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 3px solid var(--line);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 44px; height: 44px; border-width: 4px; }

/* inside a yellow button the ring needs to be black on yellow */
.btn-primary .spinner { border-color: rgba(0, 0, 0, 0.25); border-top-color: #000000; }

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

/* train loader drawing (colours are the --m-* tokens above) */
.m-line { fill: var(--m-line); }
.m-line-stop { fill: var(--m-line-stop); }
.m-car { fill: var(--m-car); }
.m-car-edge { fill: var(--m-car-edge); }
.m-car-glass { fill: var(--m-car-glass); }
.m-lit { fill: var(--m-lit); }
.m-car-glass.m-lit { fill: var(--m-car-lit); }
.m-wheel { fill: var(--m-wheel); }
.m-headlight { fill: var(--m-headlight); }
.m-q { fill: #FCCC0A; }
.m-bullet-text { font: 700 14px Arimo, "Helvetica Neue", Helvetica, Arial, sans-serif; fill: #000; }

.loading-train { display: block; width: min(100%, 480px); height: auto; }

@keyframes lt-roll {
    from { transform: translateX(-360px); }
    to { transform: translateX(500px); }
}

.loading-train-car { animation: lt-roll 7s linear -3s infinite; }

@media (prefers-reduced-motion: reduce) {
    .loading-train-car { animation: none; transform: translateX(66px); }
}


/* ── EMPTY STATES ────────────────────────────────────────────
   main.js emptyState(iconName, title, body)
   ---------------------------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 36px 16px;
    text-align: center;
}

.empty-state-icon {
    color: var(--muted);
    line-height: 1;
    margin-bottom: 4px;
}

    .empty-state-icon .icon { width: 40px; height: 40px; vertical-align: 0; }

.empty-state-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--ink);
}

.empty-state-body {
    max-width: 320px;
    font-size: 0.9375rem;
    color: var(--muted);
}


/* ── CHARACTER COUNTER ───────────────────────────────────────
   Paired with charCounter() in main.js.
   ---------------------------------------------------------- */
.char-counter {
    margin-top: 4px;
    font-size: var(--text-xs);
    color: var(--muted);
    text-align: right;
}

    .char-counter.warning { color: var(--ink); font-weight: 700; }
    .char-counter.danger { color: var(--danger-text); font-weight: 700; }


/* ── STARS ───────────────────────────────────────────────────
   The read-only star row from starsHtml().
   ---------------------------------------------------------- */
.stars {
    color: var(--q-yellow);
    font-size: 1.125rem;
    line-height: 1;
    letter-spacing: 2px;
    white-space: nowrap;
    -webkit-text-stroke: var(--star-stroke);
    paint-order: stroke fill;
}


/* ── STAYCATION SHARE (F3) ───────────────────────────────────
   The "Share Rex's staycation!" picker (#staycationModal, client_dash.js).
   Square toggle tiles, segmented radios, the reel preview.
   ---------------------------------------------------------- */
.staycation-share-row { margin-top: 10px; }
.staycation-share-row .btn { white-space: normal; max-width: 100%; text-align: center; }

.staycation-card { max-width: 600px; }

.staycation-fields,
.staycation-option {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.staycation-option { margin-bottom: 16px; }
    .staycation-option legend { margin-bottom: 6px; padding: 0; }

.staycation-pick-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    margin-bottom: 8px;
}

.staycation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
}

.staycation-grid-msg { grid-column: 1 / -1; }

.staycation-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    padding: 0;
    overflow: hidden;
    background: var(--tint);
    color: var(--muted);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
}

    .staycation-tile img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* the selected ring: 3px of brand orange, drawn inside the tile so the
       focus outline (outside) can show at the same time */
    .staycation-tile::after {
        content: '';
        position: absolute;
        inset: 0;
        border: 3px solid transparent;
        border-radius: 2px;
        pointer-events: none;
    }
    .staycation-tile[aria-pressed="true"]::after { border-color: var(--b-orange); }

.staycation-tile-blank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
    .staycation-tile-blank .icon { width: 28px; height: 28px; }

.staycation-tile-check {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.55);
    color: #000000;
    border: 1.5px solid #FFFFFF;
    border-radius: 2px;
}
    .staycation-tile-check .icon { width: 16px; height: 16px; visibility: hidden; }
    .staycation-tile[aria-pressed="true"] .staycation-tile-check { background: var(--b-orange); border-color: var(--b-orange); }
    .staycation-tile[aria-pressed="true"] .staycation-tile-check .icon { visibility: visible; }

.staycation-tile-badge {
    position: absolute;
    left: 5px;
    bottom: 5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 5px;
    background: #000000;
    color: #FFFFFF;
    border-radius: 2px;
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1.3;
}
    .staycation-tile-badge .icon { width: 13px; height: 13px; }

.staycation-fields:disabled .staycation-tile,
.staycation-fields:disabled .form-group,
.staycation-fields:disabled .staycation-option { opacity: 0.55; }
.staycation-fields:disabled .staycation-tile,
.staycation-fields:disabled .staycation-seg-face { cursor: not-allowed; }

/* Segmented radios: the Current / Past switch's sign language */
.staycation-seg {
    display: grid;
    gap: 3px;
    padding: 3px;
    border: 1.5px solid var(--ink);
    border-radius: var(--radius);
}
.staycation-seg--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.staycation-seg--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.staycation-seg-opt {
    position: relative;
    display: flex;
    min-width: 0;
}

.staycation-seg-face {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 6px 8px;
    color: var(--ink);
    border-radius: 2px;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}
.staycation-seg-face--stack { flex-direction: column; gap: 2px; }

.staycation-seg-sub {
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 400;
}

    @media (hover: hover) {
        .staycation-seg-opt input:not(:checked):not(:disabled) + .staycation-seg-face:hover { background: var(--q-yellow); color: #000000; }
        .staycation-seg-opt input:not(:checked):not(:disabled) + .staycation-seg-face:hover .staycation-seg-sub { color: #000000; }
    }
    .staycation-seg-opt input:checked + .staycation-seg-face { background: var(--ink); color: var(--surface); }
    .staycation-seg-opt input:checked + .staycation-seg-face .staycation-seg-sub { color: inherit; }
    .staycation-seg-opt input:focus-visible + .staycation-seg-face { outline: 3px solid var(--focus); outline-offset: 2px; }

/* theme swatch: the background colour with its accent in the corner */
.staycation-swatch {
    position: relative;
    flex: none;
    width: 18px;
    height: 18px;
    background: var(--sw-bg);
    border: 1.5px solid currentColor;
    border-radius: 2px;
}
    .staycation-swatch::after {
        content: '';
        position: absolute;
        right: 2px;
        bottom: 2px;
        width: 7px;
        height: 7px;
        background: var(--sw-accent);
        border-radius: 1px;
    }
.staycation-swatch--warm    { --sw-bg: #F7E9DA; --sw-accent: #D9793D; }
.staycation-swatch--clean   { --sw-bg: #FFFFFF; --sw-accent: #2F6FED; }
.staycation-swatch--playful { --sw-bg: #FFF3B0; --sw-accent: #E4572E; }

.staycation-note {
    margin-top: 8px;
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 700;
}

.staycation-error {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--tint);
    color: var(--ink);
    border-left: 4px solid var(--danger-text);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 700;
}

/* ready:false: the reason on a black sign band */
.staycation-reason {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: var(--sign);
    color: var(--on-sign);
    border: 1.5px solid var(--sign-edge);
    border-radius: var(--radius);
    font-weight: 700;
}
    .staycation-reason .icon { margin-top: 2px; color: var(--q-yellow); }

#staycationStatus .spinner-overlay { padding: 20px 8px 4px; }

.staycation-preview {
    display: flex;
    justify-content: center;
    padding: 8px;
    background: var(--sign);
    border: 1.5px solid var(--sign-edge);
    border-radius: var(--radius);
}
    .staycation-preview video {
        display: block;
        max-width: 100%;
        height: auto;
        background: #000000;
    }
    .staycation-preview--vertical video { aspect-ratio: 9 / 16; width: min(100%, calc(min(60vh, 520px) * 9 / 16)); }
    .staycation-preview--square video   { aspect-ratio: 1 / 1;  width: min(100%, 60vh, 420px); }

.staycation-ready-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}


/* ── TOAST ───────────────────────────────────────────────────
   A black sign block; success / error add a coloured bar on the left.
   ---------------------------------------------------------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    z-index: 999;
    max-width: calc(100% - 32px);
    padding: 14px 22px;
    background: var(--sign);
    color: var(--on-sign);
    border: 1px solid var(--sign-edge);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: normal;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

    .toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    .toast.success { border-left: 6px solid var(--st-in-progress); }
    .toast.error { border-left: 6px solid var(--st-stopped); }

@media (prefers-reduced-motion: reduce) {
    .toast { transition: none; }
}


/* ── FOOTER BAND ─────────────────────────────────────────────
   The bottom of the scene: the train with the whole crew aboard.
   The strip's height follows the page width (1440:300 image area,
   border outside it), so the band is never cropped.
   ---------------------------------------------------------- */
.scene-footer {
    box-sizing: content-box;
    display: block;
    flex: none;
    width: 100%;
    height: auto;
    aspect-ratio: 1440 / 300;
    background-color: var(--scene-fill);
    background-image: var(--scene-band);
    background-position: center bottom;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    border-top: 3px solid #000000;
}


/* ── SIGN-IN PAGES ───────────────────────────────────────────
   An overhead station sign, then the form card on the wall. On the
   login page the wall is the street scene (light theme).
   ---------------------------------------------------------- */
.auth-container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* the overhead sign */
.auth-logo {
    position: relative;
    width: 100%;
    padding: 64px 24px 48px;
    background: var(--sign);
    color: var(--on-sign);
    border-bottom: 1px solid var(--sign-edge);
    text-align: center;
    --focus: #FCCC0A;
}

    .auth-logo::before { /* the thin white rule near the top edge */
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: 10px;
        height: 3px;
        background: var(--on-sign);
    }

.sign-line {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px 28px;
}

.brand-bullets {
    display: flex;
    gap: 10px;
    font-size: 2.25rem;
}

.auth-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.025em;
}

.auth-subtitle {
    max-width: 34rem;
    margin: 22px auto 0;
    font-size: 1.125rem;
    line-height: 1.45;
    color: var(--on-sign-muted);
}

.auth-logo .theme-toggle {
    position: absolute;
    top: 26px;
    right: 24px;
    width: 40px;
    height: 40px;
    border: 1.5px solid #6A6C70;
}

    @media (hover: hover) {
        .auth-logo .theme-toggle:hover { background: var(--q-yellow); color: #000000; border-color: var(--q-yellow); }
    }
    .auth-logo .theme-toggle .icon { width: 20px; height: 20px; }

/* the form panel on the wall */
.auth-card {
    width: calc(100% - 40px);
    max-width: 440px;
    margin: 56px 20px 64px;
    padding: 36px 36px 30px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.auth-card--wide { max-width: 580px; }

.auth-heading {
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--ink);
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.auth-card .btn-primary.btn-full { margin-top: 6px; }

.auth-links {
    margin-top: 26px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.auth-footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 12px 0;
    font-size: 0.9375rem;
    color: var(--muted);
}

    .auth-footer + .auth-footer { border-top: 1px solid var(--line); }
    .auth-footer a { font-weight: 700; color: var(--ink); }

.auth-footer--solo { justify-content: flex-start; padding-top: 16px; }

/* sitter application: one service per row, price field on the right */
.service-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.service-row-price {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9375rem;
}

    .service-row-price .form-input { width: 96px; }

/* Login: the street scene is the wall; the card floats on its empty
   left end, clear of the cast and the whole train crew. */
.auth-stage {
    flex: 1 0 auto;
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    /* the picture is scaled to the stage height and centred: wide windows
       crop the sides, never the sky or the street */
    padding: 24px 40px;
    background-color: var(--scene-stage-fill);
    background-image: var(--scene-wide);
    background-position: center bottom;
    background-size: cover;
    background-repeat: no-repeat;
}

/* desktop only (the phone shows the stacked crops instead): the min-height
   keeps the card above the train (art row 505 of 660) */
@media (min-width: 761px) {
    .auth-stage { min-height: 706px; }
}

/* sharper 2x picture only where the stage is tall in device pixels */
@media (min-width: 761px) and (min-height: 1370px),
       (min-width: 761px) and (min-resolution: 1.25dppx) and (min-height: 1140px),
       (min-width: 761px) and (min-resolution: 1.5dppx) and (min-height: 990px),
       (min-width: 761px) and (min-resolution: 2dppx) and (min-height: 800px) {
    .auth-stage { background-image: var(--scene-wide-2x); }
}

    .auth-stage .auth-card {
        width: 100%;
        max-width: 410px;
        margin: 0;
        padding: 28px 30px 20px;
        box-shadow: 0 10px 30px rgba(48, 20, 13, 0.35), 0 2px 6px rgba(48, 20, 13, 0.25);
    }

    .auth-stage .auth-heading { margin-bottom: 18px; }
    .auth-stage .form-group { margin-bottom: 14px; }
    .auth-stage .auth-links { margin-top: 14px; }
    .auth-stage .auth-footer { padding: 9px 0; }

/* phone: the scene as two stacked crops under the card */
.scene-crops { display: none; }

.scene-crop {
    display: block;
    width: 100%;
    background-image: var(--scene-full);
    background-repeat: no-repeat;
    border-top: 3px solid #000000;
}

/* Hobby in the parlour window, the cart pair and Paul with his ball:
   scene x 296-536, y 268-440 of 960 x 660 */
.scene-crop--street {
    aspect-ratio: 240 / 172;
    background-size: 400% auto;
    background-position: 41.11% 54.92%;
}

/* the family on the train: scene x 364-760, y 476-566 */
.scene-crop--train {
    aspect-ratio: 396 / 90;
    background-size: 242.42% auto;
    background-position: 64.54% 83.51%;
}



/* ── UTILITIES ───────────────────────────────────────────────
   ---------------------------------------------------------- */
.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;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: 0.9375rem; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger-text); }
.text-success { color: var(--success-text); }
.fw-600 { font-weight: 700; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.gap-sm { gap: 10px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}


/* ── PHONE (max-width: 760px) ────────────────────────────────
   One breakpoint for the whole app.
   ---------------------------------------------------------- */
@media (max-width: 760px) {
    :root { --tile-size: 72px 72px; }

    /* navbar: bullets, toggle, bell, logout */
    .navbar { padding: 8px 14px 0; gap: 10px; }
    .brand-name, .nav-links, .nav-username { display: none; }
    .nav-right { position: static; gap: 6px; }
    .logout-btn { margin-left: 4px; padding: 7px 11px; }

    .notification-panel {
        position: fixed;
        top: calc(var(--navbar-height) + 8px);
        left: 16px;
        right: 16px;
        width: auto;
        max-width: none;
    }

    .notification-item { padding: 14px 16px; }

    /* page */
    .dashboard-container { padding: 24px 16px 40px; }
    body.has-tabbar .dashboard-container { padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 28px); }
    .dashboard-top { margin-bottom: 20px; }
    .dashboard-top .mb-lg { margin-top: 16px; }
    .dashboard-top .btn-primary { width: 100%; }
    .dashboard-header { margin-bottom: 16px; }
    .dashboard-title { font-size: 2rem; }
    .dashboard-subtitle { font-size: 1rem; }

    .welcome-sign { grid-template-columns: minmax(0, 1fr); }
    .welcome-sign .dashboard-header { padding: 30px 16px 18px; }
    .welcome-sign .now-board {
        margin: 0 16px;
        padding: 12px 0 14px;
        border-left: 0;
        border-top: 1px solid #3A3B3F;
    }

    .now-board { padding: 12px 14px; gap: 4px; }
    .now-row { grid-template-columns: minmax(0, 1fr); }
    .now-board-time { text-align: left; }

    .card { padding: 20px 16px 16px; }
    .card-title { font-size: 1.375rem; }
    .form-row { grid-template-columns: minmax(0, 1fr); }

    /* booking cards: one column; the main block is a flex column so a
       page can reorder its parts with `order` */
    .booking-card { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 20px 0; }
    .booking-card-main { display: flex; flex-direction: column; }
    .booking-card-header { flex-direction: column-reverse; align-items: flex-start; gap: 10px; }
    .booking-card-meta { flex-direction: column; gap: 2px; }
    .booking-card-meta { margin-left: 0; }
    .booking-card-meta > span { margin: 0; padding-left: 0; border-left: 0; }
    .booking-card-actions { gap: 8px; }
    .booking-pay-actions { flex-direction: column; }
    .booking-pay-actions .btn { width: 100%; min-height: 44px; }
    .booking-scope { display: flex; }
    .booking-scope-btn { flex: 1 1 0; min-height: 48px; padding: 8px 6px; font-size: 0.875rem; }
    .line-map { padding-top: 0; }
    .stop-name { font-size: 0.75rem; }

    .chat-layout { grid-template-columns: minmax(0, 1fr); }
    .chat-messages { height: 55vh; }
    .chat-placeholder { min-height: 160px; }
    .message-bubble { max-width: 85%; }

    .modal-card { padding: 22px 18px 18px; }

    /* staycation picker: three tiles a row at 360px, tighter option faces */
    .staycation-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
    .staycation-seg-face { padding: 6px 4px; font-size: 0.875rem; }
    .staycation-ready-actions .btn { flex: 1 1 auto; }
    .modal-header { font-size: 1.25rem; }

    /* the tab bar, pinned as a bottom bar: at most five slots */
    .tab-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 90;
        flex-wrap: nowrap;
        gap: 0;
        align-items: stretch;
        /* the bar's height IS the token (plus the safe area), so nothing that
           offsets itself by --tabbar-height can drift from the real bar */
        height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        border: 0;
        border-top: 1px solid var(--sign-edge);
        border-radius: 0;
    }

    .tab-btn,
    .tab-more-btn {
        flex: 1 1 0;
        min-width: 0;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 7px 2px 6px;
        font-size: 0.75rem;
    }

    .tab-icon { display: block; }

    /* the full label stays for screen readers; the short one is shown */
    .tab-text {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .tab-text-short {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .tab-unread-badge {
        position: absolute;
        top: 2px;
        left: calc(50% + 4px);
        min-width: 18px;
        height: 18px;
        font-size: 0.6875rem;
    }

    /* More: a slot like the others, opening a sheet above the bar */
    .tab-more-btn {
        position: relative;
        display: inline-flex;
        align-items: center;
        background: none;
        color: var(--on-sign);
        border: 0;
        border-radius: 2px;
        font-family: var(--font);
        font-weight: 700;
        line-height: 1.5;
        cursor: pointer;
        white-space: nowrap;
    }

        @media (hover: hover) {
            .tab-more-btn:not(.active):hover { background: var(--q-yellow); color: #000000; }
        }

        .tab-more-btn.active {
            background: #FFFFFF;
            color: #000000;
        }

    .tab-more-sheet { display: none; }

    .tab-bar.is-more-open .tab-more-sheet {
        display: flex;
        flex-direction: column;
        position: absolute;
        left: 0;
        right: 0;
        bottom: calc(100% + 1px); /* clear of the bar's 1px top border */
        max-height: calc(100dvh - var(--navbar-height) - var(--tabbar-height) - env(safe-area-inset-bottom) - 16px);
        overflow-y: auto;
        background: var(--sign);
        border-top: 1px solid #3A3B3F;
        padding: 6px;
        animation: tab-sheet-in 150ms ease-out;
    }

    .tab-more-sheet .tab-btn {
        flex: none;
        flex-direction: row;
        justify-content: flex-start;
        gap: 14px;
        width: 100%;
        min-height: 56px;
        padding: 14px 18px;
        font-size: 1rem;
    }

    .tab-more-sheet .tab-text {
        position: static;
        width: auto;
        height: auto;
        margin: 0;
        overflow: visible;
        clip: auto;
    }

    .tab-more-sheet .tab-text-short { display: none; }

    .tab-bar.is-more-open::before { /* scrim over the page */
        content: "";
        position: fixed;
        inset: 0;
        z-index: -1;
        background: rgba(0, 0, 0, 0.45);
    }

    body.has-tabbar .scene-footer { margin-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom)); }
    body.has-tabbar .toast { bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 16px); }

    /* sign-in pages */
    .auth-logo { padding: 52px 20px 30px; text-align: left; }
    .sign-line { justify-content: flex-start; gap: 16px; }
    .brand-bullets { font-size: 1.625rem; gap: 8px; }
    .auth-title { font-size: 2.125rem; width: 100%; }
    .auth-subtitle { margin: 14px 0 0; font-size: 1rem; }
    .auth-logo .theme-toggle { top: 24px; right: 16px; width: 36px; height: 36px; }
    .auth-card { width: calc(100% - 32px); margin: 20px 16px 28px; padding: 24px 20px 18px; }
    .auth-heading { font-size: 1.375rem; margin-bottom: 18px; }

    .auth-stage { display: block; padding: 20px 16px 28px; background: none; flex: 0 0 auto; }
    .auth-stage .auth-card { max-width: none; margin: 0; box-shadow: none; padding: 24px 20px 18px; }
    .scene-crops { display: block; width: 100%; border-bottom: 3px solid #000000; }
}

@keyframes tab-sheet-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .tab-bar.is-more-open .tab-more-sheet { animation: none; }
}
