/* Integrity Scan — the one stylesheet (docs/07-design-profile.md).
   Colours are defined once as tokens and used everywhere. Navy and gold; no teal. */
@font-face { font-family: Manrope; src: url("/assets/manrope.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --brand: #1b2f52; --brand-ink: #ffffff; --brand-soft: #e8eaee; --brand-soft-ink: #1b2f52; --gold: #c9a24d;
  --ink: #1b1f24; --muted: #6c6e71; --bg: #f5f3ee; --card: #ffffff; --surface-2: #eeede8; --line: #e2e0dc;
  --field: #ffffff; --field-line: #8d8f92; --focus: #1b2f52; --link: #1b2f52;
  --ok: #0b6b3f; --success-bg: #ecfdf3;
  --warn: #8a4a0b; --warn-ink: #6b3a07; --warn-bg: #fdf3e4; --warn-line: #e3b16b;
  --danger: #b42318; --error-ink: #55160c; --error-bg: #fef3f2;
  --info-ink: #162642; --info-bg: #eff0f3; --info-line: #a4acba;
  --chart-strong: #1b2f52; --chart: #5f6d86; --chart-track: #e8eaee; --chart-ink: #1b2f52;
  --shadow: 0 1px 2px #1418200f, 0 2px 8px #1418200d;
  --qr-bg: #ffffff; --qr-fg: #1b1f24;
}
/* Dark: navy becomes the background family and gold becomes the brand colour. No shadows. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151a22; --card: #1e252f; --surface-2: #242c38; --line: #2d3642; --ink: #ece8df; --muted: #a3a9b3;
    --brand: #c9a24d; --focus: #c9a24d; --brand-ink: #15191f; --link: #e1cc9d; --brand-soft-ink: #e1cc9d; --brand-soft: #393934;
    --field: #1e252f; --field-line: #a3a9b3;
    --ok: #5cd69a; --warn: #f5b85c; --warn-ink: #f5b85c; --danger: #ff8a7a; --error-ink: #ff8a7a; --info-ink: #ece8df;
    --success-bg: #242c38; --warn-bg: #242c38; --error-bg: #242c38; --info-bg: #242c38; --warn-line: #2d3642; --info-line: #2d3642;
    --chart-strong: #b4bbc6; --chart: #828da0; --chart-track: #242c38; --chart-ink: #ece8df;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #151a22; --card: #1e252f; --surface-2: #242c38; --line: #2d3642; --ink: #ece8df; --muted: #a3a9b3;
  --brand: #c9a24d; --focus: #c9a24d; --brand-ink: #15191f; --link: #e1cc9d; --brand-soft-ink: #e1cc9d; --brand-soft: #393934;
  --field: #1e252f; --field-line: #a3a9b3;
  --ok: #5cd69a; --warn: #f5b85c; --warn-ink: #f5b85c; --danger: #ff8a7a; --error-ink: #ff8a7a; --info-ink: #ece8df;
  --success-bg: #242c38; --warn-bg: #242c38; --error-bg: #242c38; --info-bg: #242c38; --warn-line: #2d3642; --info-line: #2d3642;
  --chart-strong: #b4bbc6; --chart: #828da0; --chart-track: #242c38; --chart-ink: #ece8df;
  --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/24px -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-variant-numeric: tabular-nums; }
a { color: var(--link); }
h1 { margin: 0; font-size: 1.4rem; line-height: 30px; font-weight: 700; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 18px; line-height: 26px; font-weight: 700; }
h3 { margin: 0; font-size: 18px; line-height: 26px; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 16px; border-radius: 8px; z-index: 5; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); font-size: 14px; }
.block { display: block; }
.grow { flex: 1; min-width: 0; }
.good { color: var(--ok); font-weight: 600; }
.watch { color: var(--warn); font-weight: 600; }
.brand-ink { color: var(--chart-ink); }
.icon { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- one layout for every screen: left menu, top bar, full-width content ---- */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
.menu { flex: 1 1 256px; max-width: 264px; background: var(--card); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 8px; }
.brand { padding: 0 8px 16px; display: flex; flex-direction: column; gap: 8px; }
.wordmark { font-family: Manrope, sans-serif; font-weight: 800; font-size: 22px; letter-spacing: -0.2px; color: var(--chart-ink); }
.rule { width: 48px; height: 2px; background: var(--gold); }
.menu-head { font-size: 13px; color: var(--muted); padding: 16px 8px 4px; margin-top: 8px; border-top: 1px solid var(--line); }
.brand + .menu-head { margin-top: 0; }
.menu-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.menu-item:hover { background: var(--surface-2); }
.menu-item[aria-current="page"] { background: var(--brand-soft); color: var(--brand-soft-ink); font-weight: 600; }
.count { font-size: 13px; font-weight: 700; color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 0 8px; }
.page { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 32px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.plainbar { justify-content: space-between; }
.plainbar .brand { padding: 0; }
.search { flex: 1 1 280px; min-width: 0; display: flex; }
.search input { width: 100%; }
.pick { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.pick label { font-size: 14px; color: var(--muted); }
.bell { position: relative; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); display: flex; align-items: center; justify-content: center; color: var(--chart-ink); }
.badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.owner-only { font-size: 13px; font-weight: 600; color: var(--chart-ink); border: 1px solid var(--gold); border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.owner-only.small { padding: 2px 10px; }
main { padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.sub { margin-top: 4px; font-size: 14px; color: var(--muted); }
.aside { font-size: 15px; color: var(--muted); max-width: 640px; }
.section-title { margin-top: 8px; }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; text-decoration: none; }

/* ---- cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 24px; }
.grid.flags { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.card { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card, :root:not([data-theme="light"]) .step { border: 1px solid var(--line); } }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .step { border: 1px solid var(--line); }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.lead { max-width: 80ch; }
.actions, .button-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.card-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.picture-row { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.picture-row > p { flex: 1 1 120px; min-width: 0; }
.picture-row > .icon { color: var(--chart-ink); stroke-width: 1.6; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 0.95rem; font-weight: 600; color: var(--link); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: " ▾"; white-space: pre; }
details[open] > summary::after { content: " ▴"; }
.details-body { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }

/* ---- buttons: 44px high, three standard widths, one primary per card ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 1.1rem; border-radius: 8px; border: 1px solid var(--brand); font: inherit; font-size: 0.95rem; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn.small { width: 7.5rem; } .btn.medium { min-width: 11rem; } .btn.large { min-width: 13rem; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.secondary { background: var(--card); color: var(--link); border-color: var(--link); }
.btn:disabled { background: var(--brand-soft); color: var(--muted); border-color: var(--brand-soft); cursor: not-allowed; }
.textbtn, .textlink { background: none; border: 0; padding: 0 8px; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 0.95rem; font-weight: 600; color: var(--link); cursor: pointer; text-decoration: none; }
.textlink { padding: 0; align-self: flex-start; }
@media (pointer: coarse) { .btn, .textbtn, .textlink, .tab, input, select { min-height: 48px; } }

/* ---- forms ---- */
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea { height: 44px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; max-width: 100%; }
textarea { height: auto; padding: 12px; resize: vertical; width: 100%; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 600; }
.field input { width: 100%; max-width: 28rem; }
.hint { font-size: 14px; color: var(--muted); }
.error { color: var(--danger); font-weight: 600; font-size: 15px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.choice { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.command { display: block; background: var(--surface-2); border-radius: 8px; padding: 12px 16px; font: 14px/22px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; flex: 1 1 320px; min-width: 0; }
code { font: 14px/22px ui-monospace, SFMono-Regular, Menlo, monospace; }
.codes { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.codes li { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }

/* ---- tags, notices ---- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { flex: none; font-size: 14px; font-weight: 600; border-radius: 999px; padding: 2px 12px; white-space: nowrap; }
.tag.high { background: var(--error-bg); color: var(--danger); }
.tag.medium, .tag.look { background: var(--warn-bg); color: var(--warn); }
.tag.low, .tag.area { background: var(--info-bg); color: var(--info-ink); }
.tag.done { background: var(--success-bg); color: var(--ok); }
.tag.new { background: var(--brand); color: var(--brand-ink); }
.notice { display: flex; align-items: center; gap: 12px; border-radius: 12px; padding: 16px 24px; font-weight: 600; }
.notice.good { background: var(--success-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.notice.bad { background: var(--error-bg); color: var(--danger); }
.notice.info { background: var(--info-bg); color: var(--info-ink); border: 1px solid var(--info-line); }
.card .notice { padding: 16px; }

/* ---- pictures ---- */
.ring { flex: none; }
.ring circle { fill: none; stroke-width: 14; }
.ring .track { stroke: var(--chart-track); }
.ring .value { stroke: var(--chart-strong); stroke-linecap: round; }
.ring-number { font-family: Manrope, sans-serif; font-weight: 800; font-size: 30px; fill: var(--chart-ink); }
.ring-word { font-size: 13px; fill: var(--muted); }
.progress { display: block; }
.progress .track { fill: var(--chart-track); }
.progress .value { fill: var(--chart-strong); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 200px) minmax(0, 1fr); gap: 12px; align-items: center; text-decoration: none; color: var(--ink); font-size: 14px; }
.bar-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar { flex: none; }
.bar rect { fill: var(--chart-strong); }
.bar-n { font-weight: 700; color: var(--chart-ink); }
.rows { display: flex; flex-direction: column; }
.card > .rows { gap: 0; }
.meter { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.rows > .meter + .meter { margin-top: 16px; }
.meter-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.tile { background: var(--surface-2); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-label { font-size: 14px; color: var(--muted); }
.tile-value { font-family: Manrope, sans-serif; font-weight: 800; font-size: 28px; line-height: 34px; color: var(--chart-ink); overflow-wrap: anywhere; }
.tile-value.small { font-size: 18px; line-height: 26px; font-weight: 700; }
.steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; }
.step { background: var(--card); border-radius: 12px; padding: 16px 24px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); border: 2px solid transparent; }
.card .step { background: var(--surface-2); box-shadow: none; }
.step.now { border-color: var(--brand); }
.step-n { flex: none; width: 32px; height: 32px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-soft-ink); display: inline-flex; align-items: center; justify-content: center; font-family: Manrope, sans-serif; font-weight: 800; }
.step.now .step-n { background: var(--brand); color: var(--brand-ink); }
.step.done .step-n { background: var(--success-bg); color: var(--ok); }
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-of { font-size: 13px; color: var(--muted); }
.step-title { font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 12px; }
.chip { display: inline-flex; align-items: center; height: 44px; padding: 0 16px; border-radius: 8px; font-weight: 600; }
.chip.good { background: var(--success-bg); color: var(--ok); }
.chip.empty { border: 1px dashed var(--field-line); color: var(--muted); }
.chip.now { background: var(--brand); color: var(--brand-ink); }
.qr { flex: none; border-radius: 8px; }
.qr-bg { fill: var(--qr-bg); } .qr-fg { fill: var(--qr-fg); }

/* ---- lists and rows ---- */
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.row > .icon { color: var(--chart-ink); stroke-width: 1.6; }
.row-text { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 700; text-decoration: none; color: var(--ink); }
a.row-title:hover { text-decoration: underline; }
.checklist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink); font-weight: 400; }
.checklist .mark { flex: none; width: 24px; text-align: center; font-weight: 700; }
.checklist .state { font-size: 14px; font-weight: 600; }
.checklist li.good .mark, .checklist li.good .state { color: var(--ok); }
.checklist li.watch .mark, .checklist li.watch .state { color: var(--warn); }
.reasons { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.reasons li { display: flex; gap: 12px; align-items: flex-start; }
.reason-n { color: var(--chart-ink); font-weight: 700; }
.who { font-weight: 700; font-size: 18px; }

/* ---- flags ---- */
.flag .amount-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.amount { font-family: Manrope, sans-serif; font-weight: 800; font-size: 28px; line-height: 34px; color: var(--chart-ink); }
.progress-card { flex-direction: row; flex-wrap: wrap; gap: 24px; align-items: center; }
.progress-main { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.progress-main .meter-top { font-size: 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { display: inline-flex; align-items: center; height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--field-line); background: var(--card); color: var(--link); font-size: 0.95rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tab[aria-current="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.flag-head { display: flex; flex-direction: column; gap: 12px; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.split-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.decide { display: flex; flex-direction: column; gap: 16px; }

/* ---- tables: only behind "Show details" and on admin screens; they scroll inside their card ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 15px; }
th { text-align: left; padding: 8px 12px; font-weight: 600; font-size: 14px; color: var(--muted); }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--surface-2); }
.num { text-align: right; }

.js-only { display: none; }
.js .js-only { display: inline-flex; }
.js .js-hide { display: none; }

/* ---- phone ---- */
@media (max-width: 720px) {
  .menu { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .menu .brand { flex-basis: 100%; padding: 0 0 4px; }
  .menu-head { display: none; }
  .menu-item { padding: 0 10px; }
  .topbar { padding: 12px 16px; }
  main { padding: 32px 16px; }
  .btn.medium, .btn.large { min-width: 0; }
}

/* ---- print and PDF: white paper, black ink, no browser chrome of ours ---- */
@media print {
  :root { --bg: #ffffff; --card: #ffffff; --ink: #1b1f24; --muted: #4b5563; --line: #d1d5db; --surface-2: #f3f4f6; --shadow: none; }
  .menu, .topbar, .back, .print-hide, .decide, .actions, .skip { display: none !important; }
  main { padding: 0; }
  .card { border: 1px solid var(--line); break-inside: avoid; }
  details > summary { display: none; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .menu-item, .tab { transition: background-color 0.12s; } }
