/* VitalReg office, "Registry ledger" (docs/design/ui-system.md). The office reads like the register it keeps:
   a deep-green ledger spine on the left, white file pages on a pale canvas, ruled tables with small-caps column
   heads, and statuses set as rubber stamps. Colours come only from the tokens in office.css. */

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { flex: none; display: inline-block; vertical-align: -0.2em; }

.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--ledger); color: var(--ledger-ink);
  overflow: hidden; border-right: 1px solid var(--ledger-line); z-index: 40; }
.side::after { /* the certificate guilloche, faint, at the foot of the spine */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 220px; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cg fill='none' stroke='white' stroke-width='.8'%3E%3Cpath d='M0 30 C 20 0, 40 60, 60 30 S 100 0, 120 30'/%3E%3Cpath d='M0 30 C 20 60, 40 0, 60 30 S 100 60, 120 30'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(to top, #000, transparent); mask-image: linear-gradient(to top, #000, transparent); }
.side-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 18px 14px; border-bottom: 1px solid var(--ledger-line); }
.side-home { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.side-seal { width: 40px; height: 40px; border-radius: 9999px; background: #ffffff; padding: 2px; flex: none; }
.side-name { display: block; font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; line-height: 1.15; }
.side-owner { display: block; font-size: .72rem; color: var(--ledger-muted); line-height: 1.25; }
.side-close { display: none; color: var(--ledger-ink); background: none; border: 0; padding: 6px; border-radius: 8px; }

.side-workas { padding: 12px 18px; border-bottom: 1px solid var(--ledger-line); display: grid; gap: 6px; }
.side-workas label { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ledger-label); }
.side-workas-row { display: flex; gap: 6px; }
.side-workas select { width: 100%; min-width: 0; height: 34px; border-radius: 8px; padding: 0 8px; font-size: .85rem; color: var(--ledger-ink);
  background: var(--ledger-hi); border: 1px solid rgba(255,255,255,.28); }
.side-workas select option { color: #111111; background: #ffffff; }
.side-workas-go { height: 34px; padding: 0 10px; border-radius: 8px; background: #ffffff; color: #0b3a20; font-weight: 600; font-size: .85rem; }

.side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; position: relative; z-index: 1; }
.side-section { padding-top: 12px; }
.side-section + .side-section { margin-top: 6px; border-top: 1px solid var(--ledger-line); }
.side .menu-group-label { margin: 2px 10px 6px; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ledger-label); }
.side-working { font-weight: 600; letter-spacing: .04em; text-transform: none; color: var(--ledger-muted); }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.side-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--ledger-ink);
  text-decoration: none; font-size: .92rem; font-weight: 500; line-height: 1.25; }
.side-link .icon { color: var(--ledger-muted); }
.side-link:hover { background: var(--ledger-hi); }
.side-link.is-active { background: var(--ledger-hi); font-weight: 700; color: #ffffff; }
.side-link.is-active::before { content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 4px; border-radius: 0 3px 3px 0; background: #e1af19; }
.side-link.is-active .icon { color: #e9c766; }
.side-label { flex: 1; min-width: 0; }
.side-count { min-width: 1.6rem; padding: 1px 7px; border-radius: 9999px; text-align: center; font-size: .75rem; font-weight: 700;
  background: #e1af19; color: #1a1a1a; font-variant-numeric: tabular-nums; }
.side .side-link:focus-visible, .side button:focus-visible, .side select:focus-visible, .side a:focus-visible { outline: 2px solid #e9c766; outline-offset: 1px; }

.side-foot { position: relative; z-index: 1; padding: 12px 14px 16px; border-top: 1px solid var(--ledger-line); display: grid; gap: 10px; background: var(--ledger); }
.side-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-avatar { width: 36px; height: 36px; border-radius: 9999px; display: grid; place-items: center; flex: none;
  background: #e1af19; color: #1a1a1a; font-weight: 800; font-size: .8rem; letter-spacing: .02em; }
.side-who { min-width: 0; }
.side-username { display: block; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-role { display: block; font-size: .75rem; color: var(--ledger-muted); }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.side-actions form { display: contents; }
.side-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border-radius: 8px; font-size: .8rem; font-weight: 600;
  color: var(--ledger-ink); background: transparent; border: 1px solid rgba(255,255,255,.28); cursor: pointer; }
.side-btn:hover { background: var(--ledger-hi); }

.side-scrim { display: none; }

/* Top bar: where you are, and the page's own tools. */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 32px;
  background: color-mix(in oklab, var(--office-page) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-base-300); }
.topbar-menu { display: none; padding: 6px; border-radius: 8px; color: var(--color-base-content); }
.topbar-menu:hover { background: var(--color-base-200); }
.crumbs { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .88rem; color: var(--office-muted); }
.crumbs a { color: var(--office-muted); text-decoration: none; font-weight: 500; }
.crumbs a:hover { color: var(--office-text-primary); text-decoration: underline; }
.crumbs .sep { opacity: .7; }
.crumbs [aria-current] { color: var(--color-base-content); font-weight: 600; }
.topbar-tools { display: flex; align-items: center; gap: 8px; }

.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 32px 48px; flex: 1; display: grid; gap: 20px; align-content: start; }
.page > * { min-width: 0; }
.page-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 14px 32px; font-size: .78rem;
  color: var(--office-muted); border-top: 1px solid var(--color-base-300); }
.plain-head { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--color-base-100); border-bottom: 1px solid var(--color-base-300); }
.page-plain { max-width: 760px; }

@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .side-open .side { transform: none; }
  .side-close { display: inline-flex; }
  .side-open .side-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.45); }
  .topbar-menu { display: inline-flex; }
  .topbar { padding: 8px 16px; }
  .page { padding: 20px 16px 40px; gap: 16px; }
  .page-foot { padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ---------- Page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head > div:first-child { min-width: 0; flex: 1 1 420px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: .72rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--office-text-primary); }
