@font-face {
    font-family: "Alan Sans";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/alan-sans-latin.2e5ea52d1bc2.woff2") format("woff2");
    unicode-range:
        U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
        U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Alan Sans";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/alan-sans-latin-ext.e5ea8f60e171.woff2") format("woff2");
    unicode-range:
        U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
        U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
        U+2C60-2C7F, U+A720-A7FF;
}

/* Headings, prices and big numbers; body copy stays in Alan Sans */
@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/bricolage-latin.ad33cbc6d232.woff2") format("woff2");
    unicode-range:
        U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
        U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/bricolage-latin-ext.c4c7bb6a8d9b.woff2") format("woff2");
    unicode-range:
        U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
        U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
        U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* Warm paper and navy ink; flat surfaces held by hairlines, no floating shadows */
    --paper: #faf8f3;
    --paper-deep: #efebe2;
    --ink: #1c2130;
    --ink-soft: #5f6371;
    --paper-raised: #fffdf9;
    --field: #fffefb;
    --danger: #b3261e;
    --danger-tint: #fbe4e1;
    --danger-ink: #7a1a13;
    --line: #e4dfd4;
    --line-strong: #8d8f99; /* 3:1 on paper: form fields and perforations */
    --rule: 1px solid var(--line);
    --field-rule: 1px solid var(--line-strong);
    --lift: none;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-in: calc(var(--radius) - 1px);

    --font: "Alan Sans", system-ui, sans-serif;
    --font-display: "Bricolage Grotesque", "Alan Sans", system-ui, sans-serif;
    --gutter: clamp(1rem, 4vw, 2rem);
    --max: 1160px;

    /* Default colour palette */
    --accent: #000088;
    --on-accent: #fafaf7;
    --tint: #d1d1ea;
    --deep: #000088;
}

* {
    font-family: var(--font);
}

html {
    scroll-behavior: smooth;
    /* The canvas is paper from the first frame, so moving between sites never flashes white */
    background: var(--paper);
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-size: 1.0625rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;

    /* Sticky footer; ensure footer is at the bottom of the page */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

a {
    color: inherit;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}
a:hover {
    color: var(--deep);
}

h1,
h2,
h3,
h4 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0;
    text-wrap: balance;
}
h1,
h2,
h3,
h4,
.brand,
.price,
.fan-slip,
.hero-slip strong,
.stub-date b,
.foot-word {
    font-family: var(--font-display);
}
p {
    margin: 0 0 1em;
}

::selection {
    background: var(--accent);
    color: var(--on-accent);
}

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

.wrap {
    width: 100%;
    max-width: var(--max);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.num {
    font-variant-numeric: tabular-nums;
}

.eyebrow {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 0.9rem;
}

/* App switcher; top of the page */

.switcher {
    background: var(--ink);
    color: var(--paper);
    font-size: 0.85rem;
}
.switcher .wrap {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.switcher .wrap::-webkit-scrollbar {
    display: none;
}

.switcher a {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.9rem;
    color: var(--paper);
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
    opacity: 0.72;
}
.switcher a::before {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    background: var(--dot, var(--accent));
    flex: none;
    box-shadow: 0 0 0 1px rgba(242, 241, 236, 0.35); /* keeps a dark dot (brand blue) visible on the black strip */
}
.switcher a:hover {
    opacity: 1;
    color: var(--paper);
}
.switcher a:first-child {
    padding-inline-start: 0;
}

/* the tab for the site you're in lights up */
.switcher a[aria-current="true"] {
    opacity: 1;
    font-weight: 700;
    box-shadow: inset 0 -3px 0 var(--paper);
}

/* Site header */

.site-head {
    border-bottom: var(--rule);
    background: var(--paper);
}
.site-head .wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    padding-block: 1rem;
}

.brand {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-inline-end: auto;
}
.brand-app {
    color: var(--deep);
    font-weight: 700;
    letter-spacing: -0.03em;
}
.brand-app:not(:empty)::before {
    content: "/";
    margin-inline-end: 0.5rem;
    color: var(--ink);
    opacity: 0.35;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    font-weight: 600;
    font-size: 0.98rem;
}
.site-nav a {
    text-decoration: none;
    padding-block: 0.25rem;
    border-bottom: 2px solid transparent;
    color: var(--ink-soft);
    transition: color 0.15s ease;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
    border-bottom-color: var(--accent);
    color: var(--ink);
}

/* The menu's links sit in the header row on a wide screen; on a phone they fold behind the Menu button (below) */
.site-menu {
    display: contents;
}
.site-nav {
    order: 1;
}
.head-account {
    order: 2;
}
.head-basket,
.head-login {
    order: 3;
}
.head-form {
    order: 4;
}
/* .site-head so it beats .btn-bma's display; shown only on a phone, and only once the script that opens it has run */
.site-head .menu-toggle {
    display: none;
}
/* The header's gap spaces its buttons; the general "button next to a button" margin would count the hidden Menu */
.site-head .btn-bma:has(+ .btn-bma) {
    margin-inline-end: 0;
}

/* Buttons */

.btn-bma {
    --b-bg: var(--accent);
    --b-fg: var(--on-accent);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.25rem;
    background: var(--b-bg);
    color: var(--b-fg);
    border: 1px solid color-mix(in oklab, var(--b-bg), var(--ink) 18%);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}
.btn-bma:hover {
    color: var(--b-fg);
    background: color-mix(in oklab, var(--b-bg), var(--ink) 14%);
}
.btn-bma:active {
    transform: translateY(1px);
}
.btn-bma--ink {
    --b-bg: var(--ink);
    --b-fg: var(--paper);
}
.btn-bma--paper {
    --b-bg: var(--paper);
    --b-fg: var(--ink);
}
.btn-bma--ghost {
    --b-bg: transparent;
    --b-fg: var(--ink);
    border-color: var(--line-strong);
}
.btn-bma--ghost:hover {
    background: var(--paper-deep);
    color: var(--ink);
}
.btn-bma--sm {
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
}

/* Hero */

.hero {
    background: var(--accent);
    color: var(--on-accent);
    overflow: hidden;
}
.hero .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: center;
    padding-block: clamp(2.5rem, 7vw, 5.5rem);
}
.hero h1 {
    font-size: 3.5rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.05;
    max-width: 16ch;
}
.hero .lede {
    font-size: 1.15rem;
    opacity: 0.85;
    max-width: 38ch;
    margin: 1.25rem 0 2rem;
}
@media (max-width: 640px) {
    .hero h1 {
        font-size: 2.4rem;
    }
}
.hero a:hover {
    color: inherit;
}
.hero .eyebrow {
    color: inherit;
    opacity: 0.75;
}
/* on the area colour: a paper button leads, the second one is an outline */
.hero .btn-bma {
    --b-bg: var(--paper);
    --b-fg: var(--ink);
    border-color: var(--paper);
}
.hero .btn-bma--ink {
    --b-bg: transparent;
    --b-fg: var(--on-accent);
    border-color: color-mix(in oklab, var(--on-accent) 55%, transparent);
}
.hero .btn-bma--ink:hover {
    background: color-mix(in oklab, var(--on-accent) 12%, transparent);
    border-color: var(--on-accent);
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

/* single ticket slip for app heroes */
.hero-slip {
    justify-self: center;
    width: min(19rem, 100%);
    display: grid;
    gap: 1.75rem;
    padding: 1.4rem;
    background: var(--paper-raised);
    color: var(--ink);
    border: var(--field-rule);
    border-radius: var(--radius);
    transform: rotate(2deg);
}
.hero-slip small {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.hero-slip strong {
    display: block;
    font-size: 3.4rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 0.95;
    color: var(--deep);
    margin-top: 0.35rem;
}
.hero-slip-bars {
    padding-top: 1.1rem;
    border-top: 1.5px dashed var(--line-strong);
}
.hero-slip-bars::before {
    content: "";
    display: block;
    height: 2.4rem;
    background: repeating-linear-gradient(
        90deg,
        var(--ink) 0 2px,
        transparent 2px 5px,
        var(--ink) 5px 6px,
        transparent 6px 8px,
        var(--ink) 8px 11px,
        transparent 11px 14px
    );
}

/* fanned stack of coloured slips (central hero) */
.fan {
    position: relative;
    height: 20rem;
}
.fan-slip {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 11rem;
    aspect-ratio: 3 / 4;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--tint);
    color: var(--deep);
    border: 1px solid color-mix(in oklab, var(--tint), var(--deep) 35%);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: -0.02em;
}
/* tear line above the name, like the perforation on an event stub */
.fan-slip::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 3.6rem;
    border-top: 1px dashed color-mix(in oklab, var(--tint), var(--deep) 45%);
}
.fan-slip small {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.fan-slip:nth-child(1) {
    transform: translate(-158%, -51%) rotate(-5deg);
}
.fan-slip:nth-child(2) {
    transform: translate(-102%, -50%) rotate(-2deg);
}
.fan-slip:nth-child(3) {
    transform: translate(-46%, -50%) rotate(2deg);
}
.fan-slip:nth-child(4) {
    transform: translate(10%, -49%) rotate(5deg);
}

/* ---------- Legal / long-form pages ---------- */

.hero--page .wrap {
    display: block;
    padding-block: clamp(2rem, 5vw, 3.5rem);
}
.hero--page h1 {
    font-size: 2.75rem;
}
@media (max-width: 640px) {
    .hero--page h1 {
        font-size: 2.1rem;
    }
}
.hero--page .lede {
    margin-bottom: 0;
}

.prose {
    max-width: 68ch;
    line-height: 1.65;
}
.prose > * + * {
    margin-top: 1rem;
}
.prose > :first-child {
    margin-top: 0;
}
.prose h2 {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    margin-top: 2.5rem;
}
.prose h3 {
    font-size: 1.2rem;
    margin-top: 1.75rem;
}
.prose ul,
.prose ol {
    padding-inline-start: 1.4rem;
}
.prose li + li {
    margin-top: 0.4rem;
}
.prose a {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}
.prose table {
    width: 100%;
    border-collapse: collapse;
}
.prose th,
.prose td {
    padding: 0.6rem 0.75rem 0.6rem 0;
    text-align: start;
    vertical-align: top;
    border-bottom: 1px solid var(--ink-soft);
}

/* ---------- Sections ---------- */

.section {
    padding-block: clamp(2.5rem, 6vw, 4.5rem);
}
.section + .section {
    border-top: var(--rule);
}
.section--tint {
    background: var(--tint);
}
/* The first thing (the title) pushes the rest to the right; buttons that wrap start from the left, not spread out */
.section-head {
    display: flex;
    align-items: end;
    justify-content: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}
.section-head h2 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
}
.section-head > :first-child {
    margin-inline-end: auto;
}
.section-head > .btn-bma {
    margin: 0;
}
.section-head p {
    margin: 0;
    max-width: 36ch;
    color: var(--ink-soft);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
}
.chip {
    padding: 0.3rem 0.85rem;
    border: var(--rule);
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    background: transparent;
}
.chip:hover {
    background: var(--tint);
    color: var(--ink);
}
.chip[aria-current="true"] {
    background: var(--ink);
    color: var(--paper);
}

/* ---------- Central: app panels ---------- */

.panels {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.25rem;
}
.panel {
    grid-column: span 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
    min-height: 15rem;
    padding: 1.5rem;
    /* washed out: the area's pale tint, with its full colour kept in the title and arrow */
    background: var(--tint);
    color: var(--ink);
    border: 1px solid color-mix(in oklab, var(--tint), var(--deep) 22%);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color 0.15s ease;
}
.panel:hover {
    color: var(--ink);
    border-color: var(--deep);
}
/* repeating 4/2 · 2/4 pattern; a lone last panel spans the full row */
.panel:nth-child(4n + 1) {
    grid-column: span 4;
}
.panel:nth-child(4n + 2),
.panel:nth-child(4n + 3) {
    grid-column: span 2;
}
.panel:nth-child(4n + 4) {
    grid-column: span 4;
}
.panel:last-child:nth-child(4n + 1),
.panel:last-child:nth-child(4n + 3) {
    grid-column: span 6;
}
.panel h3 {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--deep);
}
.panel p {
    margin: 0.6rem 0 0;
    max-width: 32ch;
}
.panel-foot {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--deep);
}
.panel:hover .panel-foot {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.panel-foot .arrow {
    line-height: 1;
    transition: transform 0.15s ease;
}
.panel:hover .arrow {
    transform: translateX(3px);
}

/* ---------- Events: ticket stubs ---------- */

.stubs {
    display: grid;
    gap: 1.5rem;
}
.stub {
    --stub-w: 6.25rem;
    position: relative;
    display: grid;
    grid-template-columns: var(--stub-w) 1fr auto;
    background: var(--paper-raised);
    border: var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--lift);
}
.stub::before,
.stub::after {
    content: "";
    position: absolute;
    inset-inline-start: calc(var(--stub-w) - 11px);
    width: 20px;
    height: 20px;
    background: var(--paper);
    border: var(--rule);
    border-radius: 50%;
}
.stub::before {
    top: -12px;
    clip-path: inset(50% 0 0 0);
}
.stub::after {
    bottom: -12px;
    clip-path: inset(0 0 50% 0);
}

.stub-date {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--accent);
    color: var(--on-accent);
    border-inline-end: 1.5px dashed var(--line-strong);
    border-start-start-radius: var(--radius-in);
    border-end-start-radius: var(--radius-in);
    padding: 1rem 0.5rem;
    line-height: 1;
}
.stub-date b {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}
.stub-date span {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 0.3rem;
}

.stub-body {
    padding: 1.15rem 1.5rem;
}
.stub-body h3 {
    font-size: 1.6rem;
    margin-bottom: 0.4rem;
}
.stub-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin: 0;
}

.stub-buy {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem 1.5rem;
}
.price {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    /* "£3.00" never breaks in two, even where long words may (main p { overflow-wrap: anywhere }) */
    white-space: nowrap;
    overflow-wrap: normal;
}
.price small {
    white-space: normal;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-soft);
    letter-spacing: 0;
}

/* ---------- Trips: departure board ---------- */

.board {
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius);
    padding: 0.5rem 1.5rem 1rem;
    box-shadow: var(--lift);
}
.board-row {
    display: grid;
    grid-template-columns: 5.5rem 1fr 7rem 5rem 8rem;
    gap: 1rem;
    align-items: center;
    padding: 1.1rem 0;
    border-bottom: 1px dashed rgba(242, 241, 236, 0.3);
}
.board-row:last-child {
    border-bottom: 0;
}
.board-row--head {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.6;
    padding-block: 1rem 0.75rem;
    border-bottom: 1px solid rgba(242, 241, 236, 0.5);
}
.board-time {
    white-space: nowrap;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: #f2c14e;
}
.board-dest strong {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.board-dest span {
    font-size: 0.9rem;
    opacity: 0.7;
}
.board-status {
    font-size: 0.9rem;
    font-weight: 700;
}
.board-status::before {
    content: "";
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    margin-inline-end: 0.5rem;
    background: #5fd0b2;
}
.board-status[data-state="low"]::before {
    background: #f2c14e;
}
.board-status[data-state="full"]::before {
    background: #e8674c;
}
.board-status[data-state="full"] {
    opacity: 0.6;
}
.board .price {
    font-size: 1.35rem;
}
.board .price small {
    color: inherit;
    opacity: 0.6;
}
.board a:not(.btn-bma) {
    color: var(--paper);
}
.board .btn-bma {
    --b-bg: var(--paper);
    --b-fg: var(--ink);
    color: var(--ink);
    justify-content: center;
    box-shadow: var(--lift);
}
.board .btn-bma[aria-disabled="true"] {
    opacity: 0.4;
    pointer-events: none;
    box-shadow: none;
}

/* ---------- Clubs: membership rows ---------- */

.roll {
    border-top: var(--rule);
}
.club {
    display: grid;
    grid-template-columns: 4.25rem 1fr auto auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: var(--rule);
}
.club-mark {
    width: 4.25rem;
    height: 4.25rem;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--on-accent);
    border: var(--rule);
    border-radius: 50% 50% 50% 8px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}
.club:nth-child(even) .club-mark {
    border-radius: 8px 50% 50% 50%;
}
.club h3 {
    font-size: 1.45rem;
    margin-bottom: 0.2rem;
}
.club p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.95rem;
}
.club-count {
    text-align: end;
    font-size: 0.85rem;
    color: var(--ink-soft);
    line-height: 1.2;
}
.club-count b {
    display: block;
    font-size: 1.5rem;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* ---------- Shop: products ---------- */

.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem 1.5rem;
}
.product {
    text-decoration: none;
    display: block;
}
.product:hover {
    color: inherit;
}
.product-img {
    aspect-ratio: 4 / 5;
    position: relative;
    overflow: hidden;
    background: var(--tint);
    border: var(--rule);
    border-radius: var(--radius-in);
    display: grid;
    place-items: center;
    transition: transform 0.12s ease;
}
.product:hover .product-img {
    transform: rotate(-1.2deg) scale(1.015);
}
.product-img i {
    font-style: normal;
    font-weight: 800;
    letter-spacing: -0.06em;
    font-size: clamp(4rem, 9vw, 7rem);
    line-height: 1;
    color: var(--deep);
}
.product-tag {
    position: absolute;
    inset-inline-start: 0.75rem;
    top: 0.75rem;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.25rem 0.55rem;
    border-radius: 3px;
}
.product-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding-top: 0.8rem;
}
.product-info h3 {
    min-width: 0;
    font-size: 1.1rem;
    letter-spacing: -0.015em;
    line-height: 1.2;
    overflow-wrap: break-word; /* whole words only: "Replacement" never splits */
    hyphens: auto;
}
/* Two narrow tiles side by side on a phone: the price goes under the name instead of squeezing it */
@media (max-width: 640px) {
    .product-info {
        flex-direction: column;
        gap: 0.2rem;
    }
}
.product-info .price {
    font-size: 1.1rem;
}

/* ---------- Note strip / footer ---------- */

.note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.5rem;
    background: var(--tint);
    border: var(--rule);
    border-radius: var(--radius);
}
.note p {
    margin: 0;
    font-weight: 600;
    max-width: 52ch;
}

.site-foot {
    background: var(--ink);
    color: var(--paper);
    margin-top: 0;
}
.site-foot a {
    color: var(--paper);
    text-decoration-color: rgba(242, 241, 236, 0.4);
}
.site-foot a:hover {
    color: var(--paper);
    text-decoration-color: var(--accent);
}
.foot-top {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 2.5rem;
    padding-block: 3.5rem 2.5rem;
}
.foot-word {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
}
.foot-top h2 {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0;
    opacity: 0.6;
    margin-bottom: 0.9rem;
}
.foot-top ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.4rem;
}
.foot-bar {
    border-top: 1px solid rgba(242, 241, 236, 0.25);
    padding-block: 1.25rem;
    font-size: 0.85rem;
    opacity: 0.7;
}
.foot-stripe {
    display: flex;
    height: 0.5rem;
}
.foot-stripe i {
    flex: 1;
    background: var(--accent);
}

/* ---------- Forms and sign-in ---------- */

.head-form {
    margin: 0;
}

.auth {
    display: flex;
    justify-content: center;
    padding: clamp(2rem, 6vw, 4.5rem) var(--gutter);
}
.auth-card {
    width: min(28rem, 100%);
    padding: 2rem;
    background: var(--paper-raised);
    border: var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--lift);
}
.auth-card h1 {
    font-size: 2.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}
.auth-card .lede {
    color: var(--ink-soft);
    margin-bottom: 1.75rem;
}
.auth-card .btn-bma {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

.field {
    margin-bottom: 1.1rem;
}
.field label {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}
.field-input,
.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font-size: 1rem;
    color: var(--ink);
    background: var(--field);
    border: var(--field-rule);
    border-radius: var(--radius-sm);
}
.field-input:focus,
.field input:focus {
    outline: 3px solid var(--accent);
    outline-offset: 0;
}
.field-error,
.errorlist {
    list-style: none;
    margin: 0.4rem 0 0;
    padding: 0;
    color: var(--danger);
    font-weight: 600;
    font-size: 0.9rem;
}

.field--check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.field--check input {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--accent);
    flex: none;
}
.field--check label {
    margin: 0;
    font-weight: 600;
}
.field--check .errorlist {
    flex-basis: 100%;
}

.auth-card h1 + p {
    color: var(--ink-soft);
    margin-bottom: 1.75rem;
}
.auth-card p {
    margin-bottom: 1rem;
}
.auth-card .btn-bma + .btn-bma {
    margin-top: 0.9rem;
}
.auth-card--wide {
    width: min(40rem, 100%);
}
/* Account pages with more than one part (email addresses, two-step login) */
.auth-card h2 {
    font-size: 1.4rem;
    margin: 1.75rem 0 0.5rem;
}
.auth-card section > ul {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.messages {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.messages .form-alert {
    margin-bottom: 0;
}
main > .messages {
    max-width: var(--max);
    width: 100%;
    margin: 1.25rem auto 0;
    padding-inline: var(--gutter);
    box-sizing: border-box;
}

.field-help {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--ink-soft);
}
.field-help a {
    font-weight: 700;
}
.field-help ul {
    margin: 0;
    padding-inline-start: 1.1rem;
}
.auth-links {
    margin: 1.5rem 0 0;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}

.form-alert {
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: var(--tint);
    border: var(--rule);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.form-alert--error {
    background: #fbe4e1;
    border-color: var(--danger);
    color: #7a1a13;
}
/* Text links such as "Receipt" and "Add to calendar" are hard to hit with a thumb. Padding on an inline link makes the
   area that takes the tap taller without moving any text. */
@media (pointer: coarse) {
    main :is(p, li, td, dd, span, small) > a:not(.btn-bma) {
        padding-block: 0.45rem;
    }
}

/* "Added to your basket" and the like: plain, so it never reads as an error on the red Events or pink Shop sites */
.form-alert--done {
    background: var(--paper-raised);
}
.form-alert--done::before {
    content: "\2713";
    margin-inline-end: 0.5rem;
}

/* ---------- Staff: sent emails ---------- */
.email-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1.25rem;
    margin-bottom: 1.5rem;
}
.email-meta dt {
    font-weight: 600;
}
.email-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}
.email-frame {
    display: block;
    width: 100%;
    height: 75vh;
    border: var(--rule);
    background: #fff;
}
.email-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: 1rem;
    border: var(--rule);
    font-size: 0.9rem;
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
    .hero .wrap {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
    }
    .fan {
        height: 16rem;
    }
    .hero-slip {
        display: none;
    }
    .fan {
        left: 1.5rem;
    }
    .fan-slip {
        width: 6.75rem;
        padding: 0.85rem;
        font-size: 1rem;
    }
    /* Spread a little wider than on desktop, so each name ("Events") shows in full past the next slip */
    .fan-slip:nth-child(1) {
        transform: translate(-170%, -52%) rotate(-8deg);
    }
    .fan-slip:nth-child(2) {
        transform: translate(-108%, -50%) rotate(-3deg);
    }
    .fan-slip:nth-child(3) {
        transform: translate(-46%, -50%) rotate(3deg);
    }
    .fan-slip:nth-child(4) {
        transform: translate(16%, -48%) rotate(8deg);
    }
    .panel,
    .panel:nth-child(n) {
        grid-column: span 6;
        min-height: 12rem;
    }
    .products {
        grid-template-columns: repeat(2, 1fr);
    }
    .foot-top {
        grid-template-columns: 1fr 1fr;
    }
    .foot-top > :first-child {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .site-head .wrap {
        gap: 0.5rem;
        padding-block: 0.6rem;
    }
    .brand {
        font-size: 1.2rem;
        white-space: nowrap;
        min-width: 0;
    }
    .site-head .btn-bma--sm {
        padding-inline: 0.6rem;
    }
    /* One row: brand, Basket, Menu. The menu opens underneath as a list of full-width rows. */
    .js .site-head:has(.menu-toggle) .menu-toggle {
        display: inline-flex;
        order: 4;
    }
    .js .site-head:has(.menu-toggle) .site-menu {
        display: none;
    }
    .site-menu,
    .js .site-head.is-open .site-menu {
        display: flex;
        flex-direction: column;
        flex: 1 1 100%;
        order: 5;
    }
    .site-menu .site-nav {
        display: contents;
    }
    .site-menu .head-account {
        order: -1;
    }
    .site-menu .head-form {
        order: 99;
    }
    .site-head .site-menu :is(a, button) {
        display: block;
        width: 100%;
        min-height: 0;
        margin: 0;
        padding: 0.8rem 0;
        border: 0;
        border-top: 1px dashed var(--line-strong);
        border-radius: 0;
        background: none;
        box-shadow: none;
        transform: none;
        color: var(--ink);
        font-size: 1.05rem;
        font-weight: 600;
        text-align: start;
    }
    .site-head .site-menu :is(a, button):hover {
        background: none;
        color: var(--deep);
    }
    .site-head.is-open .menu-toggle {
        --b-bg: var(--ink);
        --b-fg: var(--paper);
    }
    /* The smallest phones (320px): brand, Basket and Menu still share one row, and the children one more */
    @media (max-width: 359px) {
        .brand {
            font-size: 1.05rem;
            gap: 0.3rem;
        }
        .brand-app:not(:empty)::before {
            margin-inline-end: 0.3rem;
        }
        .site-head .btn-bma--sm,
        .child-switch .btn-bma--sm {
            padding-inline: 0.45rem;
            font-size: 0.82rem;
        }
        .child-switch form {
            gap: 0.4rem;
        }
    }
    .stub-body h3 {
        overflow-wrap: anywhere;
    }
    .site-nav {
        order: 3;
        flex: 1 1 100%;
    }
    .btn-bma,
    .btn-bma--sm {
        min-height: 2.75rem;
        justify-content: center;
    }
    /* All five sites fit across a 360px phone, so Shop is never cut off at the edge */
    .switcher .wrap {
        gap: 0;
        justify-content: space-between;
    }
    .switcher a {
        padding: 0.8rem 0.45rem;
        gap: 0.4rem;
        font-size: 0.8rem;
    }
    .switcher a:last-child {
        padding-inline-end: 0;
    }
    /* ...and on the smallest phones (320px) too */
    @media (max-width: 359px) {
        .switcher a {
            padding-inline: 0.3rem;
            gap: 0.3rem;
            font-size: 0.75rem;
        }
    }
    .switcher a::before {
        width: 0.5rem;
        height: 0.5rem;
    }
    .stub {
        --stub-w: 4.75rem;
        grid-template-columns: var(--stub-w) minmax(0, 1fr);
    }
    .stub-date b {
        font-size: 1.9rem;
    }
    .stub-body {
        padding: 1rem;
    }
    .stub-body h3 {
        font-size: 1.3rem;
    }
    .stub-buy {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.6rem 1rem;
        border-top: 1.5px dashed var(--line-strong);
        padding: 0.8rem 1rem;
    }

    .board {
        padding-inline: 1rem;
    }
    /* Date on the left; the trip gets the full width, with its price and button on a row of their own */
    .board-row {
        grid-template-columns: 4.25rem 1fr auto;
        gap: 0.35rem 1rem;
    }
    .board-row--head {
        display: none;
    }
    .board-time {
        grid-row: 1 / span 3;
        align-self: start;
        font-size: 1.2rem;
    }
    .board-dest {
        grid-column: 2 / -1;
    }
    .board-dest strong {
        font-size: 1.2rem;
    }
    .board-status {
        grid-column: 2 / -1;
        grid-row: 2;
    }
    .board .price {
        grid-column: 2;
        grid-row: 3;
    }
    .board-row > .btn-bma {
        grid-column: 3;
        grid-row: 3;
        justify-self: end;
    }

    .club {
        grid-template-columns: 3.25rem 1fr;
        gap: 0.5rem 1rem;
    }
    .club-mark {
        width: 3.25rem;
        height: 3.25rem;
        font-size: 1.15rem;
    }
    .club-count {
        text-align: start;
        grid-column: 2;
    }
    .club > .btn-bma {
        grid-column: 2;
        justify-self: start;
    }
}

/* ---------- Between pages ---------- */

/* Covers the page while the next one loads (static/js/page-loader.js); also stops a second tap on Pay */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 1rem;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(3px);
    color: var(--ink-soft);
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.2s ease,
        visibility 0s linear 0.2s;
}
.page-loader.is-loading {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease;
}
.page-loader__spinner {
    width: 2.75rem;
    height: 2.75rem;
    border: 4px solid var(--tint);
    border-top-color: var(--accent);
    border-radius: 50%;
    /* Always turning, even while hidden: some browsers (Safari) won't start an animation once the next page is on its way */
    animation: page-loader-spin 0.8s linear infinite;
    will-change: transform;
}
@keyframes page-loader-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Off to another of our sites (events, shop…): fade to plain paper straight away, and only show the
   spinner if the next page is slow. The new page then fades in (.is-arriving below). */
.page-loader.is-leaving {
    opacity: 1;
    visibility: visible;
    background: var(--paper);
    backdrop-filter: none;
    transition: opacity 0.15s ease;
}
.page-loader.is-leaving:not(.is-loading) > * {
    opacity: 0;
}

/* A soft fade from one page to the next, in browsers that support it */
@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 0.18s;
    }
    /* View transitions stop at the edge of a site, so a page reached from another subdomain fades in itself */
    html.is-arriving body {
        animation: page-arrive 0.22s ease;
    }
}
@keyframes page-arrive {
    from {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
    /* A still ring doesn't say "working": turn slowly instead */
    .page-loader__spinner {
        animation: page-loader-spin 2s linear infinite !important;
    }
    html {
        scroll-behavior: auto;
    }
}

/* ---------- Central: things to pay for ---------- */

.dues {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}
.due {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--paper-raised);
    border: var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--lift);
}
.due-body h3 {
    font-size: 1.15rem;
    margin: 0 0 0.2rem;
}
.due-body p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.95rem;
}
.dues-total {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.75rem;
    margin: 1rem 0 0;
    font-weight: 700;
}
.dues-empty {
    color: var(--ink-soft);
}
/* Home page "Coming up": today's and tomorrow's tickets, trips and club sessions */
.due.coming-up {
    grid-template-columns: 1fr;
}
.due-body h3 a {
    color: inherit;
}
@media (max-width: 640px) {
    .due {
        grid-template-columns: 1fr auto;
    }
    .due .btn-bma {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

/* First thing a keyboard user reaches: jumps past the site switcher and header */
.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2100;
    padding: 0.6rem 1rem;
    background: var(--ink);
    color: var(--paper);
    font-weight: 600;
    border-radius: var(--radius-sm);
    transform: translateY(-200%);
}
.skip-link:focus {
    transform: none;
}

/* Password box with its Show/Hide button (static/js/page-actions.js) */
.password-wrap {
    position: relative;
}
/* Selector as specific as the .field input rule it adds to */
.field .password-wrap input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
    padding-right: 4.5rem;
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    transform: translateY(-50%);
    min-height: 2.25rem;
    padding: 0 0.75rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-soft);
    font-weight: 600;
}
.password-toggle:hover {
    color: var(--ink);
    background: var(--tint);
}

/* A form that has been sent and is waiting for the next page */
form[aria-busy="true"] button:not([type="button"]):not([type="reset"]),
form[aria-busy="true"] input[type="submit"] {
    opacity: 0.6;
    cursor: progress;
}

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

.scan-counter {
    font-size: 1.4rem;
}
.scan-banner {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    border: var(--rule);
    font-size: 1.15rem;
    margin: 1rem 0;
}
.scan-banner--ok {
    background: #d9f2e0;
    color: #0d4a1f;
}
.scan-banner--warn {
    background: #fff0c2;
    color: #6b4a00;
}
.scan-banner--bad {
    background: #f9d6d2;
    color: #7a1208;
}
.scan-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 1rem;
}
.scan-list li {
    padding: 0.65rem 0;
    border-bottom: 1px dashed currentColor;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
}
.child-switch {
    border-bottom: var(--rule);
    padding: 0.85rem 0;
}
.child-switch form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 0;
}
.child-switch-label {
    font-weight: 600;
}
/* ---------- Spacing for plain content pages (headings, lists, tables and forms straight in .wrap) ---------- */

.section .wrap > h1 {
    margin-bottom: 1rem;
}
/* The facts line under a page title (date, place, how many left), then whatever comes next */
.section .wrap > h1 + .stub-meta {
    margin-top: -0.35rem;
}
.section .wrap > .stub-meta + .stub-meta {
    margin-top: 0.35rem;
}
.section .wrap > .stub-meta + :not(.stub-meta, h2) {
    margin-top: 1.1rem;
}
.section .wrap > h2 {
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    margin: 2.25rem 0 0.75rem;
}
.section .wrap > h2:first-child,
.section .wrap > .section-head + h2 {
    margin-top: 0;
}
.section .wrap > ul,
.section .wrap > ol {
    margin: 0 0 1.25rem;
    padding-inline-start: 1.25rem;
}
.section .wrap > ul li + li {
    margin-top: 0.35rem;
}
.section .wrap > form {
    margin-block: 1.25rem;
}
.section .wrap > table,
.section .wrap > .dt-container,
.section .wrap > .table-responsive {
    margin-bottom: 1.5rem;
}
/* Buttons side by side in running text. The space goes after a button, not before the next one, so a
   button that wraps onto a new line starts at the edge. Containers that already use gap reset this below. */
.btn-bma:has(+ .btn-bma) {
    margin-inline-end: 0.75rem;
}
/* Buttons in running text that wrap onto a second line keep a gap between the lines */
:is(p, td, div:not([class])) > .btn-bma,
:is(p, td, div:not([class])) > form > .btn-bma {
    margin-block: 0.2rem;
}
/* A tick box's label followed by its button ("Choose all shown  Invite the parents ticked") */
label + .btn-bma {
    margin-inline-start: 0.75rem;
}
/* ...and when the button wraps under the label on a phone, it starts at the same edge */
p:has(> label + .btn-bma) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}
p > label + .btn-bma {
    margin: 0;
}
/* Whatever follows a card sits clear of its shadow (a heading keeps its own, larger space) */
.section .wrap > .card-form + :not(.card-form, h2) {
    margin-top: 1.5rem;
}
/* A plain link after a button ("Back to BMA Pay  Contact us") */
.btn-bma + a:not(.btn-bma) {
    margin-inline-start: 1rem;
}
:is(
        .hero-actions,
        .child-switch form,
        .filter-actions,
        .lookup-form,
        .stub-buy form,
        .section-head,
        .stub-buy,
        .action-bar
    )
    > .btn-bma {
    margin-inline: 0;
}
.dt-container {
    margin-bottom: 1.5rem;
}
.dt-container .dt-search {
    margin-bottom: 0.75rem;
}
.dt-container .dt-search input {
    margin-left: 0.5rem;
}
.dt-container .dt-info {
    padding-top: 0.75rem;
}

/* Small number cards for the staff dashboard */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat {
    border: var(--rule);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    background: var(--paper);
}
.stat h3 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
}
.stat strong {
    display: block;
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 0.4rem;
}
.stat p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.95rem;
}
.attention-list {
    list-style: none;
    padding: 0;
}
.attention-list li {
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--line-strong);
}
.attention-list a {
    margin-left: 0.75rem;
}

/* Staff hub: keep the varied tile sizes, but stop long words such as "Reconciliation" overflowing the narrow tiles */
.panel h3 {
    overflow-wrap: anywhere;
}
.panels--tools .panel:nth-child(4n + 2) h3,
.panels--tools .panel:nth-child(4n + 3) h3 {
    font-size: clamp(1.7rem, 3.4vw, 2.3rem);
}

/* Staff hub groups. Central tools take a shade of the brand blue by group, darkest for everyday
   tools; tools on a subdomain keep their site colour. `.panel[data-shade]` outranks [data-app]. */
/* Gap between groups, counting only the ones the "Find a tool" box has left showing */
.tool-group:not([hidden]) ~ .tool-group {
    margin-top: 3.5rem;
}
/* Staff hub "Find a tool" box (static/js/tool-filter.js) */
.tool-filter .field-input {
    flex: 1 1 16rem;
}
/* "3 waiting" on a staff hub tile (core/todo.py) */
.tool-count {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.8rem;
    font-weight: 700;
    vertical-align: middle;
    white-space: nowrap;
}
/* "With the ticked trips: Publish / Hide" above a staff list (templates/staff/manage_list.html) */
.bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--ink-soft);
}
.tool-digest {
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: var(--rule);
    color: var(--ink-soft);
}
.tool-group[hidden],
.panels--tools .panel[hidden] {
    display: none;
}
.tool-group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: var(--rule);
}
.tool-group-head h2 {
    margin: 0;
}
.tool-group-head p {
    margin: 0;
    color: var(--ink-soft);
}
.panel[data-shade="deep"] {
    --accent: #000088;
    --on-accent: #fafaf7;
}
.panel[data-shade="mid"] {
    --accent: #3a3fc4;
    --on-accent: #fafaf7;
}
.panel[data-shade="tint"] {
    --accent: #d1d1ea;
    --on-accent: #1b1c21;
}
.panel[data-shade="pale"] {
    --accent: #ecebf6;
    --on-accent: #1b1c21;
}

/* ---------- Staff and admin pages: Bootstrap controls in the house style ---------- */

.form-label {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}
.form-control,
.form-select,
.field select,
.field textarea {
    display: block;
    width: 100%;
    padding: 0.7rem 0.85rem;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--ink);
    background-color: var(--field);
    border: var(--field-rule);
    border-radius: var(--radius-sm);
    box-shadow: none;
}
.form-control:focus,
.form-select:focus,
.field select:focus,
.field textarea:focus {
    color: var(--ink);
    background-color: var(--field);
    border-color: var(--ink);
    outline: 3px solid var(--accent);
    outline-offset: 0;
    box-shadow: none;
}
/* Controls written by hand without a class (a filter, a "choose all" box) look like the rest.
   :not([class]) leaves Bootstrap, crispy and Tom Select controls alone. */
:where(main) select:not([class], [multiple]) {
    max-width: 100%;
    padding: 0.6rem 2.4rem 0.6rem 0.85rem;
    font: inherit;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--ink);
    background: var(--field)
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%231b1c21' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e")
        no-repeat right 0.8rem center / 14px 10px;
    border: var(--field-rule);
    border-radius: var(--radius-sm);
    appearance: none;
}
:where(main) select:not([class], [multiple]):focus {
    outline: 3px solid var(--accent);
    outline-offset: 0;
}
:where(main) input:is([type="checkbox"], [type="radio"]):not([class]) {
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
    vertical-align: -0.2rem;
    accent-color: var(--accent);
}
:where(main) label:has(> input[type="checkbox"]:not([class])) {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
}
:where(main) label:has(> input[type="checkbox"]:not([class])) > input {
    flex: none;
    margin-top: 0.15rem;
}
.form-control::placeholder {
    color: var(--ink-soft);
    opacity: 0.8;
}
.form-control:disabled,
.form-select:disabled {
    background-color: var(--paper-deep);
    color: var(--ink-soft);
}
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0;
    margin-bottom: 0.6rem;
}
.form-check-input,
.field--check input {
    flex: none;
    float: none;
    width: 1.35rem;
    height: 1.35rem;
    margin: 0.1rem 0 0;
    background-color: var(--field);
    border: var(--field-rule);
    accent-color: var(--accent);
}
.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--ink);
}
.form-check-input:focus {
    box-shadow: none;
    outline: 3px solid var(--ink);
    outline-offset: 2px;
}
.form-check-label small {
    color: var(--ink-soft);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: var(--paper-deep);
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--ink);
    border: var(--rule);
    font-size: 0.95rem;
}
.table > thead {
    /* Bootstrap and DataTables paint cells from this variable, so set it rather than the background */
    --bs-table-bg: var(--ink);
    --bs-table-color: var(--paper);
    --bs-table-border-color: var(--ink);
}
.table > thead > tr > th {
    font-weight: 700;
    white-space: nowrap;
}
.data-table td:first-child {
    white-space: nowrap;
}
.table > :not(caption) > * > * {
    padding: 0.6rem 0.75rem;
    vertical-align: middle; /* a row's text lines up with its buttons */
}
.table-sm > :not(caption) > * > * {
    padding: 0.45rem 0.65rem;
}

.alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    border: var(--rule);
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.alert-warning {
    background: #fff0c2;
    color: #6b4a00;
}
.alert-danger {
    background: var(--danger-tint);
    border-color: var(--danger);
    color: var(--danger-ink);
}

.btn-bma[disabled],
.btn-bma[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- Payment received: the paid stub ---------- */

.paid-lede {
    max-width: 60ch;
    margin-bottom: 1.75rem;
}
.stub--paid {
    max-width: 44rem;
}
.stub--paid .stub-date b {
    font-size: 1.7rem;
    letter-spacing: -0.03em;
}
.paid-lines {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}
.paid-lines li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0;
    font-weight: 600;
    border-bottom: 1px dashed var(--line-strong);
}
.paid-lines .num {
    white-space: nowrap; /* keep "£18.00" on one line on narrow phones */
}
.paid-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.75rem;
    margin: 0;
}
.paid-meta dt {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.paid-meta dd {
    margin: 0;
    font-weight: 700;
}
.paid-next {
    margin-top: 2rem;
}

/* ---------- Finance: find a payer ---------- */

.lookup-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    max-width: 40rem;
    margin-bottom: 2rem;
}
.lookup-form .field {
    flex: 1 1 16rem;
    margin: 0;
}
.lookup-results {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}
.lookup-results li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--line-strong);
}

/* Filter forms: fields side by side instead of one long column */

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0 1rem;
    align-items: start;
    margin-bottom: 1.5rem;
}
.filter-form #div_id_q,
.filter-form .filter-actions {
    grid-column: 1 / -1;
}
.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Tickets with no coloured date column (basket, reports): the body takes the width the date would have had */

.stub:not(:has(> .stub-date)) {
    grid-template-columns: minmax(0, 1fr) auto;
}
.stub:not(:has(> .stub-date))::before,
.stub:not(:has(> .stub-date))::after {
    display: none;
}
@media (max-width: 640px) {
    .stub:not(:has(> .stub-date)) {
        grid-template-columns: minmax(0, 1fr);
    }
}
.stubs + :is(p, form, h2, .price) {
    margin-top: 1.75rem;
}
.stub-buy form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}
.stub-buy input[type="number"] {
    width: 4.5rem;
    padding: 0.45rem 0.6rem;
    font-size: 1rem;
    color: var(--ink);
    background: var(--field);
    border: var(--field-rule);
    border-radius: var(--radius-sm);
}

/* DataTables adds its own column padding; keep tables in line with the page edge */
.table-responsive > .dt-container > .row > * {
    padding-inline: 0;
}

@media (max-width: 640px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stat strong {
        font-size: 1.5rem;
    }
}

.inline-form {
    display: inline;
}

/* Staff forms */

.section form h2 {
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    margin: 2rem 0 0.75rem;
}
/* The submit button under a form's fields. Not a one-button form in a row of buttons (a table, a row, a bar). */
.section
    form:not(
        .lookup-form,
        .filter-form,
        .inline-form,
        .row-actions,
        .table-actions form,
        .action-bar form
    )
    > .btn-bma {
    margin-top: 1.25rem;
}
/* ...and the field above it drops its own space, so the gap is that 1.25rem, not both added together */
.section
    form:not(
        .lookup-form,
        .filter-form,
        .inline-form,
        .row-actions,
        .table-actions form,
        .action-bar form
    )
    > :is(.mb-3, .field):has(+ .btn-bma) {
    margin-bottom: 0 !important;
}
/* A card whose first thing is its button (a pay page with nothing to fill in) keeps an even edge */
.section .card-form > .btn-bma:nth-child(1 of :not(input[type="hidden"])) {
    margin-top: 0;
}
.field .field-input[type="date"],
.field input[type="date"] {
    max-width: 16rem;
}
.field--check {
    margin-bottom: 0.6rem;
}
.field--check {
    align-items: flex-start;
}
.field--check label strong {
    font-weight: 700;
}
fieldset.field legend {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem;
}
.stub + :is(p, form) {
    margin-top: 1.75rem;
}

/* ---------- Phones: comfortable tap targets, nothing wider than the screen ---------- */

main :is(p, li, a, dd, h1, h2, h3) {
    overflow-wrap: anywhere;
}
/* In a table a code or name only breaks if it must, so a column is never squeezed to "EEDB4B / 0C" */
main td :is(p, a) {
    overflow-wrap: break-word;
}

@media (max-width: 640px) {
    .site-nav {
        margin-inline-start: -0.4rem;
    }
    .site-nav a {
        padding: 0.6rem 0.4rem;
    }
    /* A page title with buttons: the title has its own line, the buttons line up under it from the left */
    .section-head:has(> .btn-bma, > form) {
        gap: 0.75rem;
    }
    .section-head > :first-child:has(~ .btn-bma, ~ form) {
        flex-basis: 100%;
    }
    .chip {
        display: inline-flex;
        align-items: center;
        min-height: 2.75rem;
        padding-inline: 1rem;
    }
}

/* The Cloudflare check is a fixed 300px wide; shrink it (and the card around it) on the smallest phones */
@media (max-width: 380px) {
    .auth-card {
        padding: 1.25rem;
    }
    .cf-turnstile {
        zoom: 0.9;
    }
    .board-row {
        grid-template-columns: 4rem minmax(0, 1fr) auto;
        gap: 0.35rem 0.75rem;
    }
    .board-time {
        font-size: 1.1rem;
    }
    .board .price {
        font-size: 1.4rem;
    }
}
@media (max-width: 340px) {
    .cf-turnstile {
        zoom: 0.8;
    }
}

.stub-buy img {
    display: block;
    max-width: 100%;
    height: auto;
}
.stub-buy:has(> img:only-child) {
    align-items: center;
}
@media (max-width: 640px) {
    .stub-buy:has(> img:only-child) {
        justify-content: center;
    }
}

/* Header on small phones: brand, Basket and Log out share the first row */
@media (max-width: 400px) {
    .site-head .btn-bma--sm {
        padding-inline: 0.5rem;
        font-size: 0.85rem;
    }
}

/* Bootstrap offsets checkboxes with a negative margin and left padding; we lay them out with flex instead */
.form-check .form-check-input {
    float: none;
    margin-left: 0;
}

/* ---------- Error pages: a ticket that could not be used ---------- */

.err-section {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
}
.err-ticket {
    --stub-w: clamp(9rem, 22vw, 13rem);
    position: relative;
    display: grid;
    grid-template-columns: var(--stub-w) minmax(0, 1fr);
    max-width: 54rem;
    margin-inline: auto;
    background: var(--paper-raised);
    border: var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--lift);
}
.err-ticket::before,
.err-ticket::after {
    content: "";
    position: absolute;
    inset-inline-start: calc(var(--stub-w) - 11px);
    width: 20px;
    height: 20px;
    background: var(--paper);
    border: var(--rule);
    border-radius: 50%;
}
.err-ticket::before {
    top: -12px;
    clip-path: inset(50% 0 0 0);
}
.err-ticket::after {
    bottom: -12px;
    clip-path: inset(0 0 50% 0);
}
.err-stub {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 0.75rem;
    background: var(--accent);
    color: var(--on-accent);
    border-inline-end: 1.5px dashed var(--line-strong);
    border-start-start-radius: var(--radius-in);
    border-end-start-radius: var(--radius-in);
    line-height: 1;
    text-align: center;
}
.err-stub small {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.err-stub b {
    font-size: clamp(3rem, 8vw, 4.75rem);
    font-weight: 800;
    letter-spacing: -0.05em;
}
.err-body {
    padding: clamp(1.5rem, 4vw, 2.5rem);
}
.err-body h1 {
    font-size: clamp(1.9rem, 4.5vw, 2.8rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.1;
    margin-bottom: 1rem;
}
.err-text {
    max-width: 44ch;
}
.err-text p {
    margin-bottom: 0.6rem;
}
.err-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1.5px dashed var(--line-strong);
}

@media (max-width: 640px) {
    .err-ticket {
        grid-template-columns: minmax(0, 1fr);
    }
    .err-ticket::before,
    .err-ticket::after {
        content: none;
    }
    .err-stub {
        position: relative;
        flex-direction: row;
        gap: 1rem;
        padding: 1.5rem 1rem;
        border-inline-end: 0;
        border-bottom: 1.5px dashed var(--line-strong);
        border-radius: var(--radius-in) var(--radius-in) 0 0;
    }
    .err-stub::before,
    .err-stub::after {
        content: "";
        position: absolute;
        bottom: -12px;
        width: 20px;
        height: 20px;
        background: var(--paper);
        border: var(--rule);
        border-radius: 50%;
    }
    .err-stub::before {
        inset-inline-start: -12px;
        clip-path: inset(0 50% 0 0);
    }
    .err-stub::after {
        inset-inline-end: -12px;
        clip-path: inset(0 0 0 50%);
    }
    .err-actions .btn-bma {
        flex: 1 1 100%;
        justify-content: center;
        min-height: 2.75rem;
    }
}

/* ---------- Staff forms: titled sections, two columns, sticky save bar ---------- */

/* A form page keeps the same left edge as every other page; only its contents are kept narrow */
.wrap--form > * {
    max-width: 48rem;
}
.form-intro {
    max-width: 40rem;
    color: var(--ink-soft);
}
.staff-form {
    display: grid;
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.form-section {
    min-width: 0;
    margin: 0;
    padding: 0 0 0.1rem;
    background: var(--paper-raised);
    border: var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--lift);
}
.form-section > .form-section-head {
    margin: 0;
    border-radius: var(--radius-in) var(--radius-in) 0 0; /* the card cannot clip it: an open picker has to overflow the card */
    padding: 0.8rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--on-accent);
    background: var(--accent);
    border-bottom: var(--rule);
}
.form-section-blurb {
    margin: 0 0 1.1rem;
    font-size: 0.95rem;
    color: var(--ink-soft);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.25rem;
}
.form-cell {
    min-width: 0;
}
.form-cell[hidden] {
    display: none;
}
.form-cell--wide {
    grid-column: 1 / -1;
}
.form-cell .mb-3 {
    margin-bottom: 1.1rem !important;
}
:is(.form-cell, .card-form) .form-check {
    flex-wrap: wrap;
}
.form-cell--wide .form-check {
    display: inline-flex;
    margin-inline-end: 1.1rem;
}
.form-text {
    flex-basis: 100%;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--ink-soft);
}
.form-check .form-text {
    padding-inline-start: 1.95rem;
    margin-top: 0;
}
:is(.form-cell, .card-form) .form-check-label {
    font-weight: 700;
}
/* The label takes the rest of the row and wraps inside it, so a long one stays beside its box */
.form-check-label {
    flex: 1 1 0;
    min-width: 0;
}
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
    background-image: none;
}
.invalid-feedback {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--danger);
}
.form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.9rem var(--gutter);
    margin-inline: calc(var(--gutter) * -1);
    background: var(--paper);
    border-top: var(--rule);
}
.form-actions .btn-bma {
    margin-top: 0;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .form-actions .btn-bma {
        flex: 1 1 auto;
        justify-content: center;
    }
}

/* A single-purpose form (one short list of fields) shown as a card. */
.card-form {
    max-width: 40rem;
    margin-top: 1.25rem;
    padding: 1.5rem 1.5rem 1.25rem;
    background: var(--paper-raised);
    border: var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--lift);
}
.card-form .mb-3 {
    margin-bottom: 1.1rem !important;
}
.card-form > .btn-bma {
    margin-top: 0.5rem;
    margin-inline-end: 0.6rem;
}
@media (max-width: 640px) {
    .card-form {
        padding-inline: 1rem;
        box-shadow: var(--lift);
    }
}

/* ---------- Instalment plans (parent page) ---------- */

.plans {
    display: grid;
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.plan {
    overflow: hidden;
    background: var(--paper-raised);
    border: var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--lift);
}
.plan-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding: 0.8rem 1.5rem;
    color: var(--on-accent);
    background: var(--accent);
    border-bottom: var(--rule);
}
.plan-head h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: inherit;
}
.plan-balance {
    margin: 0;
    font-weight: 700;
}
.plan-rows {
    margin: 0 1.5rem;
    padding: 0;
    list-style: none;
}
.plan-row {
    display: grid;
    grid-template-columns: minmax(7rem, 1fr) minmax(0, 1.5fr) auto auto;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.7rem 0;
    border-top: 1.5px dashed var(--line-strong);
}
.plan-row:first-child {
    border-top: 0;
}
.plan-row--paid {
    color: var(--ink-soft);
}
.plan-row--overdue .plan-when {
    font-weight: 700;
    color: var(--danger);
}
.plan-amount {
    text-align: end;
    font-weight: 700;
}
.plan-all {
    margin: 1rem 1.5rem 1.25rem;
}
@media (max-width: 640px) {
    .plan {
        box-shadow: var(--lift);
    }
    .plan-head {
        padding-inline: 1rem;
    }
    .plan-rows {
        margin-inline: 1rem;
    }
    .plan-all {
        margin-inline: 1rem;
    }
    .plan-row {
        grid-template-columns: 1fr auto;
    }
    .plan-when {
        grid-row: 2;
        grid-column: 1;
    }
    .plan-row form,
    .plan-row > span:last-child {
        grid-row: 2;
        grid-column: 2;
    }
}

/* ---------- Repeater rows (instalments, choices) ---------- */

.repeater {
    display: grid;
    gap: 0.6rem;
}
.repeater-head,
.repeater-row {
    display: grid;
    gap: 0.6rem;
    align-items: center;
}
.repeater--2 :is(.repeater-head, .repeater-row) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) 2.5rem;
}
.repeater--3 :is(.repeater-head, .repeater-row) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 2.5rem;
}
.repeater-head {
    font-size: 0.85rem;
    font-weight: 700;
}
.repeater-rows {
    display: grid;
    gap: 0.6rem;
}
.repeater-remove {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--ink);
    background: var(--field);
    border: var(--rule);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.repeater-remove:hover,
.repeater-remove:focus-visible {
    background: var(--danger-tint);
}
.repeater > [data-repeater-add] {
    justify-self: start;
}
/* Extra questions: one card per question. The question takes the first line; the answer type, options,
   "must answer" and the move and remove buttons share the second. Labels show on every card. */
.repeater--questions .repeater-head {
    display: none;
}
.repeater--questions .repeater-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    font-weight: 700;
}
.repeater--questions .repeater-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr) auto;
    align-items: end;
    padding: 0.75rem;
    background: var(--paper-raised);
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-sm);
}
.repeater--questions .repeater-cell:first-child {
    grid-column: 1 / -1;
}
.repeater--questions .repeater-rows {
    gap: 0.75rem;
}
.repeater-actions {
    display: flex;
    gap: 0.3rem;
}
.repeater-move {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--ink);
    background: var(--field);
    border: var(--rule);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.repeater-move:hover,
.repeater-move:focus-visible {
    background: var(--tint);
}
.repeater-row:first-child .repeater-move[data-repeater-move="-1"],
.repeater-row:last-child .repeater-move[data-repeater-move="1"] {
    visibility: hidden;
}
.repeater-cell--off {
    visibility: hidden; /* keeps its place in the row, so the columns line up */
}

/* ---------- Foldable optional sections: an outlined bar that fills with the accent colour when open ---------- */

.form-section--fold > summary {
    display: flex;
    border-radius: var(--radius-in);
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink);
    background: var(--paper-raised);
    cursor: pointer;
    list-style: none;
}
.form-section--fold > summary:hover {
    background: var(--tint);
}
.form-section--fold[open] > summary {
    color: var(--on-accent);
    border-radius: var(--radius-in) var(--radius-in) 0 0;
    background: var(--accent);
    border-bottom: var(--rule);
}
.form-section--fold > summary::-webkit-details-marker {
    display: none;
}
.form-section--fold > summary:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: -6px;
}
.form-section-title {
    min-width: 0;
}
.form-section-state {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 0.75rem;
}
.form-section-tag {
    padding: 0.15rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--ink);
    background: var(--field);
    border: var(--rule);
    border-radius: var(--radius-sm);
}
.form-section-tag--set {
    color: var(--paper);
    background: var(--ink);
}
.form-section-state::after {
    content: "+";
    display: inline-grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--paper);
    background: var(--ink);
    border: var(--rule);
    border-radius: var(--radius-sm);
}
.form-section--fold[open] > summary .form-section-state::after {
    content: "\2212";
}

/* Whatever sits under the heading keeps the card's side space */
.form-section > :not(.form-section-head, summary) {
    margin-inline: 1.5rem;
}
.form-section > :is(.form-section-head, summary) + * {
    margin-top: 1.25rem;
}
@media (max-width: 640px) {
    .form-section {
        box-shadow: var(--lift);
    }
    .form-section > .form-section-head,
    .form-section--fold > summary {
        padding: 0.75rem 1rem;
        font-size: 1.1rem;
    }
    .form-section > :not(.form-section-head, summary) {
        margin-inline: 1rem;
    }
}

/* ---------- Repeater rows on a phone: stacked, with visible labels ---------- */

.repeater-label {
    display: none;
}
@media (max-width: 640px) {
    .repeater-head {
        display: none;
    }
    .repeater-label {
        display: block;
        margin-bottom: 0.25rem;
        font-size: 0.85rem;
        font-weight: 700;
    }
    .repeater :is(.repeater-row) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0.75rem;
        border: 1.5px dashed var(--line-strong);
        border-radius: var(--radius-sm);
    }
    .repeater .repeater-cell {
        grid-column: 1 / -1;
    }
    .repeater--3 .repeater-cell:nth-of-type(n + 2) {
        grid-column: auto;
    }
    .repeater .repeater-remove,
    .repeater .repeater-actions {
        grid-column: 1 / -1;
        justify-self: end;
    }
    .repeater .repeater-actions .repeater-remove {
        grid-column: auto;
    }
    .repeater-cell--off {
        display: none;
    }
    .repeater--questions .repeater-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Searchable pickers (TomSelect) in the house style ---------- */

/* The wrapper carries the select's own .form-select look (2px ink border), so only the states change */
.ts-wrapper.form-select.focus,
.ts-wrapper.form-control.focus {
    border-color: var(--ink);
    outline: 3px solid var(--accent);
    outline-offset: 0;
}
.ts-wrapper .ts-control,
.ts-wrapper.form-select .ts-control {
    padding-block: 0.7rem;
    padding-inline-start: 0.85rem;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--ink);
}
.ts-control input {
    color: var(--ink);
}
.ts-wrapper.form-select.focus .ts-control,
.ts-wrapper.form-control.focus .ts-control {
    box-shadow: none !important;
}
.ts-wrapper .ts-dropdown,
.ts-wrapper .ts-dropdown.form-select,
.ts-wrapper .ts-dropdown.form-control {
    margin-top: 6px;
    padding: 0;
    color: var(--ink);
    background: var(--field);
    border: var(--field-rule);
    border-radius: var(--radius-sm);
    box-shadow: var(--lift);
}
.ts-dropdown .ts-dropdown-content {
    padding: 0.25rem 0;
}
.ts-dropdown .option,
.ts-dropdown .create,
.ts-dropdown .no-results {
    padding: 0.6rem 0.85rem;
}
.ts-dropdown .active,
.ts-dropdown .active.create {
    color: var(--ink);
    background-color: var(--tint);
}
.ts-dropdown .create,
.ts-dropdown .no-results {
    color: var(--ink-soft);
}
.ts-dropdown .create strong {
    color: var(--ink);
}
.ts-dropdown [data-selectable] .highlight {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    background: none;
}

/* A card form that holds a longer list (the role and permission tick boxes) */
.card-form--wide {
    max-width: 52rem;
}
/* A card's own heading: flush with the top (the CSRF field before it is hidden) and clear of what follows */
.card-form > :is(h2, h3) {
    margin-bottom: 0.75rem;
}
.card-form > :is(h2, h3):nth-child(1 of :not(input[type="hidden"])) {
    margin-top: 0;
}
.card-form > :last-child {
    margin-bottom: 0;
}
/* Fields that were written by hand (.field) line up with crispy ones (.mb-3) inside a card */
.card-form .field:last-of-type {
    margin-bottom: 1.1rem;
}

.plan-head .stub-meta,
.plan-head .stub-meta span {
    color: inherit;
}

/* ---------- Staff viewing the site as a parent (templates/hijack/notification.html) ---------- */

.viewing-as {
    position: sticky;
    bottom: 0;
    z-index: 50;
    background: var(--danger-tint);
    color: var(--danger-ink);
    border-top: var(--rule);
}
.viewing-as-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding-block: 0.75rem;
}
.viewing-as p {
    margin: 0;
    font-weight: 700;
}

/* ---------- Deposit and instalments (static/js/instalments.js) ---------- */

.plan-summary {
    margin: 0.75rem 0 0;
    font-weight: 700;
}
.plan-summary--ok {
    color: var(--ink);
}
.plan-summary--off {
    color: var(--danger-ink);
}
.plan-spread {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
}
.plan-spread label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.plan-spread input[type="number"] {
    width: 4.5rem;
}
.plan-spread input[type="date"] {
    width: auto;
}

/* ---------- Extra questions: the library picker and the preview of what parents will see ---------- */

.questions-library {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
}
.questions-library .form-select {
    width: auto;
    max-width: 100%;
}
.questions-preview {
    margin-top: 1rem;
    padding: 1rem;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--field);
}
.questions-preview-head {
    margin-bottom: 0.5rem;
    font-weight: 700;
}
.questions-preview-field + .questions-preview-field {
    margin-top: 0.75rem;
}
.questions-preview-field .form-label {
    margin-bottom: 0.25rem;
}
.scope-years {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin-left: 1.75rem;
}
.scope-years .form-text {
    flex-basis: 100%;
}

/* ---------- Roles: the permission picker, and the approvals list ---------- */

.perm-picker {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.perm-picker-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
}
.perm-picker-tools .btn-bma + .btn-bma {
    margin-inline-start: 0;
}
.perm-area-body {
    margin: 0;
    padding: 0.25rem 1.25rem 1rem;
}
.card-form fieldset.field > legend {
    margin-bottom: 0.35rem;
    font-size: 1rem;
    font-weight: 700;
}
.approval-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    max-width: 26rem;
}
.approval-form .form-control {
    flex: 1 1 12rem;
    width: auto;
    min-width: 0;
}
.stub-buy .approval-form {
    justify-content: flex-end;
}
@media (max-width: 640px) {
    .stub-buy .approval-form {
        justify-content: flex-start;
        max-width: none;
    }
}

/* A small word in a box, such as "Needs approval" or "Changed" */
.badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
    vertical-align: 0.1em;
    color: var(--ink);
    background: var(--field);
    border: var(--rule);
    border-radius: var(--radius-sm);
}

/* ---------- Data tables: the row count, download and search sit in one bar above the table ---------- */

/* DataTables' Bootstrap theme builds each bar as a .row of columns: lay them out as wrapping flex rows */
.dt-container > .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin: 0 0 0.75rem;
}
.dt-container > .row:last-child {
    margin: 0.75rem 0 0;
}
.dt-container > .row > * {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 0;
    text-align: left;
}
.dt-container > .row > .col-12:has(> table) {
    display: block;
    flex: 1 1 100%;
}
.dt-container .dt-search,
.dt-container .dt-length,
.dt-container .dt-info,
.dt-container .dt-paging {
    margin: 0;
    text-align: left;
}
.dt-container .dt-length select {
    min-width: 5rem;
    margin-inline: 0.5rem;
}
.dt-container .dt-paging .pagination {
    flex-wrap: wrap;
    margin: 0;
}
/* Dates, amounts and counts stay on one line, so rows stay short; long text still wraps */
.data-table td[data-order],
.data-table td.num {
    white-space: nowrap;
}
@media (max-width: 640px) {
    .dt-container .dt-search {
        flex: 1 1 100%;
    }
    .dt-container .dt-search input {
        flex: 1 1 auto;
        width: auto;
        margin-left: 0.5rem;
    }
}
@media (max-width: 640px) {
    .dt-container > .row > .ms-auto {
        margin-left: 0;
    }
}
/* DataTables right-aligns anything that looks like a number, codes included. Only amounts and counts
   (marked .num, or a .text-end heading) sit on the right. */
.data-table .dt-type-numeric:not(.num):not(.text-end) {
    text-align: left;
}

/* Club register on a phone (templates/clubs/session.html) */
.register-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.register-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--ink-soft);
    transition: background-color 0.3s;
}

.register-list li.is-just-marked {
    background: var(--tint);
}

.register-name {
    font-weight: 600;
}

.register-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.register-choice {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 44px;
    padding: 0.35rem 0.75rem;
    border: var(--rule);
    border-radius: 999px;
    background: var(--field);
    cursor: pointer;
    font-size: 0.95rem;
}

.register-choice input {
    accent-color: var(--accent);
}

.register-choice:has(input:checked) {
    background: var(--accent);
    color: var(--on-accent);
}

.register-choice:has(input:focus-visible) {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.scan-box {
    margin-bottom: 1.5rem;
}

.scan-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.scan-row .form-control {
    flex: 1 1 12rem;
    min-height: 44px;
}

.scan-box video {
    width: 100%;
    max-width: 420px;
    margin-top: 0.75rem;
    border: var(--rule);
}

.session-list li.is-cancelled a {
    text-decoration: line-through;
}

.register-grid td,
.register-grid th {
    white-space: nowrap;
}

.form-pair {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.club-attendance {
    margin-bottom: 1.5rem;
}

.choice-form fieldset label {
    display: block;
    min-height: 44px;
    padding: 0.5rem 0;
}

/* Payment link pay page (templates/payments/link_pay.html) */
.pay-page > * {
    max-width: 40rem;
}

.pay-picture {
    display: block;
    width: 100%;
    max-height: 18rem;
    object-fit: cover;
    border: var(--rule);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}

.pay-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    margin: 0 0 1.25rem;
    padding: 1rem 1.25rem;
    border: var(--rule);
    border-radius: var(--radius);
    background: var(--paper-raised);
}

.pay-summary dt {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.pay-summary dd {
    margin: 0;
}

.target-bar {
    height: 0.75rem;
    border: var(--rule);
    border-radius: 999px;
    overflow: hidden;
    background: var(--field);
}

.target-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
}

.budget-list {
    list-style: none;
    padding: 0;
}

.budget-list li {
    margin-bottom: 1rem;
}

.budget-list p {
    margin: 0 0 0.25rem;
}

/* One-choice questions on forms (radio buttons): each answer is a full-width box you can tap anywhere on,
   and the chosen one is filled in, so the choice reads at a glance. */
:is(.form-cell, .card-form) fieldset > legend.form-label {
    font-size: 1rem !important;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
:is(.form-cell, .card-form) .form-check:has(> input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    max-width: 36rem;
    margin: 0 0 0.6rem;
    padding: 0.65rem 0.9rem;
    border: var(--field-rule);
    border-radius: var(--radius);
    background: var(--field);
    cursor: pointer;
}
:is(.form-cell, .card-form) .form-check:has(> input[type="radio"]) .form-check-label {
    flex: 1;
    cursor: pointer;
    font-weight: 600;
}
:is(.form-cell, .card-form) .form-check:has(> input[type="radio"]:checked) {
    background: var(--tint);
}
:is(.form-cell, .card-form) .form-check:has(> input[type="radio"]:checked) .form-check-label {
    font-weight: 700;
}
:is(.form-cell, .card-form) .form-check:has(> input[type="radio"]:focus-visible) {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
}
:is(.form-cell, .card-form) .form-check:has(> input[type="radio"]:disabled) {
    opacity: 0.6;
    cursor: not-allowed;
}
.form-cell--wide .form-check:has(> input[type="radio"]) {
    display: flex;
    margin-inline-end: 0;
}
/* Room between the last answer and the help text under it */
:is(.form-cell, .card-form) fieldset:has(input[type="radio"]) .form-text {
    margin-top: 0.75rem;
    max-width: 36rem;
}

/* ---------- Wallet tickets page: the form beside a sample Apple and Google pass ---------- */

.wallet-design {
    display: grid;
    gap: 2rem;
    align-items: start;
}
@media (min-width: 60rem) {
    .wallet-design {
        grid-template-columns: minmax(0, 1fr) 20rem;
    }
    .wallet-preview {
        position: sticky;
        top: 1rem;
    }
}
.wallet-preview {
    --pass-bg: #c93a1f;
    --pass-text: #fff8f2;
    --pass-label: #fff8f2;
    --pass-google-text: #ffffff;
    display: grid;
    gap: 0.75rem;
}
.wallet-preview [hidden] {
    display: none !important;
}
.wallet-preview-title {
    font-size: 1rem;
    margin: 0.5rem 0 0;
}
.wallet-apple,
.wallet-google {
    display: grid;
    gap: 0.75rem;
    padding: 0.9rem;
    border-radius: 0.75rem;
    background: var(--pass-bg);
    color: var(--pass-text);
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
}
.wallet-google {
    border-radius: 1.25rem;
    background: var(--pass-google-bg, var(--pass-bg));
    color: var(--pass-google-text);
    overflow: hidden;
}
.wallet-apple-head,
.wallet-google-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.75rem;
    font-weight: 600;
}
.wallet-apple-logo {
    max-height: 1.75rem;
    max-width: 8rem;
}
.wallet-apple {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}
/* Apple blurs the background picture behind the pass, and leaves it off a pass with a strip */
.wallet-apple-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}
.wallet-apple-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(12px);
    transform: scale(1.15);
}
.wallet-apple:has(.wallet-apple-strip:not([hidden])) .wallet-apple-bg {
    display: none;
}
.wallet-test {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 2rem;
}
.wallet-test select {
    min-width: 0;
    max-width: 100%;
}
/* Google's wide logo takes the place of the round icon and the school name */
.wallet-google-wide img {
    display: block;
    max-width: 100%;
    max-height: 2.5rem;
}
.wallet-google:has(.wallet-google-wide:not([hidden])) .wallet-google-head {
    display: none;
}
.wallet-apple-header {
    margin-left: auto;
    text-align: right;
    font-weight: 400;
}
.wallet-google-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    object-fit: contain;
    background: rgb(255 255 255 / 0.9);
}
.wallet-apple-strip {
    margin: 0 -0.9rem;
}
/* Apple writes the event name over the banner, unless staff want the banner clear: then it goes by the date */
.wallet-apple-hero {
    position: relative;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.75rem;
}
/* Apple's thumbnail sits by the event name, and only on a pass without a banner */
.wallet-apple-thumb img {
    display: block;
    max-width: 4.5rem;
    max-height: 4.5rem;
    object-fit: contain;
}
.wallet-apple-hero:has(.wallet-apple-strip:not([hidden])) {
    display: block;
}
.wallet-apple-hero:has(.wallet-apple-strip:not([hidden])) .wallet-apple-thumb {
    display: none;
}
.wallet-preview[data-align="PKTextAlignmentCenter"] .wallet-apple .wallet-row {
    justify-content: space-around;
    text-align: center;
}
.wallet-preview[data-align="PKTextAlignmentRight"] .wallet-apple .wallet-row {
    justify-content: flex-end;
    text-align: right;
}
.wallet-apple-hero:has(.wallet-apple-strip:not([hidden])) .wallet-field--primary {
    position: absolute;
    inset: auto 0 0.4rem;
}
.wallet-apple-hero--clear:has(.wallet-apple-strip:not([hidden])) .wallet-field--primary,
.wallet-apple:not(:has(.wallet-apple-hero--clear .wallet-apple-strip:not([hidden])))
    .wallet-field--title-below {
    display: none;
}
.wallet-apple-strip img,
.wallet-google-hero img {
    display: block;
    width: 100%;
    aspect-ratio: 375 / 98;
    object-fit: cover;
}
.wallet-google-hero {
    margin: 0 -0.9rem -0.9rem;
}
.wallet-google-hero img {
    aspect-ratio: 1032 / 336;
}
.wallet-google-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}
.wallet-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}
.wallet-field {
    display: grid;
    min-width: 0;
}
.wallet-field--primary .wallet-value {
    font-size: 1.4rem;
    line-height: 1.2;
}
.wallet-label {
    color: var(--pass-label);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.wallet-google .wallet-label {
    color: inherit;
    opacity: 0.8;
}
.wallet-value {
    overflow-wrap: anywhere;
}
.wallet-qr {
    justify-self: center;
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.5rem 0.35rem;
    border-radius: 0.4rem;
    background: #ffffff;
    color: #1b1c21;
    font-size: 0.75rem;
}
.wallet-qr img {
    width: 6.5rem;
    height: 6.5rem;
}
.wallet-contrast {
    margin: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 0.4rem;
    background: var(--danger-tint);
    color: var(--danger-ink);
}

/* An item's staff page (events): the lists on the left, tools such as the QR code alongside */
.manage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22rem;
    gap: 2.5rem;
    align-items: start;
    margin-top: 2.5rem;
}
.manage-main > h2 {
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    margin: 2.25rem 0 0.75rem;
}
.manage-main > h2:first-child {
    margin-top: 0;
}
.manage-side {
    display: grid;
    gap: 1.5rem;
}
.manage-side .card-form {
    max-width: none;
    margin-top: 0;
}
.manage-side h2 {
    font-size: 1.4rem;
}
.manage-qr img {
    display: block;
    margin-block: 0.5rem;
}
.manage-qr a {
    overflow-wrap: anywhere;
}
.manage-fold {
    margin-top: 1.5rem;
}
.manage-fold-body {
    padding: 1.25rem 1.5rem;
}
@media (max-width: 900px) {
    .manage-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* A table row's buttons (staff lists): side by side, wrapping onto a second line rather than squeezing
   the other columns. The cell keeps a sensible width so the buttons wrap in twos or threes, not one by one. */
.table-actions {
    min-width: 13rem;
    text-align: end;
}
.table-actions > * {
    margin: 0.2rem 0 0.2rem 0.4rem;
    vertical-align: middle; /* links and buttons-in-forms sit on one line */
}
.table-actions form {
    display: inline-block;
    vertical-align: middle;
}
.table-actions .btn-bma {
    white-space: nowrap;
}

/* Printing a list (the trip register): the table only, without its search, download and page controls */
@media print {
    .dt-container > .row:has(.dt-search, .dt-paging, .dt-info),
    .table-actions {
        display: none !important;
    }
}

/* One row per person or child with its buttons at the end: things to do before booking, a pupil's parents */
.row-list {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    max-width: 40rem;
    border-top: 1.5px dashed var(--line-strong);
}
.section .wrap > .row-list {
    padding: 0;
}
.row-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.75rem 0;
    border-bottom: 1.5px dashed var(--line-strong);
}
.section .wrap > .row-list li + li {
    margin-top: 0;
}
.row-list strong {
    margin-inline-end: 0.5rem;
}
.row-list .stub-meta {
    margin-top: 0.15rem;
}
.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.row-actions form {
    margin: 0;
}
.row-actions .btn-bma {
    margin: 0;
}

/* A record page's buttons (Edit, Add a parent), under its title */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin: 1.25rem 0 0;
}
.action-bar form {
    margin: 0;
}
.action-bar .btn-bma {
    margin: 0;
}
.action-bar + * {
    margin-top: 0.5rem;
}
.action-note {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: var(--ink-soft);
}
/* Year group, form and classes link to everyone in them */
.chips--groups {
    margin-bottom: 0;
}
/* "Recently viewed:" before the chips on the staff student and parent search pages */
.chips-label {
    align-self: center;
    color: var(--ink-soft);
    font-size: 0.9rem;
}
.row-list li:not(.is-done) > span {
    font-weight: 600;
}
.row-list li.is-done > span {
    color: var(--ink-soft);
}
.row-list li.is-done strong {
    color: var(--ink);
}

/* Letters and kit lists on an item's page: the name, then its type and size */
.doc-list {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}
.section .wrap > .doc-list {
    padding: 0;
}
.doc-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1rem;
}
.doc-list a {
    font-weight: 700;
}

/* Help page: each guide with a line on what it covers */
.guide-list li {
    margin-bottom: 1rem;
}
.guide-list li p {
    flex-basis: 100%;
    margin: 0;
}

/* A short reassurance under a form's buttons ("You pay on the bank's secure page next") */
.form-note {
    margin: 0.9rem 0 0;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

/* The door scanner is used on a phone; on a laptop its controls keep a phone-like width */
.scan-tool > :not(h1, .scan-list, ul) {
    max-width: 34rem;
}
.scan-tool select {
    width: 100%;
}

/* Colour pickers (wallet pass colours): a solid swatch the height of a text field, not a thin line */
.form-control[type="color"] {
    width: 6rem;
    height: 2.95rem;
    padding: 0.3rem;
    cursor: pointer;
}
.form-control[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
.form-control[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 3px;
}
.form-control[type="color"]::-moz-color-swatch {
    border: 0;
    border-radius: 3px;
}

/* A text box in a card with its buttons straight after (standard wording) */
.card-form > textarea + * {
    margin-top: 0.9rem;
}

/* Two or three plain links in a row at the end of a page */
.link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}
.stubs + .link-row {
    margin-top: 1.75rem;
}

/* Above the buy form for someone without an account (a public item) */
.guest-note {
    margin: 0 0 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1.5px dashed var(--line-strong);
    font-size: 0.95rem;
}

/* A wide table scrolls inside its box. Positioned so a visually-hidden heading (absolute) stays in that box too
   instead of widening the whole page on a phone. */
.table-responsive {
    position: relative;
}

/* Finance: give an item its nominal code and cost centre. The two choices wrap under each other on a phone. */
.classify-form {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 40rem;
}
.classify-form > :is(select, .ts-wrapper) {
    flex: 1 1 14rem;
    min-width: 0;
}

/* Long names in code (Arbor fields such as Student.studentNumber) wrap inside a table cell, and a
   query in a fold wraps instead of running off the side of a phone */
.table code {
    overflow-wrap: anywhere;
}
details pre {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Phones: a list table becomes one card per row, each value with its column heading beside it
   (js/table-cards.js adds the headings and the class). Grids (.table--grid) keep their columns and scroll. */
@media (max-width: 640px) {
    .table-cards,
    .table-cards tbody,
    .table-cards tr,
    .table-cards :is(td, tbody th) {
        display: block;
        width: 100%;
    }
    /* Each value carries its own heading (data-label), so the heading row is not needed */
    .table-cards thead {
        display: none;
    }
    .table-cards tbody tr {
        padding-block: 0.4rem;
        border-bottom: var(--rule);
    }
    .table-cards tbody tr:last-child {
        border-bottom: 0;
    }
    .table.table-cards > :not(caption) > * > * {
        padding: 0.3rem 0.85rem;
        border-bottom: 0;
    }
    .table.table-cards tbody :is(td, th) {
        white-space: normal; /* lists keep their first column on one line; a card has room to wrap */
        overflow-wrap: anywhere; /* even one long word (primaryEmailAddress.emailAddress) */
    }
    .table-cards [data-label] > * {
        min-width: 0; /* a long value (an Arbor field name) wraps instead of pushing the card wider */
    }
    .table-cards [data-label] {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        text-align: end;
        white-space: normal;
    }
    .table-cards [data-label]::before {
        content: attr(data-label);
        flex: none;
        max-width: 45%;
        font-weight: 700;
        text-align: start;
    }
    /* The row's name (first column) reads as the card's title */
    .table-cards tbody tr > :first-child {
        font-weight: 700;
    }
    .table-cards tbody tr > :first-child[data-label]::before {
        content: none;
    }
    .table-cards tbody tr > :first-child[data-label] {
        justify-content: flex-start;
        text-align: start;
    }
    .table-cards td.table-actions {
        min-width: 0;
        padding-top: 0.5rem;
    }
    .table-cards td.table-actions > *,
    .table-cards td.table-actions .btn-bma {
        margin: 0; /* the cell's gap spaces them, so every button lines up */
    }
    .table-cards td.table-actions form {
        display: flex;
    }
    .table-cards td.table-actions,
    .table-cards td.table-actions[data-label] {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 0.5rem;
        text-align: start;
    }
    .table-cards td.table-actions[data-label]::before {
        content: none;
    }
    .table-cards td:empty {
        display: none;
    }
}

/* A table beside a side panel (an event's purchases) has less room: its headings may wrap */
.manage-main .table > thead > tr > th {
    white-space: normal;
}

/* ---------- Help pages (helpcentre) ---------- */

.help-topics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: 0.5rem 2.5rem;
    margin-bottom: 2.5rem;
}
.help-topics h3 {
    font-size: 1.15rem;
    margin: 1rem 0 0.75rem;
}
.help-steps {
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
}
.help-step {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem 2.5rem;
    align-items: start;
    padding: 2rem 0;
    border-bottom: 1px solid var(--paper-deep);
}
.help-step:first-child {
    padding-top: 0;
}
@media (min-width: 52rem) {
    .help-step {
        grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
    }
    .help-steps--wide .help-step {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    }
}
.help-step h2 {
    font-size: clamp(1.3rem, 3vw, 1.6rem);
    margin-top: 0;
}
.help-step-number {
    color: var(--accent);
}
.help-note {
    padding: 0.9rem 1.1rem;
    background: var(--tint);
    border-radius: var(--radius-in);
}
.help-note p {
    margin: 0;
}
.help-note p + p {
    margin-top: 0.5rem;
}
.help-picture {
    margin: 0;
}
.help-picture img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--paper-deep);
    border-radius: var(--radius);
    background: var(--paper-raised);
}
.help-picture--small {
    max-width: 16rem;
    margin: 0.5rem 0 1rem;
}
.help-picture figcaption {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-top: 0.3rem;
}
.help-actions,
.help-step-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.help-actions {
    margin-top: 2rem;
}
.help-marks {
    margin-bottom: 1.5rem;
}
.help-marks summary {
    cursor: pointer;
    font-weight: 700;
}
@media print {
    .help-actions,
    .lookup-form {
        display: none;
    }
    .help-step {
        break-inside: avoid;
    }
}
