/*
 * admin.css: screens that exist only in the admin portal.
 *
 * Part of the new stylesheet stack (redesign Step 3). Loaded by
 * templates/base.html.twig in this order, one <link> each: tokens.css,
 * base.css, layout.css, components.css, forms.css, admin.css, parent.css.
 * Never use @import here: every file is linked on its own so that
 * FileModifiedVersionStrategy versions each one by its modification time.
 *
 * Ported from the portal's original stylesheet, in its source order, keeping its class names and restyling
 * them onto the design system's tokens. The portal's own classes do the jobs
 * bundle.css gives new names to, so those are restyled here rather than added
 * in parallel: .timeline is the system's Timeline (.tl), .schedule-legend its
 * legend and swatch, .today-board__people its people list, .waitlist-candidates its candidates, .availability-list its
 * week-list. This file is linked on both hosts; what only the parent screens
 * use lives in parent.css.
 */

/* ------------------------------------------------------- player and camera wall
   Not designed yet (the README lists them under "Not yet in the system"), so
   they are carried over as they were, with the old stylesheet's hard-coded
   dark plum and light lilac rebuilt from tokens. --video-bg is the old dark
   plum: --ink darkened with black. */

.player-frame {
    --video-bg: color-mix(in srgb, var(--ink) 60%, black);
    position: relative;
    background: var(--video-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-raised);
    aspect-ratio: 16 / 9;
}

.player-frame video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.player-frame video.is-offline { visibility: hidden; }

.player-offline {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: var(--space-1);
    text-align: center;
    color: var(--plum-tint);
    padding: var(--space-6);
}

/* display:grid above would otherwise override the browser's built-in
   [hidden] rule; this keeps the JS's hidden-toggling authoritative. */
.player-offline[hidden] { display: none; }

.player-offline p { margin: var(--space-1) 0; }
.player-offline .btn { margin: var(--space-4) auto 0; }

.camera-switch {
    margin-top: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.camera-switch__label {
    font-size: var(--text-overline);
    line-height: var(--leading-overline);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-overline);
    text-transform: uppercase;
    color: var(--muted);
}

.camera-switch__pill {
    text-decoration: none;
    font-size: var(--text-label);
    line-height: var(--leading-label);
    font-weight: var(--weight-semibold);
    color: var(--plum-dark);
    background: var(--card);
    border: 1px solid var(--line-control);
    border-radius: var(--radius-pill);
    padding: var(--space-1) var(--space-4);
}

.camera-switch__pill:hover { border-color: var(--plum); background: var(--plum-tint); }

/* Slideshow: a wall of live tiles, built by camera_grid_controller.js. Each
   tile reuses .player-frame/.player-offline, so it looks like the single-camera
   player at tile size. */
.camera-stage { min-width: 0; }

.camera-grid {
    display: grid;
    gap: var(--space-4);
    /* Three across, matching the 3x3 wall the screen view fills. */
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .camera-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .camera-grid { grid-template-columns: minmax(0, 1fr); }
}

.camera-tile__label {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    max-width: calc(100% - var(--space-4));
    background: color-mix(in srgb, var(--video-bg) 72%, transparent);
    color: var(--plum-tint);
    border-radius: var(--radius-pill);
    padding: 2px var(--space-3);
    font-size: var(--text-small);
    line-height: var(--leading-small);
    font-weight: var(--weight-semibold);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.camera-tile__flag {
    display: inline-block;
    background: color-mix(in srgb, var(--plum-tint) 22%, transparent);
    border-radius: var(--radius-pill);
    padding: 0 var(--space-2);
    font-size: var(--text-overline);
    line-height: var(--leading-overline);
    font-weight: var(--weight-bold);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* Expanded onto a television: nothing but the feeds, edge to edge. The tile
   spans are dealt out by camera_grid_controller.js so no screenful ever
   leaves a hole. Pure black on purpose: any letterbox bar disappears. */
.camera-stage:fullscreen {
    background: black;
    width: 100vw;
    height: 100vh;
}

.camera-stage:fullscreen .camera-grid {
    gap: 0;
    height: 100vh;
}

.camera-stage:fullscreen .player-frame {
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
    min-height: 0;
}

/* Fill the tile rather than letterbox it: a wall of black bars is exactly
   the gap this view is meant to avoid. */
.camera-stage:fullscreen .player-frame video { object-fit: cover; }

.camera-stage:fullscreen .camera-grid__indicator { display: none; }

/* Informational only: never looks or behaves like a control. */
.camera-grid__indicator {
    margin: 0 0 var(--space-3);
    color: var(--muted);
    font-size: var(--text-table);
    line-height: var(--leading-table);
}

/* ------------------------------------------------------ configuration tiles
   The system's Tile under a section title per group, three across. The tile
   is the portal's own markup (a heading and a line inside .config-tile__body),
   styled to match .tile in components.css. */

/* Each group is a size container: the columns follow the width of the content
   column (718px at a 1024px window, beside the sidebar), not the window's. */
.config-group { margin-bottom: var(--space-8); container: config-group / inline-size; }
.config-group:last-child { margin-bottom: 0; }

.config-group__title {
    margin: 0 0 var(--space-3);
    font-family: var(--font-display);
    font-size: var(--text-display-section);
    line-height: var(--leading-display-section);
    font-weight: var(--weight-semibold);
}

.config-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
}

.config-tile {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--ink);
    text-decoration: none;
}

a.config-tile:hover { border-color: var(--plum); background: var(--plum-tint); }

.config-tile__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--plum-tint);
    color: var(--plum-dark);
}

/* The tint is the tile's own; on hover the tile takes it, so the icon's well
   moves to the card colour and stays visible. */
a.config-tile:hover .config-tile__icon { background: var(--card); }

.config-tile__icon .icon { width: 18px; height: 18px; }

.config-tile__body { min-width: 0; }

.config-tile__body h3 {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-table);
    line-height: var(--leading-table);
    font-weight: var(--weight-bold);
}