.page-title { margin: 0; font-size: 1.75rem; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.page-lede { margin: 6px 0 0; max-width: 70ch; color: var(--office-muted); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 640px) { .page-title { font-size: 1.4rem; } }

/* ---------- Panels ---------- */
.panel { background: var(--color-base-100); border: 1px solid var(--color-base-300); border-radius: 12px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 14px 20px;
  border-bottom: 1px solid var(--color-base-300); }
.panel-title { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 700; letter-spacing: -.005em; }
.panel-title .icon { color: var(--office-text-primary); }
.panel-meta { font-size: .85rem; color: var(--office-muted); }
.panel-body { padding: 18px 20px; display: grid; gap: 14px; }
.panel-body > * { min-width: 0; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--color-base-300); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  font-size: .88rem; color: var(--office-muted); }
.panel-flush { padding: 0; }
.panel-flush .table-scroll, .panel-flush > .overflow-x-auto { border: 0; border-radius: 0 0 12px 12px; }
.panel-tint { background: var(--color-base-200); }
.grid-main { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-main > * { min-width: 0; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.col-stack { display: grid; gap: 20px; align-content: start; min-width: 0; }
.sticky-side { position: sticky; top: 76px; }
@media (max-width: 1100px) { .grid-main { grid-template-columns: minmax(0, 1fr); } .sticky-side { position: static; } }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* daisyUI cards keep working, re-drawn as panels, until each page moves to .panel. */
.card { border-radius: 12px; box-shadow: none; }
.card.border { border-color: var(--color-base-300); }
.card-title { font-size: 1rem; font-weight: 700; }

/* ---------- The file head (a record, a person, a user, a partner) ---------- */
.file-head { position: relative; overflow: hidden; background: var(--color-base-100); border: 1px solid var(--color-base-300); border-radius: 12px;
  border-top: 4px solid var(--color-primary); padding: 20px 22px; display: grid; gap: 14px; }
.file-head::after { content: ""; position: absolute; right: -40px; top: -30px; width: 260px; height: 160px; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cg fill='none' stroke='%230a6e2a' stroke-width='.9'%3E%3Cpath d='M0 30 C 20 0, 40 60, 60 30 S 100 0, 120 30'/%3E%3Cpath d='M0 30 C 20 60, 40 0, 60 30 S 100 60, 120 30'/%3E%3C/g%3E%3C/svg%3E"); }
[data-theme="npc-dark"] .file-head::after { filter: invert(1); opacity: .05; }
.file-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; position: relative; z-index: 1; }
.file-top > div:first-child { min-width: 0; }
.file-ref { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .85rem; font-weight: 500; color: var(--office-muted); }
.file-title { margin: 2px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 1.7rem; line-height: 1.2;
  font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) { .file-title { font-size: 1.35rem; } .file-head { padding: 16px; } }

/* ---------- Facts: label over value ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 12px 24px; margin: 0; position: relative; z-index: 1; }
.facts > div { min-width: 0; }
.facts dt { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--office-muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.facts-ruled { border-top: 1px dashed var(--color-base-300); padding-top: 14px; }
.facts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .facts-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Ledger tables ---------- */
.table { font-size: .9rem; }
.table :where(thead, tfoot) th { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--office-muted);
  background: var(--color-base-200); border-bottom: 1px solid var(--color-base-300); white-space: nowrap; }
.table :where(td, th) { padding: 10px 14px; vertical-align: middle; }
.table :where(tbody tr) { border-bottom: 1px solid var(--color-base-300); }
.table :where(tbody tr:last-child) { border-bottom: 0; }
.table-zebra tbody tr:nth-child(even) { background: color-mix(in oklab, var(--color-base-200) 60%, var(--color-base-100)); }
.table td.num, .table th.num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .row-link { font-weight: 600; color: var(--office-text-primary); text-decoration: none; }
.table .row-link:hover { text-decoration: underline; }
.table-scroll { border-radius: 10px; }
.table-sticky thead th { background: var(--color-base-200); color: var(--office-muted); }
.cell-sub { display: block; font-size: .8rem; font-weight: 400; color: var(--office-muted); }

/* ---------- Stamps (status) ---------- */
.stamp, .badge { display: inline-flex; align-items: center; gap: 6px; height: auto; min-height: 1.6rem; padding: 2px 10px; border-radius: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; line-height: 1.3; white-space: nowrap;
  border: 1.5px solid currentColor; background: var(--stamp-paper); color: var(--color-base-content); }
.badge-sm { min-height: 1.3rem; padding: 0 7px; font-size: .66rem; }
.stamp-lg { font-size: .8rem; padding: 4px 12px; border-width: 2px; }
.stamp::before { content: ""; width: 7px; height: 7px; border-radius: 9999px; background: currentColor; }
.tone-ok, .badge-success, .badge-primary, .badge-accent { color: var(--office-text-success); background: color-mix(in oklab, var(--color-success) 9%, var(--color-base-100)); }
.tone-wait, .badge-warning, .badge-secondary { color: var(--office-text-warning); background: color-mix(in oklab, var(--color-warning) 14%, var(--color-base-100)); }
.tone-bad, .badge-error { color: var(--office-text-error); background: color-mix(in oklab, var(--color-error) 9%, var(--color-base-100)); }
.tone-info, .badge-info, .badge-neutral, .badge-ghost, .tone-muted { color: var(--color-base-content); background: var(--color-base-200); border-color: var(--office-border); }
.badge-outline { background: transparent; }

/* ---------- Callouts (alerts) ---------- */
.alert, .callout { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 10px; border: 1px solid; border-left-width: 5px;
  color: var(--color-base-content); font-size: .93rem; line-height: 1.5; box-shadow: none; }
.alert > .icon, .callout > .icon { margin-top: 2px; }
.callout-title { font-weight: 700; margin: 0; }
.callout ul, .alert ul { margin: 4px 0 0; padding-left: 1.1rem; list-style: disc; }
.alert-warning, .callout-warn { background: color-mix(in oklab, var(--color-warning) 14%, var(--color-base-100)); border-color: color-mix(in oklab, var(--color-warning) 60%, transparent); border-left-color: var(--color-warning); color: var(--color-base-content); }
.alert-warning > .icon, .callout-warn > .icon { color: var(--office-text-warning); }
.alert-error, .callout-bad { background: color-mix(in oklab, var(--color-error) 10%, var(--color-base-100)); border-color: color-mix(in oklab, var(--color-error) 45%, transparent); border-left-color: var(--color-error); color: var(--color-base-content); }
.alert-error > .icon, .callout-bad > .icon { color: var(--office-text-error); }
.alert-success, .callout-ok { background: color-mix(in oklab, var(--color-success) 10%, var(--color-base-100)); border-color: color-mix(in oklab, var(--color-success) 45%, transparent); border-left-color: var(--color-success); color: var(--color-base-content); }
.alert-success > .icon, .callout-ok > .icon { color: var(--office-text-success); }
.alert-info, .callout-info { background: var(--color-base-200); border-color: var(--color-base-300); border-left-color: var(--office-border); color: var(--color-base-content); }
.alert:not([class*="alert-"]) { background: var(--color-base-200); border-color: var(--color-base-300); }
.alert .btn-ghost { color: var(--color-base-content); }
.alert :focus-visible { outline-color: var(--color-primary); }
.toast-note { background: var(--color-base-100); box-shadow: 0 10px 30px rgba(0,0,0,.18); max-width: 28rem; }

/* ---------- Empty states ---------- */
.empty { display: grid; justify-items: center; gap: 6px; padding: 36px 20px; text-align: center; }
.empty-icon { width: 52px; height: 52px; border-radius: 9999px; display: grid; place-items: center; margin-bottom: 6px;
  background: color-mix(in oklab, var(--color-primary) 10%, var(--color-base-100)); color: var(--office-text-primary); }
.empty-title { margin: 0; font-weight: 700; font-size: 1rem; }
.empty-text { margin: 0; max-width: 52ch; color: var(--office-muted); font-size: .92rem; }
.empty .btn { margin-top: 8px; }

/* ---------- Figures (dashboard tiles) ---------- */
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile { position: relative; background: var(--color-base-100); border: 1px solid var(--color-base-300); border-radius: 12px; padding: 16px 18px 16px 20px;
  display: grid; gap: 4px; align-content: start; overflow: hidden; min-width: 0; text-decoration: none; color: inherit; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--color-base-300); }
