/* ============================================================
   Handova — Shared components
   ------------------------------------------------------------
   Buttons, cards, stat tiles, tables, badges, forms, modals,
   toasts, timelines, empty and skeleton states.

   Shared by the portals and the authentication screens.
   Tokens come from tokens.css; link base.css before this file.
   ============================================================ */

/* Icons inside text inputs, in their own file so the marketing site,
   which does not load this one, can link it too. */
@import url("input-icons.css");



/* ------------------------------------------------------------
   BUTTONS
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background-color: var(--accent); color: #FFFFFF; box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background-color: var(--accent-hover); box-shadow: var(--shadow-sm); }

.btn-secondary {
  background-color: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--navy-700); color: var(--text); }

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

.btn-success { background-color: var(--success); color: #FFFFFF; }
.btn-success:hover:not(:disabled) { filter: brightness(0.94); }

.btn-danger { background-color: var(--danger); color: #FFFFFF; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.94); }

.btn-sm { padding: 0.3125rem 0.625rem; font-size: var(--fs-xs); }
.btn-block { width: 100%; }

.btn-link {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--accent);
}
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  flex: none;
  border-radius: var(--r-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover { background-color: var(--surface-sunk); color: var(--text); }


/* ------------------------------------------------------------
   CARDS & STAT TILES
   ------------------------------------------------------------ */
.card {
  padding: var(--space-5);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.card-tight { padding: var(--space-4); }
.card-flush { padding: 0; overflow: hidden; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.card-foot {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background-color: var(--surface-sunk);
}

.stat {
  display: grid;
  gap: 0.5rem;
  padding: var(--space-4) var(--space-5);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.stat-top { display: flex; align-items: center; gap: 0.5rem; }
.stat-icon {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: var(--r-md);
  background-color: var(--surface-sunk);
  color: var(--text);
}
.stat-label {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-faint);
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-meta { font-size: var(--fs-xs); color: var(--text-muted); }
/* On a phone, figures two to a row and tighter: the list they
   summarise should be on the first screen, not under five cards. */
@media (max-width: 620px) {
  .grid-3:has(> .stat), .grid-4:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; }
  .stat { padding: 0.75rem 0.875rem; gap: 0.375rem; }
  .stat-value { font-size: 1.375rem; }
  .stat-icon { width: 24px; height: 24px; }
  .stat-label { font-size: 0.625rem; }
}
.stat-accent .stat-icon { background-color: var(--accent-soft); color: var(--accent); }
.stat-warning .stat-icon { background-color: var(--warning-soft); color: var(--warning); }
.stat-danger .stat-icon { background-color: var(--danger-soft); color: var(--danger); }
.stat-success .stat-icon { background-color: var(--success-soft); color: var(--success); }


/* ------------------------------------------------------------
   PROGRESS
   ------------------------------------------------------------ */
.progress {
  display: flex;
  height: 10px;
  border-radius: var(--r-full);
  background-color: var(--surface-sunk);
  overflow: hidden;
}
.progress-part { height: 100%; transition: width var(--t-slow) var(--ease); }
.progress-collected { background-color: var(--success); }
.progress-remaining { background-color: var(--border-strong); }
.progress-flagged { background-color: var(--danger); }

.legend { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-4); }
.legend-item { display: flex; align-items: center; gap: 0.4375rem; font-size: var(--fs-xs); color: var(--text-muted); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }


/* ------------------------------------------------------------
   AVATARS
   ------------------------------------------------------------ */
.avatar {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  flex: none;
  border-radius: var(--r-full);
  background-color: var(--surface-sunk);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar-accent { background-color: var(--accent-soft); color: var(--accent); }
.avatar-sm { width: 28px; height: 28px; font-size: 0.625rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 0.875rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 1.5rem; }
/* A child's photo over their initials (ui.childAvatar; filled by
   packages/photos). The initials show until it loads, or for good
   when there is none. */
.avatar-photo { position: relative; overflow: hidden; }
.avatar-photo img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* A pickup person's face (packages/photos' fillPersonPhotos fills
   the <img>). Round, cropped, with an icon until it loads or when
   there is none on file. */
.person-photo {
  display: grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  overflow: hidden;
  background-color: var(--accent-soft);
  color: var(--accent);
}
.person-photo img { width: 100%; height: 100%; object-fit: cover; }
.person-photo-lg { width: 112px; height: 112px; }
.person-photo-lg .icon { width: 30px; height: 30px; }
.person-photo-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}


/* ------------------------------------------------------------
   BADGES
   Status always carries an icon and text, never colour alone.
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-sm { font-size: 0.6875rem; padding: 0.125rem 0.4375rem; }
.badge-success { background-color: var(--success-soft); color: var(--success); }
.badge-warning { background-color: var(--warning-soft); color: var(--warning); }
.badge-danger  { background-color: var(--danger-soft);  color: var(--danger); }
.badge-info    { background-color: var(--info-soft);    color: var(--info); }
.badge-neutral { background-color: var(--surface-sunk); color: var(--text-muted); }


/* ------------------------------------------------------------
   TABLES
   Below 620px each row becomes a card, using the data-label
   attribute the renderer writes onto every cell.
   ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }

/* Table tool bar: filters and export (ui.table) */
.table-tools {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .5rem;
  padding: .625rem .875rem; border-bottom: 1px solid var(--border);
}
.table-tools .table-count { margin-right: auto; }
.table-count { font-size: var(--fs-xs, .75rem); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.table-badge {
  display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; margin-left: .15rem;
  border-radius: 999px; background: var(--accent); color: var(--text-invert, #fff); font-size: .7rem; font-weight: 700;
}
.table-locked { width: 100%; text-align: right; font-size: var(--fs-xs, .75rem); color: var(--text-faint); }
.table-filter-panel {
  display: grid; gap: .625rem; padding: .875rem; border-bottom: 1px solid var(--border); background: var(--surface-sunk, var(--surface));
}
.table-filter-panel[hidden] { display: none; }
.table-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.table-panel-head label { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-sm, .875rem); color: var(--text-muted); }
.table-panel-empty { margin: 0; font-size: var(--fs-sm, .875rem); color: var(--text-faint); }
.table-cond { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.table-cond > select:first-child { min-width: 9rem; }
.table-cond .control { width: auto; min-width: 7rem; }
.table-and { font-size: var(--fs-sm, .875rem); color: var(--text-muted); }
.table-choices { display: flex; flex-wrap: wrap; gap: .25rem .875rem; max-width: 100%; }
.table-panel-foot { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.table-pager {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem;
  padding: .625rem .875rem; border-top: 1px solid var(--border);
}
.table-size { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-xs, .75rem); color: var(--text-muted); }
.table-size .control { width: auto; }
.table-pages { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; margin-left: auto; }
.table-pages .table-page { min-width: 2rem; justify-content: center; font-variant-numeric: tabular-nums; }
.table-gap { padding: 0 .25rem; color: var(--text-muted); }

/* A PDF shown in a modal (HD.pdf.preview). The page itself
   stays white in dark mode: it is the document as it prints. */
.pdf-preview { display: grid; gap: .5rem; }
.pdf-frame {
  width: 100%; height: min(70vh, 760px); border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px); background: #fff;
}
.pdf-fallback { margin: 0; font-size: var(--fs-xs, .75rem); color: var(--text-muted); text-align: center; }
.control.control-sm { height: 2rem; padding: 0 .5rem; font-size: var(--fs-sm, .875rem); }
@media (max-width: 620px) {
  .table-tools { justify-content: stretch; }
  .table-tools .table-count { width: 100%; }
  .table-pager { justify-content: center; }
  .table-pages { margin-left: 0; justify-content: center; width: 100%; }
  .table-cond { display: grid; grid-template-columns: 1fr 1fr auto; }
  .table-cond .control { width: 100%; min-width: 0; }
  .table-cond .table-choices { grid-column: 1 / -1; }
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.table th {
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-faint);
  background-color: var(--surface-sunk);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th:first-child { border-top-left-radius: var(--r-md); }
.table th:last-child { border-top-right-radius: var(--r-md); }

.table td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background-color var(--t-fast) var(--ease); }
.table tbody tr:hover { background-color: var(--surface-sunk); }
.table tbody tr:last-child td { border-bottom: 0; }

.table tr[data-href] { cursor: pointer; }

.col-num { text-align: right; font-variant-numeric: tabular-nums; }
/* .table th sets left; a number column's header lines up with its figures. */
.table th.col-num { text-align: right; }
.col-end { text-align: right; }
.col-tight { width: 1%; white-space: nowrap; }

.cell-main { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.cell-text { min-width: 0; display: grid; }
.cell-name { font-weight: 600; color: var(--text); }
.cell-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* One line with an ellipsis suits a table cell; anywhere else (a
   sentence in a dialog or a card) it must wrap, or one long line
   pushes the whole screen sideways on a phone. */
p.cell-meta, div.cell-meta, li.cell-meta { white-space: normal; overflow: visible; text-overflow: clip; }


/* ------------------------------------------------------------
   FILTER BAR
   ------------------------------------------------------------ */
.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-4);
}
.filters .control { height: 38px; width: auto; min-width: 9rem; }
.filter-search { position: relative; flex: 1 1 14rem; min-width: 0; }
.filter-search .icon { position: absolute; left: 0.625rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.filter-search .control { width: 100%; padding-left: 2rem; }
.result-count { font-size: var(--fs-xs); color: var(--text-faint); margin-left: auto; }


/* ------------------------------------------------------------
   FORMS
   ------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
/* align-content: start keeps a field from stretching to its row
   neighbour's height (one with a hint under it), which would hand
   the spare height to the control and make it taller than the rest. */
.field { display: grid; gap: 0.375rem; min-width: 0; align-content: start; }
.field-wide { grid-column: 1 / -1; }

.field label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text);
}
.field-optional { font-weight: 400; color: var(--text-faint); }
.field-hint { font-size: var(--fs-xs); color: var(--text-faint); }
.field-error { font-size: var(--fs-xs); font-weight: 500; color: var(--danger); }
/* A field with something to fix: its label turns red, and when the
   form brings it into view (ui.revealFirstError) it flashes once. */
