/* Proof of concept styling.
   Aims: WCAG 2.2 AA — contrast 4.5:1 for text and 3:1 for interface parts,
   visible focus, targets of at least 24px, nothing conveyed by colour alone,
   and a layout that reflows to one column on a phone. */

/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --sunken: #eef1ef;
  --ink: #15201d;          /* 15.6:1 on surface */
  --muted: #55615c;        /* 5.6:1 on surface */
  --line: #c3ccc7;          /* decorative separators */
  --control: #78837e;       /* 3.9:1 on surface — borders of real controls */
  --accent: #10595e;       /* 6.5:1 on surface */
  --accent-ink: #ffffff;
  --ok: #1d6b40;           /* 5.3:1 */
  --warn: #8a4a0c;         /* 5.6:1 */
  --bad: #9a2f23;          /* 6.4:1 */
  --focus: #0b5bd3;
  --radius: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101614;
    --surface: #19211f;
    --sunken: #141b19;
    --ink: #e8eeeb;        /* 13.9:1 on surface */
    --muted: #a3afaa;      /* 7.3:1 */
    --line: #39453f;
    --control: #7d8a85;    /* 4.6:1 on surface */
    --accent: #6ec5c9;     /* 8.4:1 */
    --accent-ink: #0c1413;
    --ok: #74c491;
    --warn: #e0a763;
    --bad: #ef9385;
    --focus: #8ab4ff;
  }
}

:root[data-theme="dark"] {
  --bg: #101614;
  --surface: #19211f;
  --sunken: #141b19;
  --ink: #e8eeeb;
  --muted: #a3afaa;
  --line: #39453f;
  --control: #7d8a85;
  --accent: #6ec5c9;
  --accent-ink: #0c1413;
  --ok: #74c491;
  --warn: #e0a763;
  --bad: #ef9385;
  --focus: #8ab4ff;
}

* { box-sizing: border-box; }

html, body { background: var(--bg); color: var(--ink); }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; }

/* ------------------------------------------------------------- basics */
a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

h1 { font-size: 1.65rem; margin: 0 0 .2rem; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 .6rem; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .85em;
  background: var(--sunken); padding: 1px 5px; border-radius: 4px; }

main { max-width: 1100px; margin: 0 auto; padding: 22px 16px 60px; }
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--surface); color: var(--ink); padding: 10px 16px;
  border: 2px solid var(--focus); border-radius: 0 0 8px 8px;
}
.skip:focus { top: 0; }

/* ------------------------------------------------------------- top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; }
.topbar-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  max-width: 1100px; margin: 0 auto; padding: 8px 16px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; min-height: 28px; padding: 2px 4px; }
.search { flex: 1 1 260px; }
.search input { width: 100%; min-height: 40px; padding: 8px 14px; font: inherit;
  border: 1px solid var(--control); border-radius: 999px; background: var(--bg); color: var(--ink); }

.menu-button, .tool {
  font: inherit; font-size: 14px; min-height: 36px; padding: 6px 12px; cursor: pointer;
  background: var(--sunken); color: var(--ink);
  border: 1px solid var(--control); border-radius: 999px;
}
.menu-button[aria-expanded="true"], .tool[aria-pressed="true"] {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.topbar-tools { display: flex; gap: 8px; }

/* ----------------------------------------------------------------- menu */
.mainnav { border-top: 1px solid var(--line); background: var(--sunken); }
.nav-sections { list-style: none; margin: 0 auto; padding: 16px;
  max-width: 1100px; display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.nav-title { font-size: .95rem; margin: 0 0 2px; }
.nav-blurb { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.nav-items { list-style: none; margin: 0; padding: 0; }
.nav-items li { padding: 3px 0; }
.nav-items a, .nav-title a { display: inline-block; min-height: 24px; }
[aria-current="page"] { font-weight: 700; }

/* ---------------------------------------------------------------- pages */
.page-head { display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.daynav { display: flex; gap: 14px; font-size: 14px; }
.daynav a { min-height: 24px; display: inline-flex; align-items: center; }
.lede { color: var(--muted); max-width: 70ch; }
.section-head { margin: 18px 0 8px; }

.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a { display: inline-flex; align-items: center; min-height: 24px; padding: 0 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }
.count { color: var(--muted); font-weight: 400; font-size: .85em; }
.note { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 12px; }
.note-built { border-left: 4px solid var(--ok); }
.note-sketch { border-left: 4px solid var(--line); }

/* summary numbers on Today */
.summary { list-style: none; display: flex; flex-wrap: wrap; gap: 10px;
  margin: 0 0 18px; padding: 0; }
.summary li { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; font-size: 13px; color: var(--muted); }
.summary .big { display: block; font-size: 1.5rem; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums; }

.programme-block .programme-head { display: flex; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; align-items: baseline; }
.people { list-style: none; margin: 10px 0 0; padding: 0;
  display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.people li { padding: 4px 6px; border-radius: 5px; background: var(--sunken);
  display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }

/* status words — never colour alone */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: .3rem 0; }
.chip { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface); white-space: nowrap; }
.chip.ok, .chip.settled, .chip.status-confirmed, .chip.sent { color: var(--ok); border-color: var(--ok); }
.chip.warn, .chip.owes, .chip.status-pending, .chip.issued { color: var(--warn); border-color: var(--warn); }
.chip.credit { color: var(--accent); border-color: var(--accent); }
.chip.status-cancelled, .chip.cancelled { color: var(--bad); border-color: var(--bad); }
.chip.status-arrived { color: var(--accent); border-color: var(--accent); }
.chip.diet { border-style: dashed; color: var(--ink); }
.chip.quiet { color: var(--muted); }

ul.plain, ul.results { list-style: none; margin: 0; padding: 0; }
ul.plain li, ul.results li { padding: 6px 0; border-bottom: 1px solid var(--line);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
ul.plain li:last-child, ul.results li:last-child { border-bottom: 0; }
ul.plain li > a, ul.results li > a, .people li > a {
  display: inline-flex; align-items: center; min-height: 24px; }
ul.reqs { margin: 0; padding-left: 18px; }

/* --------------------------------------------------- editing in place */
dl.fields { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 14px; margin: 0; }
dl.fields dt { color: var(--muted); font-size: 13px; }
dl.fields dd { margin: 0; }

.field.live input[type="text"], .field.live input[type="email"],
.field.live input[type="date"], .field.live select, .field.live textarea {
  font: inherit; color: inherit; width: 100%; max-width: 32ch;
  min-height: 32px; padding: 4px 7px;
  background: transparent; color: var(--ink);
  border: 1px solid transparent; border-bottom-color: var(--line);
  border-radius: 4px;
}
.field.live textarea { max-width: 100%; }
.field.live :is(input, select, textarea):hover { background: var(--sunken); border-color: var(--control); }
.field.live :is(input, select, textarea):focus { background: var(--surface); border-color: var(--accent);
  outline: 3px solid var(--focus); outline-offset: 1px; }
.field.live ::placeholder { color: var(--muted); font-style: italic; }
.field-status { font-size: 12px; color: var(--ok); margin-left: 6px; }

.field .value {
  font: inherit; color: inherit; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 5px;
  padding: 2px 6px; min-height: 24px; cursor: pointer;
}
.field .value:hover { background: var(--sunken); border-color: var(--control); }
.field .empty { color: var(--muted); font-style: italic; }
.field.editing form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.field input, .field select, .field textarea {
  font: inherit; min-height: 36px; padding: 5px 8px; border: 1px solid var(--accent);
  border-radius: 5px; background: var(--surface); color: var(--ink);
}
.field textarea { width: 100%; min-width: 260px; }
.hint { font-size: 11px; color: var(--muted); }

button.small { font: inherit; font-size: 13px; min-height: 36px; padding: 5px 12px;
  border-radius: 5px; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-ink); cursor: pointer; }
button.small.ghost { background: var(--surface); color: var(--ink); border-color: var(--control); }

.flash { font-size: 12px; color: var(--ok); margin-left: 6px; }
.legacy { font-size: 11px; font-family: ui-monospace, Menlo, monospace; color: var(--muted);
  background: var(--sunken); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; margin-left: 6px; }

.switches { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 8px; }
.switch { display: inline-flex; gap: 8px; align-items: center; font-size: 14px;
  cursor: pointer; min-height: 32px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

/* --------------------------------------------------------------- tables */
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid caption { text-align: left; color: var(--muted); font-size: 13px; padding-bottom: 6px; }
/* column headings shout quietly; row headings are people's names, so they do not */
table.grid th { text-align: left; border-bottom: 1px solid var(--line); padding: 7px 8px; }
table.grid thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; }
table.grid th[scope="row"] { font-size: 14px; color: var(--ink); font-weight: 400; }
table.grid td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
table.grid tr.payment td { color: var(--muted); }
table.grid tr.is-cancelled td { opacity: .75; }
table.grid tr.is-cancelled td:first-child::before { content: "Cancelled — "; font-weight: 700; color: var(--bad); }

blockquote { margin: 6px 0; padding: 8px 12px; border-left: 3px solid var(--line);
  color: var(--ink); background: var(--sunken); border-radius: 0 5px 5px 0; }
.results-panel:not(:empty) { max-width: 1100px; margin: 12px auto 0; padding: 0 16px; }
.results-panel .card { margin-bottom: 10px; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .topbar, .foot, .note, .skip, .daynav { display: none; }
  .card { border: 0; padding: 0; margin-bottom: 10px; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { text-decoration: none; color: #000; }
  .chip { border: 1px solid #666; }
}


/* ------------------------------------------------- signing in, forms */
/* the signed-out pages: sign in, reset, invitation — centred, not adrift */
.narrow { max-width: 46ch; margin: 6vh auto 0; }
.narrow .stack input[type=text],
.narrow .stack input[type=email],
.narrow .stack input[type=password] { width: 100%; }
.narrow .demo-note { margin-top: 24px; }
.stack p { margin: 0 0 14px; }
.stack label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.stack input { width: 100%; font: inherit; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--control); border-radius: 6px;
  background: var(--surface); color: var(--ink); }
.button { display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 8px 18px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: 6px; text-decoration: none; }
.alert { border: 1px solid var(--bad); border-left-width: 4px; border-radius: 6px;
  background: var(--surface); color: var(--ink); padding: 10px 14px; margin-bottom: 14px; }
.alert ul { margin: 4px 0 0 18px; padding: 0; }
.demo-note { margin-top: 26px; }
.signout { display: flex; align-items: center; gap: 8px; margin: 0; }
.who { font-size: 13px; color: var(--ink); }
.public-number .big { font-size: 2.4rem; font-weight: 700; display: block;
  font-variant-numeric: tabular-nums; }
a.tool { display: inline-flex; align-items: center; text-decoration: none; }

.field.readonly .readonly-value, .field.readonly .readonly-bool {
  display: inline-block; padding: 4px 0; min-height: 24px;
}

/* ------------------------------------------------------- count tables */
table.counts th.day { font-weight: 400; white-space: nowrap; }
table.counts tbody tr:nth-child(odd) { background: var(--sunken); }
table.counts tr.is-today th, table.counts tr.is-today td { font-weight: 700; }
table.counts tr.is-today th.day::after { content: " · today"; color: var(--accent); font-weight: 400; }
table.counts.compact td, table.counts.compact th { padding: 5px 8px; font-size: 13px; }
table.counts tfoot td, table.counts tfoot th { border-top: 2px solid var(--line); font-weight: 700; }

.filters { margin-bottom: 14px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 0; }
.filter { display: inline-flex; flex-direction: column; gap: 2px; }
.filter label { font-size: 13px; color: var(--muted); }
.filter input { font: inherit; min-height: 40px; padding: 6px 10px;
  border: 1px solid var(--control); border-radius: 6px;
  background: var(--surface); color: var(--ink); }

/* ----------------------------------------------------- programme timeline */
.timeline-figure { margin: 0 0 16px; }
.timeline-figure figcaption { color: var(--muted); font-size: 13px; margin-bottom: 10px; max-width: 80ch; }
.timeline-scroll { overflow-x: auto; }
.timeline { position: relative; min-width: 640px; padding-bottom: 16px; }
.timeline-months, .timeline-row {
  display: grid; grid-template-columns: repeat(var(--days), 1fr);
}
.timeline-months { border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.month { grid-column: var(--start) / span var(--span);
  font-size: 12px; color: var(--muted); padding: 2px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: clip;
  border-left: 1px solid var(--line); min-width: 0; }

.month-short { display: none; }
.timeline-rows { display: grid; gap: 3px; }
.timeline-row { min-height: 22px; }
.bar { grid-column: var(--start) / span var(--span);
  display: block; min-height: 20px; border-radius: 4px; padding: 1px 6px;
  font-size: 12px; line-height: 18px; color: var(--ink); text-decoration: none;
  background: var(--sunken); border: 1px solid var(--control); overflow: hidden; white-space: nowrap; }
.bar-label { text-overflow: ellipsis; overflow: hidden; display: block; }
.bar.kind-course { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-color: var(--accent); }
.bar.kind-staff  { background: color-mix(in srgb, var(--ok) 20%, var(--surface)); border-color: var(--ok); }
.bar.kind-visit  { background: color-mix(in srgb, var(--warn) 20%, var(--surface)); border-color: var(--warn); }
.bar.running { outline: 2px solid var(--accent); outline-offset: 1px; }
.bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-style: dashed; }
.bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dashed; }
.timeline-today { position: absolute; top: 0; bottom: 0; width: 0;
  grid-column: var(--start); border-left: 2px dotted var(--accent);
  left: calc((var(--start) - 0.5) / var(--days) * 100%); }
.timeline-today span { position: absolute; bottom: 0; left: -15px; font-size: 11px;
  color: var(--accent); background: var(--surface); padding: 0 4px; border-radius: 3px;
  border: 1px solid var(--accent); }
.legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.legend .swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block;
  border: 1px solid var(--control); margin-left: 10px; }
.legend .swatch.kind-course { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.legend .swatch.kind-staff { background: color-mix(in srgb, var(--ok) 45%, var(--surface)); }
.legend .swatch.kind-visit { background: color-mix(in srgb, var(--warn) 45%, var(--surface)); }
.legend .swatch.kind-other { background: var(--sunken); }
table.programmes th[scope="row"] { font-weight: 400; }
table.programmes thead a { color: var(--ink); text-decoration: none; display: inline-flex;
  min-height: 24px; align-items: center; }
table.programmes thead a:hover { text-decoration: underline; }



/* wide tables scroll on their own, so the page never does */
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.timeline-scroll { max-width: 100%; }
@media (max-width: 700px) {
  table.grid { font-size: 13px; }
  table.grid th, table.grid td { padding: 6px 6px; }
}

/* ------------------------------------------------------ roles screens */
.switch.centred { justify-content: center; }
table.permissions th[scope="row"] { font-weight: 600; max-width: 22ch; }
table.permissions td { text-align: center; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form input { font: inherit; min-height: 36px; padding: 4px 8px;
  border: 1px solid var(--control); border-radius: 6px;
  background: var(--surface); color: var(--ink); }
.danger-zone { margin-top: 12px; display: flex; gap: 10px; align-items: center; }
.tool.danger { color: var(--bad); border-color: var(--bad); background: var(--surface); }
.filters select { font: inherit; min-height: 40px; padding: 6px 10px;
  border: 1px solid var(--control); border-radius: 6px;
  background: var(--surface); color: var(--ink); }

/* ------------------------------------------------ arrivals and departures */
.day-block .day-head { display: flex; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; align-items: baseline; border-bottom: 1px solid var(--line);
  padding-bottom: 6px; margin-bottom: 10px; }
.day-block h2 { font-size: 1.05rem; }
.day-block h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin-bottom: 6px; }
/* marks today without taking a pixel off the content, so columns stay aligned */
.is-today-card { border-color: var(--accent); box-shadow: inset 4px 0 0 0 var(--accent); }

/* --------------------------------- arrivals: one list per width, no sideways scroll */
.list-head { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 14px 0 4px; }
/* one set of widths for every day, so the columns line up down the page */
table.stacking { table-layout: fixed; width: 100%; }
table.stacking .col-time { width: 5.5em; white-space: nowrap; }
table.stacking .col-how { width: 26%; }
table.stacking .col-room { width: 9em; }
table.stacking .col-needs { width: 22%; }
table.stacking .col-who { width: auto; }
table.stacking td, table.stacking th { overflow-wrap: anywhere; }
table.stacking th[scope="row"] { font-weight: 400; }
table.stacking .sub { display: block; font-size: 12px; }
/* how someone travels: the ones needing a driver stand out, the rest stay quiet */
table.stacking .way { color: var(--muted); }
table.stacking .way-unknown .way { color: var(--warn); }
.print-only { display: none; }

/* narrow screens: each row becomes a small block, so nothing scrolls sideways */
@media (max-width: 640px) {
  table.stacking, table.stacking tbody, table.stacking tr,
  table.stacking td, table.stacking th[scope="row"] { display: block; width: auto; }
  table.stacking thead { position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip-path: inset(50%); }
  table.stacking tr { border: 1px solid var(--line); border-radius: 8px;
    padding: 8px 10px; margin-bottom: 8px; }
  table.stacking td, table.stacking th[scope="row"] { border: 0; padding: 2px 0; }
  table.stacking td[data-label]::before {
    content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
  table.stacking .col-time { width: auto; font-weight: 700; }
  table.stacking .col-how { width: auto; }
}

/* ------------------------------------------------------------- printing */
@media print {
  .no-print, .summary, .filters, .day-head .chips .chip.quiet { display: none !important; }
  .print-only { display: block; }
  .period { font-size: 11pt; margin-bottom: 8pt; }
  .day-block { break-inside: avoid; page-break-inside: avoid;
    border: 0; border-top: 1pt solid #000; border-radius: 0;
    padding: 0; margin: 0 0 10pt; }
  .day-head { border-bottom: 0; margin-bottom: 2pt; padding-bottom: 0; }
  .day-block h2 { font-size: 12pt; margin-top: 6pt; }
  .list-head { font-size: 9pt; margin: 6pt 0 2pt; }
  table.grid { page-break-inside: auto; }
  table.grid thead { display: table-header-group; }   /* repeat on each page */
  table.grid tr { page-break-inside: avoid; }
  table.grid th, table.grid td { padding: 2pt 4pt; }
  .table-scroll { overflow: visible !important; }
  .chip { border: 1pt solid #666; padding: 0 3pt; }
  .is-today-card { box-shadow: none; }      /* the bar would sit over the text */
  .day-block h2 .chip.ok { border-color: #000; }
  a { color: #000; text-decoration: none; }
}
@page { size: A4; margin: 14mm; }

/* ------------------------------------------------------- website intake */
.sync-bar { display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; }
.sync-bar h2 { margin-bottom: 2px; }
.intake.state-ready { box-shadow: inset 4px 0 0 0 var(--ok); }
.intake.state-no_member, .intake.state-awaiting_sync { box-shadow: inset 4px 0 0 0 var(--warn); }
.intake.state-linked { opacity: .75; }
.alert.success { border-color: var(--ok); }
.alert.error { border-color: var(--bad); }
.alert.warn-note { border-color: var(--warn); }
.filter-row.chips a.chip { text-decoration: none; }
.filter-row.chips a.chip.ok { font-weight: 700; }

/* the person picker on the intake screen */
.picker { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.picker > summary { cursor: pointer; min-height: 24px; padding: 2px 0; font-weight: 600; }
.picker > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.picker-results { margin: 8px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.picker-results form { margin: 0; }
button.pick { display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font: inherit; min-height: 44px; }
button.pick:hover { border-color: var(--accent); }
button.pick:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pick-name { display: block; font-weight: 600; }
.pick-about { display: block; font-size: 12px; color: var(--muted); }

/* households on the person page */
.household-name { font-weight: 600; margin-bottom: 4px; }
.household-members li { display: flex; align-items: center; gap: 10px;
  padding: 3px 0; flex-wrap: wrap; }
form.inline { display: inline; margin: 0; }
.tool.compact { font-size: 12px; padding: 3px 9px; min-height: 26px; }

/* what SDB says about the family */
.sdb-says { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.sdb-says .says { font-weight: 600; margin: 2px 0 6px; }
.sdb-says li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 3px 0; }

/* ------------------------------------------- "saved", with an undo */
.saved-note { display: inline-flex; align-items: center; gap: 6px;
  margin-left: 6px; vertical-align: middle; }
.saved-note .flash { margin-left: 0; }
.saved-note.going { opacity: 0; transition: opacity .4s ease; }
button.undo { font: inherit; font-size: 12px; line-height: 1; cursor: pointer;
  min-height: 24px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
button.undo:hover { border-color: var(--accent); }
button.undo:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.note-slot { display: inline-block; }
table.grid .saved-note { margin-left: 0; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) {
  .saved-note.going { transition: none; }
}
@media print { .saved-note { display: none; } }
.saved-note.refused .flash { color: var(--bad); }
.saved-note .why { font-size: 12px; color: var(--bad); }

/* ------------------------------------------------ accounts and history */
.account-form .form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.account-form .filter.grow, .filter.grow { flex: 1 1 260px; }
.roles-pick { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  margin: 6px 0 12px; display: flex; flex-wrap: wrap; gap: 10px 18px; }
.roles-pick legend { font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; padding: 0 4px; }
.role-list { display: flex; flex-direction: column; gap: 6px; }
.role-line { margin: 0; display: block; width: 100%; }
button.pick.held { border-color: var(--ok); }
.trail { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 6px; }
.trail li { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline;
  border-bottom: 1px solid var(--line); padding-bottom: 5px; font-size: 14px; }
.trail .when { color: var(--muted); font-size: 12px; min-width: 9.5em;
  font-variant-numeric: tabular-nums; }
.trail .who { font-weight: 600; }
.trail .what { flex: 1 1 14em; }
.danger-zone { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

/* the demo outbox */
pre.mail-body { white-space: pre-wrap; word-wrap: break-word; font: inherit;
  font-size: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; margin: 4px 0 0; }

/* The acceptance environment says so on every page. One fixed pair of
   colours, so it reads the same in light and dark (white on this purple
   is 10:1), and it is unlike the real-data band on purpose. It prints
   too: a sheet from acceptance should not pass for a real one. */
.environment-band {
  margin: 0; padding: 8px 16px; display: flex; gap: 10px; flex-wrap: wrap;
  align-items: baseline; background: #4a2a82; color: #fff;
  border-bottom: 2px solid #c9b3ff; font-size: .95rem;
}
.environment-band strong { font-weight: 700; }
@media print {
  .environment-band { background: none; color: #000; border: 1px solid #000; }
}

/* Reading the centre's own data. Loud on purpose: the one state nobody
   should be in without knowing (core/source.py). */
.real-data-banner {
  margin: 0; padding: 10px 16px; display: flex; gap: 10px; flex-wrap: wrap;
  align-items: baseline; background: #7a2e00; color: #fff;
  border-bottom: 2px solid #ffb86b; font-size: .95rem;
}
.real-data-banner strong { font-weight: 700; }
.real-data-banner span { opacity: .92; }
.tool.is-real {
  background: #7a2e00; color: #fff; border-color: #ffb86b;
}

/* The kitchen's diet sheet. The guest's own words are set apart on
   purpose: they are quoted, not translated (requirement N-22). */
table.diets td q.verbatim { font-style: italic; quotes: "“" "”"; }
table.diets th[scope="row"] { font-weight: 600; }

/* The occupancy chart: rooms down, nights across. Fullness is shown by
   a number and by shading, never by shading alone. */
table.occupancy th.night { font-size: .72rem; text-align: center; line-height: 1.15;
  font-weight: 600; padding: 4px 3px; }
table.occupancy td.cell { text-align: center; font-size: .72rem; letter-spacing: .02em;
  padding: 4px 3px; white-space: nowrap; }
table.occupancy td.is-part { background: color-mix(in srgb, var(--accent, #3b6ea5) 14%, transparent); }
table.occupancy td.is-full { background: color-mix(in srgb, var(--accent, #3b6ea5) 30%, transparent);
  font-weight: 700; }
table.occupancy td.is-over { background: #7a2e00; color: #fff; font-weight: 700; }
table.occupancy tr.group th { background: var(--sunken); font-size: .85rem;
  text-align: left; letter-spacing: .04em; text-transform: none; }
table.occupancy tr.is-empty-room th[scope="row"] { opacity: .55; }
@media print {
  table.occupancy td.is-part, table.occupancy td.is-full { background: #e8e8e8; }
  table.occupancy td.is-over { background: #000; color: #fff; }
}

/* A page that has left something out says so here, in words. */
p.notice { margin: 0 0 14px; padding: 9px 12px; border-left: 4px solid var(--accent, #3b6ea5);
  background: var(--sunken); font-size: .95rem; }
p.notice a { margin-left: .4em; }

/* A list of things to tick, in a form. */
fieldset.switches { border: 0; padding: 0; margin: 0 0 12px; }
fieldset.switches legend { font-weight: 600; padding: 0 0 6px; }
fieldset.switches .switch { display: flex; gap: 8px; align-items: baseline;
  padding: 3px 0; }