.tile.tone-good::before { background: var(--color-success); }
.tile.tone-watch::before { background: var(--color-warning); }
.tile.tone-bad::before { background: var(--color-error); }
a.tile:hover { border-color: var(--office-border); }
.tile-label { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--office-muted); }
.tile-value { margin: 2px 0; font-size: 2rem; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile-value small { font-size: .9rem; font-weight: 600; color: var(--office-muted); letter-spacing: 0; }
.tile-note { margin: 0; font-size: .86rem; color: var(--office-muted); }
.tile-link { margin-top: 6px; font-size: .86rem; font-weight: 600; color: var(--office-text-primary); }
.tile .stamp { justify-self: start; }
.tile.tone-good, .tile.tone-watch, .tile.tone-bad { background: var(--color-base-100); color: inherit; }

/* ---------- Bars (dashboard progress against target) ---------- */
.bar-track { position: relative; height: 12px; border-radius: 9999px; background: var(--color-base-200); border: 1px solid var(--color-base-300); }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 9999px; background: var(--color-primary); }
.bar-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 2px; background: var(--color-base-content); }

/* ---------- Toolbar (filters above a list) ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 14px 20px; border-bottom: 1px solid var(--color-base-300); background: var(--color-base-100); border-radius: 12px 12px 0 0; }
.toolbar .field { min-width: 160px; flex: 1 1 160px; max-width: 260px; }
.toolbar .toolbar-end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.list-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 20px;
  font-size: .86rem; color: var(--office-muted); border-bottom: 1px solid var(--color-base-300); }

/* ---------- Sub-navigation (tabs inside one area) ---------- */
.subnav { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--color-base-300); scrollbar-width: thin; }
.subnav a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; margin-bottom: -1px; border-bottom: 3px solid transparent;
  color: var(--office-muted); font-weight: 600; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.subnav a:hover { color: var(--color-base-content); }