.field:has(.field-error:not([hidden])) > label,
.field:has(.field-error:not([hidden])) > .sign-label { color: var(--danger); }
.field-flash { animation: field-flash 1.2s var(--ease) 1; border-radius: var(--r-md); }
@keyframes field-flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; background-color: transparent; }
  20%, 60% { box-shadow: 0 0 0 6px var(--danger-soft); background-color: var(--danger-soft); }
}
@media (prefers-reduced-motion: reduce) {
  .field-flash { animation: none; box-shadow: 0 0 0 3px var(--danger-soft); }
}

.control {
  width: 100%;
  padding: 0.5rem 0.6875rem;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.control:hover { border-color: var(--navy-700); }
.control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.control:focus-visible { outline: none; }
.control[aria-invalid="true"] { border-color: var(--danger); }
.control[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }

textarea.control { resize: vertical; min-height: 5rem; }

/* iPhone Safari zooms the whole page into any field whose text is
   under 16px when it is tapped, and leaves it zoomed: the form a
   parent was filling in suddenly fills the screen, sideways. On a
   touch screen every field is 16px. :root lifts this above the apps'
   own smaller sizes (.gt-search-sm .control, .control-sm). */
@media (pointer: coarse) {
  :root input.control, :root select.control, :root textarea.control,
  :root .handover-code input { font-size: 16px; }
}

/* One height for every single-line control, so inputs, selects and
   dates sit level side by side. */
input.control:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not(.control-sm),
select.control:not(.control-sm) { height: 2.625rem; }

select.control {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235C6779' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.75 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 16px 16px;
  cursor: pointer;
}

.checkgroup { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.checkgroup[aria-invalid="true"] { outline: 1px solid var(--danger); outline-offset: 4px; border-radius: var(--r-sm); }

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.check:hover { border-color: var(--navy-700); }
.check input { accent-color: var(--accent); margin: 0; }
.check:has(input:checked) { border-color: var(--accent); background-color: var(--accent-soft); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-text { min-width: 0; }
/* Both are spans inside a span, so they need to be told to stack. */
.toggle-name,
.toggle-desc { display: block; }
.toggle-name { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.toggle-desc { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.45; }
.toggle input { accent-color: var(--accent); width: 18px; height: 18px; }


/* ------------------------------------------------------------
   DROPZONE

   The file input is the real control and keeps every native
   behaviour; it is only moved out of sight, never hidden with
   display:none, so it still takes focus and still opens the
   picker from the keyboard.
   ------------------------------------------------------------ */
.dropzone { position: relative; display: grid; gap: 0.625rem; }

.dropzone-input {
  position: absolute;
  width: 1px; height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.dropzone-face {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: var(--space-6) var(--space-5);
  text-align: center;
  background-color: var(--surface-sunk);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease),
              background-color var(--t-fast) var(--ease);
}

.dropzone-face:hover { border-color: var(--accent); background-color: var(--accent-soft); }

/* The ring belongs on the face, because the input it follows is
   the thing nobody can see. */
.dropzone-input:focus-visible + .dropzone-face {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dropzone.is-over .dropzone-face {
  border-color: var(--accent);
  border-style: solid;
  background-color: var(--accent-soft);
}

/* Mid-drag the pointer must reach the zone, not its contents,
   or dragleave fires on every child crossed. */
.dropzone.is-over .dropzone-face > * { pointer-events: none; }

.dropzone-mark {
  display: grid;
  place-items: center;
  width: 2.5rem; height: 2.5rem;
  margin-bottom: 0.25rem;
  color: var(--accent);
  background-color: var(--accent-soft);
  border-radius: var(--r-full);
}
.dropzone.is-over .dropzone-mark { background-color: var(--surface); }

.dropzone-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.dropzone-text { font-size: var(--fs-xs); color: var(--text-muted); }

.dropzone-chosen {
  display: flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.5rem 0.6875rem;
  font-size: var(--fs-xs);
  color: var(--text);
  background-color: var(--success-soft);
  border: 1px solid #CBE4D2;
  border-radius: var(--r-sm);
}
.dropzone-chosen .icon { flex: none; color: var(--success); }
.dropzone-chosen span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ------------------------------------------------------------
   DEFINITION LISTS
   ------------------------------------------------------------ */
.detail-list { display: grid; gap: var(--space-4); }
.detail-list > div { display: grid; gap: 0.1875rem; }
.detail-list dt {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-faint);
}
.detail-list dd { font-size: var(--fs-sm); color: var(--text); }
.detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }


/* ------------------------------------------------------------
   TIMELINE (authorization history)
   ------------------------------------------------------------ */
.timeline { display: grid; gap: 0; }
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0.75rem;
  padding-bottom: var(--space-4);
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 26px;
  bottom: 0;
  width: 1.5px;
  background-color: var(--border);
}
.timeline-item:last-child::before { display: none; }

.timeline-dot {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  background-color: var(--surface-sunk);
  color: var(--text-muted);
  z-index: 1;
}
.timeline-dot.is-success { background-color: var(--success-soft); color: var(--success); }
.timeline-dot.is-warning { background-color: var(--warning-soft); color: var(--warning); }
.timeline-dot.is-danger  { background-color: var(--danger-soft);  color: var(--danger); }

.timeline-body { padding-top: 0.1875rem; }
.timeline-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.timeline-meta { font-size: var(--fs-xs); color: var(--text-muted); }
.timeline-reason {
  margin-top: 0.375rem;
  padding: 0.5rem 0.625rem;
  border-left: 2px solid var(--border-strong);
  background-color: var(--surface-sunk);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}


/* ------------------------------------------------------------
   VERIFY PANEL (collector lookup)
   ------------------------------------------------------------ */
.verify {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background-color: var(--surface);
}
.verify.is-authorized { border-color: var(--success); background-color: var(--success-soft); }
.verify.is-blocked,
.verify.is-caution { border-color: var(--warning); background-color: var(--warning-soft); }

.verify-head { display: flex; align-items: center; gap: 0.625rem; margin-bottom: var(--space-3); }
.verify-status { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.verify.is-authorized .verify-status { color: var(--success); }
.verify.is-blocked .verify-status,
.verify.is-caution .verify-status { color: var(--warning); }
.verify-reason { font-size: var(--fs-sm); color: var(--text); }
.verify-detail { margin-top: 0.25rem; font-size: var(--fs-xs); color: var(--text-muted); }
.verify-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: var(--space-4); }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  border: 1px solid transparent;
}
.notice-info { background-color: var(--info-soft); color: var(--text); border-color: var(--accent-border); }
.notice-warning { background-color: var(--warning-soft); color: var(--text); border-color: #EBD9B4; }
.notice-danger { background-color: var(--danger-soft); color: var(--text); border-color: #F0CFCC; }
.notice-success { background-color: var(--success-soft); color: var(--text); border-color: var(--success-soft); }
.notice-success .icon { color: var(--success); }
/* The rows an upload stopped on (a meal plan CSV). */
.import-errors { margin: 0.375rem 0 0; padding-left: 1.125rem; font-size: var(--fs-sm); display: grid; gap: 0.125rem; }
.notice .icon { flex: none; margin-top: 1px; }
.notice-info .icon { color: var(--accent); }
.notice-warning .icon { color: var(--warning); }
.notice-danger .icon { color: var(--danger); }


/* ------------------------------------------------------------
   EMPTY & SKELETON
   ------------------------------------------------------------ */
.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: clamp(2rem, 5vw, 3.5rem) 1.5rem;
}
.empty-icon {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  margin-bottom: 0.25rem;
  border-radius: var(--r-full);
  background-color: var(--surface-sunk);
  color: var(--text-faint);
}
.empty-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.empty-text { font-size: var(--fs-xs); color: var(--text-muted); max-width: 34ch; }
.empty-action { margin-top: var(--space-3); }

.skeleton-block { display: grid; gap: 0.75rem; padding: var(--space-4); }
.skeleton-row { display: flex; align-items: center; gap: 0.75rem; }
.skeleton {
  display: block;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-sunk) 25%, #EEF1F4 37%, var(--surface-sunk) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton-avatar { width: 34px; height: 34px; border-radius: var(--r-full); flex: none; }
.skeleton-line { height: 12px; flex: 1; }
.skeleton-short { max-width: 22%; }
@keyframes shimmer {
  from { background-position: 100% 50%; }
  to   { background-position: 0 50%; }
}


/* ------------------------------------------------------------
   MODAL
   ------------------------------------------------------------ */
.modal {
  width: min(38rem, calc(100% - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  margin: auto;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
.modal-lg { width: min(52rem, calc(100% - 2rem)); }
.modal::backdrop {
  background-color: rgba(12, 20, 36, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}
.modal[open] { animation: modal-in 220ms var(--ease); }

.modal-card { display: grid; grid-template-columns: minmax(0, 1fr); }
/* Nothing inside a dialog can make it wider than the dialog: a long
   line wraps or scrolls inside its own box instead. */
.modal-card > *, .modal-body > * { min-width: 0; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
.modal-sub { margin-top: 0.25rem; font-size: var(--fs-sm); color: var(--text-muted); }
.modal-body { padding: var(--space-5); }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  background-color: var(--surface-sunk);
}


/* ------------------------------------------------------------
   TOASTS
   ------------------------------------------------------------ */
.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 120;
  display: grid;
  gap: 0.5rem;
  justify-items: end;
  pointer-events: none;
}
/* As a popover (ui.js toast): clear the browser's popover box so it
   sits where .toast-host puts it, see-through and click-through. */
.toast-host[popover] {
  inset: auto 1rem 1rem auto;
  /* Safari's popover box is as tall as the screen unless told
     otherwise, and the grid then stretches every toast to fill it:
     an iPhone showed one alert as a full-screen navy slab. */
  width: auto;
  height: auto;
  max-height: calc(100dvh - 2rem);
  align-content: end;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  color: inherit;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--r-md);
  background-color: var(--navy-900);
  color: #FFFFFF;
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
  max-width: min(24rem, calc(100vw - 2rem));
}
.toast.is-visible { opacity: 1; transform: none; }
.toast-success .icon { color: #6EE7A8; }
.toast-warning .icon { color: #F5CE7A; }
.toast-danger  .icon { color: #F2A9A2; }
.toast-info    .icon { color: #A8C4F7; }


/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 1080px) {
  .col-p3 { display: none; }
}

@media (max-width: 900px) {
  .col-p2 { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 620px) {
  /* Rows become cards — the header row is dropped and each cell
     labels itself from the data-label the renderer wrote. */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }

  .table tr {
    margin-bottom: 0.625rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background-color: var(--surface);
  }
  .table tr:last-child { margin-bottom: 0; }
  /* Label on the left at one fixed width, value beside it, both
     left-aligned: every value in a card starts on the same line, and
     a value that wraps (a name over a relationship) stays in its
     column instead of hugging the right edge. */
  .table td {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.3125rem 0;
    border-bottom: 0;
    text-align: left;
  }
  .table td::before {
    content: attr(data-label);
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--text-faint);
    text-align: left;
    flex: 0 0 7.5rem;
    padding-top: 0.125rem;
  }
  /* A cell with no label (the row's buttons) needs no label column. */
  .table td[data-label=""]::before, .table td:not([data-label])::before { display: none; }
  .table td.col-end { justify-content: flex-end; }
  .table td .cell-text, .table td .cell-main { min-width: 0; }
  .table td:first-child {
    justify-content: flex-start;
    padding-bottom: 0.625rem;
    margin-bottom: 0.375rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }
  .table td:first-child::before { display: none; }
  .col-p2, .col-p3 { display: flex; }

  /* A selectable table's box sits in the card's corner, and the
     column after it is the card's title, as the first one is. */
  .table tr:has(> td.col-select) { position: relative; }
  .table td.col-select {
    position: absolute; top: 0.75rem; right: 0.75rem;
    width: auto; padding: 0; margin: 0; border: 0;
  }
  .table td.col-select + td {
    justify-content: flex-start;
    padding: 0.3125rem 2rem 0.625rem 0;
    margin-bottom: 0.375rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }
  .table td.col-select + td::before { display: none; }

  /* Only a large dialog (a form, the scanner) takes the whole phone.
     A confirmation or a short alert is a card at the bottom, the page
     still visible above it, as phones show their own alerts. */
  .modal {
    width: calc(100% - 1.5rem); max-width: none; max-height: calc(100dvh - 1.5rem);
    margin: auto auto 0.75rem; border-radius: var(--r-lg);
  }
  .modal-lg { width: 100%; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .modal-foot { justify-content: stretch; }
  .modal-foot .btn { flex: 1; }

  .toast-host { left: 1rem; right: 1rem; justify-items: stretch; }
  .toast-host[popover] { left: 1rem; right: 1rem; }
}


/* ------------------------------------------------------------
   INLINE STEPS (import wizard)
   ------------------------------------------------------------ */
.steps-inline { display: grid; gap: var(--space-5); margin-bottom: var(--space-5); }

.steps-inline li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.steps-num {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  background-color: var(--navy-900);
  color: var(--text-invert);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.steps-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.steps-text {
  margin-top: 0.1875rem;
  margin-bottom: 0.625rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.55;
}

/* ------------------------------------------------------------
   COLUMN REFERENCE
   ------------------------------------------------------------ */
.col-help {
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background-color: var(--surface-sunk);
}
.col-help summary {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.col-help summary::marker { color: var(--text-faint); }

.col-list { display: grid; gap: 0.5rem; margin-top: 0.875rem; }
.col-list li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--fs-xs);
}
.col-list code {
  padding: 0.125rem 0.375rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
}
.col-req {
  font-weight: 600;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.625rem;
}
.col-opt {
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.625rem;
}
.col-note { color: var(--text-muted); flex: 1 1 12rem; }

/* File inputs need a little help to match the other controls. */
input[type="file"].control { padding: 0.4375rem 0.5rem; cursor: pointer; }
input[type="file"].control::file-selector-button {
  margin-right: 0.625rem;
  padding: 0.3125rem 0.625rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background-color: var(--surface);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
input[type="file"].control::file-selector-button:hover { border-color: var(--navy-700); }


/* ------------------------------------------------------------
   WIZARD STEPS
   ------------------------------------------------------------ */
.wizard {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.wizard-step { display: flex; align-items: center; gap: 0.4375rem; flex: 1; min-width: 0; }
.wizard-step + .wizard-step::before {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--border);
  margin-right: 0.5rem;
}
.wizard-num {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  flex: none;
  border-radius: var(--r-full);
  background-color: var(--surface-sunk);
  color: var(--text-faint);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.wizard-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-faint);
  white-space: nowrap;
}
.wizard-step.is-current .wizard-num { background-color: var(--navy-900); color: var(--text-invert); }
.wizard-step.is-current .wizard-label { color: var(--text); font-weight: 600; }
.wizard-step.is-done .wizard-num { background-color: var(--success-soft); color: var(--success); }
.wizard-step.is-done .wizard-label { color: var(--text-muted); }

/* ------------------------------------------------------------
   PICKUP FLOW
   ------------------------------------------------------------ */
.pickup-child {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background-color: var(--surface-sunk);
}
.pickup-collector { margin-top: 0.75rem; font-size: var(--fs-sm); color: var(--text-muted); }

.proof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin-top: var(--space-5);
}
.proof-option {
  display: grid;
  justify-items: start;
  gap: 0.25rem;
  padding: var(--space-4);
  text-align: left;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background-color: var(--surface);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.proof-option:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.proof-option.is-selected { border-color: var(--accent); background-color: var(--accent-soft); }
.proof-icon {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  margin-bottom: 0.375rem;
  border-radius: var(--r-md);
  background-color: var(--surface-sunk);
  color: var(--text);
  flex: none;
}
.proof-option.is-selected .proof-icon { background-color: var(--surface); color: var(--accent); }
.proof-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.proof-text { font-size: var(--fs-xs); color: var(--text-muted); }

.proof-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background-color: var(--surface-sunk);
}
.proof-result .cell-text { flex: 1; min-width: 0; }
.proof-thumb {
  width: 64px; height: 48px;
  flex: none;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background-color: var(--surface);
}

/* ------------------------------------------------------------
   SIGNATURE PAD
   ------------------------------------------------------------ */
.sign-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text);
}

.sign-pad {
  position: relative;
  height: 180px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background-color: var(--surface);
  overflow: hidden;
  touch-action: none;          /* let the pad own the gesture */
}
.sign-pad[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.sign-pad canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
.sign-baseline {
  position: absolute;
  left: 1.5rem; right: 1.5rem;
  bottom: 2.75rem;
  height: 1px;
  background-color: var(--border);
  pointer-events: none;
}
.sign-hint {
  position: absolute;
  left: 1.5rem;
  bottom: 1.5rem;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  pointer-events: none;
}

/* Taking a photo (ui.js capturePhoto): its own dialog, over a modal
   if one is open. */
.camera-capture {
  width: min(48rem, calc(100vw - 2rem));
  max-width: none;
  padding: 1.25rem;
  border: 0;
  border-radius: var(--r-lg);
  background-color: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.camera-capture::backdrop { background-color: rgba(12, 20, 36, 0.6); }
.camera-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.camera-head h2 { font-size: 1.125rem; margin: 0; }
.camera-pick { display: flex; align-items: center; gap: 0.5rem; font-size: var(--fs-sm); color: var(--text-muted); }
.camera-pick .control { min-width: 14rem; }
.camera-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: min(60dvh, 30rem);
  border-radius: var(--r-md);
  background-color: #0C1424;
  overflow: hidden;
}
.camera-stage video, .camera-stage img { width: 100%; height: 100%; object-fit: contain; }
.camera-capture [hidden] { display: none !important; }
.camera-message { max-width: 28rem; margin: 0; padding: 1.5rem; color: #FFFFFF; text-align: center; }
.camera-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }

/* The enlarged pad (ui.js enlargeSignature): its own dialog, over a
   modal if one is open. 3:1 like the small pads, as wide as fits. */
.sign-enlarged {
  width: min(64rem, calc(100vw - 2rem));
  max-width: none;
  padding: 1.25rem;
  border: 0;
  border-radius: var(--r-lg, 0.75rem);
  background-color: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.sign-enlarged::backdrop { background-color: rgba(12, 20, 36, 0.6); }
.sign-enlarged-head h2 { font-size: var(--fs-lg, 1.125rem); margin: 0 0 0.25rem; }
.sign-enlarged-head p { margin: 0 0 1rem; color: var(--text-muted); font-size: var(--fs-sm); }
.sign-enlarged-pad {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 1;
  max-height: calc(100dvh - 12rem);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background-color: #FFFFFF;
  overflow: hidden;
}
.sign-enlarged-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.sign-enlarged-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; }

.sign-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.375rem;
}

/* The signed handover of a medicine (school-day.js medProofHtml). */
.med-proof { margin-bottom: 0.75rem; }
.med-proof-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.25rem; }
.med-proof-sign img {
  display: block;
  height: 84px;
  aspect-ratio: 3 / 1;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background-color: #FFFFFF;
}

/* ------------------------------------------------------------
   RECORDED PROOF & SIGNATURE (activity detail)
   ------------------------------------------------------------ */
.record-proof {
  display: grid;
  gap: 0.5rem;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background-color: var(--surface-sunk);
}
.record-proof img {
  width: 100%;
  max-height: 190px;
  object-fit: contain;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.record-caption { font-size: var(--fs-xs); color: var(--text-muted); }

.sig-thumb {
  height: 28px;
  max-width: 110px;
  object-fit: contain;
  object-position: left center;
}

@media (max-width: 620px) {
  .proof-grid { grid-template-columns: minmax(0, 1fr); }
  .wizard-label { display: none; }
  .wizard-step { flex: none; }
  .wizard-step + .wizard-step::before { width: 2rem; flex: none; }
}

.record-proof .btn { justify-self: start; margin-top: 0.25rem; }


/* ------------------------------------------------------------
   SCAN
   ------------------------------------------------------------ */
.scan-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: var(--space-4);
}
.scan-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background-color: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}
.scan-mode:hover { border-color: var(--navy-700); color: var(--text); }
.scan-mode.is-active {
  border-color: var(--accent);
  background-color: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Signing a child in: their photo beside their name, and finding a
   child without a card by name. */
.scan-arrival-who { display: flex; align-items: center; gap: var(--space-4); }
.scan-arrival-who .verify-reason { margin: 0; }
.scan-byname { margin-top: var(--space-4); }
.scan-name-results { display: grid; gap: 0.375rem; margin-top: 0.5rem; }
.scan-name-hit {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  text-align: left;
  font: inherit;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
}
.scan-name-hit:hover { border-color: var(--accent); background-color: var(--accent-soft); }
.scan-name-text { display: grid; min-width: 0; font-weight: 500; }

.scan-camera {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-lg);
  background-color: var(--navy-900);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.scan-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.scan-camera.is-live video { display: block; }

/* The reticle only means anything once a picture is behind it. */
.scan-frame { display: none; }
.scan-camera.is-live .scan-frame {
  display: block;
  position: absolute;
  inset: 18%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 100vmax rgba(12, 20, 36, 0.35);
}

.scan-unavailable {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.375rem;
  padding: var(--space-6) var(--space-5);
  color: rgba(255, 255, 255, 0.75);
}
.scan-unavailable .icon { width: 28px; height: 28px; color: rgba(255, 255, 255, 0.55); }
.scan-unavailable-title { font-size: var(--fs-sm); font-weight: 600; color: #FFFFFF; }
.scan-unavailable-text { font-size: var(--fs-xs); line-height: 1.55; max-width: 38ch; }

.scan-entry { display: flex; gap: 0.5rem; }
.scan-entry .control {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.scan-entry .btn { flex: none; }

.code-chip {
  display: inline-block;
  padding: 0.1875rem 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  background-color: var(--surface-sunk);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
}

/* ------------------------------------------------------------
   PICKUP CARD
   ------------------------------------------------------------ */
.card-preview { display: grid; place-items: center; }
.card-image {
  width: 100%;
  max-width: 340px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  display: block;
}

/* --- The shared card modal, opened from both portals --- */
.pcard-preview {
  display: grid;
  place-items: center;
  min-height: 210px;
}
.pcard-image {
  width: 100%;
  max-width: 340px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  display: block;
}
.pcard-loading { font-size: var(--fs-sm); color: var(--text-faint); }

.pcard-facts { margin-top: var(--space-5); }

.pcard-photo {
  margin-top: var(--space-5);
  padding: var(--space-4);
  background-color: var(--surface-sunk);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.pcard-photo-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pcard-photo-title {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}
.pcard-photo-title .icon { color: var(--text-muted); }
.pcard-photo-by { font-size: var(--fs-xs); color: var(--text-faint); }
.pcard-photo-text {
  margin-top: 0.375rem;
  font-size: var(--fs-xs);
  line-height: var(--lh-body);
  color: var(--text-muted);
}
.pcard-photo-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.pcard-note { margin-top: var(--space-4); }

@media (max-width: 620px) {
  .scan-modes { grid-template-columns: minmax(0, 1fr); }
  .scan-entry { flex-wrap: wrap; }
  .scan-entry .btn { width: 100%; }
}

/* ------------------------------------------------------------
   ROW ACTION MENU
   The panel is fixed-positioned by ui.js because its ancestors
   clip it: .table-wrap scrolls on x, .card-flush hides overflow.
   ------------------------------------------------------------ */
.row-menu { display: inline-block; }

.row-menu-toggle[aria-expanded="true"] {
  background-color: var(--surface-sunk);
  color: var(--text);
}

.row-menu-panel {
  z-index: 60;
  min-width: 12.5rem;
  padding: 0.3125rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  text-align: left;
}
.row-menu-panel[hidden] { display: none; }

.row-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4375rem 0.5rem;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--text);
  text-align: left;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease);
}
.row-menu-item .icon { color: var(--text-faint); flex: none; }
.row-menu-item:hover,
.row-menu-item:focus-visible { background-color: var(--surface-sunk); }
.row-menu-item:hover .icon { color: var(--text-muted); }

.row-menu-item.is-danger { color: var(--danger); }
.row-menu-item.is-danger .icon { color: var(--danger); }
.row-menu-item.is-danger:hover,
.row-menu-item.is-danger:focus-visible { background-color: var(--danger-soft); }

.row-menu-sep {
  height: 1px;
  margin: 0.3125rem 0.25rem;
  background-color: var(--border);
}

/* Row actions sit together at the end of a row. */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  justify-content: flex-end;
}

/* ------------------------------------------------------------
   CONFIRM
   ------------------------------------------------------------ */
.confirm-text {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-muted);
}
.confirm-text strong { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------
   COMBOBOX
   A select you can type into. The list is fixed-positioned by
   ui.js so it can overflow the dialog it sits in.
   ------------------------------------------------------------ */
.combo { position: relative; }

.combo-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
  display: flex;
}
.combo-input { padding-left: 2.25rem; }

.combo-list {
  z-index: 70;
  margin: 0;
  padding: 0.3125rem;
  list-style: none;
  overflow-y: auto;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.combo-list[hidden] { display: none; }

.combo-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4375rem 0.5rem;
  border-radius: var(--r-md);
  cursor: pointer;
}
.combo-option[hidden] { display: none; }
.combo-option:hover,
.combo-option.is-active { background-color: var(--surface-sunk); }
.combo-option.is-active { box-shadow: inset 0 0 0 1px var(--accent-border); }

.combo-option-label {
  font-size: var(--fs-sm);
  color: var(--text);
  min-width: 0;
}
.combo-option-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
  flex: none;
}