.config-tile__body p {
    margin: 2px 0 var(--space-2);
    font-size: var(--text-small);
    line-height: var(--leading-small);
    color: var(--muted);
}

.config-tile--soon { opacity: 0.5; }

/* Three across needs about 840px (three 260px tiles and two gaps); two across
   about 540px; below that, one. */
@container config-group (max-width: 839px) {
    .config-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container config-group (max-width: 539px) {
    .config-tiles { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------- small chips and hidden text */

/* The RECE mark beside a name. The system draws it as a .tag; .badge is the
   same chip where the today board writes it that way. (The original stylesheet's .badge was
   the shop's product-card overlay, absolutely positioned; it is not carried.) */
.rece-badge,
.badge {
    display: inline-block;
    padding: 0 var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--sunken);
    color: var(--muted);
    font-size: var(--text-overline);
    line-height: var(--leading-small);
    font-weight: var(--weight-bold);
    white-space: nowrap;
    vertical-align: middle;
}

/* ------------------------------------------------------------- shop orders
   The admin order list and the single-order page: working screens, so state
   first (a pill you can read across a room), money second, and everything else
   (supplier ids, session ids) subordinate. */

.order-table .is-numeric { text-align: right; font-variant-numeric: tabular-nums; }

.order-row--attention { background: color-mix(in srgb, var(--danger-tint) 45%, transparent); }

/* A second, unambiguous tap target per row: the order number is a link, but
   "which bit do I press" should never be a question on a list this dense. */
.order-row:hover { background: var(--paper); }

.order-row__link {
    font-weight: var(--weight-bold);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--plum-dark);
    text-decoration: none;
}

.order-row__link:hover { text-decoration: underline; }

/* The order number is read whole; the date and customer under it, and the
   currency after the total, are what wrap on a phone. */
.order-table .order-row__link { white-space: nowrap; }

@media (max-width: 640px) {
    .order-table th,
    .order-table td { padding-inline: var(--space-3); }
}

.order-row__when,
.order-row__email,
.order-row__note {
    display: block;
    margin-top: 2px;
    font-size: var(--text-small);
    line-height: var(--leading-small);
    color: var(--muted);
}

.order-row__name { display: block; font-weight: var(--weight-semibold); }


/* ---- single order page
   The page is a record page (.detail-grid, below); these are the pieces inside
   its cards. */

/* The total and the day it was placed, on a line of their own under the
   header's sentence. */
.order-head-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-3);
    margin: var(--space-2) 0 0;
}

.order-total {
    font-family: var(--font-display);
    font-size: var(--text-display-section);
    line-height: var(--leading-display-section);
    font-weight: var(--weight-semibold);
    font-variant-numeric: tabular-nums;
}

/* Manage: its forms and its two disclosures one under the other. The
   disclosures take the card's width; a button keeps its own. */
.order-manage { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.order-manage > .order-action { align-self: stretch; }
.order-manage > .order-action__hint { margin: calc(var(--space-2) * -1) 0 0; }
.order-manage > p { margin: 0; }

.order-items {
    font-size: var(--text-table);
    line-height: var(--leading-table);
}

.order-items .is-numeric { text-align: right; font-variant-numeric: tabular-nums; }
.order-items__name { display: block; font-weight: var(--weight-semibold); }
.order-items__sku { display: block; font-size: var(--text-small); line-height: var(--leading-small); color: var(--muted); }

.order-items tfoot th {
    text-align: left;
    font-weight: var(--weight-regular);
    color: var(--muted);
}

.order-items tfoot td,
.order-items tfoot th { border-bottom: none; padding-top: var(--space-1); padding-bottom: var(--space-1); }

.order-items tfoot tr:first-child th,
.order-items tfoot tr:first-child td { padding-top: var(--space-3); }

/* Two class names and an element beat the tfoot rules above, so the total's
   rule and padding win on specificity alone. */
.order-items tfoot .order-items__total th,
.order-items tfoot .order-items__total td {
    padding-top: var(--space-2);
    border-top: 1px solid var(--line);
    font-size: var(--text-body);
    line-height: var(--leading-body);
    font-weight: var(--weight-bold);
    color: var(--ink);
}

.order-items__refund td { color: var(--danger); }

.order-margin {
    margin: var(--space-3) 0 0;
    padding-top: var(--space-3);
    border-top: 1px dashed var(--line);
    font-size: var(--text-label);
    line-height: var(--leading-label);
    color: var(--muted);
}

.order-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: var(--space-5);
}

.order-grid > div { margin-bottom: 0; }

.order-label {
    margin: 0 0 var(--space-1);
    font-size: var(--text-overline);
    line-height: var(--leading-overline);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-overline);
    text-transform: uppercase;
    color: var(--muted);
}

/* The parcels heading under a facts list needs room the list's last row does not give. */
.dl + .order-label { margin-top: var(--space-4); }

.order-label__source { text-transform: none; letter-spacing: 0; font-weight: var(--weight-regular); }

.order-value { margin: 0; line-height: var(--leading-body-ratio); }

.order-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--line);
    font-size: var(--text-label);
    line-height: var(--leading-label);
    font-weight: var(--weight-bold);
}

/* An error from the payment or supplier service: the callout's error tone. */
.order-panel__error {
    margin: 0;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--danger-tint);
    color: var(--danger);
    font-size: var(--text-label);
    line-height: var(--leading-label);
}

.order-parcels {
    list-style: none;
    margin: var(--space-2) 0 0;
    padding: 0;
    font-size: var(--text-label);
    line-height: var(--leading-label);
}

.order-parcels li {
    padding: var(--space-2) 0;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 2px var(--space-3);
}

.order-parcels__carrier { font-weight: var(--weight-bold); width: 100%; }
.order-parcels__number { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- the order's history. The marker's shape changes with the event's tone
   (ring = plain, disc = good, diamond = a problem), as the status mark does. */

.order-timeline { list-style: none; margin: 0; padding: 0 0 0 var(--space-5); position: relative; }

.order-timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--line);
}