.subnav a[aria-current] { color: var(--office-text-primary); border-bottom-color: var(--color-primary); }

/* ---------- Timeline (history) ---------- */
.timeline-list { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline-list li { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.timeline-list li::before { content: ""; position: absolute; left: 11px; top: 22px; bottom: 0; width: 2px; background: var(--color-base-300); }
.timeline-list li:last-child { padding-bottom: 0; }
.timeline-list li:last-child::before { display: none; }
.tl-dot { width: 24px; height: 24px; border-radius: 9999px; display: grid; place-items: center; background: var(--color-base-200);
  border: 2px solid var(--color-base-300); color: var(--office-muted); }
.tl-dot.tone-ok { border-color: var(--color-success); color: var(--office-text-success); background: var(--color-base-100); }
.tl-dot.tone-wait { border-color: var(--color-warning); color: var(--office-text-warning); background: var(--color-base-100); }
.tl-dot.tone-bad { border-color: var(--color-error); color: var(--office-text-error); background: var(--color-base-100); }
.tl-what { margin: 0; font-weight: 600; }
.tl-meta { margin: 0; font-size: .84rem; color: var(--office-muted); }
.tl-note { margin: 4px 0 0; font-size: .9rem; padding: 8px 12px; border-radius: 8px; background: var(--color-base-200); }

/* ---------- People cards (a record's people) ---------- */
.people { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.person { border: 1px solid var(--color-base-300); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; background: var(--color-base-100); min-width: 0; }
.person-role { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--office-text-primary); }
.person-name { margin: 0; font-weight: 700; font-size: 1.02rem; overflow-wrap: anywhere; }
.person dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; font-size: .86rem; }
.person dt { color: var(--office-muted); }
.person dd { margin: 0; font-weight: 500; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: .88rem; }
.field-help { font-size: .82rem; color: var(--office-muted); }
.field-error { font-size: .82rem; color: var(--office-text-error); font-weight: 600; }
.form-grid { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.form-grid .span-all { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 4px; }
.input, .select, .textarea { border-radius: 8px; font-size: .93rem; }
.input, .select { height: 2.5rem; }
.input-sm, .select-sm { height: 2.1rem; font-size: .86rem; }
fieldset.group { border: 1px solid var(--color-base-300); border-radius: 10px; padding: 12px 16px 16px; display: grid; gap: 12px; }
fieldset.group > legend { padding: 0 6px; font-weight: 700; font-size: .9rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: 8px; font-weight: 600; letter-spacing: 0; box-shadow: none; }
.btn .icon { margin-right: 2px; }
.btn-block-stack { display: grid; gap: 8px; }
.btn-block-stack .btn { width: 100%; justify-content: center; }
.link { text-underline-offset: 2px; }

/* ---------- Actions panel (the decision box on a file) ---------- */
.action-panel .panel-body { gap: 10px; }
.action-note { font-size: .9rem; color: var(--office-muted); margin: 0; display: flex; gap: 8px; align-items: flex-start; }
.action-note .icon { margin-top: 2px; color: var(--office-muted); }
.divider-label { display: flex; align-items: center; gap: 10px; margin: 6px 0 0; font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--office-muted); }
.divider-label::after { content: ""; flex: 1; height: 1px; background: var(--color-base-300); }

/* ---------- Pager ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px; font-size: .86rem; color: var(--office-muted); }

/* Modal dialogs */
.modal-box { border-radius: 14px; border: 1px solid var(--color-base-300); }
.modal-box h3 { font-size: 1.1rem; font-weight: 800; }
.table td { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .facts:not(.facts-2) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; } }

/* ---------- group: registry ---------- */
/* Disclosures: a form that opens in place inside a panel (care: add a guardian, pass guardianship, adoption). */
.panel-clip { overflow: hidden; }
.disclosure + .disclosure { border-top: 1px solid var(--color-base-300); }
.disclosure > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 20px; cursor: pointer; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { background: var(--color-base-200); }
.disclosure > summary:focus-visible { outline-offset: -3px; }
.disclosure-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: color-mix(in oklab, var(--color-primary) 10%, var(--color-base-100)); color: var(--office-text-primary); }
.disclosure-text { min-width: 0; flex: 1; }
.disclosure-title { display: block; font-weight: 700; }
.disclosure-sub { display: block; font-size: .85rem; color: var(--office-muted); }
.disclosure-chev { flex: none; color: var(--office-muted); transition: transform .15s ease; }
.disclosure[open] > summary { background: var(--color-base-200); }
.disclosure[open] .disclosure-chev { transform: rotate(180deg); }
.disclosure-body { padding: 18px 20px 20px; display: grid; gap: 14px; border-top: 1px solid var(--color-base-300); }
@media (prefers-reduced-motion: reduce) { .disclosure-chev { transition: none; } }