.combo-none {
  padding: 0.75rem 0.5rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-align: center;
  list-style: none;
}
.combo-none[hidden] { display: none; }

/* --- Multicombo: the same control, picking several ---
   The list anchors to .combo-field rather than .combo, so the
   chips above it never push the list away from the input it
   belongs to. */
.combo-multi { display: grid; gap: 0.5rem; }
.combo-multi .combo-field { position: relative; }

.combo-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; }
.combo-chips[hidden] { display: none; }

.combo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.25rem 0.1875rem 0.5rem;
  font-size: var(--fs-xs);
  color: var(--text);
  background-color: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-full);
  max-width: 100%;
}
.combo-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.combo-chip-x {
  display: grid;
  place-items: center;
  width: 1.125rem; height: 1.125rem;
  flex: none;
  color: var(--text-muted);
  border-radius: var(--r-full);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.combo-chip-x:hover { color: var(--danger); background-color: var(--surface); }

.combo-chip-clear { margin-left: 0.125rem; font-size: var(--fs-xs); }

/* A picked option stays in the list, ticked, so it can be
   unpicked from the same place it was chosen. */
.combo-option-tick { display: none; flex: none; color: var(--accent); }
.combo-option.is-picked { background-color: var(--accent-soft); }
.combo-option.is-picked .combo-option-tick { display: flex; }
.combo-option.is-picked .combo-option-label { font-weight: 500; }

/* ============================================================
   Safeguarding and care (packages/care/care.js)
   ------------------------------------------------------------
   A do-not-release banner is the loudest thing in the product:
   solid danger, white text, and it never relies on colour alone.
   ============================================================ */
.dnr {
  border-radius: var(--r-md);
  background-color: var(--danger);
  color: #FFFFFF;
  padding: var(--space-4);
  display: grid;
  gap: 0.375rem;
}
.dnr .icon { color: #FFFFFF; }
.dnr-head { display: flex; align-items: center; gap: 0.5rem; font-size: var(--fs-md, 1.05rem); text-transform: uppercase; letter-spacing: 0.03em; }
.dnr-tag {
  margin-left: auto;
  font-size: var(--fs-xs);
  text-transform: none;
  letter-spacing: 0;
  background-color: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.125rem 0.5rem;
}
.dnr-name { font-size: 1.125rem; font-weight: 600; margin: 0; }
.dnr-name span { font-weight: 400; opacity: 0.9; font-size: var(--fs-sm); }
.dnr-reason, .dnr-action { margin: 0; font-size: var(--fs-sm); }
.dnr-action { font-weight: 600; }
.dnr-list ul { margin: 0; padding-left: 1.125rem; display: grid; gap: 0.25rem; font-size: var(--fs-sm); }
.dnr-list .dnr-tag { margin-left: 0.25rem; }

.care-block { display: grid; gap: 0.5rem; }
.care-label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 0.375rem; }
.care-contacts ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.375rem; }
.care-contacts li { display: flex; justify-content: space-between; gap: 0.75rem; font-size: var(--fs-sm); flex-wrap: wrap; }
.care-contacts a { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 500; }
.care-contact-row { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 0.5rem; margin-bottom: 0.5rem; }
@media (max-width: 560px) { .care-contact-row { grid-template-columns: 1fr; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); } }

