:root {
  --primary: #E91E7D;
  --primary-hover: #C9196A;
  --secondary: #1E3A5F;
  --background: #FAFBFD;
  --surface: #FFFFFF;
  --text: #1A2B3C;
  --text-secondary: #5A6B7C;
  --border: #E2E8F0;
  --error: #B91C1C;
  --error-bg: #FEF2F2;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--secondary);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; text-decoration: none; }
.signout { display: flex; align-items: center; gap: 16px; margin: 0; }
.who { color: #D6DEE8; }
.content { max-width: 1240px; margin: 0 auto; padding: 32px 16px; }
.card {
  max-width: 440px;
  margin: 48px auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
h1 { margin: 0 0 16px; font-size: 1.5rem; color: var(--secondary); }
p { margin: 0 0 16px; }
.muted { color: var(--text-secondary); }
label { display: block; margin-bottom: 6px; font-weight: 600; }
input[type="email"] {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  margin-bottom: 16px;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
}
input[type="email"]:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
button.primary {
  min-height: 44px;
  padding: 8px 20px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
button.primary:hover { background: var(--primary-hover); }
button.link { font: inherit; color: #fff; background: none; border: 0; text-decoration: underline; cursor: pointer; min-height: 44px; }
a { color: var(--secondary); }
.notice { padding: 12px 16px; margin-bottom: 16px; color: var(--error); background: var(--error-bg); border-radius: 6px; }
h2 { margin: 32px 0 12px; font-size: 1.15rem; color: var(--secondary); }
.small { font-size: 0.875rem; }
.sub { display: block; font-size: 0.8125rem; font-weight: 400; color: var(--text-secondary); }
.crumb { margin: 0 0 8px; font-size: 0.875rem; }
.heading h1 { margin-bottom: 4px; }
.banner { padding: 10px 14px; margin: 0 0 20px; background: #FFF7E6; border: 1px solid #F0D9A8; border-radius: 6px; color: #6B4E00; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
table.grid thead th { font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); background: #F4F6FA; white-space: nowrap; }
table.grid tbody th { font-weight: 600; }
table.grid tbody tr:last-child th, table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid .num { display: inline-block; min-width: 2.6em; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; font-size: 0.875rem; font-weight: 600; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.chip .glyph { font-size: 0.8em; }
.tone-bad { color: #8F1414; background: #FDECEC; border-color: #F5B8B8; }
.tone-warn { color: #7A4B00; background: #FFF3D6; border-color: #F0D08A; }
.tone-good { color: #14603A; background: #E5F6EC; border-color: #A9DDBF; }
.tone-neutral { color: #3D4C5E; background: #EEF1F5; border-color: #D3DAE3; }
.summary { display: flex; flex-wrap: wrap; gap: 16px; margin: 20px 0; }
.figure { flex: 1 1 240px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.figure strong { display: block; margin: 4px 0 8px; font-size: 1.35rem; color: var(--secondary); }
.indicators { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 12px; }
.indicator { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.indicator .sub { margin-bottom: 6px; }
.why { margin: 10px 0 0; padding-left: 18px; font-size: 0.8125rem; color: var(--text-secondary); }
.trend { display: block; width: 100%; height: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.trend .axis { stroke: var(--border); stroke-width: 1; }
.trend .line { fill: none; stroke-width: 2.5; }
.trend .major { stroke: #B91C1C; }
.trend .minor { stroke: #C77700; }
.trend .dot.major { fill: #B91C1C; }
.trend .dot.minor { fill: #C77700; }
.trend .dot.monthly { fill: var(--surface); stroke-width: 2.5; }
.trend .tick { font-size: 12px; fill: var(--text-secondary); stroke: none; }
.trend .tick.value { fill: var(--text); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 8px; font-size: 0.875rem; }
.key::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; }
.key.major::before { background: #B91C1C; }
.key.minor::before { background: #C77700; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0 8px; }
.tile { padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.tile .sub { margin-bottom: 8px; }
.tile .big { display: block; font-size: 1.6rem; line-height: 1.25; color: var(--secondary); }
.tile .big.second { color: var(--text-secondary); font-size: 1.25rem; }
.tile .big .unit { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); }
.dist { display: block; width: 100%; height: 14px; margin: 6px 0 10px; border-radius: 7px; }
.seg-bad { fill: #C62828; background: #C62828; }
.seg-warn { fill: #E0A100; background: #E0A100; }
.seg-good { fill: #2E9E5B; background: #2E9E5B; }
.seg-neutral { fill: #C3CCD8; background: #C3CCD8; }
.dist-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--text-secondary); }
.dist-key strong { color: var(--text); }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; }
.spark { display: block; }
.spark .line { fill: none; stroke-width: 1.75; }
.spark .major { stroke: #B91C1C; }
.spark .minor { stroke: #C77700; }
.spark .dot.major { fill: #B91C1C; stroke: none; }
.spark .dot.minor { fill: #C77700; stroke: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
a.button, button.secondary { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px; font: inherit; font-weight: 600; border-radius: 6px; cursor: pointer; text-decoration: none; }
a.button { color: #fff; background: var(--primary); border: 0; }
a.button:hover { background: var(--primary-hover); }
button.secondary { color: var(--secondary); background: var(--surface); border: 1px solid #B9C4D2; }
button.secondary:hover { background: #F4F6FA; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 20px; }
.banner.locked { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.banner.locked form { margin: 0; }
.month-summary { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; padding: 12px 20px; margin: 0 0 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 6px rgba(30, 58, 95, 0.08); }
.month-summary strong { font-size: 1.15rem; color: var(--secondary); }
.month-summary a.button { margin-left: auto; }
.month-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.chapter-nav { position: sticky; top: 84px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 0.875rem; }
.chapter-nav ol { margin: 0; padding: 0; list-style: none; }
.chapter-nav a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 6px; text-decoration: none; }
.chapter-nav a:hover { background: #F4F6FA; }
.chapter-nav .count { min-width: 22px; padding: 0 6px; text-align: center; font-weight: 700; color: #8F1414; background: #FDECEC; border-radius: 999px; }
.chapters section { scroll-margin-top: 84px; }
.chapters h2 { margin-top: 0; }
.chapters section + section h2 { margin-top: 32px; }
.control { padding: 16px 20px; margin: 0 0 12px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 8px; scroll-margin-top: 84px; }
.control.changed { border-left-color: var(--primary); }
.control.invalid { border-left-color: var(--error); }
.control-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 16px; }
.control h3 { flex: 1 1 320px; margin: 0; font-size: 1rem; font-weight: 600; }
.control h3 .num { color: var(--text-secondary); margin-right: 4px; }
.control-state { display: flex; align-items: center; gap: 8px; }
.saved { font-size: 0.8125rem; font-weight: 600; color: #14603A; }
.guidance { margin: 8px 0 0; font-size: 0.875rem; color: var(--text-secondary); }
.guidance summary { cursor: pointer; }
.guidance p { margin: 6px 0 0; }
.control fieldset { margin: 12px 0 0; padding: 0; border: 0; min-width: 0; }
.answer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.pill { display: inline-flex; margin: 0; font-weight: 400; }
.pill input { position: absolute; opacity: 0; }
.pill span { min-width: 72px; padding: 8px 18px; text-align: center; border: 1px solid #B9C4D2; border-radius: 6px; cursor: pointer; }
.pill input:checked + span { color: #fff; background: var(--secondary); border-color: var(--secondary); font-weight: 600; }
.pill input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.check input { width: 18px; height: 18px; }
.control select, .control input[type="text"], .control input[type="date"], .control textarea { min-height: 40px; padding: 6px 10px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid #B9C4D2; border-radius: 6px; }
.control input.number { width: 140px; }
.control textarea { width: 100%; resize: vertical; }
.control select:focus-visible, .control input:focus-visible, .control textarea:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.extras { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; margin: 14px 0 12px; }
.extras label { font-size: 0.8125rem; color: var(--text-secondary); }
.extras .check { margin-top: 10px; color: var(--text); font-size: 0.875rem; }
.control fieldset[disabled] { opacity: 0.85; }
.end { margin: 24px 0 0; }
.jump { display: inline-block; margin: 0 8px 6px 0; padding: 2px 10px; background: var(--surface); border: 1px solid #F5B8B8; border-radius: 999px; }
.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 28px 0 0; }
.submit-row p { flex: 1 1 100%; margin: 0; }
@media (max-width: 820px) {
  .month-layout { grid-template-columns: 1fr; }
  .chapter-nav { position: static; }
  .extras { grid-template-columns: 1fr; }
}
table.overview th a, table.overview td { white-space: nowrap; }
.chapter-nav .count { align-self: flex-start; }
.control button.secondary { margin-top: 10px; }
.topnav { display: flex; gap: 20px; margin-left: auto; margin-right: 28px; }
.topnav a { color: #fff; text-decoration: none; font-weight: 600; }
.topnav a:hover { text-decoration: underline; }
/* --- Admin screens (internal/admin) --- */
.admin-nav { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 0 0 24px; border-bottom: 1px solid var(--border); }
.admin-nav a { padding: 6px 0 8px; font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; }
.admin-nav a:hover { border-bottom-color: #B9C4D2; }
.admin-nav a[aria-current="page"] { border-bottom-color: var(--primary); }
.done { padding: 10px 14px; margin: 0 0 20px; color: #14603A; background: #E5F6EC; border: 1px solid #A9DDBF; border-radius: 6px; }
.heading-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.heading-row h1 { margin: 0; }
a.tile { display: block; color: inherit; text-decoration: none; }
a.tile:hover { border-color: #B9C4D2; box-shadow: 0 2px 6px rgba(30, 58, 95, 0.08); }
.form, .panel { max-width: 560px; padding: 20px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.form .field { margin: 0 0 16px; }
.form .actions { margin: 4px 0 0; }
.form input[type="text"], .form input[type="email"], .form select,
.row-actions input[type="text"], .row-actions select, .add-row input[type="text"], .add-row select, .filter select {
  min-height: 40px; padding: 6px 10px; margin: 0; font: inherit; color: var(--text); background: var(--surface); border: 1px solid #B9C4D2; border-radius: 6px;
}
.form input[type="text"], .form input[type="email"], .form select { width: 100%; }
.form .sub { margin-top: 4px; }
.form input:focus-visible, .form select:focus-visible, .row-actions input:focus-visible, .row-actions select:focus-visible,
.add-row input:focus-visible, .add-row select:focus-visible, .filter select:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.panel p { margin: 0 0 12px; }
.panel > :last-child { margin-bottom: 0; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; }
.row-actions form { margin: 0; }
.add-row, .filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 12px 0 0; }
.filter { margin: 0 0 16px; }
.add-row label, .filter label { font-size: 0.8125rem; color: var(--text-secondary); }
.add-row select, .filter select { min-width: 260px; }
button.secondary.danger { color: #8F1414; border-color: #E5A3A3; }
button.secondary.danger:hover { background: #FDECEC; }
table.grid tr.inactive th, table.grid tr.inactive td { color: var(--text-secondary); background: #FAFBFD; }
table.grid h1 .chip, h1 .chip { vertical-align: middle; margin-left: 8px; }
ul.plain { margin: 0; padding: 0; list-style: none; }
ul.plain li + li { margin-top: 6px; }
table.people td, table.people th { font-size: 0.9375rem; }
table.audit td { font-size: 0.875rem; overflow-wrap: break-word; }
table.audit td.when { white-space: nowrap; overflow-wrap: normal; }
table.people .row-actions { flex-wrap: nowrap; white-space: nowrap; }
table.grid td.source { min-width: 7em; }
/* Long names and addresses wrap instead of stretching the page. */
table.grid .long { min-width: 9em; max-width: 22em; overflow-wrap: anywhere; }
table.audit td { max-width: 24em; }
h1, .crumb, ul.plain li { overflow-wrap: anywhere; }
.form select, .add-row select, .filter select, .row-actions select { max-width: 100%; }
.add-row > div, .filter > div { min-width: 0; max-width: 100%; }
.add-row select, .filter select { width: 22em; }
.pager { display: flex; gap: 24px; margin: 16px 0 0; }
table.people td.long { min-width: 19em; }

/* PowerPoint export: the "Download deck" link, quieter than the main action. */
a.button.quiet, a.button.quiet:hover { color: var(--secondary); background: var(--surface); border: 1px solid #B9C4D2; }
a.button.quiet:hover { background: #F4F6FA; }

/* Slice 6: hardening */
/* The same bar height signed in and signed out: the sign-out button is what made it taller. */
.topbar { min-height: 68px; }
/* The hint on a renumbered control: what was answered under its earlier number. */
.control .carried { margin: 0 0 12px; padding: 8px 12px; background: #F4F6FA; border-left: 3px solid var(--secondary); border-radius: 4px; color: var(--text); }

/* --- Score check (internal/admin/scorecheck.templ) --- */
table.scorecheck .count { text-align: right; font-variant-numeric: tabular-nums; }
table.scorecheck td.count { font-weight: 600; }
table.scorecheck td.count.zero { font-weight: 400; color: var(--text-secondary); }
table.scorecheck tfoot th, table.scorecheck tfoot td { padding: 10px 14px; text-align: left; font-weight: 700; background: #F4F6FA; border-top: 2px solid var(--border); }
table.scorecheck tfoot td.count { text-align: right; }
table.scorecheck td.why { min-width: 16em; max-width: 30em; }
table.scorecheck td.why .line { display: block; }
table.scorecheck td.why .line + .line { margin-top: 4px; }
.check-legend { margin: 12px 0 0; max-width: 60em; }
.check-legend strong { color: var(--text); }

/* Dashboard: the official count like for like, under the two summary figures. */
.like-for-like { margin: -8px 0 20px; color: var(--text-secondary); }
/* --- SharePoint load (internal/admin/load.templ) --- */
.panel.load-form { margin: 20px 0 0; }
.panel.load-form h2 { margin-top: 0; }
.load-form label { display: block; margin-bottom: 6px; font-weight: 600; }
.load-form input[type="file"] { display: block; max-width: 100%; min-height: 44px; padding: 8px 0; font: inherit; }
.load-form input[type="file"]:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
table.load td, table.load thead th { font-variant-numeric: tabular-nums; }
table.load td.ids { max-width: 28em; overflow-wrap: anywhere; font-size: 0.875rem; }
ul.load-key { margin: 10px 0 0; padding-left: 18px; }
ul.load-key li + li { margin-top: 4px; }
details.load-text { margin: 28px 0 0; }
details.load-text summary { cursor: pointer; font-weight: 600; color: var(--secondary); }
details.load-text pre { margin: 10px 0 0; padding: 14px 16px; overflow-x: auto; font-size: 0.8125rem; line-height: 1.5; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }

/* --- Help page (internal/help) --- */
.help { max-width: 860px; }
.help section { margin-top: 8px; }
.help li + li { margin-top: 6px; }
.help-contents { margin: 20px 0 0; padding: 14px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.help-contents ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 24px; }
.help-contents li + li { margin-top: 0; }
.help h2 { scroll-margin-top: 16px; }
table.help-indicators tbody th { border-right: 1px solid var(--border); }
.help .table-wrap + p { margin-top: 12px; }