.order-timeline__item { position: relative; padding: 0 0 var(--space-4); }
.order-timeline__item:last-child { padding-bottom: 0; }

.order-timeline__item::before {
    content: '';
    position: absolute;
    left: calc(var(--space-5) * -1);
    top: 6px;
    width: 10px;
    height: 10px;
    box-sizing: border-box;
    border: 2px solid var(--muted);
    border-radius: 50%;
    background: var(--card);
    box-shadow: 0 0 0 3px var(--card);
}

/* The marker takes its tone from OrderEventType::tone() (App\Ui\Tone). The
   shapes are the status badge's: disc = positive, diamond = danger, ring =
   neutral. Only those three are used, on purpose. */
.order-timeline__item--positive::before { border-color: var(--sage); background: var(--sage); }
.order-timeline__item--danger::before {
    border-color: var(--danger);
    background: var(--danger);
    border-radius: 1px;
    transform: rotate(45deg) scale(0.85);
}
/* --neutral has no rule on purpose: it is the ring above. */

.order-timeline__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
}

.order-timeline__type { font-weight: var(--weight-bold); font-size: var(--text-label); line-height: var(--leading-label); }
.order-timeline__head time { font-size: var(--text-small); line-height: var(--leading-small); color: var(--muted); }

.order-timeline__summary {
    margin: 2px 0 0;
    font-size: var(--text-label);
    line-height: var(--leading-label);
}

.order-timeline__actor {
    margin: 2px 0 0;
    font-size: var(--text-small);
    line-height: var(--leading-small);
    color: var(--muted);
}

.order-note { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }

.order-note .btn { margin-top: var(--space-2); }

/* Cancel and refund are folded away behind a summary on purpose. They are
   irreversible and they are next to buttons people press all day; making each
   one a deliberate two-step is worth the extra click. */
.order-action {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
}

.order-action[open] { border-color: var(--danger); background: color-mix(in srgb, var(--danger-tint) 30%, transparent); }

.order-action__summary {
    cursor: pointer;
    font-weight: var(--weight-bold);
    font-size: var(--text-label);
    line-height: var(--leading-label);
    color: var(--danger);
    list-style: none;
}

.order-action__summary::-webkit-details-marker { display: none; }
.order-action__summary::before { content: '▸ '; }
.order-action[open] .order-action__summary::before { content: '▾ '; }

.order-action__hint {
    margin: var(--space-2) 0 var(--space-3);
    font-size: var(--text-small);
    line-height: var(--leading-small);
    color: var(--muted);
}

.order-refund__row { display: flex; align-items: center; gap: var(--space-1); }
.order-refund__currency { color: var(--muted); font-weight: var(--weight-bold); }
.order-refund__row input { flex: 1; min-width: 0; }

/* ------------------------------------------------------------- door access
   Configuration > Door access, and a staff member's own door access. The
   shared table, tab, notice and plain-list rules are in components.css. */

.door-unavailable { border-style: dashed; }

.door-table td { vertical-align: top; }
.door-table tr.is-readonly td { color: var(--muted); }
.door-table tr.is-readonly td strong { color: var(--ink); }

.door-footnote {
    max-width: 60rem;
    margin-top: var(--space-3);
    font-size: var(--text-small);
    line-height: var(--leading-small);
}

/* Configuration > Door access: the doors and how far each is in step. */
.door-device-table td { vertical-align: middle; }
.door-device-table .data-table__actions { white-space: nowrap; }
.door-device-table .data-table__actions .inline-form { display: inline-flex; margin: 0; }
.door-device-table__result td { padding-top: 0; }

.door-sync + .door-sync { border-top: 1px solid var(--line); margin-top: var(--space-4); padding-top: var(--space-4); }

.door-sync__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-2);
    font-family: var(--font-body);
    font-size: var(--text-table);
    line-height: var(--leading-table);
    font-weight: var(--weight-bold);
}

.door-sync__changes,
.door-sync__notes { margin: 0 0 var(--space-3); padding-left: var(--space-5); }

.door-sync__notes { font-size: var(--text-small); line-height: var(--leading-small); }
.door-sync__verb { display: inline-block; min-width: 9.5rem; color: var(--muted); }
.door-sync .checkbox-row { margin: 0 var(--space-3) 0 0; }

.door-window { white-space: nowrap; margin-left: var(--space-2); }

/* Seven cells, Monday first; the open days filled. The letters repeat the
   strip's aria-label, so a filled cell against an outlined one is the whole
   difference and the days read without the colour. */
.day-strip {
    display: inline-flex;
    gap: 2px;
    vertical-align: middle;
}

.day-strip__day {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-sm);
    font-size: var(--text-overline);
    line-height: 1;
    font-weight: var(--weight-bold);
    background: var(--paper);
    color: var(--muted);
    border: 1px solid var(--line);
}

.day-strip__day.is-on { background: var(--plum); color: var(--on-plum); border-color: var(--plum); }

.code-schedule {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    margin: 2px 0 var(--space-1);
}

.code-schedule > span:first-child { font-weight: var(--weight-semibold); min-width: 5.5rem; }

.code-warning {
    margin: var(--space-2) 0 0;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--attention-tint);
    color: var(--attention);
    font-size: var(--text-label);
    line-height: var(--leading-label);
}

/* ---- schedule form */

.day-picker,
.schedule-choices,
.mode-picker,
.ratio-rule {
    border: 0;
    padding: 0;
    margin: 0 0 var(--space-4);
    min-width: 0;
}

.day-picker legend,
.schedule-choices legend,
.mode-picker legend,
.ratio-rule legend {
    margin-bottom: var(--space-2);
    padding: 0;
    font-size: var(--text-label);
    line-height: var(--leading-label);
    font-weight: var(--weight-semibold);
}