/* Small markers on a roll row: allergy, restriction, notice. */
.row-flags { display: inline-flex; gap: 0.25rem; margin-left: 0.375rem; vertical-align: middle; }
.row-flag { display: inline-flex; align-items: center; gap: 0.1875rem; font-size: var(--fs-xs); font-weight: 600; border-radius: 999px; padding: 0.0625rem 0.4375rem; }
.row-flag-danger { background-color: var(--danger-soft); color: var(--danger); }
.row-flag-warning { background-color: var(--warning-soft); color: var(--warning); }
.row-flag-info { background-color: var(--info-soft); color: var(--accent); }

/* A plain horizontal bar list (reports). Every bar carries its
   number as text, so nothing depends on reading a length. */
.bar-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.bar-row { display: grid; grid-template-columns: minmax(6rem, 9rem) 1fr 3rem; gap: 0.625rem; align-items: center; font-size: var(--fs-sm); }
.bar-track { height: 0.625rem; border-radius: 999px; background-color: var(--surface-2, var(--border)); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background-color: var(--accent); }
.bar-fill.is-warning { background-color: var(--warning); }
.bar-fill.is-danger { background-color: var(--danger); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }

/* Day columns for the reports' daily chart. */
.day-chart { display: flex; align-items: flex-end; gap: 3px; height: 8rem; padding-top: 0.5rem; overflow-x: auto; }
.day-col { flex: 1 0 0.875rem; display: flex; flex-direction: column-reverse; min-width: 0.875rem; height: 100%; }
.day-col span { display: block; width: 100%; }
.day-col .is-collected { background-color: var(--accent); border-radius: 2px 2px 0 0; }
.day-col .is-late { background-color: var(--warning); }
.day-col .is-flagged { background-color: var(--danger); }

