/* =====================================================================
   People portal design system
   Layout: left navigation on wide screens, bottom bar on phones; content in
   a single left-aligned column with a wider work area for tables and the rota.
   Typeface: Atkinson Hyperlegible Next (built for legibility) throughout.
   Colour: cool neutral greys; one accent per company (--brand) set from
   that company's branding; GOV.UK-style yellow focus ring for keyboard users.
   ===================================================================== */

@font-face { font-family: "Atkinson Next"; src: url("/assets/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("/assets/fonts/atkinson-hyperlegible-next-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("/assets/fonts/atkinson-hyperlegible-next-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("/assets/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --font: "Atkinson Next", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --ink: #1b1f24;
  --ink-2: #4a525c;
  --ink-3: #6b7480;
  --line: #d9dde3;
  --line-2: #e8ebef;
  --brand: #2f5d8a;        /* fills: top bar, primary buttons */
  --brand-ink: #ffffff;     /* text on a --brand fill */
  --brand-text: #2f5d8a;    /* brand-coloured text on white (darkened if the brand is light) */
  --brand-soft: #e8eef5;    /* tinted backgrounds */
  --focus: #ffbf47;
  --ok: #1d6b41;      --ok-soft: #e3f2e8;
  --warn: #8a5300;    --warn-soft: #fbefd9;
  --bad: #b42318;     --bad-soft: #fde8e6;
  --info: #1f5f99;    --info-soft: #e4eef8;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-pop: 0 10px 30px rgba(17, 24, 39, 0.18);
  --nav-w: 248px;
  --top-h: 56px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* type scale (1.2) */
  --t-xs: 0.8125rem; --t-sm: 0.875rem; --t-md: 1rem; --t-lg: 1.2rem; --t-xl: 1.44rem; --t-2xl: 1.728rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--t-md); line-height: 1.5; color: var(--ink); background: var(--bg); }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 var(--s3); font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h4 { font-size: var(--t-md); }
p { margin: 0 0 var(--s3); max-width: 70ch; }
a { color: var(--brand-text); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
small, .small { font-size: var(--t-sm); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden, [hidden] { display: none !important; }
.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; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: 0 0 0 5px var(--ink); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); box-shadow: inset 0 0 0 2px var(--ink); }

/* ---------- App frame ---------- */
.frame { min-height: 100vh; background: linear-gradient(to right, var(--surface) calc(var(--nav-w) - 1px), var(--line) calc(var(--nav-w) - 1px), var(--line) var(--nav-w), var(--bg) var(--nav-w)); display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-rows: var(--top-h) 1fr; grid-template-areas: "top top" "nav main"; }
.topbar { grid-area: top; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s4); background: var(--brand); color: var(--brand-ink); }
.topbar .org { display: flex; align-items: center; gap: var(--s3); min-width: 0; font-weight: 700; font-size: var(--t-lg); }
.topbar .org img { height: 32px; width: auto; border-radius: 4px; background: #fff; padding: 2px; }
.topbar .org span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: var(--t-sm); opacity: 0.92; white-space: nowrap; }
.topbar button.menu { display: none; }
.mode-banner { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #e9cf9e; padding: var(--s2) var(--s4); font-size: var(--t-sm); grid-column: 1 / -1; }

.sidenav { grid-area: nav; background: transparent; padding: var(--s4) var(--s3) var(--s6); overflow-y: auto; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); }
.sidenav .group { margin-bottom: var(--s4); }
.sidenav .group-title { font-size: var(--t-xs); color: var(--ink-3); font-weight: 600; padding: 0 var(--s3) var(--s1); }
.sidenav a { display: flex; align-items: center; gap: var(--s3); padding: 7px var(--s3); border-radius: var(--radius); color: var(--ink); text-decoration: none; font-size: var(--t-md); }
.sidenav a svg { width: 20px; height: 20px; flex: none; color: var(--ink-2); }
.sidenav a:hover { background: var(--surface-2); }
.sidenav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.sidenav a[aria-current="page"] svg { color: var(--brand-text); }
.sidenav .count { margin-left: auto; font-size: var(--t-xs); background: var(--bad); color: #fff; border-radius: 999px; padding: 0 7px; font-weight: 700; }

.main { grid-area: main; min-width: 0; padding: var(--s5) var(--s6) var(--s7); }
.main.wide { padding-left: var(--s5); padding-right: var(--s5); }
.page { max-width: 1180px; }
.page.narrow { max-width: 760px; }
.page.full { max-width: none; }

.bottomnav { display: none; }

@media (max-width: 900px) {
  .frame { grid-template-columns: 1fr; grid-template-areas: "top" "main"; background: var(--bg); }
  .sidenav { position: fixed; inset: var(--top-h) 0 0 0; height: auto; z-index: 40; background: var(--surface); transform: translateX(-100%); visibility: hidden; transition: transform 0.2s ease, visibility 0s linear 0.2s; width: min(320px, 86vw); }
  .frame.nav-open .sidenav { transform: none; visibility: visible; box-shadow: var(--shadow-pop); transition: transform 0.2s ease; }
  .topbar button.menu { display: inline-flex; }
  .topbar .who { display: none; }
  .main { padding: var(--s4) var(--s4) calc(var(--s7) + 64px); }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0); }
  .bottomnav a, .bottomnav button { display: flex; border: 0; background: none; font: inherit; cursor: pointer; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; font-size: 0.72rem; color: var(--ink-2); text-decoration: none; }
  .bottomnav a svg, .bottomnav button svg { width: 22px; height: 22px; }
  .bottomnav a[aria-current="page"], .bottomnav button[aria-expanded="true"] { color: var(--brand-text); font-weight: 600; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); }