/* A ratio rule on the scheduling page's section card: each age group is a boxed
   group of its own, its legend sitting on the box's top edge, so the three
   rules do not run into each other down one long card. */
.form-section .ratio-rule {
    padding: var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.form-section .ratio-rule legend {
    padding: 0 var(--space-2);
    font-size: var(--text-table);
    line-height: var(--leading-table);
}

.form-section .ratio-rule > p { margin-top: 0; }

/* Staff, children and largest group (and qualified share with its "out of")
   are short numbers: the 220px minimum of a plain .form-grid wraps the third
   onto a row of its own inside the box. */
.form-section .ratio-rule .form-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.day-picker__days { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.day-picker__presets { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-2); }

/* Real checkboxes, restyled as toggle chips: keyboard and screen-reader
   behaviour stay the browser's. */
.form-card label.day-chip {
    position: relative;
    display: inline-block;
    margin: 0;
    font-weight: var(--weight-bold);
    cursor: pointer;
}

.day-chip input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.day-chip span {
    display: inline-grid;
    place-items: center;
    min-width: 3rem;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--line-control);
    background: var(--card);
    color: var(--muted);
    transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

.day-chip:hover span { border-color: var(--plum); }
.day-chip input:checked + span { background: var(--plum); border-color: var(--plum); color: var(--on-plum); }
.day-chip input:focus-visible + span { outline: 2px solid var(--oak-deep); outline-offset: 2px; }

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

/* What the chosen days and hours add up to, said in words; door_schedule_controller.js
   adds .is-problem when they do not add up. */
.schedule-summary {
    margin: var(--space-1) 0 var(--space-5);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--sage-tint);
    color: var(--sage-deep);
    font-size: var(--text-table);
    line-height: var(--leading-table);
    font-weight: var(--weight-semibold);
}

.schedule-summary.is-problem { background: var(--danger-tint); color: var(--danger); }
.schedule-summary:empty { display: none; }

/* ---- door codes */

.form-card .pin-input,
.pin-reveal__value {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    letter-spacing: 0.18em;
}

.pin-field__row { display: flex; gap: var(--space-2); align-items: center; }
.form-card .pin-field__row input { max-width: 12rem; }

.pin-field__status {
    display: block;
    min-height: 1.2em;
    margin-top: var(--space-1);
    font-size: var(--text-small);
    line-height: var(--leading-small);
    color: var(--sage-deep);
}

.pin-reveal { display: inline-flex; align-items: center; gap: var(--space-2); }
.pin-reveal__value { color: var(--muted); }
.pin-reveal__value.is-revealed { color: var(--ink); font-weight: var(--weight-bold); }

.pin-reveal__value.is-error {
    color: var(--danger);
    font-family: var(--font-body);
    letter-spacing: 0;
    font-size: var(--text-label);
    line-height: var(--leading-label);
}

.form-card label.schedule-choice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    margin: 0 0 var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--card);
    font-size: var(--text-table);
    line-height: var(--leading-table);
    font-weight: var(--weight-regular);
    cursor: pointer;
}

.schedule-choice input { margin-top: 2px; accent-color: var(--plum); }
.form-card label.schedule-choice:has(input:checked) { border-color: var(--plum); background: var(--plum-tint); }
.schedule-choice__body { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); }
.schedule-choice__name { font-weight: var(--weight-bold); min-width: 6rem; }

/* ---- staff door access */

.form-card label.mode-option {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    padding: var(--space-3) var(--space-4);
    margin: 0 0 var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--card);
    font-size: var(--text-table);
    line-height: var(--leading-table);
    font-weight: var(--weight-regular);
    cursor: pointer;
}

.mode-option input { margin-top: 2px; accent-color: var(--plum); }
.form-card label.mode-option:has(input:checked) { border-color: var(--plum); background: var(--plum-tint); }
.mode-option__body { display: flex; flex-direction: column; gap: 2px; }
.mode-option__title { font-weight: var(--weight-bold); }
.mode-option__text { color: var(--muted); font-size: var(--text-label); line-height: var(--leading-label); }

.mode-section {
    border-left: 2px solid var(--line);
    padding: var(--space-1) 0 var(--space-1) var(--space-4);
    margin: 0 0 var(--space-4);
}

.door-card__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); }
.form-card .door-card__head { margin-bottom: var(--space-2); }
.door-card__head .section__title { margin: 0; }

.door-card .dl,
.test-result .dl {
    grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
    gap: var(--space-2) var(--space-5);
    margin: var(--space-3) 0;
}

/* The result of testing a door: the callout's success and error tones. */
.test-result {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--ink);
}

.test-result p { margin: 0 0 var(--space-1); }
.test-result--ok { background: var(--sage-tint); }
.test-result--ok > p:first-child strong { color: var(--sage-deep); }
.test-result--bad { background: var(--danger-tint); }
.test-result--bad > p:first-child strong { color: var(--danger); }

.steps-list { margin: var(--space-2) 0 var(--space-3); padding-left: var(--space-5); }
.steps-list li + li { margin-top: var(--space-1); }

@media (max-width: 560px) {
    .door-window { display: block; margin: var(--space-1) 0 0; }
    .code-schedule > span:first-child { min-width: 0; }
    .door-card .dl, .test-result .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .door-card .dl dd, .test-result .dl dd { margin-bottom: var(--space-2); }
}

/* ---------------------------------------------------------------- waitlist
   Seats (the system's WaitlistSeats), families, offers and check-ins. The
   parent's own check-in page (.check-in) is in parent.css. */

.waitlist-room { margin-bottom: var(--space-6); }

/* The room's age band and headcount beside its name: the body face, not the title's. */
.waitlist-room .section__title .muted {
    font-family: var(--font-body);
    font-size: var(--text-table);
    line-height: var(--leading-table);
    font-weight: var(--weight-regular);
}
.waitlist-seats td { vertical-align: top; }