/* A one-time link handed to somebody. */
.handover-code {
  display: grid; gap: 0.5rem; padding: var(--space-4);
  border: 1px dashed var(--accent-border, var(--border)); border-radius: var(--r-md);
  background-color: var(--accent-soft);
}
.handover-code input { font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--fs-sm); }

/* Bulk selection bar. */
.bulk-bar {
  position: sticky; bottom: var(--space-4); z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem;
  padding: 0.625rem 0.875rem; margin-top: var(--space-4);
  border-radius: var(--r-md); background-color: var(--navy-900, #0C1424); color: #FFFFFF;
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.18));
}
.bulk-bar .btn-ghost { color: #FFFFFF; }
.bulk-count { font-weight: 600; margin-right: auto; }

/* Selectable tables (ui.table config.select). */
.table .col-select { width: 1%; padding-right: 0; }
.table-check { width: 1rem; height: 1rem; margin: 0; vertical-align: middle; accent-color: var(--accent); cursor: pointer; }
.table tbody tr[data-selected],
.table tbody tr[data-selected]:hover { background-color: var(--accent-soft); }
.table-bulk { margin: var(--space-3); }
/* The rows a bulk action is about to touch, in its dialog. */
.bulk-list { margin: 0 0 1rem; padding-left: 1.1rem; font-size: var(--fs-xs); color: var(--text-muted); display: grid; gap: 0.125rem; }
.bulk-all { margin-left: 0.5rem; color: #FFFFFF; text-decoration: underline; text-underline-offset: 2px; }
.bulk-all:hover { color: #FFFFFF; opacity: 0.85; }
@media (max-width: 620px) {
  .table-bulk .btn { flex: 1 1 auto; justify-content: center; }
  .table-bulk .bulk-count { flex-basis: 100%; }
}

/* Two-step sign-in setup. */
.mfa-setup { display: grid; grid-template-columns: auto 1fr; gap: var(--space-4); align-items: start; }
.mfa-qr { width: 168px; height: 168px; background: #FFFFFF; padding: 8px; border-radius: var(--r-md); border: 1px solid var(--border); }
.mfa-qr canvas, .mfa-qr svg, .mfa-qr img { width: 100%; height: 100%; display: block; }
@media (max-width: 560px) { .mfa-setup { grid-template-columns: 1fr; } }

/* Language picker (packages/design-system/i18n.js). */
.language-picker { display: inline-flex; align-items: center; gap: var(--space-2, 0.5rem); font-size: var(--fs-sm, 0.875rem); color: var(--text-muted); }
.language-picker-select { width: auto; min-width: 11rem; }
.auth-language { margin-top: var(--space-5, 1.5rem); display: flex; justify-content: center; }

/* Passkeys panel (packages/design-system/passkeys.js). */
.passkey-list { list-style: none; margin: var(--space-3) 0; padding: 0; display: grid; gap: var(--space-2, 0.5rem); }
.passkey-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 0.625rem 0.875rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.passkey-add { display: flex; flex-wrap: wrap; gap: var(--space-2, 0.5rem); align-items: center; }
.passkey-add .control { flex: 1 1 14rem; min-width: 0; width: auto; height: 40px; }

/* Lockdown: the banner every school screen and gate shows while one
   is on. Loud on purpose, in both themes. */
.lockdown-banner {
  position: sticky; top: 0; z-index: 9000;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  padding: 0.875rem 1.25rem; background: #9F1D1D; color: #FFFFFF;
  font-weight: 600; box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
.lockdown-banner .lockdown-title { font-size: 1.05rem; letter-spacing: 0.02em; text-transform: uppercase; }
.lockdown-banner .lockdown-detail { font-weight: 500; opacity: 0.95; flex: 1 1 18rem; }
.lockdown-banner .btn { background: #FFFFFF; color: #9F1D1D; border-color: #FFFFFF; }
.lockdown-full {
  position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center; padding: var(--space-5, 1.5rem);
  background: #7F1414; color: #FFFFFF; text-align: center;
}
.lockdown-full h1 { font-size: clamp(1.8rem, 6vw, 3rem); margin: 0 0 var(--space-3); letter-spacing: 0.03em; }
.lockdown-full p { font-size: 1.1rem; max-width: 34rem; margin: 0 auto var(--space-3); }
.lockdown-full .btn { background: #FFFFFF; color: #7F1414; border-color: #FFFFFF; }

/* A plain notice strip (email confirmation, autopay state). */
.notice-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  padding: 0.75rem 1rem; border-radius: var(--r-md); margin-bottom: var(--space-4);
  background: var(--warning-soft, #FDF3D8); color: var(--text); border: 1px solid var(--border);
}
.notice-strip .notice-strip-text { flex: 1 1 16rem; }
.go-live-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.go-live-list li { display: grid; grid-template-columns: 1.5rem 1fr; gap: 0.5rem; align-items: start; }
.go-live-list .go-live-fix { color: var(--text-muted); font-size: var(--fs-sm, 0.875rem); }

/* Month calendar (packages/design-system/calendar.js). */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2, 0.5rem); margin-bottom: var(--space-3); }
.cal-toolbar .cal-title { font-size: var(--fs-lg, 1.125rem); font-weight: 600; margin: 0 auto 0 var(--space-2, 0.5rem); }
.cal-month { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 0.5rem; font-size: var(--fs-xs, 0.75rem); font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-sunk); }
.cal-cell { min-height: 6.5rem; padding: 0.25rem; border-top: 1px solid var(--border); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-cell:nth-child(7n + 1) { border-left: 0; }
.cal-cell.is-other { background: var(--surface-sunk); }
.cal-cell.is-other .cal-day { color: var(--text-muted); opacity: 0.6; }
.cal-day { align-self: flex-start; border: 0; background: none; font: inherit; font-size: var(--fs-sm, 0.875rem);
  font-weight: 600; color: var(--text); width: 1.75rem; height: 1.75rem; border-radius: 50%; cursor: pointer; }
.cal-cell.is-today .cal-day { background: var(--accent); color: #FFFFFF; }
.cal-item, .cal-more { display: block; width: 100%; text-align: left; border: 0; border-radius: 4px; padding: 2px 6px;
  font: inherit; font-size: 0.75rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; color: var(--text); background: var(--surface-sunk); }
.cal-more { background: none; color: var(--text-muted); }
.cal-item.is-cancelled { text-decoration: line-through; opacity: 0.6; }
.cal-time { font-weight: 600; }
.cal-tone-meeting { background: #E6EEFF; } .cal-tone-sports { background: #E1F5E9; } .cal-tone-arts { background: #F7E8FF; }
.cal-tone-outing { background: #FFF1DD; } .cal-tone-staff { background: #EDEFF2; } .cal-tone-other { background: #EEF3F8; }
.cal-tone-closed { background: #FBE4E1; } .cal-tone-early { background: #FDF3D8; }
/* The year: public holidays in a stronger red than an ordinary
   closure, school holidays in teal, terms a quiet band. */
.cal-tone-public { background: #F7C9C3; } .cal-tone-holiday { background: #D3F1EE; }
.cal-tone-lesson { background: #F1EAFC; box-shadow: inset 3px 0 0 #7B3FD4; }
:root[data-theme="dark"] .cal-tone-lesson { background: #2A1F45; box-shadow: inset 3px 0 0 #9D74E8; }
.cal-tone-term { background: #ECE7FB; } .cal-tone-invited { background: #DCE7FF; box-shadow: inset 3px 0 0 #4F7BE8; }
:root[data-theme="dark"] .cal-tone-public { background: #4A1F1B; } :root[data-theme="dark"] .cal-tone-holiday { background: #123532; }
:root[data-theme="dark"] .cal-tone-term { background: #2A2440; } :root[data-theme="dark"] .cal-tone-invited { background: #1D2B4A; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 0.375rem 1rem; margin: 0.75rem 0 0; font-size: var(--fs-xs, 0.75rem); color: var(--text-muted); }
.cal-key { display: inline-flex; align-items: center; gap: 0.375rem; }
.cal-key-dot { width: 0.75rem; height: 0.75rem; border-radius: 3px; border: 1px solid var(--border); }
:root[data-theme="dark"] .cal-tone-meeting { background: #1D2B4A; } :root[data-theme="dark"] .cal-tone-sports { background: #173426; }
:root[data-theme="dark"] .cal-tone-arts { background: #33204A; } :root[data-theme="dark"] .cal-tone-outing { background: #3A2A12; }
:root[data-theme="dark"] .cal-tone-staff, :root[data-theme="dark"] .cal-tone-other { background: #1E2738; }
:root[data-theme="dark"] .cal-tone-closed { background: #3A1A18; } :root[data-theme="dark"] .cal-tone-early { background: #332510; }
@media (max-width: 640px) {
  .cal-cell { min-height: 3.25rem; }
  .cal-item, .cal-more { font-size: 0; padding: 0; height: 6px; border-radius: 3px; }
  .cal-item .cal-time { display: none; }
}

/* Day / Week / Month / Year (calendar.js toolbar, render). */
.cal-modes { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-sunk); }
.cal-mode { border: 0; background: none; font: inherit; font-size: var(--fs-xs, 0.8125rem); font-weight: 600; color: var(--text-muted);
  padding: 0.3125rem 0.75rem; border-radius: calc(var(--r-md) - 2px); cursor: pointer; }
.cal-mode:hover { color: var(--text); }
.cal-mode.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cal-item-wide { padding: 0.375rem 0.625rem; margin-top: 0.25rem; font-size: var(--fs-sm, 0.875rem); }
.cal-empty { font-size: var(--fs-xs, 0.75rem); color: var(--text-faint, var(--text-muted)); }
.cal-none { margin: var(--space-3) 0 0; font-size: var(--fs-sm); color: var(--text-muted); text-align: center; }

.cal-dayview { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.cal-hour, .cal-allday { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); border-top: 1px solid var(--border); min-height: 2.75rem; }
.cal-allday { border-top: 0; background: var(--surface-sunk); }
.cal-hour-label { padding: 0.5rem; font-size: var(--fs-xs, 0.75rem); font-weight: 600; color: var(--text-muted); border-right: 1px solid var(--border); }
.cal-hour-items { padding: 0.25rem 0.5rem 0.5rem; }

.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden; }
.cal-weekday { min-height: 12rem; border-left: 1px solid var(--border); padding: 0.375rem; }
.cal-weekday:first-child { border-left: 0; }
.cal-weekday.is-weekend { background: var(--surface-sunk); }
.cal-weekday-head { display: flex; flex-direction: column; align-items: center; width: 100%; border: 0; background: none; font: inherit;
  padding: 0.25rem 0 0.5rem; cursor: pointer; color: var(--text); }
.cal-weekday-name { font-size: var(--fs-xs, 0.75rem); font-weight: 600; color: var(--text-muted); }
.cal-weekday-date { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 999px; font-weight: 600; }
.cal-weekday.is-today .cal-weekday-date { background: var(--accent); color: #FFFFFF; }

.cal-year { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: var(--space-4); }
.cal-mini { border: 1px solid var(--border); border-radius: var(--r-md); padding: 0.625rem; background: var(--surface); }
.cal-mini-title { border: 0; background: none; font: inherit; font-weight: 600; padding: 0 0 0.375rem; cursor: pointer; color: var(--text); }
.cal-mini-title:hover { color: var(--accent); }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.cal-mini-dow { font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); padding-bottom: 2px; }
.cal-mini-day { border: 0; background: none; font: inherit; font-size: 0.75rem; aspect-ratio: 1; border-radius: 999px; cursor: pointer; color: var(--text); padding: 0; }
.cal-mini-day:hover { outline: 1px solid var(--border-strong, var(--border)); }
.cal-mini-day.is-other { cursor: default; }
.cal-mini-day.has-items { font-weight: 700; }
.cal-mini-day.is-today { background: var(--accent); color: #FFFFFF; }

@media (max-width: 640px) {
  .cal-item.cal-item-wide { font-size: var(--fs-sm, 0.875rem); padding: 0.375rem 0.625rem; height: auto; border-radius: 4px; }
  .cal-item.cal-item-wide .cal-time { display: inline; }
  .cal-modes { order: 5; width: 100%; }
  .cal-mode { flex: 1; }
  /* The week as a list of days, one under another. */
  .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal-weekday { min-height: 0; border-left: 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: 0.5rem; }
  .cal-weekday:first-child { border-top: 0; }
  .cal-hour, .cal-allday { grid-template-columns: 3.75rem minmax(0, 1fr); }
}
.event-qr { display: grid; justify-items: center; gap: var(--space-2, 0.5rem); text-align: center; }
.event-qr img { width: min(18rem, 70vw); height: auto; image-rendering: pixelated; background: #FFFFFF; padding: 12px; border-radius: var(--r-md); }
.event-qr-full { position: fixed; inset: 0; z-index: 9800; display: grid; place-items: center; background: #FFFFFF; color: #16202E; text-align: center; padding: 1.5rem; }
.event-qr-full img { width: min(80vmin, 40rem); height: auto; image-rendering: pixelated; }
.event-qr-full h2 { font-size: clamp(1.4rem, 4vw, 2.4rem); margin: 0 0 0.5rem; }
.event-meta { display: grid; gap: 0.35rem; margin: 0 0 var(--space-4); }
.event-meta div { display: flex; gap: 0.5rem; align-items: baseline; }

.list-plain { list-style: none; margin: 0; padding: 0; }

/* ------------------------------------------------------------
   AVATAR MENU (ui.avatarMenu): who is signed in, and Sign out.
   ------------------------------------------------------------ */
.avatar-menu { position: relative; display: inline-flex; }
.avatar-menu-btn { display: inline-flex; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.avatar-menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-menu-panel {
  position: absolute; top: calc(100% + 0.5rem); right: 0; z-index: 130;
  width: min(16rem, calc(100vw - 1.5rem)); padding: 0.375rem;
  background-color: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.avatar-menu-head { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border); margin-bottom: 0.25rem; }
.avatar-menu-who { display: grid; min-width: 0; }
.avatar-menu-name { font-weight: 600; font-size: var(--fs-sm); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-menu-detail { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-menu-item { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.625rem; border-radius: var(--r-md);
  font-size: var(--fs-sm); color: var(--text); text-decoration: none; }
.avatar-menu-item:hover, .avatar-menu-item:focus-visible { background-color: var(--surface-sunk); outline: none; }
/* A keyboard user must see where they are: the tint alone is too faint. */
.avatar-menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.avatar-menu-item .icon { color: var(--text-muted); }
.avatar-menu-item.is-danger, .avatar-menu-item.is-danger .icon { color: var(--danger); }
.avatar-menu-sep { height: 1px; background-color: var(--border); margin: 0.25rem 0; }


/* ------------------------------------------------------------
   ATTENDANCE (attendance.js): the day, the filters, the counts.
   ------------------------------------------------------------ */
.att-bar { display: grid; gap: var(--space-3); margin-bottom: var(--space-4); }
.att-day { display: flex; align-items: center; gap: 0.5rem; }
.att-day .control { flex: 1; min-width: 0; max-width: 220px; }
.att-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.att-filters input[type="search"] { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .att-bar { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .att-filters { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); }
  .att-filters input[type="search"] { grid-column: auto; }
}
.att-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: var(--space-4);
}
@media (min-width: 900px) { .att-stats { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.att-stat {
  display: grid;
  gap: 0.125rem;
  padding: var(--space-3);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.att-stat-value { font-size: 1.375rem; font-weight: 600; line-height: 1.1; color: var(--text); }
.att-stat-label { font-size: var(--fs-xs); color: var(--text-muted); }
.att-stat.is-success .att-stat-value { color: var(--success); }
.att-stat.is-warning .att-stat-value { color: var(--warning); }
.att-how { display: inline-flex; align-items: center; gap: 0.3125rem; white-space: nowrap; }
.att-note {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0 0 var(--space-4);
  padding: 0.75rem 0.875rem;
  font-size: var(--fs-sm);
  background-color: var(--info-soft);
  border-radius: var(--r-md);
}
.att-step { border: 1px solid var(--border); background-color: var(--surface); }
.att-step:disabled { opacity: 0.4; cursor: default; }

/* ------------------------------------------------------------
   A record's checks and an incident's follow-up timeline
   (school portal: Pickup Activity, Incidents; gate app records)
   ------------------------------------------------------------ */
.record-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.record-checks li { display: flex; gap: 0.5rem; align-items: flex-start; }
.record-checks li.is-ok > .icon { color: var(--success); }
.record-checks li.is-bad > .icon { color: var(--danger); }
.incident-timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border); display: grid; gap: 0.75rem; }
.incident-timeline li p { margin: 0.25rem 0 0; }

/* ------------------------------------------------------------
   The school day (school-day.js, insights.js): medication, meals,
   daily care, learning and the parents' routine charts
   ------------------------------------------------------------ */
.day-tabs { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; margin-bottom: var(--space-4); }
.day-tabs .chip {
  flex: none;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background-color: var(--surface);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}
.day-tabs .chip:hover { border-color: var(--border-strong); color: var(--text); }
.day-tabs .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.day-tabs .chip.is-active { background-color: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.day-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--space-4); }
.day-range { font-size: var(--fs-sm); padding: 0 0.5rem; }
.day-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.day-row:last-child { border-bottom: 0; }
.day-row-body { flex: 1; min-width: 0; }
.day-slots { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.5rem; }
.day-slot { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.625rem; border-radius: var(--r-full);
  border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: var(--fs-xs); color: var(--text); cursor: pointer; }
.day-slot.is-due { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.day-slot.is-late { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.day-slot.is-done { cursor: default; background: var(--success-soft); border-color: transparent; color: var(--success); }
.day-card { margin-bottom: var(--space-3); }
.day-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.day-card-title { margin: 0; font-size: 1rem; font-weight: 600; }
.day-hint { display: flex; gap: 0.375rem; align-items: center; color: var(--warning); font-size: var(--fs-sm); }
.day-mini { list-style: none; margin: 0.5rem 0; padding: 0; display: grid; gap: 0.25rem; font-size: var(--fs-sm); }
.day-mini li { display: flex; gap: 0.375rem; align-items: baseline; flex-wrap: wrap; }
.day-photos { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.day-photo { position: relative; width: 96px; height: 96px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); background: var(--surface-sunk); }
.day-photo img { width: 100%; height: 100%; object-fit: cover; }
.day-photo .icon-btn { position: absolute; top: 2px; right: 2px; background: var(--surface); }
.day-photo-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

.meal-grid th[scope="row"] { white-space: nowrap; }
.meal-grid tr.is-today { background: var(--accent-soft); }
.meal-cell { display: block; width: 100%; min-height: 2.5rem; text-align: left; background: none; border: 1px dashed transparent;
  border-radius: var(--r-sm); padding: 0.25rem; font: inherit; color: inherit; cursor: pointer; }
.meal-cell:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.meal-bulk textarea { min-width: 9rem; }

.care-feed { list-style: none; margin: 0; padding: 0; }
.care-item { display: grid; grid-template-columns: 3.25rem 2rem minmax(0, 1fr) auto; gap: 0.5rem; align-items: start;
  padding: 0.625rem 0; border-bottom: 1px solid var(--border); }
.care-item:last-child { border-bottom: 0; }
.care-time { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: var(--fs-sm); }
.care-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent); }
.care-item.is-health .care-icon { background: var(--warning-soft); color: var(--warning); }
.care-gate-top { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.care-gate-top .control { flex: 1; min-width: 10rem; }
.care-kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; margin: 1rem 0; }
.care-kid { display: grid; justify-items: center; gap: 0.25rem; padding: 0.75rem 0.25rem; border: 2px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); font: inherit; color: inherit; cursor: pointer; }
.care-kid.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.care-kid-name { font-weight: 600; font-size: var(--fs-sm); }
.care-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; position: sticky; bottom: 0;
  padding: 0.75rem 0; background: var(--bg); }
.chip-radio { display: inline-flex; position: relative; }
.chip-radio input { position: absolute; opacity: 0; }
.chip-radio span { padding: 0.375rem 0.75rem; border: 1px solid var(--border-strong); border-radius: var(--r-full); cursor: pointer; text-transform: capitalize; }
.chip-radio input:checked + span { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.chip-radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-3); }
.room-card { display: flex; gap: 1rem; align-items: center; }
.room-card > div { flex: 1; min-width: 0; }
.report-facts { display: flex; flex-wrap: wrap; gap: 0.375rem 1.25rem; padding: 0.75rem 1rem; border-radius: var(--r-md); background: var(--accent-soft); font-size: var(--fs-sm); color: var(--text); }
/* The care log's filters: quick dates, then the range, kind, class
   and a search, wrapping on a phone. */
.log-filters { display: grid; gap: 0.625rem; margin-bottom: var(--space-3); }
.log-filters .day-tabs { margin: 0; }
.log-filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.log-filter-row select.control { flex: 0 1 11rem; width: auto; }
.log-filter-row .filter-search { flex: 1 1 14rem; }
.log-date { display: inline-flex; align-items: center; gap: 0.375rem; font-size: var(--fs-xs); color: var(--text-muted); }
.log-date .control { width: auto; }
.care-kind { display: inline-flex; align-items: center; gap: 0.375rem; white-space: nowrap; }
.care-kind .icon { color: var(--accent); }
.care-kind.is-health .icon { color: var(--warning); }
/* Lesson categories: a colour dot by the name, and the editor's rows. */
.area-tag { display: inline-flex; align-items: center; gap: 0.375rem; }
.area-dot { flex: none; width: 0.625rem; height: 0.625rem; border-radius: var(--r-full); }
.cat-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.cat-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cat-row input.control { flex: 1 1 12rem; width: auto; }
.cat-row select.control { width: auto; }
.cat-add { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.75rem; align-items: start; border-top: 1px solid var(--border); padding-top: 1rem; }
.cat-add > .btn { margin-top: 1.5rem; }
@media (max-width: 560px) { .cat-add { grid-template-columns: 1fr; } .cat-add > .btn { margin-top: 0; } }

/* Reporting terms: a row per term. */
.term-presets { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.term-presets select.control { width: auto; }
.term-rows { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
.term-row { display: grid; grid-template-columns: minmax(8rem, 1fr) auto auto auto auto; gap: 0.5rem; align-items: center; }
.term-row .control { width: auto; min-width: 0; }
.term-row input[data-tm="name"] { width: 100%; }
@media (max-width: 640px) {
  .term-row { grid-template-columns: 1fr 1fr auto; }
  .term-row input[data-tm="name"] { grid-column: 1 / -1; }
  .term-row > .cell-meta { display: none; }
}

/* A round of report cards: its deadline and how far along it is. */
.round-list { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); margin-bottom: var(--space-4); }
.round-card { padding: 1rem 1.125rem; display: grid; gap: 0.625rem; }
.round-card.is-done { opacity: 0.85; }
.round-head { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.round-head .badge { flex: none; }
.round-track { display: flex; height: 0.5rem; border-radius: var(--r-full); background: var(--surface-sunk); overflow: hidden; gap: 2px; }
.round-fill { display: block; height: 100%; }
.round-fill.is-published { background: var(--success); }
.round-fill.is-ready { background: var(--accent); }
.round-counts { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0; font-size: var(--fs-sm); }
.round-actions { margin: 0; gap: 0.375rem; }
.room-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--space-3); }
.room-filters select.control { flex: 0 1 14rem; width: auto; }
.room-qr-sm { display: block; width: 56px; height: 56px; image-rendering: pixelated; background: #FFFFFF; padding: 3px; border-radius: var(--r-sm); }
.room-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0.04em; color: var(--accent); }
.room-card .day-toolbar { gap: 0.25rem; margin: 0.625rem 0 0; }
.room-qr { width: 112px; height: 112px; image-rendering: pixelated; background: #FFFFFF; padding: 4px; border-radius: var(--r-sm); }

.area-bars { display: grid; gap: 0.5rem; }
.area-bar { display: grid; grid-template-columns: minmax(8rem, 14rem) minmax(0, 1fr) 3rem; gap: 0.75rem; align-items: center; font-size: var(--fs-sm); }
.area-track { position: relative; display: flex; height: 10px; border-radius: var(--r-full); background: var(--surface-sunk); overflow: hidden; }
.area-fill { height: 100%; }
.area-fill.is-dev { opacity: 0.35; }
.area-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.milestones { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.375rem; }
.milestone { display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; padding: 0.375rem 0.5rem; border-radius: var(--r-sm); }
.milestone.is-achieved { background: var(--success-soft); }
.milestone .control-sm { width: auto; min-width: 8rem; padding: 0.25rem 0.5rem; }
.obs-photo { max-width: 220px; border-radius: var(--r-md); margin-top: 0.5rem; }
@media (max-width: 600px) {
  .area-bar { grid-template-columns: minmax(0, 1fr) 3rem; }
  .area-track { grid-column: 1 / -1; grid-row: 2; }
}

/* Charts: recessive grid and axes, thin purple bars (series 1), orange series 2. */
.viz-root { --series-1: #7B3FD4; --series-2: #EB6834; }
:root[data-theme="dark"] .viz-root { --series-1: #9D74E8; --series-2: #D95926; }
.viz-grid-2 { display: grid; gap: var(--space-3); }
@media (min-width: 900px) { .viz-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.viz-card { min-width: 0; }
.viz-title { margin: 0; font-size: 0.9375rem; font-weight: 600; }
.viz { width: 100%; height: auto; display: block; margin-top: 0.5rem; }
.viz-grid { stroke: var(--border); stroke-width: 1; }
.viz-axis { stroke: var(--border-strong); stroke-width: 1; }
.viz-tick { fill: var(--text-muted); font-size: 11px; font-family: var(--font-sans); }
.viz-label { fill: var(--text-muted); font-size: 11px; font-weight: 600; font-family: var(--font-sans); }
.viz-bar { fill: var(--series-1); }
.viz-hit:hover .viz-bar, .viz-hit:focus .viz-bar { opacity: 0.8; }
.viz-hit:focus { outline: none; }
/* Tabbing through the chart: the bar or dot in focus gets a ring. */
.viz-hit:focus-visible .viz-bar, .viz-hit:focus-visible .viz-dot { stroke: var(--text); stroke-width: 2; }
.viz-dot { stroke: var(--surface); stroke-width: 2; }
.viz-dot.is-1 { fill: var(--series-1); }
.viz-dot.is-2 { fill: var(--series-2); }
.viz-legend { display: flex; gap: 1rem; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 0.5rem; }
.viz-legend span { display: inline-flex; align-items: center; gap: 0.375rem; }
.viz-key { display: inline-block; width: 10px; height: 10px; border-radius: var(--r-full); }
.viz-key.is-1 { background: var(--series-1); }
.viz-key.is-2 { background: var(--series-2); }
.viz-tip { position: absolute; transform: translate(-50%, -100%); z-index: 5; pointer-events: none; padding: 0.25rem 0.5rem;
  border-radius: var(--r-sm); background: var(--navy-900); color: #FFFFFF; font-size: var(--fs-xs); white-space: nowrap; box-shadow: var(--shadow-md); }
.viz-table { margin-top: var(--space-3); }
.viz-table summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.day-timeline { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; border-left: 2px solid var(--accent-border); }
.day-timeline li { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0.75rem; padding: 0.5rem 0 0.5rem 1rem; position: relative; }
.day-timeline li::before { content: ""; position: absolute; left: -6px; top: 0.8rem; width: 10px; height: 10px; border-radius: var(--r-full); background: var(--accent); }
.day-timeline-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.tips { display: grid; gap: 0.5rem; }

/* The staff app's room picker (school-day.js gateCare): rooms to tap, a search. */
.care-search { flex: 1; min-width: 12rem; }
.care-head { margin: 1.25rem 0 0.5rem; }
.room-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.5rem; }
.room-pick-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.875rem 1rem; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: 60px; }
.room-pick-card:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.room-pick-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.room-pick-icon { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); flex: none; }
.room-pick-body { flex: 1; display: grid; }
.room-pick-name { font-weight: 600; }
.care-all { margin-top: 0.75rem; }
.care-back { margin-bottom: 0.25rem; }


/* ------------------------------------------------------------
   SWITCH -- an on/off control. A real checkbox (keyboard, screen
   readers: role="switch"), drawn as a sliding pill.
     <label class="switch"><input type="checkbox" role="switch">
       <span class="switch-track" aria-hidden="true"></span>
       <span class="switch-label">On</span></label>
   ------------------------------------------------------------ */
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--fs-sm); color: var(--text); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch-track { position: relative; flex: none; width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong); transition: background-color .15s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s ease; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch:has(input:disabled) { cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }
