/* Page-level patterns built from the primitives: page container, page header, layout helpers, forms */
@layer vb.patterns {
    /* ---- Page container: wraps a migrated page's content inside .main-content ---- */
    /* width and side padding line the content up with the header's logo and right edge at every width
       (the shell gutters --content-side-padding and --page-side-padding come from legacy.css and shell.css) */
    .vb-page {
        width: 100%;
        max-width: calc(var(--vb-shell-content-max) - 2 * var(--page-side-padding, 0px));
        margin: 0 auto;
        padding: var(--vb-space-24) max(0px, calc(var(--content-side-padding, 0px) - var(--page-side-padding, 0px))) var(--vb-space-40);
    }

    .vb-page--narrow {
        max-width: 880px;
    }

    /* ---- Page header: <vb-page-header title="" subtitle="">actions</vb-page-header> renders this ---- */
    .vb-page-header {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-end;
        justify-content: space-between;
        gap: var(--vb-space-12) var(--vb-space-24);
        margin: 0 0 var(--vb-space-20);
    }

    .vb-page-header__title {
        margin: 0;
        font-size: var(--vb-text-22);
        font-weight: var(--vb-weight-semibold);
        line-height: var(--vb-leading-tight);
        letter-spacing: -0.01em;
        color: var(--vb-text);
    }

    .vb-page-header__subtitle {
        margin: var(--vb-space-4) 0 0;
        max-width: 70ch;
        color: var(--vb-text-muted);
        font-size: var(--vb-text-14);
    }

    /* never wider than the header: the actions wrap (and a vb-segmented row scrolls) instead of widening the page */
    .vb-page-header__actions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--vb-space-8);
        max-width: 100%;
    }

    /* the way one level up, above the title: "← Cases" (back-href on vb-page-header, vb-case-header) */
    .vb-page-header__back {
        display: inline-flex;
        align-items: center;
        gap: var(--vb-space-6);
        margin: 0 0 var(--vb-space-6);
        color: var(--vb-link);
        font-size: var(--vb-text-13);
        font-weight: var(--vb-weight-medium);
        text-decoration: none;
    }

    .vb-page-header__back:hover {
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    .vb-page-header__back:focus-visible {
        outline: 2px solid var(--vb-focus);
        outline-offset: 2px;
        border-radius: var(--vb-radius-sm);
    }

    .vb-page-header__back i {
        font-size: calc(11px * var(--vb-text-scale));
    }

    /* facts about the page's subject on one muted line, between dots (vb-case-header: complaint, patient, first visit) */
    .vb-page-header__meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--vb-space-4) var(--vb-space-8);
        margin: var(--vb-space-4) 0 0;
        padding: 0;
        list-style: none;
        color: var(--vb-text-muted);
        font-size: var(--vb-text-13);
    }

    /* the dot ends an item, so a line that wraps never starts with one */
    .vb-page-header__meta > li:not(:last-child)::after {
        content: "\00b7"; /* · as an escape: reads the same whatever encoding the stylesheet is taken in */
        margin-left: var(--vb-space-8);
        color: var(--vb-border-control);
    }

    .vb-page-header__meta strong {
        color: var(--vb-text);
        font-weight: var(--vb-weight-medium);
    }

    /* the case's folder at the head of vb-case-header's line: a link back to it on Cases (inline, so the line keeps its height) */
    .vb-case-header__folder {
        color: var(--vb-link);
        font-weight: var(--vb-weight-medium);
        text-decoration: none;
    }

    .vb-case-header__folder:hover {
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    .vb-case-header__folder:focus-visible {
        outline: 2px solid var(--vb-focus);
        outline-offset: 2px;
        border-radius: var(--vb-radius-sm);
    }

    .vb-case-header__folder i {
        margin-right: var(--vb-space-6);
        font-size: calc(12px * var(--vb-text-scale));
    }

    /* a tool page's header (Analysis): a smaller title, the actions centred on the text */
    .vb-page-header--compact {
        align-items: center;
        margin-bottom: var(--vb-space-12);
    }

    .vb-page-header--compact .vb-page-header__title {
        font-size: var(--vb-text-18);
    }

    /* compact with a way back: the arrow beside the title and its line (the line names the case it goes back to) */
    .vb-page-header__text--back {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        column-gap: var(--vb-space-12);
    }

    .vb-page-header__text--back > .vb-page-header__back--icon {
        grid-row: 1 / span 2;
    }

    .vb-page-header__back--icon {
        justify-content: center;
        width: 32px;
        height: 32px;
        margin: 0;
        border: 1px solid var(--vb-border-control);
        border-radius: var(--vb-radius-md);
        background: var(--vb-bg-surface);
    }

    .vb-page-header__back--icon:hover {
        border-color: var(--vb-action);
        background: var(--vb-bg-selected);
    }

    .vb-page-header__back--icon i {
        font-size: calc(13px * var(--vb-text-scale));
    }

    .vb-page-header--compact .vb-page-header__title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .vb-page-header--compact .vb-page-header__meta {
        margin-top: var(--vb-space-2);
    }

    /* from tablets up the case's line keeps to one line: when it is too long the main complaint gives way, the case's
       name keeps up to 40% of the line, and the folder and the patient stay whole (the case history shows it all);
       phones wrap it instead */
    @media (min-width: 577px) {
        .vb-page-header--compact .vb-page-header__meta {
            flex-wrap: nowrap;
            min-width: 0;
            overflow: hidden;
        }

        .vb-page-header--compact .vb-page-header__meta > li {
            flex: none;
            white-space: nowrap;
        }

        .vb-page-header--compact .vb-page-header__meta > li:not(:last-child):not(:has(> .vb-case-header__folder)) {
            flex: 0 1 auto;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .vb-page-header--compact .vb-page-header__meta > li:not(:last-child):not(:has(> .vb-case-header__folder)):has(> strong) {
            flex: none;
            max-width: 40%;
        }
    }

    @media (max-width: 576px) {
        .vb-page-header__text--back > .vb-page-header__back--icon {
            align-self: start;
        }
    }

    /* wide screens: the actions stay on the title's row, so the header never takes a second row */
    @media (min-width: 1024px) {
        .vb-page-header--compact {
            flex-wrap: nowrap;
        }

        .vb-page-header--compact > .vb-page-header__text {
            flex: 1 1 auto;
            min-width: 0;
        }

        .vb-page-header--compact > .vb-page-header__actions {
            flex: none;
            flex-wrap: nowrap;
        }
    }

    @media (max-width: 576px) {
        .vb-page-header {
            flex-direction: column;
            align-items: stretch;
        }

        .vb-page-header__actions > .vb-btn {
            flex: 1 1 auto;
        }
    }

    /* ---- Hero: the welcome ribbon at the top of a home page, in place of the page header (Dashboard) ---- */
    .vb-hero {
        margin: 0 0 var(--vb-space-20);
        padding: var(--vb-space-24) var(--vb-space-32);
        border-radius: var(--vb-radius-lg);
        background: linear-gradient(120deg, var(--vb-action-hover), var(--vb-action));
        color: var(--vb-text-on-action);
    }

    .vb-hero__title {
        margin: 0;
        font-size: var(--vb-text-22);
        font-weight: var(--vb-weight-semibold);
        line-height: var(--vb-leading-tight);
        letter-spacing: -0.01em;
        color: inherit;
    }

    .vb-hero__text {
        margin: var(--vb-space-6) 0 0;
        max-width: 70ch;
        font-size: var(--vb-text-14);
        color: inherit;
        opacity: 0.92;
    }

    /* dark theme: a deep green band with light text instead of the bright action colour */
    :root[data-vb-theme="dark"] .vb-hero {
        background: linear-gradient(120deg, color-mix(in srgb, var(--vb-action) 20%, var(--vb-bg-surface)), color-mix(in srgb, var(--vb-action) 34%, var(--vb-bg-surface)));
        color: var(--vb-text);
    }

    @media (prefers-color-scheme: dark) {
        :root[data-vb-theme="system"] .vb-hero {
            background: linear-gradient(120deg, color-mix(in srgb, var(--vb-action) 20%, var(--vb-bg-surface)), color-mix(in srgb, var(--vb-action) 34%, var(--vb-bg-surface)));
            color: var(--vb-text);
        }
    }

    @media (max-width: 576px) {
        .vb-hero {
            padding: var(--vb-space-20);
        }
    }

    /* ---- Layout helpers ---- */
    /* one column that never grows past its container: a wide child (a table, a Kendo toolbar) scrolls or wraps inside it */
    .vb-stack {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: var(--vb-space-16);
        min-width: 0;
    }

    .vb-stack--sm { gap: var(--vb-space-8); }
    .vb-stack--lg { gap: var(--vb-space-24); }

    .vb-cluster {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--vb-space-8);
    }

    .vb-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
        gap: var(--vb-space-12);
    }

    /* fewer, wider columns: four items sit two by two instead of three plus one */
    .vb-grid--wide {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    }

    /* four columns on wide screens, two on tablets, one on phones, so eight tiles always fill their rows */
    .vb-grid--4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    @media (max-width: 1100px) {
        .vb-grid--4 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    @media (max-width: 480px) {
        .vb-grid--4 {
            grid-template-columns: minmax(0, 1fr);
        }
    }

    /* two equal columns, as tall as each other, that stack below 900px */
    .vb-columns {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--vb-space-16);
    }

    @media (max-width: 900px) {
        .vb-columns {
            grid-template-columns: minmax(0, 1fr);
        }
    }

    /* image beside text; the text wraps under the image when narrow */
    .vb-media {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: var(--vb-space-16);
    }

    .vb-media__figure {
        flex: none;
        max-width: 100%;
    }

    .vb-media__figure img {
        display: block;
        width: 200px;
        max-width: 100%;
        height: auto;
        border-radius: var(--vb-radius-md);
    }

    .vb-media__body {
        flex: 1 1 16rem;
        min-width: 0;
        display: grid;
        justify-items: start;
        gap: var(--vb-space-12);
    }

    /* ---- Auth card: sign-in, registration and password reset, centred on the public layout ---- */
    .vb-auth {
        width: 100%;
        max-width: 440px;
        margin: var(--vb-space-40) auto;
    }

    .vb-auth--wide {
        max-width: 880px;
    }

    .vb-auth__brand {
        display: flex;
        align-items: center;
        gap: var(--vb-space-12);
        margin-bottom: var(--vb-space-20);
    }

    .vb-auth__portrait {
        flex: none;
        width: 56px;
        height: 56px;
        border-radius: var(--vb-radius-md);
        object-fit: cover;
    }

    .vb-auth__title {
        margin: 0;
        font-size: var(--vb-text-22);
        font-weight: var(--vb-weight-semibold);
        line-height: var(--vb-leading-tight);
    }

    .vb-auth__subtitle {
        margin: var(--vb-space-2) 0 0;
        color: var(--vb-text-muted);
    }

    .vb-auth__foot {
        margin-top: var(--vb-space-16);
        color: var(--vb-text-muted);
        font-size: var(--vb-text-13);
        text-align: center;
    }

    @media (max-width: 576px) {
        .vb-auth {
            margin: var(--vb-space-20) auto;
        }
    }

    /* ---- Form: fields stacked, actions at the end ---- */
    .vb-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: var(--vb-space-16);
        max-width: 640px;
    }

    /* two short fields side by side, one column on phones */
    /* each field keeps its own height (a textarea beside an input doesn't stretch the input) */
    .vb-form__row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: var(--vb-space-16);
    }

    @media (max-width: 576px) {
        .vb-form__row {
            grid-template-columns: minmax(0, 1fr);
        }
    }

    /* ---- Checkout: what is on offer (__main) beside an order summary (__aside) that stays in view while the page
       scrolls, then anything more (__more, e.g. how points work) under the offer (Buy points). From 1100px the summary is
       a column at the right; below that it comes right after the offer, and on phones a vb-checkout__bar (a vb-actionbar)
       keeps the choice and its button at the foot of the screen until the summary's own button is in view ---- */
    .vb-checkout {
        display: grid;
        grid-template-areas: "main" "aside" "more";
        align-items: start;
        gap: var(--vb-space-16);
    }

    .vb-checkout__main,
    .vb-checkout__more {
        display: grid;
        gap: var(--vb-space-16);
        min-width: 0;
    }

    .vb-checkout__main {
        grid-area: main;
    }

    .vb-checkout__aside {
        grid-area: aside;
        min-width: 0;
    }

    .vb-checkout__more {
        grid-area: more;
    }

    @media (min-width: 1100px) {
        .vb-checkout {
            grid-template-columns: minmax(0, 1fr) 300px;
            grid-template-areas: "main aside" "more aside";
        }

        .vb-checkout__aside {
            align-self: start;
            position: sticky;
            top: calc(var(--vb-shell-header-h) + var(--vb-space-16));
        }
    }

    .vb-actionbar.vb-checkout__bar {
        display: none;
    }

    @media (max-width: 576px) {
        .vb-actionbar.vb-checkout__bar:not([hidden]) {
            display: flex;
        }
    }

    /* the order summary: a title, the chosen item and its details, optional extras (a code), the total, the primary
       button full width and a note under it */
    .vb-summary {
        display: grid;
        gap: var(--vb-space-12);
        padding: var(--vb-space-16);
        border: 1px solid var(--vb-border);
        border-radius: var(--vb-radius-lg);
        background: var(--vb-bg-surface);
    }

    .vb-summary [hidden] {
        display: none;
    }

    .vb-summary__title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--vb-space-8);
        margin: 0;
        font-size: var(--vb-text-16);
        font-weight: var(--vb-weight-semibold);
    }

    .vb-summary__line {
        display: flex;
        justify-content: space-between;
        gap: var(--vb-space-8);
        font-variant-numeric: tabular-nums;
    }

    .vb-summary__line--muted {
        color: var(--vb-text-muted);
        font-size: var(--vb-text-13);
    }

    .vb-summary__line--total {
        padding-top: var(--vb-space-12);
        border-top: 1px solid var(--vb-border);
        font-size: var(--vb-text-18);
        font-weight: var(--vb-weight-bold);
    }

    .vb-summary > .vb-btn {
        width: 100%;
    }

    .vb-summary__note {
        display: flex;
        align-items: center;
        gap: var(--vb-space-6);
        margin: 0;
        color: var(--vb-text-muted);
        font-size: var(--vb-text-12);
    }

    /* ---- Action bar: a long form's buttons, kept in view at the bottom of the screen (above the phone tab bar) ---- */
    .vb-actionbar {
        position: sticky;
        bottom: var(--vb-tabbar-h, 0px);
        z-index: var(--vb-z-sticky);
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: var(--vb-space-8);
        padding: var(--vb-space-12) var(--vb-space-16);
        border: 1px solid var(--vb-border);
        border-radius: var(--vb-radius-lg);
        background: var(--vb-bg-surface);
        box-shadow: var(--vb-shadow-md);
    }

    /* a short note at the start of the bar, e.g. "Already have an account?" */
    .vb-actionbar__note {
        margin-right: auto;
        color: var(--vb-text-muted);
        font-size: var(--vb-text-13);
    }

    @media (max-width: 576px) {
        .vb-actionbar > .vb-btn {
            flex: 1 1 auto;
        }

        .vb-actionbar__note {
            flex-basis: 100%;
        }
    }

    .vb-form__actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: var(--vb-space-8);
    }

    /* primary button first in the markup (so Enter submits it) and first on screen */
    .vb-form__actions--start {
        justify-content: flex-start;
    }

    @media (max-width: 576px) {
        .vb-form__actions > .vb-btn {
            flex: 1 1 auto;
        }
    }

    /* ---- Toolbar: a list's search field, filters and buttons in one row that wraps ---- */
    .vb-toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--vb-space-8);
    }

    /* the search field takes the free room */
    .vb-toolbar__search {
        flex: 1 1 260px;
        max-width: 420px;
    }

    .vb-toolbar > .vb-select {
        width: auto;
    }

    @media (max-width: 576px) {
        .vb-toolbar__search {
            flex-basis: 100%;
            max-width: none;
        }

        .vb-toolbar > .vb-btn {
            flex: 1 1 auto;
        }
    }

    /* ---- Filters: a compact vb-disclosure under a search ("Filters", what they are, an "In use" vb-badge while one
       is set, when the page renders it open) whose body is labelled sections, each a label over its controls.
       Repertory is the example; Analysis's repertory filters look the same. ---- */
    .vb-filters__sections {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: var(--vb-space-12) var(--vb-space-24);
        padding: var(--vb-space-8) var(--vb-space-12) var(--vb-space-12);
        border-top: 1px solid var(--vb-border);
    }

    .vb-filters__section {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--vb-space-4);
        min-width: 0;
    }

    .vb-filters__label {
        margin: 0;
        color: var(--vb-text-muted);
        font-size: var(--vb-text-12);
        font-weight: var(--vb-weight-semibold);
        white-space: nowrap;
    }

    /* a check box under a label is as tall as the fields beside it, so every section's control sits on one centre line
       (30px; 36px on phones, as the fields) */
    .vb-filters__section > .vb-check {
        min-height: var(--vb-control-h-sm);
    }

    /* the row's last item: "Clear all" (a ghost button) takes the search, the chapters and every filter back to how a
       fresh page has them, as Home does */
    .vb-filters__clear {
        align-self: flex-end;
        margin-left: auto;
    }

    @media (max-width: 576px) {
        /* one line: the list of filters shows once the panel is open */
        .vb-filters > summary .vb-disclosure__meta {
            display: none;
        }

        .vb-filters__section {
            flex: 1 1 100%;
        }

        .vb-filters__section > .vb-check {
            min-height: var(--vb-control-h);
        }
    }

    /* ---- Sticky: a list's header and toolbar stay in view while the list scrolls (not on phones, where they would cover it) ---- */
    .vb-sticky {
        position: sticky;
        top: var(--vb-sticky-top, 0px);
        z-index: var(--vb-z-sticky);
        box-shadow: var(--vb-shadow-sm);
    }

    @media (max-width: 576px) {
        .vb-sticky {
            position: static;
        }
    }

    /* ---- vb-sidebar-layout - a side column (a vb-toc, filters) beside the page's main column.
       Wide screens: the side column stays in view under the app header and scrolls on its own when long.
       900px and below: one column; the side column becomes a bottom sheet over the page (.open, set by the page script),
       sliding up like the menus and panels, opened by a vb-fab with __open and closed by __close, Esc, the vb-backdrop
       behind it or a swipe down on its grip (vb-core.js).
       --reading: the main column is only as wide as vb-prose text (72ch) plus a vb-section's padding, so sections hug the text.
       (In patterns.css it comes after vb-toc, so its drawer rules win over the card's.) ---- */
    .vb-sidebar-layout {
        display: grid;
        grid-template-columns: var(--vb-shell-sidebar-w) minmax(0, 1fr);
        align-items: start;
        gap: var(--vb-space-24);
    }

    .vb-sidebar-layout__aside {
        position: sticky;
        top: calc(var(--vb-shell-header-h) + var(--vb-space-16));
        max-height: calc(100vh - var(--vb-shell-header-h) - 2 * var(--vb-space-16));
    }

    .vb-sidebar-layout__main {
        min-width: 0;
    }

    .vb-sidebar-layout--reading > .vb-sidebar-layout__main {
        max-width: calc(72ch + 2 * var(--vb-space-20) + 2px);
    }

    /* links into the page land below the fixed app header */
    .vb-sidebar-layout__main [id] {
        scroll-margin-top: calc(var(--vb-shell-header-h) + var(--vb-space-16));
    }

    .vb-sidebar-layout__open,
    .vb-sidebar-layout__close {
        display: none;
    }

    @media (max-width: 900px) {
        .vb-sidebar-layout {
            grid-template-columns: minmax(0, 1fr);
        }

        /* hidden, not just moved off-screen, so its links leave the tab order while closed */
        .vb-sidebar-layout__aside {
            position: fixed;
            top: auto;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: var(--vb-z-drawer);
            width: min(100%, 760px);
            height: calc(100dvh - var(--vb-space-48));
            max-height: none;
            margin-inline: auto;
            padding-top: var(--vb-space-24);
            padding-bottom: calc(var(--vb-space-16) + env(safe-area-inset-bottom, 0px));
            border: 0;
            border-radius: 16px 16px 0 0;
            box-shadow: var(--vb-shadow-lg);
            transform: translateY(100%);
            visibility: hidden;
            transition:
                transform var(--vb-duration-sheet) var(--vb-ease-sheet),
                visibility 0s linear var(--vb-duration-sheet);
        }

        .vb-sidebar-layout__aside.open {
            transform: none;
            visibility: visible;
            transition: transform var(--vb-duration-sheet) var(--vb-ease-sheet);
        }

        /* the grip */
        .vb-sidebar-layout__aside::before {
            content: "";
            position: absolute;
            top: var(--vb-space-8);
            left: 50%;
            width: 36px;
            height: 5px;
            margin-left: -18px;
            border-radius: var(--vb-radius-pill);
            background: var(--vb-border-control);
        }

        .vb-sidebar-layout__open,
        .vb-sidebar-layout__close {
            display: inline-flex;
        }
    }

    @media (max-width: 900px) and (prefers-reduced-motion: reduce) {
        .vb-sidebar-layout__aside,
        .vb-sidebar-layout__aside.open {
            transition: none;
        }
    }

    /* ---- vb-page--fill — a tool page sized to the screen between the header and the footer:
       vb-fill blocks pass the free height down to a flush section, whose vb-section__scroll part scrolls inside.
       Only on screens wide and tall enough; on phones and short screens the page scrolls as usual */
    @media (min-width: 577px) and (min-height: 560px) {
        .vb-page--fill {
            display: flex;
            flex-direction: column;
            height: calc(100vh - var(--vb-shell-header-h) - var(--footer-height, 0px));
            height: calc(100dvh - var(--vb-shell-header-h) - var(--footer-height, 0px));
            padding-top: var(--vb-space-16);
            padding-bottom: var(--vb-space-16);
        }

        .vb-page--fill .vb-fill {
            display: flex;
            flex-direction: column;
            flex: 1 1 auto;
            min-height: 0;
        }

        .vb-page--fill .vb-section__scroll {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
        }

        /* the section clips an outside ring */
        .vb-page--fill .vb-section__scroll:focus-visible {
            outline-offset: -2px;
        }
    }

    /* ---- vb-home - Home's two columns: the case to continue (__lead) and the waiting list in __main, a 340px __rail
       (Recent, points, a tip). Below 1100px one column in this order: the case, Recent (__recent), the waiting list,
       the rest of the rail ---- */
    .vb-home {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        align-items: start;
        gap: var(--vb-space-24) var(--vb-space-20);
    }

    .vb-home__main,
    .vb-home__rail {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
        min-width: 0;
    }

    .vb-home__main {
        gap: var(--vb-space-24);
    }

    .vb-home__rail {
        gap: var(--vb-space-16);
    }

    @media (max-width: 1100px) {
        .vb-home {
            grid-template-columns: minmax(0, 1fr);
        }

        /* the columns open up so their parts line up as one */
        .vb-home__main,
        .vb-home__rail {
            display: contents;
        }

        .vb-home__lead {
            order: -2;
        }

        .vb-home__recent {
            order: -1;
        }
    }

    /* the find field in Home's page header: as wide as its placeholder while empty, wider while in use or while it
       holds text (the width eases between the two); on phones it spans the row. Its keyboard hint sits under it */
    .vb-home__find {
        display: grid;
        justify-items: end;
        gap: var(--vb-space-4);
        max-width: 100%;
    }

    .vb-home__find .vb-search {
        width: auto;
        max-width: 100%;
    }

    .vb-home__find .vb-search__input {
        flex: 0 1 auto;
        width: 15rem;
        transition: width var(--vb-duration-base) var(--vb-ease);
    }

    .vb-home__find .vb-search:focus-within .vb-search__input,
    .vb-home__find .vb-search:has(.vb-search__input:not(:placeholder-shown)) .vb-search__input {
        width: 26rem;
    }

    @media (prefers-reduced-motion: reduce) {
        .vb-home__find .vb-search__input {
            transition: none;
        }
    }

    .vb-home__find-hint {
        margin: 0;
        color: var(--vb-text-muted);
        font-size: var(--vb-text-12);
        text-align: right;
    }

    .vb-home__find-hint kbd {
        display: inline-block;
        min-width: 1.6em;
        padding: 0 var(--vb-space-4);
        border: 1px solid var(--vb-border-control);
        border-bottom-width: 2px;
        border-radius: var(--vb-radius-sm);
        background: var(--vb-bg-subtle);
        color: var(--vb-text);
        font-family: var(--vb-font-mono);
        font-size: var(--vb-text-11);
        line-height: 1.5;
        text-align: center;
    }

    @media (max-width: 576px) {
        .vb-home__find {
            width: 100%;
            justify-items: stretch;
        }

        .vb-home__find .vb-search {
            width: 100%;
        }

        .vb-home__find .vb-search__input,
        .vb-home__find .vb-search:focus-within .vb-search__input,
        .vb-home__find .vb-search:has(.vb-search__input:not(:placeholder-shown)) .vb-search__input {
            flex: 1 1 auto;
            width: auto;
        }

        .vb-home__find-hint,
        .vb-home__find .vb-search__filter-label {
            display: none;
        }

        /* without its "In:" label the scope keeps its own padding only, leaving the field more room */
        .vb-home__find .vb-search__filter select {
            padding-left: var(--vb-space-12);
        }
    }

    /* ---- vb-page-footer - the quiet line at the end of a page: legal links and the app version (Home) ---- */
    .vb-page-footer {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--vb-space-8) var(--vb-space-24);
        padding-top: var(--vb-space-16);
        border-top: 1px solid var(--vb-border);
        color: var(--vb-text-muted);
        font-size: var(--vb-text-12);
    }

    .vb-page-footer nav {
        display: flex;
        flex-wrap: wrap;
        gap: var(--vb-space-4) var(--vb-space-12);
    }

    .vb-page-footer a {
        color: var(--vb-text-muted);
    }

    .vb-page-footer a:hover {
        color: var(--vb-link);
    }
}
