/* LAB - Village Arts Centre Booking - Custom Styles */

/* ===== WCAG Compliance & Accessibility ===== */
/* Screen reader only content - visually hidden but accessible to assistive tech */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.concession-card-form-panel,
.concession-created-card {
    border: 2px solid var(--primary);
    border-radius: var(--pico-border-radius);
    padding: clamp(1rem, 3vw, 2rem);
    margin-block: 1rem 1.5rem;
}

.concession-form-grid,
.concession-admin-grid,
.concession-write-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem;
}

.concession-used-clicks {
    margin-block: 1rem;
}

.concession-click-selector {
    grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
}

.concession-click-option {
    align-items: center;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    cursor: pointer;
    display: flex;
    gap: .5rem;
    margin: 0;
    padding: .75rem;
}

.concession-click-option:has(input:checked):not(:has(input:disabled)) {
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    border-color: var(--primary);
}

.concession-click-selector .concession-click-used {
    border-color: var(--pico-muted-border-color);
    background: transparent;
    cursor: not-allowed;
    opacity: 0.6;
}

.concession-form-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
}

.concession-form-error {
    background: color-mix(in srgb, var(--pico-del-color) 10%, transparent);
    border-left: .3rem solid var(--pico-del-color);
    margin-block: 1rem;
    padding: 1rem;
}

.concession-success-kicker {
    color: var(--pico-ins-color);
    font-size: 1.1rem;
    font-weight: 700;
}

.concession-write-card {
    background: var(--pico-card-background-color);
    border: 3px dashed var(--primary);
    margin-block: 1.5rem;
    padding: 1.25rem;
}

.concession-write-card div {
    display: grid;
    gap: .25rem;
}

.concession-write-card strong {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    letter-spacing: .04em;
}

.concession-admin-grid > form {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 1rem;
}

/* Focus indicators for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

/* Ensure sufficient color contrast for interactive elements */
a:not([role="button"]):focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

/* Override Pico CSS defaults for better contrast */
[data-theme="dark"] button,
[data-theme="dark"] [role="button"],
[data-theme="dark"] input[type="submit"],
[data-theme="dark"] input[type="button"] {
    --primary: var(--vac-mint);
    font-weight: 500;
}

/* :not(.btn-danger):not(.danger) keeps destructive buttons on their red
   styling (.btn-danger, .btn-action.danger); without it this override
   out-specifies them and Delete buttons render as primary CTAs. */
[data-theme="dark"] button:not(.outline):not(.secondary):not(.contrast):not(.tab):not([rel="prev"]):not(.btn-danger):not(.danger),
[data-theme="dark"] [role="button"]:not(.outline):not(.secondary):not(.contrast):not(.btn-danger):not(.danger),
[data-theme="dark"] input[type="submit"]:not(.outline):not(.secondary):not(.contrast):not(.btn-danger):not(.danger),
[data-theme="dark"] input[type="button"]:not(.outline):not(.secondary):not(.contrast):not(.btn-danger):not(.danger) {
    background-color: var(--vac-mint);
    border-color: var(--vac-mint);
    color: var(--vac-mint-ink);
}

[data-theme="dark"] button:not(.outline):not(.secondary):not(.contrast):not(.tab):not([rel="prev"]):not(.btn-danger):not(.danger):hover,
[data-theme="dark"] [role="button"]:not(.outline):not(.secondary):not(.contrast):not(.btn-danger):not(.danger):hover {
    background-color: var(--vac-mint-hover);
    border-color: var(--vac-mint-hover);
}

[data-theme="light"] button,
[data-theme="light"] [role="button"],
[data-theme="light"] input[type="submit"],
[data-theme="light"] input[type="button"] {
    font-weight: 500;
}

/* Preserve newlines in plain text fields for multiline text display */
.preserve-newlines {
    white-space: pre-line;
}

/* ===== Public Booking - Date Selection ===== */
.date-option:hover {
    border-color: var(--pico-primary) !important;
}

.date-option:has(input:checked) {
    border-color: var(--pico-primary) !important;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.date-option:has(input:disabled) {
    cursor: not-allowed;
}

.date-option:has(input:disabled):hover {
    border-color: var(--pico-muted-border-color) !important;
}

.topic-group + .topic-group {
    margin-top: 1rem;
}

/* Improve muted color contrast */
[data-theme="dark"] {
    --muted-color: hsl(205, 10%, 75%);
}

[data-theme="light"] {
    --muted-color: hsl(205, 10%, 35%);
}

/* -----------------------------------------------------------------------
   Checkboxes - WCAG contrast fix
   PicoCSS v1 dark theme leaves native checkboxes as near-invisible grey.
   We override accent-color (the checked fill) and explicitly draw the
   unchecked border so the box is always legible.
   ----------------------------------------------------------------------- */
[data-theme="dark"] input[type="checkbox"]:not([role="switch"]),
[data-theme="dark"] input[type="radio"] {
    accent-color: var(--vac-mint);
    /* Force a visible unchecked border using appearance:none + manual draw */
    -webkit-appearance: none;
    appearance: none;
    width: 1.1em;
    height: 1.1em;
    min-width: 1.1em;
    border: 2px solid #9aaaa6;   /* AA-compliant against dark bg */
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    transition: border-color 0.12s, background 0.12s;
}

[data-theme="dark"] input[type="radio"] {
    border-radius: 50%;
}

[data-theme="dark"] input[type="checkbox"]:not([role="switch"]):checked,
[data-theme="dark"] input[type="radio"]:checked {
    background: var(--vac-mint);
    border-color: var(--vac-mint);
}

/* Checkmark via pseudo-element */
[data-theme="dark"] input[type="checkbox"]:not([role="switch"]):checked::after {
    content: '';
    position: absolute;
    left: 0.18em;
    top: 0.02em;
    width: 0.35em;
    height: 0.6em;
    border: 2px solid var(--vac-mint-ink);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

[data-theme="dark"] input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0.45em;
    height: 0.45em;
    border-radius: 50%;
    background: var(--vac-mint-ink);
}

[data-theme="dark"] input[type="checkbox"]:not([role="switch"]):focus-visible,
[data-theme="dark"] input[type="radio"]:focus-visible {
    outline: 3px solid var(--vac-mint);
    outline-offset: 2px;
}

/* Light theme - use accent-color only; native appearance is already legible */
[data-theme="light"] input[type="checkbox"],
[data-theme="light"] input[type="radio"] {
    accent-color: var(--vac-teal-deep);
}

/* Pico fills checked boxes from --pico-primary-background (mint), which
   would leave its white tick at 1.64:1; use the deep teal instead. */
:root[data-theme="light"] input[type="checkbox"]:checked {
    --pico-background-color: var(--vac-teal-deep);
    --pico-border-color: var(--vac-teal-deep);
}

:root[data-theme="light"] input[type="radio"]:checked {
    --pico-background-color: #ffffff;
    --pico-border-color: var(--vac-teal-deep);
}

/* =================================================================
   Responsive nav - hamburger menu below 1600px
   -----------------------------------------------------------------
   The authenticated nav (Dashboard, Today, This Week, All Bookings,
   Centre Home, VAC Website, Approvals?, user dropdown) + brand needs
   ~1200px. At 1600px+ (wide desktop) all items fit in one row.
   Below that the hamburger drawer is used instead.
   ================================================================= */

/* Visually hide the checkbox input but keep it keyboard-focusable
   (the <label> is what the user actually interacts with). */
.lab-nav-toggle {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.lab-nav-hamburger {
    display: none !important; /* hidden at desktop; !important beats any Pico v2 nav label rule */
}

.lab-nav-hamburger-close {
    display: none;
}

.lab-nav-brand strong {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Prevent nav items from word-wrapping - each label must stay on one line. */
ul.lab-nav-links li a,
ul.lab-nav-links li > details > summary {
    white-space: nowrap;
}

/* Keep the desktop nav on a single row. The wrap needed by the hamburger
   drawer is scoped to the <=1600px media query below, so wide screens never
   wrap the links onto a second line. */
nav.lab-nav {
    display: flex;
    align-items: center;
}

/* Hamburger drawer: collapses the nav links below 1600px.
   Authenticated nav (6-7 items) + brand needs ~1546px total. At 1600px+
   (wide desktop/TV monitors) all items fit in one row. At < 1600px (laptops,
   tablets) the hamburger drawer is used - a clean single-row layout that's
   better than the old two-row wrap this replaced. */
@media (max-width: 1600px) {
    /* Allow the open drawer (flex-basis:100%; order:99) to wrap to its own
       full-width row beneath the brand/hamburger. */
    nav.lab-nav {
        flex-wrap: wrap;
        row-gap: 0.25rem;
    }

    .lab-nav-brand strong {
        max-width: calc(100vw - 4rem);
    }

    /* Override the global display:none !important for hamburger at mobile */
    body .lab-nav-hamburger {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 2.75rem;
        height: 2.75rem;
        cursor: pointer;
        border: 1px solid var(--pico-muted-border-color);
        border-radius: var(--pico-border-radius);
        font-size: 1.5rem;
        line-height: 1;
        user-select: none;
        transition: background 0.15s ease, border-color 0.15s ease;
        margin-left: auto;
        flex-shrink: 0;
    }

    .lab-nav-hamburger:hover {
        background: rgba(var(--pico-primary-rgb, 94, 191, 179), 0.1);
        border-color: var(--pico-primary);
    }

    .lab-nav-toggle:focus-visible + .lab-nav-hamburger {
        outline: 3px solid var(--pico-primary);
        outline-offset: 2px;
    }

    .lab-nav-toggle:checked ~ .lab-nav-hamburger .lab-nav-hamburger-open {
        display: none;
    }

    .lab-nav-toggle:checked ~ .lab-nav-hamburger .lab-nav-hamburger-close {
        display: inline;
    }

    /* !important ensures this beats any Pico v2 layer rule that tries to
       display the ul (Pico v2 uses @layer so outside-layer rules like ours
       should win, but !important makes it explicit). */
    nav.lab-nav > ul.lab-nav-links {
        display: none !important; /* must beat any Pico v2 @layer rule */
        order: 99;
        flex-basis: 100%;
        flex-direction: column;
        padding: 0.5rem 0 0.25rem;
        margin: 0.5rem 0 0 0;
        border-top: 1px solid var(--pico-muted-border-color);
        gap: 0;
    }

    .lab-nav-toggle:checked ~ ul.lab-nav-links {
        display: flex !important;
    }

    ul.lab-nav-links li {
        margin: 0;
        width: 100%;
    }

    ul.lab-nav-links li a,
    ul.lab-nav-links li a[role="button"] {
        display: block !important;
        width: 100%;
        padding: 0.85rem 0.5rem;
        text-align: left;
        min-height: 2.75rem; /* WCAG 44px touch target */
        box-sizing: border-box;
        white-space: normal; /* allow text to wrap inside the drawer */
    }

    /* User dropdown inside the drawer: open downwards (not rtl-floating) */
    ul.lab-nav-links li.lab-nav-user-menu details.dropdown {
        width: 100%;
        dir: ltr; /* override dir="rtl" from the attribute */
    }

    ul.lab-nav-links li.lab-nav-user-menu details.dropdown summary {
        padding: 0.85rem 0.5rem;
        min-height: 2.75rem;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .lab-nav-brand strong {
        font-size: 0.95rem;
    }
}

/* (user dropdown positioning is in the page-level overflow section above) */

/* Constrain figure.overflow-auto wrappers to their parent so wide tables
   scroll inside the wrapper rather than pushing the whole page wider.
   `width: 100%` (not max-width) forces the figure to take exactly the
   parent's width regardless of inner content. */
figure.overflow-auto,
.overflow-auto {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Page-level horizontal-overflow guard: clip at html/body to prevent the nav
   (which has too many items to fit at narrow desktop widths) from creating
   horizontal page scroll. Absolute-positioned elements (modals, dropdowns)
   that are positioned WITHIN the viewport are not affected by this clip. */
html, body {
    overflow-x: clip;
    max-width: 100%;
}

/* User dropdown: open with its right edge aligned to the summary's right edge,
   so it extends leftward into the viewport rather than rightward off-screen.
   min-width ensures "Change Password" always fits on one line. */
nav.lab-nav li.lab-nav-user-menu details.dropdown > ul {
    right: 0;
    left: auto;
    min-width: 13rem;
}

/* Skip to Content Link - WCAG Level A requirement */
.skip-link {
    position: absolute;
    top: -999px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 0.6rem 1.25rem;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 var(--border-radius) 0;
    font-weight: 600;
    font-size: 1rem;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid white;
    outline-offset: 3px;
}

/* ===== Breadcrumb ===== */
nav.breadcrumb ul,
nav[aria-label="breadcrumb"] ul,
nav[aria-label="Breadcrumb"] ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
}

nav.breadcrumb ul li,
nav[aria-label="breadcrumb"] ul li,
nav[aria-label="Breadcrumb"] ul li {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    /* Reset Pico's nav <li> padding and its breadcrumb margin-inline-start,
       both of which add a visible indent before our "›" separator. */
    padding: 0;
    margin: 0;
}

/* Pico v2 ships its own breadcrumb divider as an absolutely-positioned
   ::after on each non-last <li> (width 4x nav spacing). Suppress it so our
   single "›" ::before below is the only separator and the spacing stays tight. */
nav.breadcrumb ul li:not(:last-child)::after,
nav[aria-label="breadcrumb"] ul li:not(:last-child)::after,
nav[aria-label="Breadcrumb"] ul li:not(:last-child)::after {
    content: none;
}

nav.breadcrumb ul li + li::before,
nav[aria-label="breadcrumb"] ul li + li::before,
nav[aria-label="Breadcrumb"] ul li + li::before {
    content: "›";
    color: var(--pico-muted-color);
    margin-right: 0.25rem;
}

nav.breadcrumb ul li a,
nav[aria-label="breadcrumb"] ul li a,
nav[aria-label="Breadcrumb"] ul li a {
    color: var(--pico-primary);
    text-decoration: none;
    /* Reset Pico's negative breadcrumb link margins. */
    margin: 0;
}

nav.breadcrumb ul li a:hover,
nav[aria-label="breadcrumb"] ul li a:hover,
nav[aria-label="Breadcrumb"] ul li a:hover {
    text-decoration: underline;
}

nav.breadcrumb ul li:last-child,
nav[aria-label="breadcrumb"] ul li:last-child,
nav[aria-label="Breadcrumb"] ul li:last-child {
    color: var(--pico-muted-color);
}

/* ===== Site Footer ===== */
.site-footer {
    margin-top: 3rem;
    padding: 1rem 0 0.5rem;
    border-top: 1px solid var(--pico-muted-border-color);
    text-align: center;
    color: var(--pico-muted-color);
}

.site-footer a {
    color: var(--pico-muted-color);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ===== Settings page toggle rows ===== */
.setting-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.setting-info {
    flex: 1;
    min-width: 0;
}

.setting-info strong {
    display: block;
    margin-bottom: 0.25rem;
}

.setting-info small {
    display: block;
    color: var(--pico-muted-color);
}

.switch-label {
    flex-shrink: 0;
    margin: 0;
}

/* ===== Utility Classes ===== */

/* Spacing System - Use these instead of inline styles */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.ml-0 { margin-left: 0 !important; }
.mr-0 { margin-right: 0 !important; }

.m-xs { margin: 0.25rem !important; }
.mt-xs { margin-top: 0.25rem !important; }
.mb-xs { margin-bottom: 0.25rem !important; }
.ml-xs { margin-left: 0.25rem !important; }
.mr-xs { margin-right: 0.25rem !important; }

.m-sm { margin: 0.5rem !important; }
.mt-sm { margin-top: 0.5rem !important; }
.mb-sm { margin-bottom: 0.5rem !important; }
.ml-sm { margin-left: 0.5rem !important; }
.mr-sm { margin-right: 0.5rem !important; }

.m-md { margin: 1rem !important; }
.mt-md { margin-top: 1rem !important; }
.mb-md { margin-bottom: 1rem !important; }
.ml-md { margin-left: 1rem !important; }
.mr-md { margin-right: 1rem !important; }

.m-lg { margin: 1.5rem !important; }
.mt-lg { margin-top: 1.5rem !important; }
.mb-lg { margin-bottom: 1.5rem !important; }
.ml-lg { margin-left: 1.5rem !important; }
.mr-lg { margin-right: 1.5rem !important; }

.m-xl { margin: 2rem !important; }
.mt-xl { margin-top: 2rem !important; }
.mb-xl { margin-bottom: 2rem !important; }
.ml-xl { margin-left: 2rem !important; }
.mr-xl { margin-right: 2rem !important; }

.p-0 { padding: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.pb-0 { padding-bottom: 0 !important; }
.pl-0 { padding-left: 0 !important; }
.pr-0 { padding-right: 0 !important; }

.p-xs { padding: 0.25rem !important; }
.pt-xs { padding-top: 0.25rem !important; }
.pb-xs { padding-bottom: 0.25rem !important; }
.pl-xs { padding-left: 0.25rem !important; }
.pr-xs { padding-right: 0.25rem !important; }

.p-sm { padding: 0.5rem !important; }
.pt-sm { padding-top: 0.5rem !important; }
.pb-sm { padding-bottom: 0.5rem !important; }
.pl-sm { padding-left: 0.5rem !important; }
.pr-sm { padding-right: 0.5rem !important; }

.p-md { padding: 1rem !important; }
.pt-md { padding-top: 1rem !important; }
.pb-md { padding-bottom: 1rem !important; }
.pl-md { padding-left: 1rem !important; }
.pr-md { padding-right: 1rem !important; }

.p-lg { padding: 1.5rem !important; }
.pt-lg { padding-top: 1.5rem !important; }
.pb-lg { padding-bottom: 1.5rem !important; }
.pl-lg { padding-left: 1.5rem !important; }
.pr-lg { padding-right: 1.5rem !important; }

.p-xl { padding: 2rem !important; }
.pt-xl { padding-top: 2rem !important; }
.pb-xl { padding-bottom: 2rem !important; }
.pl-xl { padding-left: 2rem !important; }
.pr-xl { padding-right: 2rem !important; }

/* Display */
.d-flex { display: flex !important; }
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }
.d-none { display: none !important; }

/* Flex utilities */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.align-center { align-items: center !important; }
.align-start { align-items: flex-start !important; }
.align-end { align-items: flex-end !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-end { justify-content: flex-end !important; }
.gap-xs { gap: 0.25rem !important; }
.gap-sm { gap: 0.5rem !important; }
.gap-md { gap: 0.75rem !important; }
.gap-lg { gap: 1rem !important; }
.gap-xl { gap: 1.5rem !important; }

/* Typography */
.text-xs { font-size: 0.75rem !important; }
.text-sm { font-size: 0.875rem !important; }
.text-base { font-size: 1rem !important; }
.text-lg { font-size: 1.125rem !important; }
.text-xl { font-size: 1.25rem !important; }
.text-2xl { font-size: 1.5rem !important; }

.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

.font-normal { font-weight: 400 !important; }
.font-medium { font-weight: 500 !important; }
.font-bold { font-weight: 600 !important; }

.text-muted { color: var(--muted-color) !important; }
.opacity-50 { opacity: 0.5 !important; }
.opacity-75 { opacity: 0.75 !important; }

/* Width utilities */
.w-full { width: 100% !important; }
.w-auto { width: auto !important; }

/* Height utilities */
.h-0 { height: 0 !important; }

/* Table and text utilities */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.overflow-x-auto { overflow-x: auto; }
.opacity-60 { opacity: 0.6 !important; }

/* Position utilities */
.position-relative { position: relative; }

/* Grid utilities */
.grid-auto-fill {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

/* Cursor utilities */
.cursor-pointer { cursor: pointer; }

/* Filter section styling */
.filter-section {
    background: var(--pico-card-background-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

/* Button Size Utilities - Consistent button sizing */
.btn-xs {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
}

.btn-sm {
    font-size: 0.875rem !important;
    padding: 0.35rem 0.75rem !important;
}

.btn-md {
    font-size: 0.875rem !important;
    padding: 0.5rem 1rem !important;
}

.btn-lg {
    font-size: 1rem !important;
    padding: 0.75rem 1.5rem !important;
}

/* Button variants */
button.btn-outline,
[role="button"].btn-outline,
a.btn-outline {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    /* Not --pico-color: Pico sets that to the dark mint label inside buttons. */
    color: var(--vac-text) !important;
}

button.btn-full,
[role="button"].btn-full,
a.btn-full {
    width: 100% !important;
    display: block !important;
}

/* Action row: canonical toolbar / table-actions container. Keeps buttons on
   one line, same height, left-aligned and content-width (never stretched),
   overriding Pico's default full-width form buttons. */
.action-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.action-row > * {
    margin-bottom: 0;
}
.action-row button,
.action-row a[role="button"],
.action-row input[type="submit"],
.action-row [role="button"] {
    width: auto;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}
.action-row > form {
    display: inline-flex;
    margin: 0;
}
@media (max-width: 768px) {
    .action-row {
        gap: 0.4rem;
    }
}

/* Add-Instances style control rows: give date inputs, selects and the submit
   button an identical box height so a flex row aligns cleanly. */
.duration-controls input,
.duration-controls select,
.duration-controls button {
    height: 2.75rem;
    box-sizing: border-box;
}

/* Compact inputs: short fields (numbers, day counts, prices) should size to
   content, not span the whole row. Apply to the input or a wrapping label. */
.input-compact,
.input-compact input,
label.input-compact input {
    max-width: 12rem;
}
.input-compact-sm,
.input-compact-sm input,
label.input-compact-sm input {
    max-width: 7rem;
}

/* ===== Layout Improvements ===== */
:root {
    --spacing: 1rem;
}

.container {
    max-width: 1600px;
    padding: 0.75rem 1rem 1rem;
}

nav {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--muted-border-color);
}

nav ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

nav ul li {
    margin: 0 0.5rem 0 0;
}

main {
    margin-top: 0;
}

main > header {
    margin-top: 0 !important;
    margin-bottom: 1rem;
}

main > h1:first-child,
main > header h1 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

main > header:first-child {
    margin-top: 0 !important;
    margin-bottom: 1rem;
}

/* Reduce spacing between sections */
main > section,
main > article {
    margin-bottom: 1.5rem;
}

/* Quick actions spacing */
nav[aria-label="Quick actions"] {
    margin-bottom: 1.5rem;
    border-bottom: none;
    padding-bottom: 0;
}

/* ===== Toast Notifications ===== */
/* WCAG: Sufficient contrast ratios, keyboard accessible */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    max-width: min(28rem, calc(100vw - 2rem));
}

.toast {
    background: var(--primary);
    color: white;
    padding: 0.85rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease-out;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.toast > div {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.toast-message {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5; /* WCAG: Line height at least 1.5 */
    font-weight: 500;
}

/* WCAG: Ensure contrast ratio >= 4.5:1 */
/* Toasts are a fixed, theme-independent contrast scheme (dark solid bg + white
   text; white undo pill + matching dark text). They intentionally do NOT use the
   theme-flipping --tone-* tokens, which would break contrast in dark mode. */
.toast.success {
    background: #2e7d32;
}

.toast.error {
    background: #c62828;
}

.toast.warning {
    background: #ef6c00; /* Darker orange for better contrast */
}

.toast-undo {
    background: white;
    color: #2e7d32;
    border: 2px solid transparent;
    padding: 0.45rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: var(--border-radius);
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
}

.toast.error .toast-undo {
    color: #c62828;
}

.toast.warning .toast-undo {
    color: #ef6c00;
}

.toast-undo:hover,
.toast-undo:focus {
    transform: scale(1.05);
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.3);
    border-color: currentColor;
}

.toast-undo:focus-visible {
    outline: 3px solid white;
    outline-offset: 2px;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Tab Navigation ===== */
/* WCAG: Keyboard accessible with clear focus states */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--muted-border-color);
    overflow-x: auto;
}

.tab {
    padding: 0.6rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    color: var(--muted-color);
    transition: all 0.2s;
    font-size: 0.95rem;
    min-height: 2.75rem;
}

.tab:hover {
    color: var(--primary);
    background: var(--card-background-color);
}

.tab:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Status Indicators ===== */
/* WCAG: Ensure sufficient color contrast */
.status-restricted {
    color: var(--tone-danger);
    font-weight: 700;
}

.status-active {
    color: var(--tone-positive);
    font-weight: 600;
}

.status-pending {
    color: var(--pico-primary);
    font-weight: 600;
}

.status-inactive {
    color: var(--pico-muted-color);
    font-weight: 500;
}

/* User management page */
.pending-approvals-card {
    border-left: 4px solid var(--pico-primary);
}

.role-permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.role-select {
    display: inline-block;
    width: auto;
    margin: 0;
    padding: 0.3rem 0.6rem;
    font-size: 0.875rem;
}

.user-approve-form .action-buttons {
    flex-wrap: nowrap;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.filter-btn {
    padding: 0.3rem 0.75rem;
    font-size: 0.875rem;
    min-width: auto;
}

.filter-btn.active {
    background: var(--pico-primary);
    border-color: var(--pico-primary);
    color: var(--pico-primary-inverse);
}

.status-full {
    color: var(--tone-warning);
    font-weight: 600;
}

/* ===== Highlight Colors ===== */
/* WCAG: Ensure colors meet contrast requirements */
.price {
    color: var(--tone-positive);
    font-weight: 600;
}

.selected-class {
    color: var(--primary);
    font-weight: 600;
}

/* ===== Date Button Grid ===== */
.date-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.75rem 0;
}

.date-btn {
    padding: 0.55rem 0.9rem;
    margin: 0;
    min-height: 2.75rem;
    min-width: 2.75rem;
}

/* ===== Button Sizes ===== */
.btn-sm {
    padding: 0.3rem 0.65rem;
    margin: 0;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ===== Flash Messages & Alerts ===== */
/* WCAG: Clear contrast and semantic roles */
.flash-message {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    line-height: 1.5;
    font-size: 0.95rem;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.flash-success {
    background-color: var(--tone-positive-bg);
    border-left: 4px solid var(--tone-positive);
    color: var(--tone-positive);
}

.flash-warning {
    background-color: var(--tone-warning-bg);
    border-left: 4px solid var(--tone-warning);
    color: var(--tone-warning);
}

.flash-error {
    background-color: var(--tone-danger-bg);
    border-left: 4px solid var(--tone-danger);
    color: var(--tone-danger);
}

/* 'info' and bare flash() with no category (mapped to info in template) */
.flash-info {
    background-color: var(--tone-info-bg);
    border-left: 4px solid var(--tone-info);
    color: var(--tone-info);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Site notices ===== */
/* partials/notices.html (public + staff) and admin/notices_list.html. Enhancement
   layer only: a bare Pico <article> is legible without this. Uses the shared
   --tone-* tokens (dark-mode aware via tokens.css). No animation. */
.lab-notices {
    margin: 1rem 0 1.5rem;
}

.lab-notice {
    margin-bottom: 0.75rem;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--tone-info);
    border-left-width: 5px;
    border-radius: var(--border-radius);
    background: var(--tone-info-bg);
}

.lab-notice:last-child {
    margin-bottom: 0;
}

/* The admin list wraps each card in Pico <header>/<footer>; strip their default
   fills and rules so the tint stays continuous. */
.lab-notice > header,
.lab-notice > footer {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.lab-notice > footer {
    margin-top: 0.75rem;
}

.lab-notice-head {
    margin-bottom: 0.35rem;
}

.lab-notice-body {
    margin: 0;
}

.lab-notice-tag {
    margin-right: 0.4rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--tone-info);
}

.lab-notice--warning {
    border-color: var(--tone-warning);
    background: var(--tone-warning-bg);
}

.lab-notice--warning .lab-notice-tag {
    color: var(--tone-warning);
}

/* Urgent: a full 2px border on every side so it lifts off the page. */
.lab-notice--urgent {
    border: 2px solid var(--tone-danger);
    background: var(--tone-danger-bg);
}

.lab-notice--urgent .lab-notice-tag {
    color: var(--tone-danger);
}

.alert-box {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.25rem;
    font-weight: 700;
    line-height: 1.5;
}

/* WCAG: Contrast ratios >= 4.5:1 */
/* Solid-fill alerts with fixed white text: keep theme-independent dark hexes
   (the --tone-* foregrounds flip bright in dark mode and would fail under white
   text). A future --tone-*-solid token family could consolidate these. */
.alert-red {
    background-color: #c62828;
    color: white;
}

.alert-green {
    background-color: #2e7d32;
    color: white;
}

/* ===== Card & Article Base Styles ===== */
article,
section {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
}

[data-theme="dark"] article,
[data-theme="dark"] section {
    padding: 1.25rem;
}

[data-theme="light"] article,
[data-theme="light"] section {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 1.25rem;
}

/* ===== Card-Based Layout ===== */
/* Reusable card system for bookings and other content */
.bookings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.booking-card {
    background: var(--card-background-color);
    border: 1px solid var(--card-border-color);
    border-radius: var(--border-radius);
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.booking-card:hover,
.booking-card:focus-within {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Card variations */
.waitlist-card {
    border-left: 0.25rem solid var(--secondary);
}

.cancelled-card {
    opacity: 0.7;
    border-left: 0.25rem solid var(--tone-neutral);
}

.booking-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--muted-border-color);
    margin: 0;
}

.booking-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color);
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
}

.contact-info {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--muted-color);
}

.concession-badge {
    padding: 0.25rem 0.5rem;
    background: var(--primary);
    color: white;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.booking-body {
    padding: 1rem;
    flex: 1;
}

form {
    margin-bottom: 1.5rem;
}

form label {
    margin-bottom: 0.35rem;
    display: block;
}

form input,
form select,
form textarea {
    margin-bottom: 0.75rem;
}

/* Reduce paragraph spacing */
p {
    margin-bottom: 0.75rem;
}

/* List spacing */
ul, ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

ul li, ol li {
    margin-bottom: 0.35rem;
}

/* Heading spacing */
h2 {
    margin-bottom: 0.75rem;
    margin-top: 0;
}

h3 {
    margin-bottom: 0.5rem;
    margin-top: 0;
}

section header,
article header {
    margin-bottom: 0.75rem;
}

hgroup {
    margin-bottom: 1rem;
}

hgroup h1,
hgroup h2 {
    margin-bottom: 0.35rem;
}

hgroup p {
    margin-bottom: 0;
}

.booking-meta {
    margin: 0;
    color: var(--muted-color);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== Table Improvements ===== */
table {
    margin-bottom: 1.5rem;
}

table td,
table th {
    padding: 0.75rem 1rem;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* ===== Modal/Dialog Improvements ===== */
dialog article {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.25rem;
}

dialog header,
dialog footer {
    padding: 0.5rem 0;
    margin: 0;
}

/* Pico v2 applies var(--pico-card-sectionning-background-color) to
   article > header and article > footer, creating a visible tonal band
   across the modal top. Override so the header blends with the body. */
dialog article > header {
    background: transparent;
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Modal size variants */
dialog article.modal-sm {
    max-width: 480px;
}

dialog article.modal-md {
    max-width: 600px;
}

dialog article.modal-lg {
    max-width: 700px;
}

dialog article.modal-xl {
    max-width: 800px;
}

/* Responsive modal widths */
@media (max-width: 768px) {
    dialog article,
    dialog article.modal-sm,
    dialog article.modal-md,
    dialog article.modal-lg,
    dialog article.modal-xl {
        max-width: 90vw;
    }
}

/* Modal footer with button groups */
dialog footer.button-group {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: stretch;
}

/* Give each button in a modal footer equal width so Cancel and the primary
   action are balanced. flex: 1 distributes space evenly. min-width: 0 allows
   them to shrink below their natural content width if needed. */
dialog footer.button-group button,
dialog footer.button-group a[role="button"] {
    flex: 1;
    min-width: 0;
    margin: 0;
    text-align: center;
}

dialog footer.button-group form {
    flex: 1;
    min-width: 0;
    margin: 0;
}

dialog footer.button-group form button {
    width: 100%;
    margin: 0;
}

/* Modal scrollable content areas */
.modal-scrollable {
    max-height: 400px;
    overflow-y: auto;
    margin: 1rem 0;
    padding: 0.5rem;
    border: 1px solid var(--muted-border-color);
    border-radius: 0.375rem;
}

.modal-scrollable-sm {
    max-height: 250px;
}

.modal-scrollable-lg {
    max-height: 500px;
}

.modal-scrollable-xl {
    max-height: 75vh;
}

/* ===== Attendance Form Styles ===== */
.attendance-form {
    margin: 0;
}

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

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.03rem;
}

.form-field select {
    margin: 0;
    width: 100%;
}

.form-field select option {
    font-size: 1rem;
    padding: 0.5rem;
}

.defer-reason {
    margin-top: 1rem;
}

.defer-reason label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.03rem;
    display: block;
}

.defer-reason textarea {
    margin-top: 0.4rem;
    width: 100%;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== Payment Status Badges ===== */
.payment-badge {
    margin-top: 1rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.5;
}

/* WCAG: Ensure sufficient contrast */
.payment-badge.paid {
    background: var(--tone-positive-bg);
    color: var(--tone-positive);
    border: 2px solid var(--tone-positive-bg);
}

.payment-badge.deferred {
    background: var(--tone-warning-bg);
    color: var(--tone-warning);
    border: 2px solid var(--tone-warning-bg);
}

/* ===== Card Footer ===== */
.booking-footer {
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--muted-border-color);
    margin: 0;
}

.footer-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.status-select {
    flex: 1;
    min-width: 10rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    margin: 0;
    min-height: 2.75rem; /* WCAG: Minimum touch target */
    background: var(--pico-form-element-background-color);
    color: var(--pico-form-element-color);
}

.status-select option {
    font-size: 1rem;
    padding: 0.5rem;
}

.promote-btn {
    flex: 1;
    min-width: 10rem;
    margin: 0;
    white-space: nowrap;
    min-height: 2.75rem;
}

.delete-btn {
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    min-height: 2.75rem;
}

/* ===== Waitlist & Approval Cards ===== */
/* Action-oriented card layout for waitlist and pending approvals */
.action-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.action-card {
    background: var(--card-background-color);
    border: 1px solid var(--card-border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.action-card:hover,
.action-card:focus-within {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.action-card.sandbox-card {
    border-color: #ff6b35;
    border-width: 2px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.05) 0%, transparent 100%);
}

.action-card.sandbox-card:hover,
.action-card.sandbox-card:focus-within {
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.25);
}

.action-card-header {
    margin: 0;
}

.action-card-header h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: var(--color);
    line-height: 1.5;
}

.action-card-header h4 a {
    color: inherit;
    text-decoration: none;
}

.action-card-header h4 a:hover {
    text-decoration: underline;
}

.action-card-subtitle {
    font-size: 0.9rem;
    color: var(--muted-color);
    margin: 0;
}

.action-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.info-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.info-label {
    font-weight: 600;
    color: var(--muted-color);
    min-width: 4rem;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.03rem;
}

.info-value {
    color: var(--color);
    flex: 1;
    word-break: break-word;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    cursor: text;
}

.action-card-footer {
    margin: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--muted-border-color);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-buttons a,
.action-buttons button {
    flex: 1;
    min-width: 8rem;
    margin: 0;
    text-align: center;
    min-height: 2.75rem; /* WCAG: 44px minimum touch target */
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Pending status badge */
.pending-badge {
    padding: 0.25rem 0.5rem;
    background: var(--tone-warning-bg);
    color: var(--tone-warning);
    border: 2px solid var(--tone-warning-bg);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    display: inline-block;
}

/* ===== Client Cards ===== */
/* Card layout for client management pages */
.client-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.client-card {
    background: var(--card-background-color);
    border: 1px solid var(--card-border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.client-card:hover,
.client-card:focus-within {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Restricted client variation */
.client-card.restricted {
    border-left: 0.25rem solid var(--tone-danger);
}

.client-card-header {
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 0.75rem;
}

.client-card-header h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--color);
    line-height: 1.5;
    flex: 1;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-badge.active {
    background: var(--tone-positive-bg);
    color: var(--tone-positive);
    border: 2px solid var(--tone-positive-bg);
}

.status-badge.restricted {
    background: var(--tone-danger-bg);
    color: var(--tone-danger);
    border: 2px solid var(--tone-danger-bg);
}

.client-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.client-contact {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.contact-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.contact-icon {
    color: var(--muted-color);
    font-size: 0.9rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.contact-value {
    color: var(--color);
    word-break: break-word;
}

/* Restriction info box */
.restriction-info {
    margin-top: 0.5rem;
    padding: 0.6rem;
    background: var(--tone-danger-bg);
    border-left: 0.25rem solid var(--tone-danger);
    border-radius: 0.25rem;
}

.restriction-info h5 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
    color: var(--tone-danger);
    margin: 0 0 0.5rem 0;
}

.restriction-reason {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--muted-color);
    margin: 0 0 0.5rem 0;
}

.restriction-meta {
    font-size: 0.75rem;
    color: var(--muted-color);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.client-card-footer {
    margin: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--muted-border-color);
}

.client-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.client-actions a,
.client-actions button {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 7rem;
    margin: 0;
    text-align: center;
    min-height: 2.75rem; /* WCAG: 44px minimum touch target */
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Single action button spans full width */
.client-actions a:only-child,
.client-actions button:only-child {
    flex: 1 1 100%;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 48rem) {
    .bookings-grid {
        grid-template-columns: 1fr;
    }

    .action-cards-grid {
        grid-template-columns: 1fr;
    }

    .client-cards-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .footer-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .status-select,
    .promote-btn {
        width: 100%;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons a,
    .action-buttons button {
        width: 100%;
    }

    .client-actions {
        flex-direction: column;
    }

    .client-actions a,
    .client-actions button {
        width: 100%;
        flex: 1 1 100%;
    }
}

/* WCAG: High zoom / text scaling support */
@media (min-width: 20rem) and (max-width: 48rem) {
    .booking-header h4 {
        font-size: clamp(1rem, 4vw, 1.1rem);
    }

    .contact-info {
        font-size: clamp(0.85rem, 3.5vw, 0.9rem);
    }

    .action-card-header h4 {
        font-size: clamp(0.95rem, 4vw, 1.05rem);
    }

    .info-row {
        font-size: clamp(0.85rem, 3.5vw, 0.9rem);
    }

    .client-card-header h4 {
        font-size: clamp(0.95rem, 4vw, 1.05rem);
    }

    .client-contact {
        font-size: clamp(0.85rem, 3.5vw, 0.9rem);
    }
}

/* ===== Additional UI Polish ===== */

/* Improve main page headings visual hierarchy */
main > header > h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

main > header > p {
    color: var(--muted-color);
    font-size: 1.05rem;
    margin-top: 0;
}

/* Better article/section cards */
article, section {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Improve grid spacing for dashboard stats */
.grid > article {
    padding: 1.5rem;
    text-align: center;
}

.grid > article h3 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-color);
    margin-bottom: 0.75rem;
}

.grid > article p {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary);
}

/* Improve button groups in headers */
header .grid {
    align-items: center;
    margin-bottom: 0;
}

/* Better visual separation for forms */
form fieldset {
    margin-bottom: 1.5rem;
}

/* Improve table spacing */
table {
    margin-top: 1rem;
}

/* Better link hover states */
a:not([role="button"]):hover {
    text-decoration-thickness: 2px;
}

/* Improve outlined button contrast */
[role="button"].outline,
button.outline,
a.outline {
    transition: all 0.15s ease;
    border-width: 2px;
    font-weight: 500;
}

[data-theme="dark"] [role="button"].outline,
[data-theme="dark"] button.outline,
[data-theme="dark"] a.outline {
    border-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] [role="button"].outline:hover,
[data-theme="dark"] button.outline:hover,
[data-theme="dark"] a.outline:hover {
    border-color: rgba(255, 255, 255, 0.8);
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] [role="button"].outline,
[data-theme="light"] button.outline,
[data-theme="light"] a.outline {
    border-color: rgba(0, 0, 0, 0.4);
    color: rgba(0, 0, 0, 0.85);
}

[data-theme="light"] [role="button"].outline:hover,
[data-theme="light"] button.outline:hover,
[data-theme="light"] a.outline:hover {
    border-color: rgba(0, 0, 0, 0.6);
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Improve secondary button contrast */
[role="button"].secondary,
button.secondary,
a.secondary {
    transition: all 0.15s ease;
    font-weight: 500;
}

[data-theme="dark"] [role="button"].secondary,
[data-theme="dark"] button.secondary,
[data-theme="dark"] a.secondary {
    background-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] [role="button"].secondary:hover,
[data-theme="dark"] button.secondary:hover,
[data-theme="dark"] a.secondary:hover {
    background-color: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] [role="button"].secondary,
[data-theme="light"] button.secondary,
[data-theme="light"] a.secondary {
    background-color: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.2);
}

[data-theme="light"] [role="button"].secondary:hover,
[data-theme="light"] button.secondary:hover,
[data-theme="light"] a.secondary:hover {
    background-color: rgba(0, 0, 0, 0.12);
    border-color: rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Improve contrast button for both themes */
[role="button"].contrast,
button.contrast,
a.contrast {
    font-weight: 600;
    border: none;
}

[data-theme="dark"] [role="button"].contrast,
[data-theme="dark"] button.contrast,
[data-theme="dark"] a.contrast {
    background-color: rgba(255, 255, 255, 0.95);
    color: rgba(0, 0, 0, 0.95);
}

[data-theme="dark"] [role="button"].contrast:hover,
[data-theme="dark"] button.contrast:hover,
[data-theme="dark"] a.contrast:hover {
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

[data-theme="light"] [role="button"].contrast,
[data-theme="light"] button.contrast,
[data-theme="light"] a.contrast {
    background-color: rgba(0, 0, 0, 0.9);
    color: rgba(255, 255, 255, 0.98);
}

[data-theme="light"] [role="button"].contrast:hover,
[data-theme="light"] button.contrast:hover,
[data-theme="light"] a.contrast:hover {
    background-color: #000000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ===== Light Mode Enhancements ===== */
/* Better card distinction in light mode */
[data-theme="light"] article,
[data-theme="light"] section {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 1.25rem;
}

[data-theme="light"] .booking-card,
[data-theme="light"] .action-card,
[data-theme="light"] .client-card {
    border: 1px solid #d0d0d0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .booking-card:hover,
[data-theme="light"] .booking-card:focus-within,
[data-theme="light"] .action-card:hover,
[data-theme="light"] .action-card:focus-within,
[data-theme="light"] .client-card:hover,
[data-theme="light"] .client-card:focus-within {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    border-color: #b0b0b0;
}

[data-theme="light"] .grid > article {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 1.25rem;
}

[data-theme="light"] .grid > article:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
    border-color: #d0d0d0;
}

[data-theme="light"] .booking-header,
[data-theme="light"] .booking-footer {
    background: rgba(0, 0, 0, 0.02);
    border-color: #e8e8e8;
}

[data-theme="light"] nav {
    border-bottom-color: #d0d0d0;
}

/* Better spacing for section headings in light mode */
[data-theme="light"] section h2,
[data-theme="light"] article h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* ===== Authentication Pages Styling ===== */
.auth-card {
    max-width: 500px;
    margin: 1.5rem auto 1rem auto;
    padding: 1.5rem;
}

.auth-card hgroup {
    margin-bottom: 1.25rem;
}

.auth-card hgroup h1 {
    margin-bottom: 0.35rem;
    font-size: 1.75rem;
}

.auth-card hgroup p {
    color: var(--muted-color);
    margin: 0;
    font-size: 0.9rem;
}

/* Form spacing for auth pages */
.auth-card form label {
    margin-bottom: 0.75rem;
}

.auth-card form small {
    color: var(--muted-color);
    font-size: 0.875rem;
    display: block;
    margin-top: 0.25rem;
}

/* Text center helper */
.text-center {
    text-align: center;
}

/* Password strength indicator (optional enhancement) */
.password-strength {
    margin-top: 0.5rem;
    height: 4px;
    background: var(--muted-border-color);
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: width 0.3s, background-color 0.3s;
}

.password-strength-bar.weak {
    width: 33%;
    background-color: var(--tone-danger);
}

.password-strength-bar.medium {
    width: 66%;
    background-color: var(--ins-color, #f57c00);
}

.password-strength-bar.strong {
    width: 100%;
    background-color: var(--tone-positive);
}
/* ===== Role-Based Autosave: Unsaved Changes Indicator & Save Controls ===== */

/**
 * Save controls section - shown only for Volunteer users who don't have autosave.
 * Provides explicit Save and Cancel buttons with unsaved changes warning.
 */
.save-controls {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--card-background-color);
    border: 1px solid var(--muted-border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Unsaved changes warning indicator */
#unsaved-indicator,
[id*="unsaved-indicator"] {
    color: var(--tone-danger);
    font-weight: 600;
    display: none;  /* Hidden by default, shown by JS when changes detected */
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Save button styling - gets highlighted when changes exist */
#save-button,
[id*="save-button"] {
    transition: all 0.3s ease;
}

#save-button.highlight,
[id*="save-button"].highlight {
    background: var(--primary);
    animation: glow-button 2s infinite;
}

@keyframes glow-button {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary);
    }
    50% {
        box-shadow: 0 0 15px var(--primary);
    }
}

/* Volunteer user guidance message */
.volunteer-guidance {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--ins-color, #f57c00);
    color: white;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    line-height: 1.5;
}

.volunteer-guidance strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* Form field tracking - visual indicator that field is being tracked for changes */
input[data-track-changes]:focus,
textarea[data-track-changes]:focus,
select[data-track-changes]:focus {
    border-color: var(--form-element-focus-border-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

/* ===== MANAGE CLASSES PAGE ===== */

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Single column at phone widths - the uppercase labels ("CONFIRMED BOOKINGS"
   etc.) are too long to fit in a ~110px column without breaking awkwardly.
   3-col applies from 600px up (tablet portrait and above). */
@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .stat-card {
        padding: 1rem 1.5rem;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 1rem;
        text-align: left;
    }
    .stat-card .stat-number {
        font-size: 2rem;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .stat-card .stat-label {
        font-size: 0.75rem;
    }
    .stat-card .sr-only {
        display: none; /* number is visible, redundant for sighted users in row layout */
    }
}

.stat-card {
    background: linear-gradient(135deg, var(--pico-card-background-color) 0%, color-mix(in srgb, var(--primary) 4%, transparent) 100%);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    padding: 1.5rem 2rem;
    text-align: center;
    /* min-width: 0 lets the grid column constrain the card rather than the
       card's natural content width inflating it and overflowing the grid. */
    min-width: 0;
    overflow: hidden;
}

.stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-card .stat-number.primary {
    color: var(--pico-primary);
}

.stat-card .stat-number.amber {
    color: var(--pico-color-amber-500);
}

.stat-card .stat-number.muted {
    color: var(--pico-muted-color);
}

/* Label is descriptive metadata - muted so it doesn't compete with the number.
   Using primary on both (old behaviour) made both elements the same visual
   weight and the user correctly flagged this as "blue text on blue". */
.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.stat-card .stat-label.amber {
    color: var(--pico-color-amber-500);
}

.stat-card .stat-label.default {
    color: var(--pico-muted-color);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header hgroup {
    margin: 0;
}

.page-header hgroup h1 {
    margin-bottom: 0.25rem;
}

.page-header hgroup p {
    margin: 0;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Classes Table */
.classes-table {
    width: 100%;
    border-collapse: collapse;
}

.classes-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--pico-muted-border-color);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--pico-muted-color);
}

.classes-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    vertical-align: middle;
}

.classes-table tbody tr:hover {
    background-color: color-mix(in srgb, var(--primary) 5%, transparent);
}

.classes-table .class-name {
    font-weight: 600;
    color: var(--pico-primary);
}

.classes-table .class-name a {
    text-decoration: none;
}

.classes-table .class-name a:hover {
    text-decoration: underline;
}

/* Action Buttons (small inline buttons) */
.action-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    text-decoration: none;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-action[hidden] {
    display: none;
}

.btn-action.primary {
    background-color: var(--pico-primary-background);
    border-color: var(--pico-primary-border);
    color: var(--pico-primary-inverse);
}

.btn-action.primary:hover {
    background-color: var(--pico-primary-hover-background);
    border-color: var(--pico-primary-hover-border);
    color: var(--pico-primary-inverse);
}

.btn-action.secondary {
    background-color: transparent;
    border-color: var(--pico-muted-border-color);
    color: var(--vac-text);
}

.btn-action.secondary:hover {
    background-color: var(--pico-muted-border-color);
}

.btn-action.danger {
    background-color: transparent;
    border-color: var(--pico-color-red-500);
    color: var(--pico-color-red-500);
}

.btn-action.danger:hover {
    background-color: var(--pico-color-red-500);
    color: white;
}

.btn-action.restore {
    background-color: transparent;
    border-color: var(--pico-color-green-500);
    color: var(--pico-color-green-500);
}

.btn-action.restore:hover {
    background-color: var(--pico-color-green-500);
    color: white;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge.archived {
    background-color: var(--tone-warning-bg);
    color: var(--tone-warning);
}

.badge.warning {
    background-color: var(--tone-warning-bg);
    color: var(--tone-warning);
}

.badge.danger {
    background-color: var(--tone-danger-bg);
    color: var(--tone-danger);
}

.badge.sandbox {
    background-color: var(--accent-training-bg);
    color: var(--accent-training);
    border: 1px solid var(--accent-training);
    font-weight: 700;
}

.badge.success {
    background-color: var(--tone-positive-bg);
    color: var(--tone-positive);
}

.badge-already-booked {
    background-color: var(--tone-info-bg);
    color: var(--tone-info);
}

.badge.muted {
    background-color: rgba(128, 128, 128, 0.2);
    color: var(--pico-muted-color);
}

.badge.info {
    background-color: var(--tone-info-bg);
    color: var(--tone-info);
}

/* Solid rather than tinted: a block also stops SMS, so it outranks Deny. */
.badge.blocked {
    background-color: var(--tone-danger);
    color: var(--pico-background-color);
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--pico-primary);
    padding-bottom: 0.5rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.section-header .section-count {
    font-size: 0.9rem;
    color: var(--pico-muted-color);
}

/* Archived Section */
.archived-section {
    background-color: color-mix(in srgb, var(--tone-warning) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--tone-warning) 20%, transparent);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 2rem;
}

.archived-section .section-header {
    border-bottom-color: var(--tone-warning);
}

.archived-section .classes-table tbody tr {
    opacity: 0.75;
}

.archived-section .classes-table tbody tr:hover {
    opacity: 1;
    background-color: color-mix(in srgb, var(--tone-warning) 5%, transparent);
}

/* Instance Count */
.instance-count {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.instance-count a {
    color: var(--pico-primary);
    text-decoration: none;
}

.instance-count a:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--pico-muted-color);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.quick-actions a[role="button"],
.quick-actions button {
    margin: 0;
}

/* Filters form (card-style background) */
.filters-form {
    background: var(--pico-card-background-color);
    padding: 1.25rem;
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-muted-border-color);
    margin-bottom: 1rem;
}

.filters-form .grid {
    align-items: end;
    margin-bottom: 0;
}

.filters-form label {
    margin-bottom: 0;
}

/* Action buttons in tables */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
}

.action-buttons form {
    margin: 0 !important;
}

.action-buttons a[role="button"],
.action-buttons button {
    white-space: nowrap;
    flex-shrink: 0;
    margin: 0;
}

/* Responsive - Manage Classes */
@media (max-width: 768px) {
    /* Manage-classes stat cards have longer labels - stack to single column.
       Use .stats-grid--stacked modifier; the dashboard's plain 3-number grid
       keeps its 3 columns and does NOT get this modifier. */
    .stats-grid--stacked {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-buttons {
        flex-direction: column;
    }
}

/* ===== ADMIN DASHBOARD ===== */

/* Quick Actions Grid */
.quick-actions-section {
    margin-bottom: 2rem;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    background-color: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--pico-color);
    transition: all 0.15s ease;
}

.quick-action-card:hover {
    border-color: var(--pico-primary);
    background-color: color-mix(in srgb, var(--primary) 5%, transparent);
    transform: translateY(-2px);
}

.quick-action-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.quick-action-label {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

/* Admin Section */
.admin-section {
    margin-bottom: 2rem;
    padding: 1.25rem;
    background-color: color-mix(in srgb, var(--tone-neutral) 4%, transparent);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
}

.admin-section-badge {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--pico-muted-color);
    background: var(--tone-neutral-bg);
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
}

.admin-action-card:hover {
    border-color: var(--pico-muted-color);
    background-color: color-mix(in srgb, var(--tone-neutral) 8%, transparent);
}

/* Text Utilities */
.text-muted {
    color: var(--pico-muted-color);
}

/* Archived Row */
.archived-row {
    opacity: 0.6;
}

.archived-row:hover {
    opacity: 0.8;
}

/* =============================================
   CLASS BOOKINGS PAGE
   ============================================= */

/* Page Header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--pico-muted-color);
    font-size: 1.1rem;
    margin: 0;
}

/* Class Info Card */
.class-info-card {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.class-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-weight: 600;
    color: var(--pico-color);
}

.class-description {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--pico-muted-border-color);
    color: var(--pico-muted-color);
    margin-bottom: 0;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* Bookings Timeline */
.bookings-timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.date-section {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--pico-muted-border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.date-header h3 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-icon {
    font-size: 1.1rem;
}

.date-time {
    color: var(--pico-muted-color);
    font-weight: normal;
    margin-left: 0.5rem;
}

.booking-count {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.waitlist-badge {
    background: #b45309;
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
}

/* Bookings List */
.bookings-list {
    display: flex;
    flex-direction: column;
}

.booking-row {
    display: grid;
    grid-template-columns: 32px 32px 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.booking-row:last-child {
    border-bottom: none;
}

.booking-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.booking-cancelled {
    opacity: 0.5;
}

.booking-cancelled .client-name {
    text-decoration: line-through;
}

/* Booking Checkbox */
.booking-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

/* Status Icons */
.booking-status {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.status-icon {
    font-size: 1rem;
}

.status-icon.status-confirmed {
    color: var(--tone-positive);
}

.status-icon.status-waitlist {
    color: var(--tone-warning);
}

.status-icon.status-cancelled {
    color: var(--tone-neutral);
}

/* Client Info */
.booking-client {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.client-name {
    font-weight: 600;
    color: var(--pico-color);
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    cursor: text;
}

.client-contact {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status Badges */
.booking-badge {
    display: flex;
    align-items: center;
    height: 32px;
}

.badge {
    padding: 0.25rem 0.65rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.badge-confirmed {
    background: var(--tone-positive-bg);
    color: var(--tone-positive);
}

.badge-waitlist {
    background: var(--tone-warning-bg);
    color: var(--tone-warning);
}

.badge-cancelled {
    background: var(--tone-neutral-bg);
    color: var(--tone-neutral);
}

/* Booking Actions */
.booking-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-end;
}

.booking-actions > * {
    margin: 0 !important;
    display: inline-flex !important;
}

.booking-actions a[role="button"],
.booking-actions button,
.booking-actions form {
    display: inline-flex !important;
    align-items: center;
}

.booking-actions a[role="button"],
.booking-actions button {
    padding: 0.45rem 0.8rem !important;
    font-size: 0.8rem !important;
    white-space: nowrap;
    height: 32px !important;
    line-height: 1 !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
    border-width: 1px !important;
    vertical-align: middle !important;
}

/* Button Variants for Booking Actions */
.booking-actions .btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.25rem;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--pico-primary-background);
    color: var(--pico-primary-inverse);
    border: none;
}

.btn-primary:hover {
    background: var(--pico-primary-hover-background);
    color: var(--pico-primary-inverse);
}

.btn-secondary {
    background: var(--pico-secondary);
    color: var(--pico-secondary-inverse);
    border: none;
}

.btn-secondary:hover {
    background: var(--pico-secondary-hover);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--pico-muted-border-color);
    color: var(--vac-text);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--pico-primary);
    color: var(--pico-primary);
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* No Bookings Message */
.no-bookings {
    padding: 1.5rem 1.25rem;
    color: var(--pico-muted-color);
    font-style: italic;
    margin: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--pico-card-background-color);
    border: 1px dashed var(--pico-muted-border-color);
    border-radius: 0.5rem;
}

.empty-state p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .booking-row {
        grid-template-columns: auto auto 1fr;
        grid-template-rows: auto auto;
        gap: 0.5rem;
    }

    .booking-checkbox {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .booking-status {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .booking-client {
        grid-column: 3;
        grid-row: 1;
    }

    .booking-badge {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        align-self: start;
    }

    .booking-actions {
        grid-column: 3;
        grid-row: 2;
        justify-self: stretch;
        flex-wrap: wrap;
        align-items: stretch;
    }

    .booking-actions a[role="button"],
    .booking-actions button {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.65rem !important;
        height: 30px !important;
    }

    .class-info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* =============================================
   INSTANCE DETAIL PAGE
   ============================================= */

/* Instance Info Card */
.instance-info-card {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.instance-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.25rem;
}

/* Compact Select Inputs */
/* The booking status select carries both .status-select and .compact-select;
   .compact-select's 100px min-width (defined later) was clipping "Confirmed".
   Restore a width that fits the longest option plus the dropdown chevron. */
.status-select.compact-select {
    min-width: 9rem;
}

.compact-select {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    margin: 0;
    min-width: 100px;
    background: var(--pico-form-element-background-color);
    color: var(--pico-form-element-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.25rem;
}

.compact-select:focus {
    border-color: var(--pico-primary);
    box-shadow: 0 0 0 2px rgba(var(--pico-primary-rgb), 0.2);
}

/* Date Input Styling - width sized to fit "DD/MM/YYYY" + the native picker chrome.
   Was 160px which truncated the year ("02/06/2026" rendered as "02/06/20"). */
.date-input {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    margin: 0;
    width: 100%;
    max-width: 200px;
    background: var(--pico-form-element-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.25rem;
}

/* Bookings Table */
.bookings-table-container {
    overflow-x: auto;
    /* See .table-container: prevent overflow-x:auto from inducing a spurious
       vertical scrollbar on classic-scrollbar platforms. */
    overflow-y: hidden;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
}

.bookings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

/* -----------------------------------------------------------------------
   Standard form action row
   Right-aligned, natural-width buttons with consistent spacing. House order
   is secondary/Cancel on the left, primary submit on the right. Stacks to
   full-width on narrow screens.
   ----------------------------------------------------------------------- */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.form-actions > button,
.form-actions > a[role="button"] {
    width: auto;
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .form-actions {
        flex-direction: column;
    }

    .form-actions > button,
    .form-actions > a[role="button"] {
        width: 100%;
    }
}

.bookings-table thead {
    background: rgba(0, 0, 0, 0.2);
}

.bookings-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--pico-muted-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.bookings-table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.bookings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Table Cell Types */
.client-cell .client-link {
    font-weight: 600;
    color: var(--pico-primary);
    text-decoration: none;
}

.client-cell .client-link:hover {
    text-decoration: underline;
}

.contact-cell {
    font-size: 0.85rem;
}

.contact-cell .phone {
    color: var(--pico-color);
}

.contact-cell .email {
    color: var(--pico-muted-color);
    font-size: 0.8rem;
}

.attendance-cell,
.payment-cell,
.actions-cell {
    white-space: nowrap;
}

.actions-cell .booking-actions {
    gap: 0.5rem;
}

/* Payment Status Indicators */
.payment-status {
    /* Block so "Paid"/"Deferred" sits below the payment dropdown rather than
       beside it - the cell is white-space:nowrap, so inline-block pushed this
       into the Actions column and clipped it. */
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.payment-status.paid {
    color: var(--tone-positive);
}

.payment-status.deferred {
    color: var(--tone-warning);
}

/* Defer Reason Textarea */
.defer-reason {
    margin-top: 0.35rem;
}

.defer-textarea {
    width: 100%;
    min-width: 120px;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    margin: 0;
    background: var(--pico-form-element-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.25rem;
    resize: vertical;
}

/* Concession Badge */
.concession-badge {
    display: inline-block;
    background: var(--tone-info-bg);
    color: var(--tone-info);
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Booking Meta (timestamps) */
.booking-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--pico-muted-color);
    margin-top: 0.25rem;
}

/* (btn-sm defined in Button Sizes section) */

/* Responsive Instance Page */
@media (max-width: 768px) {
    .instance-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .bookings-table th,
    .bookings-table td {
        padding: 0.5rem;
    }

    .bookings-table {
        font-size: 0.8rem;
    }

    .compact-select {
        min-width: 80px;
        font-size: 0.75rem;
    }
}

/* =============================================
   EDIT CLASS PAGE
   ============================================= */

/* Quick Stats Bar */
.edit-class-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.edit-class-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    min-width: 80px;
}

.edit-class-stats .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pico-primary);
}

.edit-class-stats .stat-label {
    font-size: 0.75rem;
    color: var(--pico-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Instances Header */
.instances-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.instances-header h3 {
    margin: 0;
}

.instances-header p {
    margin: 0.25rem 0 0;
}

.instances-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--pico-muted-color);
}

.summary-divider {
    opacity: 0.5;
}

/* Instances Table */
.instances-table-container {
    overflow-x: auto;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
}

.instances-table {
    width: 100%;
    border-collapse: collapse;
}

.instances-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--pico-muted-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
    background: rgba(0, 0, 0, 0.1);
}

.instances-table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.instances-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.instances-table .past-instance {
    opacity: 0.6;
}

.instance-link {
    font-weight: 600;
    color: var(--pico-primary);
    text-decoration: none;
}

.instance-link:hover {
    text-decoration: underline;
}

.booking-count {
    font-weight: 500;
}

.waitlist-count {
    color: var(--tone-warning);
    font-weight: 600;
}

.badge-muted {
    background: var(--tone-neutral-bg);
    color: var(--pico-muted-color);
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Details Grid Layout */
.details-form-section {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.details-form-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.details-form-section h4 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* Danger Zone */
.danger-zone {
    margin-top: 2rem;
    padding: 1.25rem;
    border: 1px solid rgba(var(--pico-del-color-rgb, 220, 53, 69), 0.3);
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--tone-danger) 4%, transparent);
}

.danger-zone h4 {
    margin: 0 0 0.5rem;
    color: var(--pico-del-color, #dc3545);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.danger-zone p {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--pico-muted-color);
}

/* Form Styling */
.edit-class-form .form-group {
    margin-bottom: 1rem;
}

.edit-class-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.edit-class-form input,
.edit-class-form textarea,
.edit-class-form select {
    width: 100%;
    margin: 0;
}

.edit-class-form small.text-muted {
    display: block;
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Pricing Grid */
.pricing-grid {
    display: grid;
    grid-template-columns: 110px 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

.pricing-grid .form-group:first-child input {
    width: 110px;
}

.pricing-grid .form-group:not(:first-child) input {
    max-width: 220px;
}

/* Duration Card */
.duration-card {
    margin-bottom: 2rem;
    background-color: var(--pico-card-background-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border-left: 3px solid var(--pico-primary);
}

.duration-header h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.duration-header p {
    margin: 0 0 1.25rem 0;
    opacity: 0.9;
}

.duration-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.duration-controls {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.duration-field {
    flex: 0 0 auto;
}

.duration-field label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.duration-field input[type="date"] {
    width: 180px;
    margin-bottom: 0.25rem;
}

.duration-field small {
    display: block;
    opacity: 0.7;
    font-size: 0.8rem;
}

.duration-controls button {
    margin: 0;
    white-space: nowrap;
}

.duration-hint {
    display: block;
    opacity: 0.75;
    font-size: 0.85rem;
    line-height: 1.4;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pico-muted-border-color);
}

.form-actions button,
.form-actions a {
    margin: 0;
}

/* Alert Styling */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.alert-warning {
    background: var(--tone-warning-bg);
    border: 1px solid color-mix(in srgb, var(--tone-warning) 30%, transparent);
    color: var(--tone-warning);
}

.alert-warning strong {
    display: block;
    margin-bottom: 0.25rem;
}

.alert-warning p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Button Full Width */
.btn-full {
    width: 100%;
    justify-content: center;
    margin-bottom: 0.75rem;
    display: inline-block;
    text-align: center;
}

.details-sidebar form + form {
    margin-top: 0.5rem;
}

/* Share Content */
.share-content {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.share-content h3 {
    margin-top: 0;
}

.share-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    margin: 1.5rem 0;
    align-items: start;
}

.share-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.copy-input-group {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
}

.copy-input-group input {
    flex: 1;
    min-width: 0;
    margin: 0;
    background: var(--pico-card-background-color);
    color: var(--pico-color);
}

.copy-input-group .btn-action {
    flex-shrink: 0;
    width: auto;
    min-width: auto;
}

.qr-container {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    display: inline-block;
}

.qr-image {
    max-width: 180px;
    width: 100%;
    height: auto;
    display: block;
}

.share-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--pico-muted-border-color);
}

/* Email Header Section */
.email-header-section {
    margin-bottom: 1rem;
}

.email-header-section h3 {
    margin: 0 0 0.25rem;
}

.email-header-section p {
    margin: 0;
}

/* Responsive Edit Class Page */
@media (max-width: 992px) {
    .details-grid {
        grid-template-columns: 1fr;
    }

    .details-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .details-sidebar h4 {
        width: 100%;
    }

    .details-sidebar .btn-full {
        width: auto;
        flex: 1;
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .edit-class-stats {
        gap: 0.75rem;
    }

    .edit-class-stats .stat-item {
        flex: 1;
        min-width: 70px;
        padding: 0.5rem 0.75rem;
    }

    .edit-class-stats .stat-value {
        font-size: 1.25rem;
    }

    .form-row,
    .form-row-3,
    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .pricing-grid .form-group:first-child input {
        width: 100%;
        max-width: 150px;
    }

    .pricing-grid .form-group:not(:first-child) input {
        max-width: none;
    }

    .duration-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .duration-field input[type="date"] {
        width: 100%;
        max-width: 250px;
    }

    .duration-controls button {
        width: 100%;
    }

    .capacity-input input,
    .price-input input {
        max-width: 100%;
    }

    .duration-form-row {
        grid-template-columns: 1fr;
    }

    .duration-input-group input[type="date"] {
        max-width: 100%;
    }

    .duration-submit-btn {
        margin-top: 0;
        width: 100%;
    }

    .share-grid {
        grid-template-columns: 1fr;
    }

    .instances-table th,
    .instances-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* ===== Sandbox/Training Mode Styles ===== */
.sandbox-header {
    /* Darkened orange keeps the sandbox "safe zone" cue while giving white text
       WCAG AA contrast: white on #c2410c is 5.18:1 (normal text passes). */
    background: linear-gradient(135deg, #c2410c 0%, #9a3412 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(154, 52, 18, 0.3);
}

.sandbox-header h1,
.sandbox-header h2 {
    margin: 0;
    color: white;
}

.sandbox-header p {
    margin: 0.5rem 0 0 0;
    color: white;
}

.sandbox-alert {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    /* Explicit dark text: the box has a fixed pale-yellow bg in both themes, so
       it must not inherit the dark theme's light body colour (unreadable). */
    color: #664d03;
}

.sandbox-alert strong {
    color: #664d03;
}

.sandbox-class-card {
    border-left: 4px solid #ff6b35;
    background: #fff8f0;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border-radius: var(--border-radius);
}

[data-theme="dark"] .sandbox-class-card {
    background: rgba(255, 107, 53, 0.1);
    border-left-color: #ff8c5a;
}

.sandbox-class-card header h3 {
    margin: 0 0 0.5rem 0;
    color: #d45500;
}

[data-theme="dark"] .sandbox-class-card header h3 {
    color: #ff8c5a;
}

.sandbox-class-card header p {
    margin: 0 0 1rem 0;
    color: #1a1a1a;
}

[data-theme="dark"] .sandbox-class-card header p {
    color: #e0e0e0;
}

/* Compact inline stat row (replaces the old boxed .sandbox-stats grid). */
.sandbox-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
    align-items: baseline;
    margin: 0.5rem 0 0.75rem;
    font-size: 0.9rem;
}

.sandbox-stat-row .sandbox-stat-label {
    color: var(--pico-muted-color);
    font-size: 0.8rem;
}

.sandbox-stat-row .danger {
    color: var(--tone-danger);
}

.sandbox-meta {
    margin: 0.5rem 0;
    color: #4a4a4a;
    font-size: 0.875rem;
}

[data-theme="dark"] .sandbox-meta {
    color: #b0b0b0;
}

.sandbox-empty {
    text-align: center;
    padding: 3rem;
    border: 2px dashed var(--muted-border-color);
    border-radius: var(--border-radius);
}

.sandbox-empty h2 {
    margin-bottom: 0.5rem;
}

.sandbox-empty p {
    color: #4a4a4a;
    margin-bottom: 2rem;
}

[data-theme="dark"] .sandbox-empty p {
    color: #b0b0b0;
}

.danger-zone {
    background: var(--tone-danger-bg);
    border: 2px solid var(--tone-danger);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 2rem;
}

.danger-zone h3 {
    color: var(--tone-danger);
    margin-top: 0;
}

.danger-zone p {
    margin-bottom: 1rem;
    color: #1a1a1a;
}

[data-theme="dark"] .danger-zone p {
    color: #e0e0e0;
}

.sandbox-count {
    color: #666;
}

[data-theme="dark"] .sandbox-count {
    color: #999;
}

/* Sandbox Settings Section */
.sandbox-settings {
    margin-top: 1.5rem;
}

.sandbox-settings-inner {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 107, 53, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 107, 53, 0.2);
}

[data-theme="dark"] .sandbox-settings-inner {
    background: rgba(255, 107, 53, 0.08);
    border-color: rgba(255, 107, 53, 0.3);
}

.sandbox-settings-inner small {
    color: #4a4a4a;
    display: block;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

[data-theme="dark"] .sandbox-settings-inner small {
    color: #b0b0b0;
}

/* ===== SECURITY PAGES ===== */

/* Stats grid - auto-fit variant for pages with 4+ cards */
.stats-grid.auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Stat detail text (below stat-label) */
.stat-card .stat-detail {
    display: block;
    color: var(--pico-muted-color);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Inline stat cards (used inside articles, no border) */
.stat-card-inline {
    text-align: center;
    padding: 1rem;
}

.stat-card-inline .stat-number-sm {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.stat-card-inline .stat-number-sm.warning {
    color: var(--tone-danger);
}

/* Stat number colour variants */
.stat-card .stat-number.warning {
    color: var(--tone-danger);
}

/* Table container for horizontal scroll */
.table-container {
    overflow-x: auto;
    /* Pin vertical: overflow-x:auto makes overflow-y compute to auto, which on
       classic (non-overlay) scrollbars induces a spurious vertical scrollbar
       whenever the horizontal one appears. The table isn't height-capped, so
       hiding vertical overflow clips nothing. */
    overflow-y: hidden;
    margin-bottom: 0;
}

/* Utility text classes */
.text-danger {
    color: var(--tone-danger);
    font-weight: bold;
}

.text-warning {
    color: var(--tone-warning);
}

/* Badge variants for security pages */
.badge.success, .badge-success {
    background-color: var(--tone-positive-bg);
    color: var(--tone-positive);
}

.badge-danger {
    background-color: var(--tone-danger-bg);
    color: var(--tone-danger);
}

.badge-warning {
    background-color: var(--tone-warning-bg);
    color: var(--tone-warning);
}

/* Back navigation footer for security pages */
.security-nav {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pico-muted-border-color);
}

.security-nav nav ul {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
}

/* Alert banner */
.alert-banner {
    padding: 1rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
}

.alert-banner.warning {
    background-color: var(--tone-warning-bg);
    border: 1px solid var(--tone-warning-bg);
}

.alert-banner.danger {
    background-color: var(--tone-danger-bg);
    border: 1px solid var(--tone-danger-bg);
}

.alert-banner.info {
    background-color: rgba(var(--pico-primary-background), 0.08);
    border-left: 4px solid var(--pico-primary);
}

/* Empty state for pages with no data */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--pico-muted-color);
}

.empty-state p:first-child {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

/* Method badge for HTTP methods */
.method-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background-color: var(--pico-muted-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: monospace;
}

/* Bar chart display in tables */
.bar-chart-cell {
    min-width: 120px;
}

.bar-chart-cell .bar {
    height: 20px;
    border-radius: 4px;
    background: var(--pico-primary);
}

/* ===== Waitlist Promotion Modal ===== */
.waitlist-promote-modal-article {
    max-width: 600px;
    margin: auto;
}

.waitlist-promote-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.waitlist-promote-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    background: var(--pico-card-sectionning-background-color, rgba(255,255,255,0.05));
    border: 1px solid var(--pico-muted-border-color);
    transition: border-color 0.15s ease;
}

.waitlist-promote-item:hover {
    border-color: var(--pico-primary);
}

.waitlist-promote-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.waitlist-promote-position {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--pico-primary);
    color: #000;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.waitlist-promote-details {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.waitlist-promote-details strong {
    font-size: 0.95rem;
}

.waitlist-promote-contact {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
}

.waitlist-promote-contact a {
    color: var(--pico-primary);
    text-decoration: none;
}

.waitlist-promote-contact a:hover {
    text-decoration: underline;
}

.waitlist-promote-action {
    flex-shrink: 0;
}

/* ===== Waitlist Promotion Dashboard Banner ===== */
.waitlist-promotion-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    background: var(--tone-warning-bg);
    border: 1px solid var(--tone-warning-bg);
    border-left: 4px solid var(--tone-warning);
    animation: fadeIn 0.3s ease;
}

.waitlist-promotion-banner-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.waitlist-promotion-banner-content {
    flex: 1;
    min-width: 0;
}

.waitlist-promotion-banner-content strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.waitlist-promotion-banner-items {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.waitlist-promotion-banner-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--pico-color);
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.15s ease;
}

.waitlist-promotion-banner-link:hover {
    background-color: var(--tone-warning-bg);
    text-decoration: none;
    color: var(--pico-color);
}

.waitlist-promotion-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 0.2rem;
    background: #ffa726;  /* fixed bright amber; black text needs a light fill in both themes */
    color: #000;
    white-space: nowrap;
}

/* Responsive: stack promotion items on mobile */
@media (max-width: 576px) {
    .waitlist-promote-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .waitlist-promote-action {
        align-self: flex-end;
        margin-top: 0.25rem;
    }

    .waitlist-promotion-banner-link {
        flex-wrap: wrap;
    }
}

/* ===== Email Settings Page ===== */

/* Color input compact display */
.color-input-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.color-input-row label {
    margin: 0;
    font-weight: 500;
    min-width: 120px;
}

.color-input-row input[type="color"] {
    width: 50px;
    height: 35px;
    padding: 2px;
    border: 1px solid var(--muted-border-color);
    border-radius: 4px;
    cursor: pointer;
}

.color-input-row small {
    opacity: 0.7;
    font-size: 0.85rem;
}

/* Email editor layout */
.email-editor-container {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.email-editor-main {
    flex: 1;
    min-width: 0;
    /* Frame the TinyMCE iframe so there's no raw white edge against the dark bg */
    border: 1px solid var(--muted-border-color);
    border-radius: 4px;
    overflow: hidden;
    /* Slightly lift it in dark mode */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* TinyMCE injects its own container inside - make sure the border sits flush */
.email-editor-main .tox-tinymce {
    border: none !important;
    border-radius: 0 !important;
}

.email-editor-sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
}

@media (max-width: 1024px) {
    .email-editor-container {
        flex-direction: column;
    }

    .email-editor-sidebar {
        width: 100%;
        position: static;
    }
}

/* Quill editor container */
.quill-container {
    border: 1px solid var(--muted-border-color);
    border-radius: 4px;
    background: var(--card-background-color);
}

.ql-toolbar.ql-snow {
    border-radius: 4px 4px 0 0;
    border-bottom: 1px solid var(--muted-border-color);
}

[data-theme="dark"] .ql-toolbar.ql-snow {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .ql-toolbar.ql-snow {
    background: rgba(0, 0, 0, 0.02);
}

.ql-container.ql-snow {
    border: none;
    border-radius: 0 0 4px 4px;
}

.ql-editor {
    min-height: 280px;
    font-size: 0.95rem;
}

/* Placeholder panel */
.placeholders-panel {
    border: 1px solid var(--muted-border-color);
    border-radius: 4px;
    padding: 0.85rem;
}

[data-theme="dark"] .placeholders-panel {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .placeholders-panel {
    background: rgba(0, 0, 0, 0.02);
}

.placeholders-panel h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    opacity: 0.5;
}

/* Use button.placeholder-item for higher specificity than PicoCSS's bare `button` rule */
.placeholders-panel button.placeholder-item,
.placeholders-panel a.placeholder-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.35rem;
    background: transparent !important;
    border: 1px solid var(--muted-border-color) !important;
    border-radius: 4px !important;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.12s;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--color) !important;
    box-shadow: none !important;
    letter-spacing: normal;
    line-height: 1.4;
}

[data-theme="dark"] .placeholders-panel button.placeholder-item,
[data-theme="dark"] .placeholders-panel a.placeholder-item {
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="light"] .placeholders-panel button.placeholder-item,
[data-theme="light"] .placeholders-panel a.placeholder-item {
    background: rgba(0, 0, 0, 0.03) !important;
}

.placeholders-panel button.placeholder-item:hover,
.placeholders-panel a.placeholder-item:hover {
    background: color-mix(in srgb, var(--primary) 12%, transparent) !important;
    border-color: var(--primary) !important;
    transform: translateX(2px);
    color: var(--color) !important;
    box-shadow: none !important;
}

.placeholders-panel button.placeholder-item code,
.placeholders-panel a.placeholder-item code {
    font-size: 0.72rem;
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    color: var(--primary);
    font-weight: 600;
    font-family: monospace;
    display: block;
    margin-bottom: 0.2rem;
}

.placeholders-panel button.placeholder-item small,
.placeholders-panel a.placeholder-item small {
    display: block;
    opacity: 0.6;
    font-size: 0.68rem;
    font-weight: 400;
}

/* Email preview box */
.email-preview-box {
    background: var(--card-background-color);
    border: 1px solid var(--muted-border-color);
    border-radius: 4px;
    padding: 1.5rem;
}

[data-theme="light"] .email-preview-box {
    background: #ffffff;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.custom {
    background-color: color-mix(in srgb, var(--pico-primary) 15%, transparent);
    color: var(--pico-primary);
}

.status-badge.default {
    background-color: var(--muted-border-color);
    color: var(--muted-color);
}

/* ===== Dashboard Administration drawer ===== */
.admin-drawer {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    margin-bottom: 1.5rem;
    padding: 0;
}

.admin-drawer > .admin-drawer-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--pico-color);
}

.admin-drawer > .admin-drawer-summary::-webkit-details-marker { display: none; }

/* Datalist-backed text inputs (e.g. the attendance form's tutor field): reuse
   Pico's own <select> chevron so a field offering suggestions looks consistent
   with the app's real dropdowns, rather than each browser's own inconsistent
   (and sometimes absent) native datalist indicator. Chromium renders its own
   triangle on focus that cannot be suppressed via CSS (no supported
   ::-webkit-list-button selector, appearance: none has no effect on it), so
   our chevron is hidden on :focus to avoid the two overlapping. */
input[list] {
    background-image: var(--pico-icon-chevron);
    background-position: calc(100% - 15px) 50%;
    background-size: 20px;
    background-repeat: no-repeat;
    padding-right: 50px;
}

input[list]:focus {
    background-image: none;
}

.admin-drawer > .admin-drawer-summary::before {
    content: "\25B8";
    color: var(--pico-muted-color);
    margin-right: 0.25rem;
    transition: transform 0.15s ease;
}

.admin-drawer[open] > .admin-drawer-summary::before { content: "\25BE"; }

.admin-drawer-title { margin-right: auto; }

.admin-drawer .quick-actions-grid { padding: 0 1rem 1rem; }

/* Calm the action-card icons so the grids read as a quiet utility row
   rather than a wall of saturated emoji. */
.quick-action-icon {
    filter: saturate(0.65);
    opacity: 0.92;
}

/* Save-failure warning banner (driven by htmx-config.js). A persistent,
   high-visibility notice shown when a data-changing request does not reach the
   server or is rejected, so an inline autosave (attendance, payment, status)
   can never silently fail to save. */
#save-failure-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--tone-danger-solid, #c62828);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
#save-failure-banner .save-failure-banner__text {
    flex: 1 1 auto;
}
#save-failure-banner .save-failure-banner__signin {
    flex: 0 0 auto;
    color: #fff;
    text-decoration: underline;
}
#save-failure-banner .save-failure-banner__dismiss {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    font: inherit;
}

/* Outline a specific control whose last save did not reach the server. */
.save-failed {
    outline: 2px solid var(--tone-danger-solid, #c62828) !important;
    outline-offset: 1px;
}

/* ---- Form editor ---- */
.form-editor .editor-hint { color: var(--pico-muted-color); margin-bottom: 1rem; }
/* Save draft (secondary) and Publish (primary) sit in an action-row and must be
   the same height: identical padding + border-box makes outline and solid match. */
.form-editor .editor-header-btn { padding: 0.6rem 1.4rem !important; margin: 0 !important; }
.field-card { border: 1px solid var(--pico-muted-border-color); border-radius: 6px;
  padding: 0.75rem 1rem; margin-bottom: 0.75rem; background: var(--pico-card-background-color); }
.field-card-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.field-card-head .field-num { font-weight: 600; opacity: 0.7; }
.field-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem;
  align-items: center; justify-content: space-between; }
/* Reorder/duplicate/delete are subordinate to the primary Edit action: small,
   muted, low-emphasis so the card reads cleanly. */
.field-mini-actions { gap: 0.25rem; }
.field-mini-btn {
  font-size: 0.75rem !important; padding: 0.2rem 0.5rem !important; line-height: 1.2 !important;
  background: transparent !important; color: var(--pico-muted-color) !important;
  border: 1px solid var(--pico-muted-border-color) !important; border-radius: 4px !important;
  cursor: pointer; box-shadow: none !important;
}
.field-mini-btn:hover { color: var(--vac-text) !important; border-color: var(--vac-text) !important; }
.field-mini-danger:hover { color: var(--tone-danger) !important; border-color: var(--tone-danger) !important; }
.smart-badge { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em;
  background: var(--pico-primary-background); color: var(--pico-primary-inverse);
  padding: 0.05rem 0.4rem; border-radius: 3px; }
.smart-summary { margin: 0.25rem 0; color: var(--pico-muted-color); font-size: 0.9rem; }
.cond-note { font-size: 0.8rem; color: var(--pico-muted-color); font-style: italic; }
.field-edit-panel { margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px dashed var(--pico-muted-border-color); }
.field-edit-panel .edit-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.field-edit-panel .edit-grow { flex: 1; min-width: 220px; margin-bottom: 0.5rem; }
.field-edit-panel .edit-required { display: flex; align-items: center; gap: 0.4rem;
  white-space: nowrap; font-weight: normal; margin-bottom: 0.9rem; }
.field-edit-panel .edit-required input { margin: 0; width: auto; }
.field-edit-panel .edit-full { display: block; }
.field-edit-panel .cond-section { margin-top: 0.25rem; }
.field-edit-panel .cond-toggle { font-size: 0.8rem !important; }
.field-edit-panel .cond-controls { margin-top: 0.5rem; }
.field-edit-panel .cond-controls[hidden] { display: none; }
.field-edit-panel .cond-controls input,
.field-edit-panel .cond-controls select { margin: 0; }
.field-edit-panel .edit-done { margin-top: 0.75rem; }
/* Theme-aware tones (see tokens.css, AA-verified by scripts/check_tones.py in
   both themes) rather than the fixed hexes these replaced, which failed AA on
   the dark card background. */
.tag-published { color: var(--tone-positive); font-weight: 600; }
.tag-draft { color: var(--tone-warning); font-weight: 600; }
.btn-sm { font-size: 0.8rem; padding: 0.25rem 0.6rem; }
@media (max-width: 768px) {
  .field-card-actions { justify-content: space-between; }
}
/* Concession cards */
.concession-sandbox-banner {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    border: 1px solid var(--accent-training);
    background: var(--accent-training-bg);
    color: var(--accent-training);
}

.concession-context-switch,
.concession-filter-actions,
.client-concession-actions,
.section-heading-row,
.concession-pagination,
.concession-history-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.concession-context-switch { margin: 1rem 0 1.5rem; }
.section-heading-row,
.concession-pagination,
.concession-history-heading { justify-content: space-between; }

.concession-filter-bar { padding: 1rem; margin-bottom: 1.5rem; }
.concession-filter-grid {
    display: grid;
    grid-template-columns: minmax(16rem, 2fr) minmax(10rem, 1fr) minmax(10rem, 1fr) auto;
    align-items: end;
    gap: 1rem;
}
.concession-filter-grid label,
.concession-filter-grid input,
.concession-filter-grid select { margin-bottom: 0; }

.concession-table { font-size: 0.9rem; }
.concession-table td { vertical-align: middle; }
.concession-pagination { margin-top: 1rem; }

.concession-state-active { color: var(--tone-positive); background: var(--tone-positive-bg); }
.concession-state-exhausted { color: var(--tone-neutral); background: var(--tone-neutral-bg); }
.concession-state-expired { color: var(--tone-warning); background: var(--tone-warning-bg); }
.concession-state-deactivated { color: var(--tone-danger); background: var(--tone-danger-bg); }

.concession-detail-header .badge { font-size: 0.9rem; padding: 0.35rem 0.75rem; }
.concession-facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1rem;
}
.concession-facts-grid div { display: grid; gap: 0.25rem; }
.concession-facts-grid small { opacity: 0.7; }
.concession-detail-section { margin-top: 1.5rem; }
.concession-detail-section > .section-heading-row p { margin: 0; opacity: 0.75; }

.concession-click-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    gap: 0.75rem;
}
.concession-click {
    min-height: 5.5rem;
    display: grid;
    place-items: center;
    align-content: center;
    border: 2px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
}
.concession-click strong { font-size: 1.5rem; line-height: 1.1; }
.concession-click span,
.concession-click small { font-size: 0.75rem; opacity: 0.75; }
.concession-click-available { border-color: var(--tone-positive); background: var(--tone-positive-bg); }
.concession-click-used { opacity: 0.55; }
.concession-click-used strong { text-decoration: line-through; }
.concession-click-pending { border-color: var(--tone-warning); background: var(--tone-warning-bg); }
.concession-click-exception { border-color: var(--tone-danger); background: var(--tone-danger-bg); }
.concession-history-list { display: grid; gap: 0.75rem; }
.concession-history-list article { margin: 0; padding: 1rem; }
.concession-history-list p { margin: 0.4rem 0 0; }

.concession-client-section { margin-top: 1.5rem; }
.concession-client-section .section-heading-row h2,
.concession-client-section .section-heading-row p { margin: 0; }
.client-concession-list { display: grid; gap: 0.6rem; margin-top: 1rem; }
.client-concession-card {
    display: grid;
    grid-template-columns: minmax(8rem, 1.2fr) 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.8rem 1rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    text-decoration: none;
}
.client-sandbox-concessions {
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--accent-training);
    border-radius: var(--pico-border-radius);
    background: var(--accent-training-bg);
}
.client-sandbox-concessions h3 { color: var(--accent-training); }

.concession-checkin-field {
    border: 2px solid var(--accent-training);
    border-radius: var(--pico-border-radius);
    padding: 1rem;
}
.concession-checkin-groups { display: grid; gap: 1rem; }
.concession-checkin-card { margin: 0; padding: 1rem; }
.concession-checkin-card > header {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: space-between;
}
.concession-card-count {
    color: var(--accent-training);
    font-size: 1.05rem;
}

.concession-review-list,
.concession-review-card,
.concession-punch-instructions,
.concession-inline-card,
.concession-inline-created {
    display: grid;
    gap: 1rem;
}
.concession-review-list article,
.concession-review-card,
.concession-punch-card {
    margin: 0;
    padding: 1rem;
}
.concession-punch-instructions > h3,
.concession-punch-instructions > h4,
.concession-inline-created > h3 { margin-bottom: 0; }
.concession-punch-card {
    border: 3px solid var(--accent-training);
    text-align: center;
}
.concession-punch-card p { font-size: 1.2rem; }
.concession-punch-card p strong { font-size: 1.8rem; }
.concession-inline-created .concession-card-number strong {
    font-size: clamp(1.8rem, 7vw, 3rem);
    letter-spacing: 0.05em;
}
.concession-punch-instructions button,
.concession-inline-card button,
.concession-inline-created button { min-height: 44px; }

@media (max-width: 768px) {
    .concession-filter-grid { grid-template-columns: 1fr; }
    .client-concession-card { grid-template-columns: 1fr 1fr; min-height: 44px; }
    .concession-punch-instructions footer,
    .concession-inline-card footer { display: grid; grid-template-columns: 1fr; }
}

/* Record pages: main content with an "about" side panel (client page). */
.record-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 1.5rem;
    align-items: start;
}
.record-flag { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.record-flag .flag-banner { flex: 1 1 20rem; }
.record-bulk-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1rem 0 0.5rem;
}
.record-bulk-bar label { margin: 0; }
.record-side > article { margin: 0 0 1rem; padding: 1rem; }
.record-side h2 { font-size: 1rem; margin: 0; }
.record-side dl { margin: 0; }
.record-side dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-color);
}
.record-side dd { margin: 0 0 0.75rem; overflow-wrap: anywhere; }
.record-side dd:last-child { margin-bottom: 0; }
.record-card-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.record-side .client-concession-card { display: grid; gap: 0.15rem; }
.record-menu { margin: 0; }
.record-menu > summary { width: auto; }
details.dropdown.record-menu > summary + ul { left: auto; right: 0; min-width: 14rem; }
.record-header .header-actions { align-items: center; }
.record-header .header-actions > * { margin: 0; }
.record-main .badge { white-space: nowrap; }
/* Keeps the visually-hidden column labels inside the table's scroll box. */
.record-main figure { position: relative; }
.record-menu-danger { color: var(--tone-danger); }

@media (max-width: 900px) {
    .record-layout { grid-template-columns: minmax(0, 1fr); }
}
.quill-surface { background: #fff; color: #111; }
#editClientModal .ql-editor { min-height: 5rem; max-height: 9rem; overflow-y: auto; color: #111; }
.client-quickview-table { font-size: 0.85rem; }
.client-quickview-table .badge { white-space: nowrap; }
/* Menu actions are buttons (they act in place); make them read like the menu's links. */
details.dropdown.record-menu li button.record-menu-item {
    display: block;
    width: calc(100% + var(--pico-form-element-spacing-horizontal) * 2);
    margin: calc(var(--pico-form-element-spacing-vertical) * -0.5) calc(var(--pico-form-element-spacing-horizontal) * -1);
    padding: calc(var(--pico-form-element-spacing-vertical) * 0.5) var(--pico-form-element-spacing-horizontal);
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--pico-dropdown-color);
    font-size: inherit;
    font-weight: inherit;
    text-align: left;
}
details.dropdown.record-menu li button.record-menu-item:hover,
details.dropdown.record-menu li button.record-menu-item:focus-visible {
    background: var(--pico-dropdown-hover-background-color);
}
details.dropdown.record-menu li button.record-menu-item.record-menu-danger { color: var(--tone-danger); }
.record-more { margin: 0.25rem 0 0; }
dd:has(> .record-more[open]) .record-more-preview { display: none; }
.record-more summary { font-size: 0.85rem; }

/* Client search dropdown and new client dialog (quick booking, walk-in panel) */
.required { color: var(--del-color); }

.qb-client-dropdown {
    display: none;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    position: absolute;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .qb-client-dropdown { background: #1a1f2e; }
[data-theme="light"] .qb-client-dropdown { background: #ffffff; }

.qb-client-option {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--pico-muted-border-color);
    transition: background-color 0.15s;
}

.qb-client-option:hover {
    background-color: var(--pico-primary-focus);
}

.qb-client-option:last-child { border-bottom: none; }

/* Walk-in panel on the staff date page */
.walk-in-prompt {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--pico-primary);
    border-radius: var(--pico-border-radius);
    background-color: rgba(33, 150, 243, 0.06);
}
.walk-in-prompt p { margin-bottom: 0.5rem; }
.walk-in-prompt form { margin: 0; }
.walk-in-regulars {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.walk-in-regulars li {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    list-style: none;
}
.walk-in-regulars form { margin: 0; }
.walk-in-regulars button { margin: 0; }
.walk-in-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }
.walk-in-actions button { margin: 0; width: auto; }

/* ===== One-name panel (components/client_name_fields.html, js/name-check.js) ===== */
.name-check-panel {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background: color-mix(in srgb, var(--tone-warning) 15%, transparent);
    border-left: 3px solid var(--tone-warning);
    border-radius: 0.25rem;
    overflow-wrap: anywhere;
}
.name-check-panel p {
    margin: 0.25rem 0 0.5rem;
    font-size: 0.9rem;
}
.name-check-panel label { margin: 0; }
.name-check-gate {
    flex-basis: 100%;
    grid-column: 1 / -1;
    order: -1;
    margin: 0 0 0.5rem;
    color: var(--tone-warning);
    font-size: 0.9rem;
    font-weight: 600;
}
:has(> .name-check-gate) { flex-wrap: wrap; }
.client-name-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}
@media (max-width: 600px) {
    .client-name-fields-row { grid-template-columns: 1fr; }
}
.name-check-blocked {
    opacity: 0.55;
    cursor: not-allowed;
}
.person-entry-heading { margin: 0 0 0.5rem; }

/* =================================================================
   Gallery brand accents (palette in theme.css)
   ================================================================= */

/* Full-width mint band behind the nav with a terracotta rule. The band is
   drawn with border-image outset so it bleeds past the .container body
   without changing layout or causing horizontal scroll. */
nav.lab-nav {
    border-bottom: 4px solid transparent;
    border-image: linear-gradient(to top, var(--vac-accent) 4px, var(--vac-band) 4px) fill 0 / 0 0 4px 0 / 0 100vmax;
    margin-bottom: 1rem;
}
.lab-nav-brand strong {
    color: var(--vac-band-text);
}
nav.lab-nav .lab-nav-hamburger {
    border-color: color-mix(in srgb, var(--vac-band-text) 35%, transparent) !important;
}

/* Short terracotta bar under each page title. */
main h1::after {
    content: "";
    display: block;
    width: 2.75rem;
    height: 4px;
    margin-top: 0.35rem;
    border-radius: 2px;
    background: var(--vac-accent);
}

/* Mint rule along the top of cards; tinted table headers. */
article,
.stat-card {
    border-top: 3px solid var(--vac-card-rule);
}
thead th,
thead td {
    background-color: var(--vac-thead);
}

/* Link hover goes terracotta (transient, so it cannot be mistaken for an
   error state); resting links stay teal. */
main a:not([role="button"]):not(.btn):not([class*="btn-"]):hover {
    color: var(--vac-accent-text);
}

.site-footer {
    border-top: 3px solid var(--vac-accent);
}