/* Choices: a radio or checkbox with its words, in a row or a column. */
.choices { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.choices-col { flex-direction: column; gap: 10px; }
.choice { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .93rem; line-height: 1.4; }
.choice > input { flex: none; margin-top: 1px; }

/* The informant declaration: the warning read aloud, then the officer's tick. */
.declare { display: grid; gap: 10px; }
.declare-tick { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 12px 14px; border-radius: 10px; font-weight: 600;
  font-size: .92rem; line-height: 1.4; border: 1px solid var(--office-border); background: var(--color-base-200); }
.declare-tick > input { flex: none; margin-top: 1px; }

/* Risk score meter (review): the fill takes the tone of the score. */
.risk-meter { display: grid; gap: 6px; }
.risk-meter .bar-fill.tone-wait { background: var(--color-warning); }
.risk-meter .bar-fill.tone-bad { background: var(--color-error); }
.risk-meter .bar-fill.tone-muted { background: var(--office-border); }
.risk-scale { position: relative; height: 1.1rem; font-size: .75rem; color: var(--office-muted); }
.risk-scale > span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.risk-scale > span:first-child { transform: none; }
.risk-scale > span:last-child { left: auto; right: 0; transform: none; }

/* A register number set as a title (a referral). */
.file-title.mono, .mono-title { font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0; }

/* Reasons listed in a table cell (review queue). */
.cell-list { margin: 0; padding-left: 1.05rem; list-style: disc; display: grid; gap: 2px; font-size: .88rem; }

/* Register numbers in a table cell stay on one line; the table scrolls in its own box on a phone. */
.table td.mono { white-space: nowrap; }

/* ---------- group: core ---------- */
/* Sign-in flow (office/auth_base.html): where the officer is in the steps, the code box, the setup key and the
   recovery-code sheet. The form side follows the theme tokens like the sign-in page. */
.auth-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .82rem; font-weight: 600; color: var(--office-muted); }
.auth-steps li { display: inline-flex; align-items: center; gap: 8px; }
.auth-step-n { width: 22px; height: 22px; border-radius: 9999px; display: grid; place-items: center; flex: none; font-size: .72rem; font-weight: 700;
  border: 1.5px solid var(--office-border); color: var(--office-muted); background: var(--color-base-100); }
.auth-steps .is-done .auth-step-n { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-primary-content); }
.auth-steps .is-current { color: var(--color-base-content); }
.auth-steps .is-current .auth-step-n { border-color: var(--color-primary); color: var(--office-text-primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 20%, transparent); }
.signin-input.code-input { height: 3.5rem; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 1.45rem; font-weight: 600;
  letter-spacing: .3em; text-align: center; }
.signin-form-wide { max-width: 480px; }
.signin-form .field-help { margin: 0; }
.signin-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.signin-row-start { justify-content: flex-start; }
.auth-key { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 12px; border-radius: 8px;
  border: 1.5px dashed var(--office-border); background: var(--color-base-200); }
.auth-key code { font-size: .92rem; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.auth-qr { display: flex; justify-content: center; padding: 4px 0; }
.code-sheet { list-style: none; margin: 0; padding: 14px 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px;
  border: 1.5px dashed var(--office-border); border-radius: 10px; background: var(--color-base-200); counter-reset: code; }
.code-sheet li { counter-increment: code; display: flex; align-items: baseline; gap: 10px; font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1.02rem; font-weight: 600; letter-spacing: .06em; }
.code-sheet li::before { content: counter(code, decimal-leading-zero); font-size: .72rem; font-weight: 500; color: var(--office-muted); }
@media (max-width: 360px) { .code-sheet { grid-template-columns: minmax(0, 1fr); } }
@media print {
  .signin { display: block; }
  .signin-panel, .signin-top, .signin-foot, .no-print { display: none !important; }
  .signin-main { min-height: 0; }
}

/* Numbered steps (help pages, set-up instructions): a ringed number beside a short title and its sentence. */
.steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
.steps-list > li { position: relative; padding-left: 42px; min-height: 30px; counter-increment: step; }
.steps-list > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 9999px;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: var(--office-text-primary);
  background: color-mix(in oklab, var(--color-primary) 10%, var(--color-base-100)); border: 1.5px solid color-mix(in oklab, var(--color-primary) 50%, transparent); }
.steps-list > li > strong { display: block; padding-top: 4px; }
.steps-list .cell-sub { margin-top: 1px; }
.step-title { margin: 4px 0 2px; font-weight: 700; }
.step-text { margin: 0; }
.step-text + .step-text { margin-top: 4px; }

/* A list where each line leads with an icon that says what kind of point it is. */
.icon-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.icon-list > li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; }
.icon-list > li > .icon { margin-top: 3px; color: var(--office-text-primary); }

/* Status legend: a stamp with what it means for the reader underneath. */
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.legend-list > li { display: grid; gap: 4px; justify-items: start; }
.legend-list p { margin: 0; font-size: .9rem; }

/* A panel that is only its head (a one-line bar with its action on the right). */
.panel-solo > .panel-head { border-bottom: 0; }

/* Ledger cells that hold a sentence: let them wrap at a readable width, and set quoted reasons off. */
.cell-wrap { min-width: 14rem; max-width: 30rem; white-space: normal; }
.cell-quote { display: block; margin-top: 4px; padding-left: 10px; border-left: 3px solid var(--color-base-300); }
.table tr.is-current > * { background: color-mix(in oklab, var(--color-primary) 7%, var(--color-base-100)); }

/* The account file: the owner's initials beside their name. */
.file-who { display: flex; align-items: center; gap: 16px; min-width: 0; }
.file-avatar { width: 56px; height: 56px; border-radius: 9999px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 1.1rem;
  letter-spacing: .02em; background: var(--color-secondary); color: var(--color-secondary-content); }
@media (max-width: 640px) { .file-avatar { width: 44px; height: 44px; font-size: .95rem; } }

/* A check-box grid inside a fieldset (indicator pickers). */
.check-grid { display: grid; gap: 8px 18px; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.check-grid label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; cursor: pointer; font-size: .9rem; }
.check-grid .checkbox { margin-top: 2px; }

/* ---------- group: admin ---------- */
/* Work list: items that each need a decision on the spot (call-backs, proposed changes, waivers and refunds).
   What the item is on the left, the form that decides it on the right; one column on a phone. */
.work-list { list-style: none; margin: 0; padding: 0; display: grid; }
.work-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 380px); gap: 14px 28px; align-items: start;
  padding: 16px 20px; border-bottom: 1px solid var(--color-base-300); }
.work-item:last-child { border-bottom: 0; }
.work-item.work-solo { grid-template-columns: minmax(0, 1fr); }
.work-main { min-width: 0; display: grid; gap: 6px; align-content: start; }
.work-title { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-weight: 700; font-size: 1rem; overflow-wrap: anywhere; }
.work-meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: .86rem; color: var(--office-muted); }
.work-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.work-figure { margin: 2px 0 0; display: flex; align-items: center; gap: 8px; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.work-figure .icon { color: var(--office-text-primary); }
.work-quote { margin: 4px 0 0; padding: 8px 12px; border-left: 3px solid var(--office-border); border-radius: 0 8px 8px 0;
  background: var(--color-base-200); font-size: .92rem; overflow-wrap: anywhere; }
.work-form { display: grid; gap: 10px; min-width: 0; }
.work-form form { display: grid; gap: 10px; }
@media (max-width: 900px) { .work-item { grid-template-columns: minmax(0, 1fr); } }

/* A rule or scope code (photo_reused, nimc:lookup): set as written, in the register type. */
.chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: .76rem; line-height: 1.5; background: var(--color-base-200); border: 1px solid var(--color-base-300); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* A key or secret shown once: selectable, wraps, set on the panel colour inside the warning callout. */
.secret-box { display: block; width: 100%; margin: 6px 0; padding: 10px 12px; border-radius: 8px; font-size: .9rem; word-break: break-all;
  user-select: all; background: var(--color-base-100); border: 1px dashed var(--office-border); color: var(--color-base-content); }

/* A form folded inside a panel ("Add an agreement", "Make a key"): the summary reads as a button. */
.disclose { border-top: 1px solid var(--color-base-300); }
.disclose > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 20px; cursor: pointer;
  font-weight: 600; font-size: .92rem; color: var(--office-text-primary); }
.disclose > summary::-webkit-details-marker { display: none; }
.disclose > summary:hover { background: var(--color-base-200); }
.disclose > summary .icon-turn { margin-left: auto; transition: transform .15s; }
.disclose[open] > summary .icon-turn { transform: rotate(180deg); }
.disclose-body { padding: 4px 20px 20px; display: grid; gap: 14px; }
@media (prefers-reduced-motion: reduce) { .disclose > summary .icon-turn { transition: none; } }

/* A small form inside a table cell (a refund request beside its payment). */
.cell-form { display: grid; gap: 6px; min-width: 220px; margin-top: 6px; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* Totals row under a report table. */
.table-totals tfoot td { font-weight: 700; color: var(--color-base-content); background: var(--color-base-200); border-top: 2px solid var(--color-base-300); }
/* A field and its button on one line (a note and "Reject"); wraps on a phone. */
.field-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.field-row > .field { flex: 1 1 200px; }
/* An inline picker in a page head (Day, Month): label, input and button on one line. */
.head-picker { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
.head-picker .input { width: auto; min-width: 0; }
.head-picker label { font-weight: 600; font-size: .88rem; }
/* Two small row buttons kept side by side (Rotate, Revoke). */
.btn-pair { display: flex; flex-wrap: nowrap; gap: 6px; justify-content: flex-end; }
/* Report tiles two to a row on a phone, so the table stays near the top. */
@media (max-width: 640px) {
  .tiles.tiles-2up { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tiles-2up .tile { padding: 12px 12px 12px 16px; }
  .tiles-2up .tile-value { font-size: 1.5rem; }
}
/* Five tiles on one line on a wide screen, instead of four and an orphan. */
@media (min-width: 1360px) { .tiles.tiles-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- group: administration ---------- */
/* Admin home: one card per console. The card is the link; a waiting count sits in its foot as a stamp. */
.console-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.console-card { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 14px; align-content: start;
  padding: 16px 18px; background: var(--color-base-100); border: 1px solid var(--color-base-300); border-radius: 12px;
  color: inherit; text-decoration: none; min-width: 0; }
.console-card:hover { border-color: var(--office-border); }
.console-card.has-waiting { border-left: 4px solid var(--color-warning); padding-left: 15px; }
.console-icon { grid-row: span 3; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in oklab, var(--color-primary) 10%, var(--color-base-100)); color: var(--office-text-primary); }
.console-title { margin: 0; font-size: 1rem; font-weight: 700; color: var(--office-text-primary); }
.console-card:hover .console-title { text-decoration: underline; }
.console-about { margin: 0; font-size: .88rem; color: var(--office-muted); }
.console-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; font-size: .84rem; font-weight: 600; color: var(--office-text-primary); }

/* Emergency access: a red strip under the top bar on every page while it is live. On a desktop it stays in view
   as the page scrolls; on a phone it scrolls away so it does not eat the screen. */
.emergency-slot { width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px 32px 0; }
.emergency-banner { border-width: 2px; border-left-width: 6px; font-size: .95rem; align-items: center; }
.emergency-banner > .icon { margin-top: 0; }
.emergency-banner .callout-title { font-size: 1rem; }
.emergency-banner p { margin: 0; }
@media (min-width: 1024px) {
  .emergency-slot { position: sticky; top: 56px; z-index: 29; }
  .emergency-slot .emergency-banner { box-shadow: 0 6px 16px color-mix(in oklab, var(--color-base-content) 12%, transparent); }
}
@media (max-width: 1023px) { .emergency-slot { padding: 16px 16px 0; } }

/* Buttons at the end of a ledger row (approve, decline, end). */
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.row-actions form { display: contents; }
/* The state or LGA picked on the geography console. */
.table tr.is-current { background: color-mix(in oklab, var(--color-primary) 12%, var(--color-base-100)); }
.table tr.is-current .row-link { text-decoration: underline; }

/* ---------- group: operations ---------- */
/* Console launcher (operations home): icon, name and one line on what the console is for. */
.ops-links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.ops-link { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; padding: 14px 16px;
  border: 1px solid var(--color-base-300); border-radius: 10px; background: var(--color-base-100); color: inherit; text-decoration: none; min-width: 0; }
.ops-link:hover { border-color: var(--office-border); background: var(--color-base-200); }
.ops-link:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ops-link-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in oklab, var(--color-primary) 10%, var(--color-base-100)); color: var(--office-text-primary); }
.ops-link-name { display: block; font-weight: 700; }
.ops-link-about { display: block; font-size: .84rem; color: var(--office-muted); }
.ops-link > .icon { color: var(--office-muted); }

/* Signal board (health): one tile per signal; the reading is words, so it is set smaller than a tile figure. */
.tile-reading { margin: 4px 0 0; font-size: 1.2rem; line-height: 1.3; font-weight: 700; overflow-wrap: anywhere; }
.tile-action { margin: 8px 0 0; padding-top: 10px; border-top: 1px dashed var(--color-base-300); font-size: .88rem; }
.tile-action a { font-weight: 600; color: var(--office-text-primary); }

/* Counts in a queue panel: state on the left, figure on the right, ruled like the ledger. */
.ops-counts { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.ops-counts dt, .ops-counts dd { padding: 7px 0; border-bottom: 1px solid var(--color-base-300); }
.ops-counts dt { font-size: .9rem; color: var(--office-muted); }
.ops-counts dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ops-counts > :nth-last-child(-n+2) { border-bottom: 0; }

/* Inbox: one row per message; an unread one carries the amber bar, a filled dot and heavier type. */
.msg-list { list-style: none; margin: 0; padding: 0; }
.panel > .msg-list:last-child { overflow: hidden; border-radius: 0 0 12px 12px; }
.msg { position: relative; display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 2px 14px; padding: 14px 20px;
  border-bottom: 1px solid var(--color-base-300); }
.msg:last-child { border-bottom: 0; }
.msg-dot { width: 10px; height: 10px; margin-top: 7px; border-radius: 9999px; border: 2px solid var(--color-base-300); }
.msg.is-unread { background: color-mix(in oklab, var(--color-warning) 8%, var(--color-base-100)); }
.msg.is-unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--color-warning); }
.msg.is-unread .msg-dot { background: var(--color-warning); border-color: var(--color-warning); }
.msg-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; min-width: 0; }
.msg-title { margin: 0; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.msg.is-unread .msg-title { font-weight: 800; }
.msg-time { font-size: .82rem; color: var(--office-muted); white-space: nowrap; }
.msg-body { grid-column: 2; margin: 2px 0 0; overflow-wrap: anywhere; }

/* A placeholder as written in a message wording: kept in its own case, so it reads exactly as typed. */
.ops-chip { display: inline-block; padding: 2px 8px; border: 1px solid var(--color-base-300); border-radius: 6px;
  background: var(--color-base-200); font-size: .85rem; }

/* A table box that closes its panel keeps the panel's rounded foot (a zebra last row would square it off). */
.panel > .overflow-x-auto:last-child { border-radius: 0 0 11px 11px; }

/* ---------- group: certs ---------- */
/* Verdict of a certificate check: a large rubber stamp beside the headline, the panel edged in the verdict's tone. */
.verdict { border-top: 4px solid var(--office-border); }
.verdict.tone-ok, .verdict.tone-bad { background: var(--color-base-100); color: inherit; }
.verdict.tone-ok { border-top-color: var(--color-success); }
.verdict.tone-bad { border-top-color: var(--color-error); }
.verdict-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.verdict-title { margin: 0; font-size: 1.45rem; line-height: 1.2; font-weight: 800; letter-spacing: -.015em; }
.verdict-lead { margin: 4px 0 0; color: var(--office-muted); max-width: 60ch; }
.stamp-xl { font-size: 1.05rem; letter-spacing: .14em; padding: 8px 16px; border-width: 3px; border-style: double; border-radius: 8px;
  transform: rotate(-3deg); min-height: 0; }
.stamp-xl::before { display: none; }

/* Handover groups of a print run: one ruled row per group, its actions under it. */
.hand-groups { list-style: none; margin: 0; padding: 0; }
.hand-group { display: grid; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--color-base-300); }
.hand-group:last-child { border-bottom: 0; }
.hand-group-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.hand-group-no { width: 30px; height: 30px; border-radius: 9999px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: .85rem;
  background: var(--color-base-200); border: 1.5px solid var(--office-border); font-variant-numeric: tabular-nums; }
.hand-group-name { flex: 1 1 220px; min-width: 0; margin: 0; font-weight: 700; }
.hand-group-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.hand-group-form .field { flex: 1 1 180px; max-width: 280px; }
.hand-group-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tick-list { display: grid; gap: 6px; max-height: 40vh; overflow: auto; padding: 4px 2px; }
.tick-list label { display: flex; align-items: center; gap: 10px; font-size: .9rem; }

/* A list of links to the pages of one area, each with a line on what it is for. */
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li + li { border-top: 1px solid var(--color-base-300); }
.link-list a { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 12px 20px;
  color: inherit; text-decoration: none; }
.link-list a:hover { background: color-mix(in oklab, var(--color-primary) 8%, var(--color-base-100)); }
.link-list a > .icon:first-child { color: var(--office-text-primary); }
.link-list a > .icon:last-child { color: var(--office-muted); }
.link-list-label { font-weight: 600; }

.tiles.tiles-fit { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
/* A console with nothing to show yet puts its forms first on a narrow screen. */
@media (max-width: 1100px) { .grid-main.form-first > aside { order: -1; } }
.hand-group-actions .btn { flex-shrink: 1; max-width: 100%; white-space: normal; height: auto; min-height: 2rem; padding-top: 6px; padding-bottom: 6px; text-align: left; }
.table td.break-words, .table td .break-words { overflow-wrap: anywhere; }
/* The ledger spine runs the full height of long pages (the panel itself stays in view as you scroll). */
@media (min-width: 1024px) { .shell { background: linear-gradient(to right, var(--ledger) 272px, transparent 272px); } }

/* ---------- group: record (phase 7) ---------- */
/* The record's file head: the child's photo beside the name, status and key facts. */
.record-head-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px 22px; align-items: start; position: relative; z-index: 1; }
.record-head-main { display: grid; gap: 14px; min-width: 0; }
@media (max-width: 640px) { .record-head-grid { grid-template-columns: minmax(0, 1fr); } }

/* A picture of the record: a framed thumbnail that opens larger in a dialog, or a placeholder. */
.photo-frame { position: relative; border-radius: 10px; overflow: hidden; background: var(--color-base-200);
  border: 1px solid var(--color-base-300); }
.photo-lg { width: 176px; aspect-ratio: 4 / 5; }
.photo-sm { width: 112px; aspect-ratio: 4 / 5; }
.photo-tile { width: 100%; aspect-ratio: 4 / 3; }
@media (max-width: 640px) { .photo-lg { width: 132px; } }
.photo-btn { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.photo-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-btn:focus-visible { outline: 3px solid var(--color-primary); outline-offset: -3px; }
.photo-zoom { position: absolute; right: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 9999px; font-size: .72rem; font-weight: 700; background: rgba(0, 0, 0, .62); color: #ffffff; }
.photo-none { display: grid; place-content: center; justify-items: center; gap: 8px; padding: 12px; text-align: center; }
.photo-none-icon { color: var(--office-muted); }
.photo-none-text { font-size: .8rem; color: var(--office-muted); line-height: 1.35; }
.photo-box { max-width: min(720px, 94vw); padding: 14px; }
.photo-box img { display: block; width: 100%; max-height: 74vh; object-fit: contain; border-radius: 8px; background: var(--color-base-200); }
.photo-caption { margin: 10px 0 0; font-size: .85rem; color: var(--office-muted); }

/* Every particular of a party, filled or not; a blank reads "Not recorded" in muted text. */
.record-facts { grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 14px 24px; }
.record-facts dd { font-weight: 500; }
.not-recorded { font-weight: 400; font-style: italic; color: var(--office-muted); }
@media (max-width: 640px) { .facts.record-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Jump links to the sections of a long record. */
.record-jump { display: flex; flex-wrap: wrap; gap: 6px; }
.record-jump a { padding: 4px 12px; border-radius: 9999px; border: 1px solid var(--color-base-300); background: var(--color-base-100);
  color: var(--color-base-content); font-size: .84rem; font-weight: 600; text-decoration: none; }
.record-jump a:hover { border-color: var(--office-text-primary); color: var(--office-text-primary); }
.record-jump-decide { display: none; }
.record-layout [id^="sec-"], #decide { scroll-margin-top: 72px; }
@media (max-width: 1100px) { .record-jump-decide { display: inline-block; } }

/* Documents as a gallery: pictures as tiles, other files in a table below. */
.doc-gallery { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); }
.doc-tile { display: grid; gap: 4px; align-content: start; justify-items: start; min-width: 0; }
.doc-tile-name { margin: 4px 0 0; font-weight: 700; }

/* Phones and tablets: the decision panel sits after the long record, so a bar at the foot jumps to it. */
.decide-bar { display: none; }
@media (max-width: 1100px) {
  .decide-bar { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20; display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: 8px 12px; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--color-base-100);
    border: 1px solid var(--color-base-300); border-top: 3px solid var(--color-primary); box-shadow: 0 8px 24px rgba(0, 0, 0, .14); }
  .decide-bar-text { font-size: .85rem; font-weight: 600; color: var(--office-muted); }
}
/* A party with a photo: the picture beside their particulars (above them on a phone). */
.party-with-photo { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 18px 22px; }
.party-facts { display: grid; gap: 10px; min-width: 0; }
.party-facts > p { margin: 0; }
@media (max-width: 640px) { .party-with-photo { grid-template-columns: minmax(0, 1fr); } }