.page-head h1 { margin: 0; }
.page-head .lede { margin: var(--s1) 0 0; color: var(--ink-2); }
.page-head .actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.crumb { font-size: var(--t-sm); margin-bottom: var(--s2); }
.crumb a { color: var(--ink-2); }

/* ---------- Panels and sections ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5); margin-bottom: var(--s5); }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel.tight { padding: var(--s4); }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.panel-head h2, .panel-head h3 { margin: 0; }
.section { margin-bottom: var(--s6); }
.grid { display: grid; gap: var(--s4); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: var(--s3); }
.divider { border: 0; border-top: 1px solid var(--line-2); margin: var(--s5) 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 40px; padding: 8px 16px; border-radius: var(--radius); border: 2px solid transparent; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn:hover { filter: brightness(0.94); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); filter: none; }
.btn.ghost { background: transparent; color: var(--brand-text); border-color: transparent; padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { background: var(--brand-soft); filter: none; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: var(--t-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-text); text-decoration: underline; cursor: pointer; }
.topbar .btn.ghost { color: var(--brand-ink); }
.topbar .btn.ghost:hover { background: rgba(255,255,255,0.14); }

/* ---------- Forms ---------- */
.form { max-width: 640px; }
.form.wide { max-width: none; }
.field { margin-bottom: var(--s4); }
.field > label, .field > .label, fieldset > legend { display: block; font-weight: 600; margin-bottom: var(--s1); }
.field .hint { display: block; color: var(--ink-2); font-size: var(--t-sm); margin: -2px 0 var(--s2); }
.field .error { display: block; color: var(--bad); font-weight: 600; font-size: var(--t-sm); margin-bottom: var(--s1); }
.field.has-error { border-left: 4px solid var(--bad); padding-left: var(--s3); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; min-height: 42px; padding: 8px 10px; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid #8f99a6; border-radius: var(--radius);
}
input.short { max-width: 12rem; }
input.tiny { max-width: 6rem; }
textarea { min-height: 110px; resize: vertical; }
select { appearance: auto; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s4); }
.choice { display: flex; align-items: flex-start; gap: var(--s2); margin-bottom: var(--s2); }
.choice input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.choice label { font-weight: 400; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin-top: var(--s5); }
.inline-fields { display: flex; flex-wrap: wrap; gap: var(--s3); }
.inline-fields .field { flex: 1 1 180px; }
.error-summary { border: 3px solid var(--bad); padding: var(--s4); margin-bottom: var(--s5); background: var(--surface); border-radius: var(--radius); }
.error-summary h2 { font-size: var(--t-lg); margin-bottom: var(--s2); }
.error-summary ul { margin: 0; padding-left: 1.2em; }
.error-summary a { color: var(--bad); font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table thead th { background: var(--surface-2); font-weight: 600; color: var(--ink-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .primary { font-weight: 600; color: var(--ink); }
.table tfoot td { font-weight: 700; background: var(--surface-2); }

/* ---------- Pills, tags, status ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: 999px; font-size: var(--t-xs); font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.brand { background: var(--brand-soft); color: var(--brand-text); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); }
.dot.ok { background: var(--ok); } .dot.warn { background: #c27c0e; } .dot.bad { background: var(--bad); }

/* Traffic-light ratings used in reviews and 1:1s */
.rag { display: inline-flex; gap: 6px; }
.rag label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: var(--t-sm); }
.rag input { position: absolute; opacity: 0; pointer-events: none; }
.rag input:focus-visible + span { outline: 3px solid var(--focus); }
.rag label.g:has(input:checked) { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.rag label.a:has(input:checked) { background: var(--warn-soft); border-color: #c27c0e; color: var(--warn); }
.rag label.r:has(input:checked) { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

/* ---------- Notices ---------- */
.notice { border-left: 5px solid var(--info); background: var(--info-soft); padding: var(--s3) var(--s4); border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: var(--s4); }
.notice.ok { border-color: var(--ok); background: var(--ok-soft); }
.notice.warn { border-color: #c27c0e; background: var(--warn-soft); }
.notice.bad { border-color: var(--bad); background: var(--bad-soft); }
.notice p:last-child { margin-bottom: 0; }
.notice strong:first-child { display: block; margin-bottom: 2px; }
.install-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }

/* ---------- Action centre (dashboard to-do list) ---------- */
.actions-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.actions-list li { border-bottom: 1px solid var(--line-2); }
.actions-list li:last-child { border-bottom: 0; }
.actions-list a { display: grid; grid-template-columns: 6px 1fr auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4) var(--s3) 0; color: var(--ink); text-decoration: none; }
.actions-list a:hover { background: var(--surface-2); }
.actions-list .rail { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--line); }
.actions-list .high .rail { background: var(--bad); }
.actions-list .medium .rail { background: #c27c0e; }
.actions-list .low .rail { background: var(--info); }
.actions-list .label { font-weight: 600; }
.actions-list .detail { display: block; font-weight: 400; color: var(--ink-2); font-size: var(--t-sm); }
.actions-list .count { font-size: var(--t-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.all-clear { padding: var(--s5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--s5); }
.stats a, .stats div { background: var(--surface); padding: var(--s3) var(--s4); text-decoration: none; color: var(--ink); }
.stats .value { display: block; font-size: var(--t-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.stats .label { font-size: var(--t-sm); color: var(--ink-2); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: var(--s1); border-bottom: 2px solid var(--line); margin-bottom: var(--s5); overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; font: inherit; color: var(--ink-2); text-decoration: none; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--brand); }

/* ---------- Key/value lists ---------- */
dl.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: var(--s2) var(--s4); margin: 0; }
dl.kv dt { color: var(--ink-2); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { dl.kv { grid-template-columns: 1fr; gap: 0; } dl.kv dd { margin-bottom: var(--s3); } }

/* ---------- Empty and loading states ---------- */
.empty { padding: var(--s6) var(--s5); text-align: left; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-lg); }
.empty h3 { margin-bottom: var(--s2); }
.loading { color: var(--ink-2); padding: var(--s5) 0; }
.loading::before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toasts and dialogs ---------- */
.toasts { position: fixed; z-index: 100; right: var(--s4); bottom: var(--s4); display: flex; flex-direction: column; gap: var(--s2); max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: var(--s3) var(--s4); border-radius: var(--radius); box-shadow: var(--shadow-pop); font-weight: 600; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); } .toast.warn { background: #6b4100; }
@media (max-width: 900px) { .toasts { bottom: calc(72px + env(safe-area-inset-bottom, 0)); right: var(--s3); left: var(--s3); max-width: none; } }
dialog.modal { border: 0; padding: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 48px); }
dialog.modal.wide { width: min(960px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(17, 24, 39, 0.45); }
dialog.modal .modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line-2); }
dialog.modal .modal-head h2 { margin: 0; font-size: var(--t-lg); }
dialog.modal .modal-body { padding: var(--s5); overflow-y: auto; max-height: calc(100vh - 200px); }
dialog.modal .modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s2); padding: var(--s4) var(--s5); border-top: 1px solid var(--line-2); background: var(--surface-2); }

/* ---------- Public pages (sign-in, jobs, apply) ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; }
.public-head { background: var(--brand); color: var(--brand-ink); padding: var(--s4) var(--s5); display: flex; align-items: center; gap: var(--s3); }
.public-head img { height: 40px; background: #fff; border-radius: 4px; padding: 3px; }
.public-head .name { font-weight: 700; font-size: var(--t-lg); }
.public-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: var(--s6) var(--s4) var(--s7); }
.public-main.narrow { max-width: 460px; }
.public-foot { padding: var(--s4) var(--s5); color: var(--ink-3); font-size: var(--t-sm); border-top: 1px solid var(--line); background: var(--surface); }
.signin-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s6) var(--s5); }

/* ---------- Print ---------- */
@media print {
  .topbar, .sidenav, .bottomnav, .no-print, .toasts, .page-head .actions { display: none !important; }
  .frame { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .panel, .table-wrap { border: 0; padding: 0; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Additions: misc components ---------- */
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); font-weight: 700; font-size: var(--t-sm); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: var(--t-xl); }
.person { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.person .name { font-weight: 600; }
.person .sub { display: block; font-size: var(--t-sm); color: var(--ink-2); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-end; margin-bottom: var(--s4); }
.toolbar .field { margin: 0; }
.toolbar input[type="search"] { min-width: 220px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 12rem)); gap: var(--s2) var(--s5); font-size: var(--t-lg); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; padding: var(--s4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--s4); }
.secret { font-size: var(--t-lg); letter-spacing: 0.08em; word-spacing: 0.3em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.qr { display: block; width: 220px; height: 220px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.copy-row { display: flex; gap: var(--s2); align-items: stretch; }
.copy-row input { flex: 1; font-size: var(--t-sm); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--line-2); }
.checklist li:last-child { border-bottom: 0; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 var(--s4); }
.cap-grid .choice label { display: block; }
.cap-grid .choice .hint { display: block; color: var(--ink-2); font-size: var(--t-sm); }
.swatch { display: inline-block; width: 1.2em; height: 1.2em; border-radius: 4px; vertical-align: -0.2em; border: 1px solid var(--line); }
input[type="color"] { width: 56px; height: 42px; padding: 2px; border: 2px solid #8f99a6; border-radius: var(--radius); background: var(--surface); }
.brand-preview { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; max-width: 420px; }
.brand-preview .bar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); font-weight: 700; }
.brand-preview .bar img { height: 28px; background: #fff; border-radius: 4px; padding: 2px; }
.brand-preview .body { padding: var(--s4); background: var(--surface); }
.detail-json { font-size: var(--t-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.forbidden, .not-found { max-width: 640px; }
.signin-steps .step[hidden] { display: none; }
.welcome-name { font-size: var(--t-xl); font-weight: 700; margin-bottom: var(--s2); }
.finder { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: stretch; }
.finder .prefix { align-self: center; color: var(--ink-2); }
.finder input { max-width: 16rem; }
.boot { padding: 24px; }

/* Headings and regions that receive focus from code (page changes) don't need a ring. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, main[tabindex="-1"]:focus { outline: none; box-shadow: none; }
.table-wrap + p, .table-wrap + .row { margin-top: var(--s3); }
.signin-card form + p { margin-top: var(--s4); }
input[type="file"] { font: inherit; font-size: var(--t-sm); color: var(--ink-2); max-width: 100%; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: var(--s3); padding: 8px 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }

/* Tables become stacked cards on phones: each cell shows its column name. */
@media (max-width: 640px) {
  .table-wrap.responsive { background: transparent; border: 0; overflow: visible; }
  .table-wrap.responsive table, .table-wrap.responsive tbody, .table-wrap.responsive tr, .table-wrap.responsive td { display: block; width: 100%; }
  .table-wrap.responsive thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap.responsive tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: var(--s3); padding: var(--s2) 0; }
  .table-wrap.responsive td { display: grid; grid-template-columns: 8rem minmax(0, 1fr); justify-items: start; gap: var(--s3); border: 0; padding: 6px var(--s4); text-align: left; overflow-wrap: anywhere; }
  .table-wrap.responsive td.num { text-align: left; }
  .table-wrap.responsive td::before { content: attr(data-label); color: var(--ink-2); font-weight: 600; }
  .table-wrap.responsive td:first-child { font-size: var(--t-md); }
  .table-wrap.responsive td:first-child::before { content: none; }
  .table-wrap.responsive td:first-child { display: block; }
  .table-wrap.responsive tfoot { display: block; }
}

/* ---------- Generated documents (contracts, letters, policies) ---------- */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s6) var(--s6); max-width: 820px; font-size: 1rem; line-height: 1.6; }
.doc h2 { font-size: var(--t-xl); margin-top: 0; }
.doc h3 { font-size: var(--t-lg); margin-top: var(--s5); }
.doc h4 { margin-top: var(--s4); }
.doc p, .doc li { max-width: 72ch; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
.doc mark.placeholder { background: var(--warn-soft); color: var(--warn); padding: 0 3px; border-radius: 3px; font-weight: 600; }
.signature-block { border-top: 2px solid var(--ink); margin-top: var(--s5); padding-top: var(--s3); font-size: var(--t-sm); color: var(--ink-2); }
@media (max-width: 640px) { .doc { padding: var(--s4); } }
@media print { .doc { border: 0; padding: 0; max-width: none; } .doc mark.placeholder { background: none; border: 1px dashed #999; } }
.todo-group { font-size: var(--t-md); margin: var(--s4) 0 var(--s2); }
.todo-group:first-child { margin-top: 0; }
.todo-more { margin-top: var(--s4); }
.todo-more > summary { cursor: pointer; font-weight: 600; color: var(--brand-text); padding: var(--s2) 0; }
.todo-more[open] > summary { margin-bottom: var(--s2); }