/* Next in line for a seat: name, Offer, and one muted line of why. */
.waitlist-candidates {
    margin: 0;
    padding: 0 0 0 var(--space-5);
    font-size: var(--text-table);
    line-height: var(--leading-table);
}

.waitlist-candidates li + li { margin-top: var(--space-2); }

.waitlist-outcome input[type="text"] { max-width: 11rem; }

/* ---------------------------------------- availability and care patterns
   Scheduling > Care patterns: a day set by hand reads as different from one
   that follows ParentApp. */

.care-patterns th,
.care-patterns td { padding-inline: var(--space-3); }
/* A weekday's hours may break after the dash ("7:00 am–" / "5:30 pm"), each
   half in a span that stays whole, so the five weekday columns stay narrow
   beside the sidebar. The row still scrolls inside its wrapper at 1024px (the
   child's name links to the same edit page as the pencil, so no action is
   hidden). */
.care-patterns td { white-space: normal; }
.care-patterns td:first-child { white-space: nowrap; }
.care-patterns__time { display: inline-block; white-space: nowrap; }
.care-patterns__set { font-weight: var(--weight-bold); color: var(--plum-dark); }
/* The note under a child's source ("Not signed out 2 times") is a sentence: it
   wraps inside a 13rem column rather than stretching the row. */
.care-patterns .data-table__sub { white-space: normal; max-width: 13rem; }
.care-pattern-form select,
.care-pattern-form input { min-width: 0; }

/* A staff member's work profile: the week as a short list (the system's
   week-list: no bullets, a muted weekday in a fixed column), and the weekday
   grid on its form. */
.availability-list {
    list-style: none;
    margin: 0 0 var(--space-1);
    padding: 0;
    font-size: var(--text-table);
    line-height: var(--leading-table);
}

.availability-list li { display: flex; gap: var(--space-3); }
/* A day with nothing is a .muted li; .dl dd .muted would make it a small block
   with no day column, so it states its own display and size. */
.availability-list li.muted { display: flex; font-size: var(--text-table); line-height: var(--leading-table); }
.availability-list__day { flex: none; width: 36px; color: var(--muted); }

.availability-form td { white-space: nowrap; }
.availability-form input { min-width: 0; }

/* --------------------------------------------------------- staff schedules
   The day page draws each room as a timeline: rows of absolutely placed cells
   and bars, positioned in % of the day by DayScheduleView, so a 7:10 start
   sits where it should without a column per minute. The timeline keeps its
   width and scrolls inside its own box (.timeline-wrap); nothing here may
   widen the page. */

/* Today board: right now, room by room. A section (its h2, a callout, the rooms
   table, a page note); the Overview and the schedule's day page share it. */
.today-board__table td { vertical-align: top; }

/* The people on a room's floor, the system's "people" list. */
.today-board__people {
    list-style: none;
    margin: var(--space-1) 0 0;
    padding: 0;
    font-size: var(--text-label);
    line-height: var(--leading-label);
}

.today-board__people li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.today-board__people li + li { margin-top: 2px; }
.today-board__people .row-actions__link { font-weight: var(--weight-regular); }

.today-board__repair { margin: var(--space-3) 0 0; }

/* A repair that is ready: a card with its list of changes and its one action. */
.schedule-repair { margin-bottom: var(--space-5); }
.schedule-repair__list { margin: 0 0 var(--space-4); padding-left: var(--space-5); }
.schedule-repair__list li + li { margin-top: var(--space-1); }

/* Under the page header: the Day / Week / Care patterns tabs on the left and,
   on the day and week pages, the previous / next links at the right end of the
   same line. On a phone the links drop under the tabs. The tabs keep their own
   underline; the links are not tabs, so the line stops short of them. */
.schedule-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
    margin: 0 0 var(--space-5);
}

.schedule-nav .tabs__nav { flex: 1 1 18rem; margin-bottom: 0; }

.schedule-nav__days {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding-bottom: var(--space-1);
}

/* The note under a figure that used to be a hover-only title. The figure's own
   face is the display serif; its explanation reads in the body face. */
.dl--figures dd .figures__note {
    margin-top: var(--space-1);
    font-family: var(--font-body);
    font-weight: var(--weight-regular);
    letter-spacing: 0;
}

.schedule-room { margin-bottom: var(--space-8); }

.schedule-room__meta {
    font-family: var(--font-body);
    font-size: var(--text-table);
    line-height: var(--leading-table);
    font-weight: var(--weight-regular);
}

/* ---- the timeline: a label column and a track per row (the system's Timeline) */

.timeline-wrap {
    min-width: 0;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
}

.timeline { min-width: 760px; }

.timeline__row { display: flex; align-items: stretch; min-height: 36px; }
.timeline__row + .timeline__row { border-top: 1px solid var(--line); }
.timeline__row--axis { min-height: 28px; background: var(--sunken); }
.timeline__row--person { min-height: 56px; }

.timeline__label {
    flex: 0 0 220px;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-label);
    line-height: var(--leading-label);
}

.timeline__name { display: block; font-weight: var(--weight-bold); }

/* The "Set by hand" tag beside a name: the words, not a star. */
.timeline__hand { vertical-align: middle; }

.timeline__hours {
    display: block;
    font-size: var(--text-small);
    line-height: var(--leading-small);
    color: var(--muted);
}

.timeline__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-3);
    font-size: var(--text-small);
    line-height: var(--leading-small);
}

.timeline__actions .row-actions__link { font-size: var(--text-small); white-space: nowrap; }
.timeline__actions > * { white-space: nowrap; }
.timeline__inline-form { display: inline; margin: 0; }
.timeline__inline-form button { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }

.timeline__track {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    border-left: 1px solid var(--line);
}

.timeline__tick {
    position: absolute;
    top: 6px;
    transform: translateX(-50%);
    font-size: var(--text-overline);
    line-height: var(--leading-overline);
    font-weight: var(--weight-bold);
    color: var(--muted);
    white-space: nowrap;
}

