/* Bamfem Portal
   Colours come from the house arms (Blue, Green, White) and the crest's ink.
   Red appears in two places only: the exercise-book margin, and anything that rejects or voids. */
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/atkinson-hyperlegible-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/atkinson-hyperlegible-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: italic; font-weight: 400; font-display: swap; src: url(../fonts/atkinson-hyperlegible-latin-400-italic.woff2) format('woff2'); }

:root {
  --ink: #1B2430;
  --ink-soft: #4A5566;
  --ink-faint: #7B8596;
  --page: #F4F6F9;
  --paper: #FFFFFF;
  --rule: #DCE4EF;
  --rule-strong: #C3CFDF;
  --blue: #1E4FA3;
  --blue-deep: #163C7E;
  --blue-wash: #E8EEF8;
  --green: #1F7A4D;
  --green-wash: #E5F2EA;
  --amber: #9A5F08;
  --amber-wash: #FBF0DC;
  --red: #C8372D;
  --red-wash: #FBE9E7;
  --margin-x: 44px;
  --font: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 6px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 var(--font);
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- buttons & fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0 1.1rem;
  border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
  font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-faint); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn-approve { background: var(--green); border-color: var(--green); color: #fff; }
.btn-approve:hover { background: #17603C; border-color: #17603C; }
.btn-reject { color: var(--red); border-color: #E7B4AF; }
.btn-reject:hover { border-color: var(--red); background: var(--red-wash); }
.btn-link { border: 0; background: none; color: var(--blue); padding: 0; min-height: 0; font-weight: 700; cursor: pointer; }
.btn-sm { min-height: 36px; padding: 0 0.8rem; font-size: 0.9375rem; }

.field { display: grid; gap: 0.3rem; }
.field > span { font-weight: 700; font-size: 0.9375rem; }
.field small { color: var(--ink-faint); }
.input {
  width: 100%; min-height: 44px; padding: 0.55rem 0.75rem;
  background: var(--paper); border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
}
.input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-wash); }
textarea.input { min-height: 88px; resize: vertical; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.form-grid .span-all { grid-column: 1 / -1; }
.req::after { content: ' *'; color: var(--ink-faint); }

.alert { padding: 0.75rem 1rem; border-radius: var(--radius); border-left: 4px solid; }
.alert-error { background: var(--red-wash); border-color: var(--red); }
.alert-pending { background: var(--amber-wash); border-color: var(--amber); }
.alert-info { background: var(--blue-wash); border-color: var(--blue); }
.alert-ok { background: var(--green-wash); border-color: var(--green); }

.chip {
  display: inline-block; padding: 0.05rem 0.55rem; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap;
}
.chip-pending { background: var(--amber-wash); color: var(--amber); }
.chip-ok { background: var(--green-wash); color: var(--green); }
.chip-no { background: var(--red-wash); color: var(--red); }
.chip-plain { background: var(--blue-wash); color: var(--blue-deep); }
.chip-grey { background: #ECEFF3; color: var(--ink-soft); }

/* ---------- sign-in: a page from an exercise book */
.signin {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem;
  background:
    linear-gradient(90deg, transparent calc(var(--margin-x) - 1px), var(--red) calc(var(--margin-x) - 1px), var(--red) calc(var(--margin-x) + 1px), transparent calc(var(--margin-x) + 1px)),
    repeating-linear-gradient(180deg, transparent 0 31px, var(--rule) 31px 32px),
    var(--paper);
}
.signin-card { width: 100%; max-width: 400px; display: grid; gap: 1.5rem; }
.crests { display: flex; gap: 1.25rem; justify-content: center; align-items: center; }
.crests img { height: 92px; width: auto; }
.signin h1 { text-align: center; font-size: 1.5rem; }
.signin .lede { text-align: center; color: var(--ink-soft); margin-top: 0.35rem; }
.signin form { display: grid; gap: 1rem; background: var(--paper); padding: 1.25rem; border: 1.5px solid var(--rule-strong); border-radius: 10px; }

/* ---------- app shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--ink); color: #E9EDF3; padding: 1.25rem 0.9rem;
  display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh; align-self: start;
}
.side .brand { display: grid; gap: 0.65rem; padding: 0 0.35rem; }
.side .brand .crest-pair { display: flex; gap: 0.5rem; }
.side .brand .crest-pair span { background: #fff; border-radius: 8px; padding: 4px; display: block; }
.side .brand .crest-pair img { height: 44px; width: auto; }
.side .brand strong { font-size: 1rem; line-height: 1.25; }
.nav { display: grid; gap: 0.2rem; }
.nav a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0.75rem; border-radius: var(--radius);
  color: #C9D2DE; text-decoration: none; font-weight: 700;
}
.nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); }
.nav .count { background: var(--amber-wash); color: var(--amber); border-radius: 999px; padding: 0 0.5rem; font-size: 0.8125rem; }
.side .who { margin-top: auto; padding: 0.75rem 0.35rem 0; border-top: 1px solid rgba(255,255,255,0.12); font-size: 0.875rem; color: #AEB8C6; }
.side .who strong { display: block; color: #fff; font-size: 0.9375rem; }

/* the main column is the page; the red rule is its margin */
.main { position: relative; padding: 1.75rem 2rem 4rem calc(var(--margin-x) + 1.5rem); }
.main::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: var(--margin-x); width: 2px; background: var(--red); opacity: 0.85;
}
.page { max-width: 920px; display: grid; gap: 1.5rem; }
.page > div:empty { display: none; }
.page > * { min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; }
.page-head p { margin-top: 0.3rem; }

.panel { background: var(--paper); border: 1.5px solid var(--rule); border-radius: 10px; }
.panel-pad { padding: 1.25rem; }
.panel-head { padding: 1rem 1.25rem; border-bottom: 1.5px solid var(--rule); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

/* ---------- approvals */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tabs { display: inline-flex; border: 1.5px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.tabs button { border: 0; background: none; padding: 0.5rem 0.9rem; font-weight: 700; cursor: pointer; color: var(--ink-soft); }
.tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.bulkbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; background: var(--ink); color: #fff; border-radius: 10px;
}
.bulkbar .actions { display: flex; gap: 0.5rem; }
.bulkbar .btn-reject { background: transparent; color: #FFB4AC; border-color: #FFB4AC; }

.req-list { display: grid; }
.req-item { display: grid; grid-template-columns: auto 1fr auto; gap: 0.25rem 1rem; padding: 1rem 1.25rem; border-top: 1.5px solid var(--rule); align-items: start; }
.req-item:first-child { border-top: 0; }
.req-item input[type="checkbox"] { width: 22px; height: 22px; margin-top: 0.15rem; accent-color: var(--blue); }
.req-item .what { display: grid; gap: 0.25rem; min-width: 0; }
.req-item .what strong { font-size: 1.0625rem; }
.req-item .meta { color: var(--ink-faint); font-size: 0.875rem; }
.req-item .item-actions { display: flex; gap: 0.5rem; }
.req-item details { grid-column: 2 / -1; margin-top: 0.35rem; }
.req-item summary { cursor: pointer; color: var(--blue); font-weight: 700; font-size: 0.9375rem; width: fit-content; }
.req-item .note { grid-column: 2 / -1; font-size: 0.9375rem; color: var(--ink-soft); }
.result-ok { grid-column: 2 / -1; color: var(--green); font-weight: 700; }
.result-err { grid-column: 2 / -1; color: var(--red); font-weight: 700; }

.diff { width: 100%; border-collapse: collapse; margin-top: 0.6rem; font-size: 0.9375rem; }
.diff th, .diff td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.diff th { color: var(--ink-faint); font-weight: 400; width: 34%; }
.diff .was { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--red); }
.diff .now { font-weight: 700; }

/* ---------- students */
.search-row { display: grid; grid-template-columns: 1fr 180px 150px; gap: 0.6rem; }
.student-list { list-style: none; margin: 0; padding: 0; }
.student-list li + li { border-top: 1.5px solid var(--rule); }
.student-list a {
  display: grid; grid-template-columns: 1fr auto; gap: 0 1rem; padding: 0.8rem 1.25rem;
  text-decoration: none; color: inherit;
}
.student-list a:hover { background: #FAFBFD; }
.student-list .name { font-weight: 700; }
.student-list .sub { color: var(--ink-faint); font-size: 0.875rem; }
.student-list .cls { align-self: center; text-align: right; font-weight: 700; color: var(--ink-soft); }

.profile-head { display: grid; grid-template-columns: auto 1fr auto; gap: 1.25rem; align-items: center; }
.profile-head .crest { width: 64px; height: auto; }
.profile-head .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.facts div { min-width: 0; }
.facts dt { color: var(--ink-faint); font-size: 0.875rem; }
.facts dd { margin: 0.1rem 0 0; font-weight: 700; overflow-wrap: anywhere; }
.facts dd.empty { font-weight: 400; color: var(--ink-faint); }
.health dd:not(.empty) { color: var(--ink); }
.money-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.money-row div { display: grid; gap: 0.15rem; }
.money-row strong { font-size: 1.375rem; }
.money-row .owing { color: var(--red); }

.family-pick { display: grid; gap: 0.6rem; }
.family-option { display: flex; gap: 0.75rem; align-items: start; padding: 0.75rem; border: 1.5px solid var(--rule); border-radius: var(--radius); cursor: pointer; }
.family-option:has(input:checked) { border-color: var(--blue); background: var(--blue-wash); }
.family-option input { margin-top: 0.3rem; accent-color: var(--blue); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; font-size: 1.125rem; margin-bottom: 0.75rem; padding: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* ---------- classes */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 0.6rem 1rem; text-align: left; border-bottom: 1.5px solid var(--rule); }
table.data th { font-size: 0.875rem; color: var(--ink-faint); font-weight: 400; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.section-row td { background: #F8FAFC; font-weight: 700; color: var(--ink-soft); }
.full { color: var(--red); font-weight: 700; }

/* ---------- misc */
.empty-state { padding: 2rem 1.25rem; text-align: center; color: var(--ink-soft); display: grid; gap: 0.75rem; justify-items: center; }
.loading { padding: 2rem 1.25rem; color: var(--ink-faint); }
#toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translate(-50%, 150%);
  background: var(--ink); color: #fff; padding: 0.8rem 1.1rem; border-radius: 10px; max-width: calc(100vw - 2rem);
  font-weight: 700; transition: transform 0.25s ease, visibility 0.25s; z-index: 50; visibility: hidden;
}
#toast.show { transform: translate(-50%, 0); visibility: visible; }
dialog { border: 0; border-radius: 12px; padding: 0; width: min(480px, calc(100vw - 2rem)); color: var(--ink); }
dialog::backdrop { background: rgba(27, 36, 48, 0.5); }
dialog form { display: grid; gap: 1rem; padding: 1.25rem; }
.menu-btn { display: none; }

/* ---------- phones */
@media (max-width: 820px) {
  :root { --margin-x: 14px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 20; padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom));
    flex-direction: row; gap: 0;
  }
  .side .brand, .side .who { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; gap: 0.25rem; }
  .nav a { flex-direction: column; justify-content: center; gap: 0.1rem; padding: 0.45rem 0.25rem; font-size: 0.8125rem; text-align: center; }
  .main { padding: 1.25rem 1rem 6.5rem calc(var(--margin-x) + 1rem); }
  .mobile-top { display: flex !important; }
  h1 { font-size: 1.5rem; }
  .search-row { grid-template-columns: 1fr 1fr; }
  .search-row .q { grid-column: 1 / -1; }
  .req-item { grid-template-columns: auto 1fr; }
  .req-item .item-actions { grid-column: 2; }
  .profile-head { grid-template-columns: auto 1fr; }
  .profile-head .head-actions { grid-column: 1 / -1; }
  .money-row strong { font-size: 1.125rem; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1rem; }
  .panel-pad { padding: 1rem; }
}
.mobile-top { display: none; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.mobile-top img { height: 34px; width: auto; }
.mobile-top strong { font-size: 0.9375rem; }

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

/* =================================================================== v3: modules 2–6 */
.narrow { max-width: 640px; }
.page.wide { max-width: 1120px; }
.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 1.5rem; }
.stack > *, .stack-lg > *, .grid-2 > * { min-width: 0; }
.grow { flex: 1 1 220px; min-width: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.small { font-size: 0.875rem; }
.prewrap { white-space: pre-wrap; }
.mt-sm { margin-top: 0.5rem; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.owing { color: var(--red); }
.btn-link.danger { color: var(--red); }
.subhead { color: var(--ink) !important; font-weight: 700 !important; padding-top: 1rem !important; }
tr.is-off td { color: var(--ink-faint); }
.big-code { font-size: 1.75rem; font-weight: 700; letter-spacing: 0.06em; }
.signin-form { display: grid; gap: 1rem; }
.check { display: inline-flex; gap: 0.5rem; align-items: center; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.cat-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--rule); }

/* nav: desktop shows everything; the More link is for phones */
.nav .more-link { display: none; }
.tabs a { display: inline-block; padding: 0.5rem 0.9rem; font-weight: 700; color: var(--ink-soft); text-decoration: none; }
.tabs a[aria-pressed="true"] { background: var(--ink); color: #fff; }
.more-list { list-style: none; margin: 0; padding: 0; }
.more-list li + li { border-top: 1.5px solid var(--rule); }
.more-list a { display: flex; justify-content: space-between; padding: 1rem 1.25rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.more-list .count { background: var(--amber-wash); color: var(--amber); border-radius: 999px; padding: 0 0.5rem; }

/* filters */
.filters-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.filters-row select.input { width: auto; min-width: 150px; }

/* people lists (students, staff) */
.person-list { list-style: none; margin: 0; padding: 0; }
.person-list li + li { border-top: 1.5px solid var(--rule); }
.person-list a { display: grid; grid-template-columns: auto 1fr auto; gap: 0.9rem; align-items: center; padding: 0.7rem 1.25rem; text-decoration: none; color: inherit; }
.person-list a:hover { background: #FAFBFD; }
.person-list .who { display: grid; min-width: 0; }
.person-list .name { font-weight: 700; }
.person-list .sub { color: var(--ink-faint); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-list .side-note { font-weight: 700; color: var(--ink-soft); text-align: right; }

/* photos: a little passport frame */
.photo { object-fit: cover; background: var(--page); border-radius: 6px; border: 1.5px solid var(--rule); }
.photo-sm { width: 44px; height: 52px; }
.photo-lg { width: 96px; height: 116px; }
.photo-empty { background: repeating-linear-gradient(135deg, var(--page) 0 6px, #E7ECF3 6px 7px); }
.photo-pick { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.profile-head { grid-template-columns: auto 1fr auto; }
.profile-head .head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* guardians */
.guardians { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }
.guardian { display: grid; gap: 0.2rem; align-content: start; }
.guardian h3 { font-size: 0.875rem; color: var(--ink-faint); font-weight: 400; margin-bottom: 0.2rem; }
.siblings { margin-top: 1.25rem; padding-top: 1rem; border-top: 1.5px solid var(--rule); }

/* bills on the profile */
.bill { border: 1.5px solid var(--rule); border-radius: 8px; padding: 1rem; display: grid; gap: 0.75rem; }
.bill.is-void { opacity: 0.65; }
.bill-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.lines { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.lines td { padding: 0.3rem 0; border-bottom: 1px dashed var(--rule); vertical-align: top; }
.lines td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 1rem; }
.lines tr.total td { font-weight: 700; border-bottom: 1.5px solid var(--rule-strong); }
.form-grid .check { grid-column: 1 / -1; }

/* fee setup: class checkboxes */
.class-picks { display: grid; gap: 1.25rem; }
.class-group { display: grid; gap: 0.6rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.chosen { display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap; }
button.family-option { text-align: left; background: var(--paper); font: inherit; width: 100%; }
.family-option .grow { flex: 1; }

/* dashboard figures: the period's key numbers, set like a ledger summary */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem 1.5rem; }
.figures-sub { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1.5px dashed var(--rule-strong); }
.figure { display: grid; gap: 0.15rem; align-content: start; min-width: 0; }
.figure-label { color: var(--ink-soft); font-size: 0.9375rem; }
.figure-value { font-size: 1.5rem; line-height: 1.2; overflow-wrap: anywhere; }
.figure-note { color: var(--ink-faint); font-size: 0.875rem; }
.figure.tone-owing .figure-value { color: var(--red); }
.figure.tone-good .figure-value { color: var(--green); }
.meter { margin-top: 1.25rem; height: 10px; background: var(--red-wash); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--green); border-radius: 999px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }

/* single-hue bar list: label, bar, printed value */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.bars li { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 0.75rem; align-items: center; font-size: 0.9375rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; background: var(--page); border-radius: 0 4px 4px 0; }
.bar-fill { display: block; height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; }
.bars-owing .bar-fill { background: var(--red); }
.bar-value { text-align: right; white-space: nowrap; }
.bars li:hover .bar-fill { filter: brightness(1.15); }

/* ---------- receipt: screen and print */
.receipt-page { min-height: 100vh; background: var(--page); padding: 1.5rem 1rem 3rem; display: grid; justify-items: center; gap: 1rem; align-content: start; }
.receipt-tools { display: flex; gap: 0.6rem; flex-wrap: wrap; width: 100%; max-width: 560px; justify-content: space-between; }
.receipt {
  position: relative; width: 100%; max-width: 560px; background: #fff; color: #111827;
  border: 1.5px solid var(--rule-strong); border-radius: 4px; padding: 1.5rem 1.6rem; display: grid; gap: 1rem;
  border-top: 6px solid var(--blue);
}
.r-head { display: grid; grid-template-columns: 64px 1fr; gap: 1rem; align-items: center; }
.r-head img { width: 64px; height: auto; }
.r-head h1 { font-size: 1.125rem; }
.r-head .motto { font-style: italic; color: var(--ink-soft); font-size: 0.875rem; margin-top: 0.1rem; }
.r-head .small { color: var(--ink-soft); margin-top: 0.25rem; font-size: 0.8125rem; }
.r-title { display: flex; justify-content: space-between; align-items: center; border-block: 1.5px solid var(--ink); padding: 0.5rem 0; }
.r-title h2 { font-size: 1rem; letter-spacing: 0.04em; }
.r-no { display: flex; gap: 0.4rem; align-items: baseline; }
.r-no strong { font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.r-grid { display: grid; gap: 0.3rem; }
.r-row { display: grid; grid-template-columns: 9.5rem 1fr; gap: 0.75rem; font-size: 0.9375rem; padding-bottom: 0.25rem; border-bottom: 1px dotted var(--rule-strong); }
.r-row span { color: var(--ink-soft); }
.r-amount { background: var(--blue-wash); border-radius: 4px; padding: 0.8rem 1rem; display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; align-items: baseline; }
.r-amount strong { font-size: 1.5rem; }
.r-amount p { grid-column: 1 / -1; font-style: italic; color: var(--ink-soft); font-size: 0.875rem; }
.r-bill { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.r-bill td { padding: 0.25rem 0; border-bottom: 1px dotted var(--rule-strong); }
.r-bill td.n { text-align: right; font-variant-numeric: tabular-nums; }
.r-bill tr.total td { font-weight: 700; }
.r-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.5rem; }
.r-foot div { display: grid; gap: 0.2rem; border-top: 1px solid var(--ink); padding-top: 0.35rem; font-size: 0.875rem; }
.r-foot div span { color: var(--ink-soft); }
.r-foot p { grid-column: 1 / -1; color: var(--ink-faint); font-size: 0.8125rem; }
.void-stamp {
  position: absolute; inset: 40% 0 auto 0; text-align: center; font-size: 5rem; font-weight: 700; letter-spacing: 0.2em;
  color: rgba(200, 55, 45, 0.22); transform: rotate(-18deg); pointer-events: none;
}
.r-void-note { color: var(--red); font-weight: 700; }

@page { size: A5; margin: 10mm; }
@media print {
  html { font-size: 12px; }
  body { background: #fff; font-size: 12px; }
  .r-row { padding-bottom: 0.15rem; }
  .r-grid { gap: 0.15rem; }
  .r-bill td { padding: 0.15rem 0; }
  .r-amount { padding: 0.5rem 0.75rem; }
  .r-foot { break-inside: avoid; margin-top: 1.25rem; }
  .no-print, #toast { display: none !important; }
  .receipt-page { padding: 0; background: #fff; min-height: 0; }
  .receipt { border: 0; border-top: 4px solid #000; padding: 0; max-width: none; gap: 0.7rem; }
  .r-amount { background: none; border: 1.5px solid #000; }
  .r-head img { width: 56px; }
  a { color: inherit; text-decoration: none; }
}

@media (max-width: 1000px) {
  .figures, .figures-sub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .hide-sm { display: none; }
  .nav a.secondary { display: none; }
  .nav .more-link { display: flex; }
  .person-list a { padding: 0.65rem 1rem; gap: 0.75rem; }
  .profile-head { grid-template-columns: auto 1fr; }
  .photo-lg { width: 76px; height: 92px; }
  .filters-row select.input { flex: 1 1 140px; min-width: 0; }
  .figure-value { font-size: 1.25rem; }
  .bars li { grid-template-columns: minmax(0, 1fr) auto; }
  .bars .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .r-row { grid-template-columns: 7.5rem 1fr; }
  .receipt { padding: 1.1rem; }
}

/* staff sign-in list (Director) */
.user-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--rule); }
.user-list li { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: start; padding: 1rem 1.25rem; }
.user-list li + li { border-top: 1.5px solid var(--rule); }
.user-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* test copies: staging and local */
.env-banner { background: var(--amber-wash); color: #6B4206; border: 1.5px solid #EBC98A; border-radius: 8px; padding: 0.55rem 0.9rem; font-weight: 700; font-size: 0.9375rem; margin-bottom: 1.25rem; max-width: 1120px; }
.env-banner.env-danger { background: var(--red-wash); color: var(--red); border-color: var(--red); }
.signin:has(.env-top) { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; }
.signin .env-top { width: min(400px, 100%); text-align: center; margin: 0; }
.demo-box { background: var(--paper); border: 1.5px dashed var(--rule-strong); border-radius: 10px; padding: 1rem 1.25rem; display: grid; gap: 0.6rem; }
.demo-box h2 { font-size: 1rem; }
.demo-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media print { .env-banner { display: none; } }