/* Summary cells: children expected, and on the floor against needed. They
   always show their numbers, so the tone is never alone. */
.timeline__cell {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--card);
    overflow: hidden;
    white-space: nowrap;
    font-size: var(--text-overline);
    line-height: var(--leading-overline);
    font-weight: var(--weight-semibold);
    color: var(--muted);
    /* A cell's own width decides whether it has room for a word after its
       number (see .timeline__cell-word); its width is set in % of the day, so
       nothing inside it can change that. */
    container-type: inline-size;
}

/* The word after a number ("3/2 over", "15, rest period"): drawn only where the
   cell is wide enough to show the number and the word without cutting either.
   It is aria-hidden; every cell that has one also carries the same meaning in
   .sr-only text and in its title, so nothing depends on it fitting. */
.timeline__cell-word { display: none; font-weight: var(--weight-regular); }

@container (min-width: 56px) {
    .timeline__cell--over .timeline__cell-word { display: inline; white-space: pre; }
}

@container (min-width: 104px) {
    .timeline__cell--reduced .timeline__cell-word { display: inline; white-space: pre; }
}

/* "have/need" is one figure. A 15-minute cell is only 12 to 20px wide, too
   narrow for three characters side by side, so below 20px the figure stacks as a
   fraction (have over need, a rule between) and steps down a size: both numbers
   always show, whole. The slash stays in the text for a screen reader. */
.timeline__figure { display: inline-flex; align-items: center; }

@container (max-width: 19.9px) {
    .timeline__figure { flex-direction: column; font-size: 10px; line-height: 11px; }
    .timeline__slash { display: block; width: 100%; min-width: 7px; height: 0; font-size: 0; border-top: 1px solid currentColor; margin: 1px 0; }
}

.timeline__row--need .timeline__cell:not(.timeline__cell--short):not(.timeline__cell--over) { background: var(--sage-tint); color: var(--sage-deep); }
.timeline__cell--over { background: var(--attention-tint); color: var(--attention); }
.timeline__cell--short { background: var(--danger); color: var(--on-plum); }
/* The tint alone is 1.2:1 against the card, so a reduced-ratio period also
   carries a plum rule along its foot (6.5:1): it reads without the colour. */
.timeline__cell--reduced { background: var(--plum-tint); color: var(--plum-dark); box-shadow: inset 0 -3px 0 var(--plum); }

/* A person's segments. Each kind has its own fill, border and a text label
   (the room name, "Break", "Cover"), so it reads without colour. These kind
   rules stand on their own so the legend's swatches can reuse them.
   Kinds, from SegmentKind: room, float, other_duties, break_unpaid,
   break_paid, break_cover; .timeline__seg--elsewhere is added on top of room
   or break_cover for time in another room, so it comes last. */
.timeline__seg {
    position: absolute;
    top: 50%;
    height: 24px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    overflow: hidden;
    border-radius: var(--radius-sm);
    font-size: var(--text-overline);
    line-height: var(--leading-overline);
    font-weight: var(--weight-bold);
}

.timeline__seg-label { padding: 0 var(--space-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.timeline__seg--room { background: var(--plum); color: var(--on-plum); border: 1px solid var(--plum); }
.timeline__seg--break_cover { background: var(--break-cover-tint); color: var(--break-cover); border: 1px solid var(--break-cover-line); }

.timeline__seg--float,
.timeline__seg--other_duties { background: var(--sage-tint); color: var(--sage-deep); border: 1px dashed var(--sage); }

.timeline__seg--break_unpaid,
.timeline__seg--break_paid { background: var(--card); color: var(--muted); border: 1px dashed var(--line-control); }

/* In another room: a plum outline round a pale fill, against the room bar's
   solid plum. The old pale border was 1.5:1 against the card, so the bar's
   edge was hard to find; plum is 6.5:1. */
.timeline__seg--elsewhere { background: var(--plum-tint); color: var(--plum-dark); border: 1px solid var(--plum); }

/* Two room segments side by side stay two: a card-coloured line between them. */
.timeline__seg--room { box-shadow: inset -1px 0 0 var(--card); }

.timeline__empty {
    margin: var(--space-2) var(--space-4);
    font-size: var(--text-label);
    line-height: var(--leading-label);
}

@media (max-width: 640px) {
    .timeline__label { flex-basis: 9.5rem; }
}

/* The legend under the last timeline: a swatch and its words. The swatches are
   empty spans carrying a segment's kind class, so they match the bars exactly.
   Inline flow (not flex) so a swatch stays with the words after it when the
   line wraps. */
.schedule-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    margin: var(--space-4) 0 0;
    font-size: var(--text-small);
    line-height: var(--leading-small);
    color: var(--muted);
}

/* One entry: its swatch and its words never part at a line end. */
.schedule-legend__item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.schedule-legend__swatch {
    display: inline-block;
    flex: none;
    width: 22px;
    height: 12px;
    border-radius: 3px;
    position: static;
}

/* ---- the week and a person's week */

.schedule-week th { vertical-align: top; }
.schedule-week tbody td { vertical-align: top; }

/* The staff member is the row's header: name, RECE tag and position. It may
   break between the name and the tag, never inside a word, so the grid keeps
   its days in view at 1440. */
.schedule-week th.schedule-week__person {
    min-width: 8.5rem;
    font-weight: var(--weight-semibold);
    color: var(--ink);
}
.schedule-week__person .muted { font-weight: var(--weight-regular); }

/* Tighter side padding than a list: nine columns have to share the content
   column. A shift span may break after its dash (7:00 am– / 4:00 pm) but never
   inside a time; the hours sit under it. */
.schedule-week th,
.schedule-week td { padding-left: var(--space-3); padding-right: var(--space-3); }
.schedule-week thead th:nth-child(n+2):nth-child(-n+6),
.schedule-week td.schedule-week__day { padding-left: var(--space-2); padding-right: var(--space-2); }
.schedule-week__time { white-space: nowrap; }
.schedule-week__day { min-width: 5.5rem; }

/* Wide enough to scroll sideways inside .table-wrap: keep the names in view
   while the days scroll under them. Not on a phone, where the column would take
   half the width. */
@media (min-width: 700px) {
    .schedule-week thead th:first-child,
    .schedule-week tbody th.schedule-week__person,
    .schedule-week tfoot th:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        box-shadow: inset -1px 0 0 var(--line);
    }
    .schedule-week thead th:first-child { background: var(--sunken); }
    .schedule-week tbody th.schedule-week__person,
    .schedule-week tfoot th:first-child { background: var(--card); }
    .schedule-week tbody tr:hover th.schedule-week__person { background: var(--paper); }
}

.schedule-week__day-status {
    margin-top: var(--space-1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    font-weight: var(--weight-regular);
    letter-spacing: 0;
    text-transform: none;
}

.schedule-week__over { color: var(--danger); font-weight: var(--weight-bold); }

.staff-week th[scope="row"] { text-align: left; }

/* ---- a terms version's Markdown source (admin/terms/view only)
   The rendered document above it is .terms-doc__content (parent.css); this is
   the collapsed read-only source with its Copy button. */

.terms-source summary {
    cursor: pointer;
    font-weight: var(--weight-semibold);
    color: var(--plum-dark);
}

.terms-source[open] summary { margin-bottom: var(--space-4); }

.terms-source .form-actions { margin: var(--space-3) 0; }

textarea.terms-source__textarea {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--sunken);
    color: var(--ink);
    font-family: monospace;
    font-size: var(--text-small);
    line-height: var(--leading-small);
    resize: vertical;
}

/* ------------------------------------------------------------------- print
   layout.css hides the header, footer, flashes, side nav, shell bar and
   anything marked .no-print, and sets the sheet's table to 11pt. These are the
   admin pages' own rules on top: no page prints its breadcrumb, its header
   buttons or its week and day links, nothing prints in a colour that needs
   ink to read, and a table prints across the page instead of scrolling.
   Invoices print from templates/billing/invoice_print.html.twig, which carries
   its own inline stylesheet and links none of this. */
@page { margin: 0.6in; }

/* The week's grid and the day's timelines are wider than a portrait page has
   room for, so the pages that hold them turn to landscape. Named pages are the only way to ask
   for that on one page and not the whole site: the staff sheet and every other
   page stay portrait. */
@page wide-grid { size: landscape; margin: 0.5in; }

@media print {
    main:has(.schedule-week, .timeline-wrap) { page: wide-grid; }

    /* A clip would cut a wide table or timeline off at the page edge. */
    .app-shell,
    .timeline-wrap { overflow: visible; }

    nav[aria-label="Breadcrumb"],
    .page-head__actions,
    .schedule-nav { display: none; }

    /* A heading is never left at the foot of a page with its timeline on the
       next. */
    h2, h3 { break-after: avoid; }
    .timeline__row { break-inside: avoid; }

    /* A badge keeps its shape and its words; its tint is a screen colour. */
    .status { background: none; border: 1px solid currentColor; }

    /* The staff sheet and the week grid: black on white, ruled in black, no
       fills, a row never split between two pages, the total printed once. */
    .printable .table-wrap,
    .app-shell--wide .table-wrap {
        overflow: visible;
        border: 1px solid #000;
        border-radius: 0;
        background: none;
    }

    .printable .page-head h1,
    .printable .page-head__sub,
    .printable .data-table,
    .printable .data-table .muted,
    .printable .data-table thead th { color: #000; }

    .printable .data-table thead th,
    .schedule-week thead th {
        background: none;
        border-bottom: 2px solid #000;
    }

    .printable .data-table th,
    .printable .data-table td,
    .schedule-week th,
    .schedule-week td { border-bottom: 1px solid #000; }

    .printable .data-table tr,
    .schedule-week tr { break-inside: avoid; }

    .printable .data-table tfoot,
    .schedule-week tfoot { display: table-row-group; }

    .printable .data-table tfoot th,
    .printable .data-table tfoot td,
    .schedule-week tfoot th,
    .schedule-week tfoot td {
        border-top: 2px solid #000;
        border-bottom: none;
    }

    /* The week grid's names stay in view on screen while the days scroll; on
       paper nothing scrolls, so the column is an ordinary one. The link to a
       person's sheet is a screen control, and the empty cell under it in the
       total row goes with it. */
    .schedule-week thead th:first-child,
    .schedule-week tbody th.schedule-week__person,
    .schedule-week tfoot th:first-child {
        position: static;
        box-shadow: none;
        background: none;
    }

    .schedule-week .data-table__actions,
    .schedule-week tfoot td:last-child { display: none; }
}

/* ------------------------------------------------ digital app work queues
   A to-do list in a card: the child, who they belong to, a link to the family
   and, when there is something to mark done, its button at the right edge. */
.card .task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: var(--text-table);
    line-height: var(--leading-table);
}

.card .task-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    padding: var(--space-2) 0;
}

.card .task-list li:first-child { padding-top: 0; }
.card .task-list li:last-child { padding-bottom: 0; }
.card .task-list li + li { border-top: 1px solid var(--line); }
.card .task-list li > form { margin-left: auto; }

/* ------------------------------------------------------- enrollment queue
   The room picker is the one control in the New enrollments table that has to
   stay on a phone, so it gives up width before the name does. */
@media (max-width: 640px) {
    #new-enrollments select.input { max-width: 9.5rem; }
}

/* The work profile's availability grid, inside its form section: the copy
   button sits on the right above the table, and the note under it is help text. */
.availability-tools {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-3);
}

.form-card .availability-note { margin: calc(var(--space-2) * -1) 0 var(--space-4); }

/* ------------------------------------------------------------ record pages
   A staff member and a family: the wide column holds the facts and the tables,
   the side column the short cards and the actions (the system's RecordLayout).

   Beside a 232px sidebar the content column is far narrower than the window
   (718px at a 1024px window, 976px at 1280px, 1136px at 1440px), so the two
   columns follow the width of the column they are in, not of the window: a
   page with a .detail-grid makes its <main> a size container (the :has() rule
   below), as the form pages do. A 300px side column leaves the wide one 724px
   at 1040px, the least that holds a five-column table with its row actions;
   below that everything is one column and the side cards follow the wide ones
   (never before them, so the Tab order matches what is on screen), laid out
   two across when there is room. */
.app-shell > main:has(.detail-grid) { container: record-page / inline-size; }

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

.detail-grid__side {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    align-items: start;
}

@container record-page (min-width: 1040px) {
    .detail-grid { grid-template-columns: minmax(0, 1fr) 300px; }
    .detail-grid__side { display: flex; flex-direction: column; align-items: stretch; }
}

/* A card's head holds a title and its actions; on a phone they wrap rather
   than push the page wider. */
.detail-grid .card__head { flex-wrap: wrap; }
.card__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* The note a tab opens with (ParentApp sync) sits clear of the first card. */
.tabs__nav + .page-note { margin-bottom: var(--space-4); }
/* After a table: the card's action (Save rooms) sits clear of it. */
.table-wrap + .card__actions { margin-top: var(--space-4); }

/* A table, an empty state or a sub-heading inside a card never touches the
   card's own padding twice. */
.detail-grid .card .empty-state { padding: var(--space-6) var(--space-5); }

/* An inline muted aside: .dl dd .muted is a block (the line under a value). */
.dl dd .muted.muted--inline { display: inline; font-size: inherit; line-height: inherit; }

/* The staff page's door card keeps its rules for the connection page; here its
   list is the stacked one every side card uses. */
.door-card .dl.dl--stacked { grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0; }
.door-card .dl.dl--stacked dd { margin-bottom: var(--space-3); }
.door-card .dl.dl--stacked dd:last-child { margin-bottom: 0; }

/* Buttons stacked in a card (Actions), left-aligned. */
.record-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.card .record-actions + .record-actions { margin-top: var(--space-2); }
dl + .record-actions { margin-top: var(--space-3); }

/* A small form in a side card: its fields one under the other. */
.record-form .field { margin-bottom: var(--space-3); }
.record-form .field .input { width: 100%; }
.record-form .field .input.input--narrow { width: 5rem; }
.record-list + .record-form { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }

/* Invitations: a name with its facts under it and the action to the right. */
.record-list { list-style: none; margin: 0; padding: 0; font-size: var(--text-table); line-height: var(--leading-table); }
.record-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; }
.record-list li:first-child { padding-top: 0; }
.record-list li + li { border-top: 1px solid var(--line); }
.record-list__main { display: flex; flex-wrap: wrap; column-gap: var(--space-2); min-width: 0; }
.record-list__name { font-weight: var(--weight-semibold); }
.record-list__when { flex-basis: 100%; font-size: var(--text-small); line-height: var(--leading-small); }

/* A row's actions as small quiet buttons that wrap under each other instead of
   scrolling out of sight (an invoice can carry up to six). Gap, not dividers:
   a divider orphaned onto its own line looks broken. */
.row-actions--buttons { flex-wrap: wrap; justify-content: flex-end; gap: var(--space-1); max-width: 30rem; margin-left: auto; }

/* A sentence in a table row that spans the columns: it wraps at a readable
   measure instead of stretching the table (and so scrolling its actions away). */
.data-table__note { max-width: 36rem; margin: 0 0 var(--space-2); white-space: normal; }

/* An email address in a crowded table may break anywhere rather than widen it;
   on a phone the table scrolls in its wrapper instead of chopping the address. */
@media (min-width: 641px) {
    .data-table__break { overflow-wrap: anywhere; }
}

/* The family's invoice table: the item's name keeps one line at the widths where
   the column is wide (840px and up: 1280 stacked, 1440 side by side), so it is the row
   actions that wrap, not the name. In the 718px column at 1024 it is left to shrink,
   or the table would scroll. */
@container record-page (min-width: 840px) {
    .data-table .invoice-item { min-width: 12rem; }
}

/* ------------------------------------------------------ record pages, part 2
   A child's billing, a waitlist family and sign-up, a shop order, a leave's
   life insurance: the same layout as above. What they add: */

/* A record page with nothing for a side column (a signed election nobody can
   act on): one column, however wide the page is. */
.detail-grid.detail-grid--single { grid-template-columns: minmax(0, 1fr); }

/* A record page that is one form: the card at a form's width, as on the form
   pages (720px), not stretched across the page. */
.detail-grid--form > .stack { max-width: 720px; }

/* A form in a wide card (the deposit, the start of billing): its fields keep a
   width a person can read a name in, not the card's whole 700px. */
.record-form--narrow { max-width: 28rem; }

/* A form's buttons side by side, wrapping on a phone. */
.record-form .card__actions { margin-top: var(--space-1); }

/* A disclosure under a card's facts ("What they signed"). */
.detail-grid .card > details { margin-top: var(--space-4); }
.detail-grid .card > details > summary { cursor: pointer; font-weight: var(--weight-semibold); }

/* A form that is itself a row of a table (the life insurance "Record a
   payment": a note and a button): the note over the button, both on the same
   right edge as the row's other buttons, at a usable width. (components.css
   makes a form in an actions cell inline-block; this puts it back to a flex
   column.) */
.row-actions--buttons .inline-form--stacked { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); margin-left: 0; }
.row-actions--buttons .inline-form--stacked .input { width: 12rem; }

/* One version of the terms: the document and its source at a reading width.
   They are plain cards, not .form-card: forms.css styles every bare <ul> in a
   .form-card as a red error list, which is what the document's own bullets
   turned into. */
.terms-view { max-width: 720px; margin: var(--space-4) 0; }
