/* Inter (SIL Open Font License, fonts/inter/LICENSE.txt), served from this site: no Google Fonts
   request, so pages load offline and Speak Up never contacts a third party. One variable file per
   script covers every weight. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter/inter-latin-ext-wght-normal.woff2") format("woff2-variations"), url("fonts/inter/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter/inter-latin-wght-normal.woff2") format("woff2-variations"), url("fonts/inter/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/*
 * Shared dialogs, alerts and toasts for every page (homepage, admin, candidate account, exam).
 * Uses its own variables so it looks the same whatever the page's stylesheet defines.
 */
/*
 * The app's colours, in one place. Light by default; dark when the device prefers dark, or when
 * the person chooses it (data-theme on <html>, set by the theme switch in ui.js).
 */
:root {
  --brand: #1a2e8b; --brand-text: #1a2e8b; --brand-hover: #0f1f6b; --brand-dark: #0f1f6b; --brand-soft: #e8ecf8; --brand-line: #cdd5ec; --focus: #9fb0ea;
  --accent: #c8933a;
  --ok: #1f9d55; --ok-soft: #e3f5ea; --ok-ink: #13703b; --ok-line: #bfe5cd;
  --warn: #c27c0e; --warn-soft: #fff4dc; --warn-ink: #7a4b00; --warn-line: #f3dfaf;
  --danger: #d8262c; --danger-soft: #fdeaea; --danger-ink: #9b1c1c; --danger-line: #f6c6c8;
  --purple: #6b3fa0; --purple-soft: #f3ecfb;
  --ink: #1c2430; --ink-2: #3b4654; --muted: #5f6b7a; --muted-2: #9aa4b2;
  --line: #e2e6eb; --disabled: #c9d1d9;
  --bg: #f4f6f8; --card: #ffffff; --surface-2: #f4f6f8; --hover: #f8f9fe;
  color-scheme: light;
  --ui-brand: var(--brand); --ui-brand-dark: var(--brand-hover); --ui-brand-soft: var(--brand-soft);
  --ui-danger: var(--danger); --ui-danger-dark: #9e1a1f; --ui-danger-soft: var(--danger-soft);
  --ui-warn: var(--warn); --ui-warn-soft: var(--warn-soft); --ui-ok: var(--ok); --ui-ok-soft: var(--ok-soft);
  --ui-ink: var(--ink); --ui-muted: var(--muted); --ui-line: var(--line);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --brand: #5b70db; --brand-text: #aebbff; --brand-hover: #6e82e6; --brand-dark: #c3ccff; --brand-soft: #1e2848; --brand-line: #35417a; --focus: #7d8fe8;
  --accent: #d9a54d;
  --ok: #3fbf7a; --ok-soft: #12301f; --ok-ink: #8ce0b0; --ok-line: #24553a;
  --warn: #e0a33a; --warn-soft: #33270f; --warn-ink: #f2c573; --warn-line: #5a4518;
  --danger: #f05a5a; --danger-soft: #3a1719; --danger-ink: #ffa3a3; --danger-line: #6b2b2e;
  --purple: #c4a4ef; --purple-soft: #2c2140;
  --ink: #e6eaf0; --ink-2: #c9d1dc; --muted: #9ba7b6; --muted-2: #6f7b8b;
  --line: #2b3442; --disabled: #3a4452;
  --bg: #0f141b; --card: #171d27; --surface-2: #1d2430; --hover: #222b39;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #5b70db; --brand-text: #aebbff; --brand-hover: #6e82e6; --brand-dark: #c3ccff; --brand-soft: #1e2848; --brand-line: #35417a; --focus: #7d8fe8;
  --accent: #d9a54d;
  --ok: #3fbf7a; --ok-soft: #12301f; --ok-ink: #8ce0b0; --ok-line: #24553a;
  --warn: #e0a33a; --warn-soft: #33270f; --warn-ink: #f2c573; --warn-line: #5a4518;
  --danger: #f05a5a; --danger-soft: #3a1719; --danger-ink: #ffa3a3; --danger-line: #6b2b2e;
  --purple: #c4a4ef; --purple-soft: #2c2140;
  --ink: #e6eaf0; --ink-2: #c9d1dc; --muted: #9ba7b6; --muted-2: #6f7b8b;
  --line: #2b3442; --disabled: #3a4452;
  --bg: #0f141b; --card: #171d27; --surface-2: #1d2430; --hover: #222b39;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ---------- inline alerts ---------- */
.alert {
  padding: 12px 16px; border-radius: 12px; margin: 16px 0; font-weight: 500; font-size: .95rem; line-height: 1.5;
  border: 1px solid transparent; border-left-width: 4px;
}
.alert.error { background: var(--ui-danger-soft); color: var(--danger-ink); border-color: var(--danger-line); border-left-color: var(--ui-danger); }
.alert.warn { background: var(--ui-warn-soft); color: var(--warn-ink); border-color: var(--warn-line); border-left-color: var(--ui-warn); }
.alert.info { background: var(--ui-brand-soft); color: var(--brand-dark); border-color: var(--brand-line); border-left-color: var(--ui-brand); }
.alert.success { background: var(--ui-ok-soft); color: var(--ok-ink); border-color: var(--ok-line); border-left-color: var(--ui-ok); }

/* ---------- dialogs ---------- */
.app-dialog {
  width: min(92vw, 460px); max-width: none; padding: 0; border: 1px solid var(--ui-line); border-radius: 18px;
  color: var(--ui-ink); background: var(--card); box-shadow: 0 24px 70px rgba(17, 24, 39, .28);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
.app-dialog::backdrop { background: rgba(17, 24, 39, .58); backdrop-filter: blur(3px); }
.app-dialog[open] { animation: ui-dialog-in .14s ease-out; }
@keyframes ui-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .app-dialog[open] { animation: none; } }
.app-dialog > form, .app-dialog > .app-dialog-body { padding: 24px; }
.app-dialog-head { display: flex; gap: 14px; align-items: flex-start; }
.app-dialog-icon {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 750; font-size: 1.15rem; background: var(--ui-brand-soft); color: var(--brand-text);
}
.app-dialog.tone-danger .app-dialog-icon { background: var(--ui-danger-soft); color: var(--ui-danger); }
.app-dialog.tone-warn .app-dialog-icon { background: var(--ui-warn-soft); color: var(--ui-warn); }
.app-dialog.tone-success .app-dialog-icon { background: var(--ui-ok-soft); color: var(--ui-ok); }
.app-dialog h2 { margin: 6px 0 8px; font-size: 1.25rem; font-weight: 650; line-height: 1.25; color: var(--ui-ink); }
.app-dialog p { margin: 0; line-height: 1.55; }
.app-dialog-message { color: var(--ui-muted); white-space: pre-line; }
.app-dialog-label { display: block; margin: 18px 0 6px; font-weight: 600; font-size: .92rem; color: var(--ui-ink); }
.app-dialog-input {
  width: 100%; min-height: 84px; padding: 10px 12px; font: inherit; color: var(--ui-ink); resize: vertical;
  border: 2px solid var(--ui-line); border-radius: 12px; background: var(--card); box-sizing: border-box;
}
.app-dialog-input:focus { outline: none; border-color: var(--ui-brand); }
.app-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
@media (max-width: 420px) { .app-dialog .dialog-actions .ui-btn { flex: 1 1 auto; } }

.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto;
  font: inherit; font-weight: 600; font-size: .92rem; white-space: nowrap;
  padding: 10px 18px; border-radius: 11px; border: 1px solid transparent; cursor: pointer;
  background: var(--ui-brand); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .12);
  transition: background-color .15s, border-color .15s;
}
.ui-btn:hover { background: var(--ui-brand-dark); }
.ui-btn:active { box-shadow: none; }
.ui-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ui-btn.secondary { background: var(--card); color: var(--brand-text); border-color: var(--ui-line); box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.ui-btn.secondary:hover { background: var(--brand-soft); }
.ui-btn.danger { background: var(--ui-danger); }
.ui-btn.danger:hover { background: var(--ui-danger-dark); }
.ui-btn.warn { background: var(--ui-warn); }
.ui-btn.warn:hover { background: #8f5a07; }

/* ---------- two-step sign-in (two-factor.js) ---------- */
.tf-dialog { width: min(94vw, 480px); max-height: 92vh; overflow-y: auto; }
.tf-input {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 1.1rem; color: var(--ui-ink); box-sizing: border-box;
  border: 2px solid var(--ui-line); border-radius: 12px; background: var(--card); letter-spacing: .08em;
}
.tf-input:focus { outline: none; border-color: var(--ui-brand); }
.tf-link { background: none; border: none; padding: 0; margin-top: 12px; color: var(--brand-text); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: underline; }
.tf-apps { margin-top: 14px !important; font-size: .92rem; }
.tf-steps { margin: 18px 0 10px; padding-left: 20px; line-height: 1.55; }
.tf-steps li { margin-bottom: 10px; }
.tf-steps label { font-weight: 600; }
.tf-qr { margin: 10px 0 6px; width: 192px; height: 192px; padding: 8px; background: #fff; border: 1px solid var(--ui-line); border-radius: 12px; }
.tf-qr svg { width: 100%; height: 100%; display: block; }
.tf-secret { display: inline-block; margin-top: 4px; padding: 6px 10px; background: var(--ui-brand-soft); border-radius: 8px; font-size: .95rem; word-break: break-all; }
.tf-codes { columns: 2; gap: 18px; margin: 18px 0 12px; padding: 14px 14px 14px 34px; background: var(--ui-brand-soft); border-radius: 12px; }
.tf-codes li { margin: 4px 0; }
.tf-codes code { font-size: .95rem; }
@media (max-width: 420px) { .tf-codes { columns: 1; } }
.tf-code-actions, .tf-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tf-check { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-weight: 600; }
.tf-check input { width: 18px; height: 18px; }
.tf-muted { color: var(--ui-muted); font-size: .9rem; margin: 6px 0 12px; }
.tf-badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 650; margin-right: 6px; }
.tf-badge.on { background: var(--ui-ok-soft); color: var(--ok-ink); }
.tf-badge.off { background: var(--ui-warn-soft); color: var(--warn-ink); }
.tf-sessions { list-style: none; padding: 0; margin: 0 0 8px; }
.tf-sessions li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--ui-line); flex-wrap: wrap; }
.tf-sessions li:first-child { border-top: none; }
.tf-sessions .tf-muted { margin: 2px 0 0; }
.tf-backups .tf-ok { color: var(--ok-ink); font-weight: 600; }
.tf-backups .tf-bad { color: var(--danger-ink); font-weight: 600; }

/* ---------- toasts ---------- */
.toast {
  position: fixed; top: 76px; left: 50%; transform: translate(-50%, -6px); z-index: 1000;
  max-width: min(92vw, 520px); padding: 12px 18px 12px 16px; border-radius: 12px;
  background: var(--ui-ink); color: #fff; font-weight: 600; line-height: 1.4;
  border-left: 4px solid var(--focus); box-shadow: 0 10px 30px rgba(17, 24, 39, .25);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { border-left-color: #5fd08d; }
.toast.error { border-left-color: #ff7b80; }
.toast.warn { border-left-color: #f5b94a; }

/* Loading placeholders: a soft moving bar instead of "0" or "Loading…" text. */
@keyframes ui-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.stat b:empty::before, .list-count:empty::before, .is-loading::after {
  content: ''; display: inline-block; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-2) 50%, var(--surface-2) 75%); background-size: 200% 100%;
  animation: ui-shimmer 1.4s linear infinite;
}
.stat b:empty::before { width: 2.5em; height: .9em; vertical-align: middle; }
.list-count:empty::before { width: 1em; height: .7em; vertical-align: middle; }
.is-loading { position: relative; color: transparent !important; min-height: 1.4em; }
.is-loading::after { position: absolute; left: 12px; top: 50%; width: min(60%, 320px); height: 12px; transform: translateY(-50%); }
li.is-loading, p.is-loading { list-style: none; }
@media (prefers-reduced-motion: reduce) { .stat b:empty::before, .list-count:empty::before, .is-loading::after { animation: none; } }

/* ---------- Tables as cards on phones (labels come from ui.js) ---------- */
@media (max-width: 760px) {
  table.as-cards, table.as-cards tbody { display: block; width: 100%; }
  table.as-cards thead { display: none; }
  table.as-cards tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line, var(--line)); }
  table.as-cards tbody tr:last-child { border-bottom: 0; }
  table.as-cards td { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 2px 8px; padding: 3px 0; border: 0; text-align: right; min-width: 0; width: auto !important; overflow-wrap: anywhere; }
  table.as-cards td::before { content: attr(data-label); flex: none; max-width: 45%; margin-right: auto; text-align: left; font-size: .82rem; font-weight: 600; color: var(--muted, var(--muted)); }
  table.as-cards td > * { min-width: 0; }
  table.as-cards td input, table.as-cards td select { max-width: 60%; }
  /* The first column is the card's title. */
  table.as-cards td:first-child { display: block; text-align: left; font-size: 1rem; padding: 0 0 6px; }
  table.as-cards td:first-child::before { content: none; }
  /* A tick-box column sits beside the title, which is then the next column. */
  table.as-cards td.select-cell:first-child { float: left; padding: 2px 10px 0 0; }
  table.as-cards td.select-cell + td { display: block; text-align: left; font-size: 1rem; padding: 0 0 6px; }
  table.as-cards td.select-cell + td::before { content: none; }
  table.as-cards tr::after { content: ''; display: block; clear: both; }
  /* Cells without a heading (row buttons) go full width at the bottom. */
  table.as-cards td[data-label=""], table.as-cards td.row-tools, table.as-cards td.actions-col, table.as-cards td[data-label="Actions"] { display: flex; justify-content: flex-start; flex-wrap: wrap; text-align: left; padding-top: 6px; }
  table.as-cards td[data-label=""]::before, table.as-cards td.row-tools::before, table.as-cards td.actions-col::before, table.as-cards td[data-label="Actions"]::before { content: none; }
  table.as-cards td:empty { display: none; }
  /* "Nothing here" rows. */
  table.as-cards td[colspan] { display: block; text-align: center; padding: 14px 0; }
  table.as-cards td[colspan]::before { content: none; }
  table.as-cards td.num, table.as-cards th.num { text-align: right; }
  .table-wrap:has(> table.as-cards) { overflow-x: visible; }
}

/* A row's less-used actions, under "More". */
details.row-menu { position: relative; display: inline-block; }
details.row-menu > summary { list-style: none; cursor: pointer; }
details.row-menu > summary::-webkit-details-marker { display: none; }
details.row-menu .row-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 210px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line, var(--line)); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .14); }
details.row-menu .row-menu-list .btn { justify-content: flex-start; width: 100%; text-align: left; }

/* The theme switch button in page headers. */
.theme-btn { font: inherit; font-size: 1.05rem; line-height: 1; width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.theme-btn:hover { background: var(--hover); }
.theme-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img.logo, .page-logo { background: #fff; }

/* ---------- Search (dashboard, Ctrl+K) ---------- */
.search-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: .9rem; color: var(--muted); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px 7px 12px; min-width: 200px; }
.search-btn:hover { border-color: var(--brand-line); color: var(--ink); }
.search-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.search-btn kbd, .search-box kbd { margin-left: auto; font: inherit; font-size: .72rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--card); }
.search-btn.hidden { display: none; }
@media (max-width: 1023px) { .search-btn { min-width: 0; padding: 0; width: 40px; height: 40px; justify-content: center; font-size: 1.1rem; } .search-btn .search-btn-text, .search-btn kbd { display: none; } }
.search-dialog { width: min(640px, 94vw); max-width: none; margin: 10vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); color: var(--ink); box-shadow: 0 24px 70px rgba(16, 24, 40, .3); }
.search-dialog::backdrop { background: rgba(16, 24, 40, .45); }
.search-box { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.search-box .search-ico { font-size: 1.2rem; color: var(--muted); }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1.05rem; color: var(--ink); padding: 6px 0; min-width: 0; box-shadow: none; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 6px; max-height: min(60vh, 460px); overflow-y: auto; }
.search-results li[data-i] { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.search-results li.on { background: var(--brand-soft); }
.search-results .search-kind { flex: none; width: 74px; font-size: .74rem; font-weight: 650; color: var(--muted); }
.search-results .search-main { display: flex; flex-direction: column; min-width: 0; }
.search-results .search-main b, .search-results .search-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-wait { padding: 12px 10px; }
.search-foot { margin: 0; padding: 8px 16px; border-top: 1px solid var(--line); }

/* ---------- Appearance menu (theme and glass effect) ---------- */
.appearance-menu { position: fixed; z-index: 60; width: 272px; padding: 14px; border-radius: 16px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(16, 24, 40, .18); }
.appearance-menu[hidden] { display: none; }
.appearance-title { margin: 0 0 10px; font-weight: 650; font-size: .95rem; }
.appearance-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.appearance-themes button { display: grid; gap: 2px; justify-items: center; font: inherit; font-size: .8rem; font-weight: 600; color: var(--muted);
  padding: 8px 4px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; }
.appearance-themes button span { font-size: 1.05rem; }
.appearance-themes button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .14); }
.appearance-themes button:focus-visible, .appearance-switch input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.appearance-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; cursor: pointer; }
.appearance-switch b { display: block; font-size: .92rem; }
.appearance-switch small { display: block; color: var(--muted); font-size: .78rem; }
.appearance-switch input { appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; margin: 0; border-radius: 999px;
  background: var(--disabled); position: relative; cursor: pointer; transition: background .15s; }
.appearance-switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.appearance-switch input:checked { background: var(--ok); }
.appearance-switch input:checked::after { transform: translateX(18px); }
@media (prefers-reduced-motion: reduce) { .appearance-switch input, .appearance-switch input::after { transition: none; } }
.appearance-install { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.appearance-install[hidden] { display: none; }
.appearance-install b { display: block; font-size: .92rem; }
.appearance-install small { display: block; color: var(--muted); font-size: .78rem; }
.appearance-install-btn { flex: none; font: inherit; font-size: .85rem; font-weight: 650; padding: 7px 14px; border: 0; border-radius: 999px;
  background: var(--brand); color: #fff; cursor: pointer; }
.appearance-install-btn:hover { background: var(--brand-hover); }
.appearance-install-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Tick boxes and switches, in the style of Apple's guidelines ----------
 * On/off settings use a switch (marked role="switch", so screen readers say "switch").
 * Agreements and choosing items from a list keep a tick, drawn as a round checkmark. */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; flex: none; display: inline-grid; place-content: center; vertical-align: middle;
  width: 20px; height: 20px; margin: 0 6px 0 0; border-radius: 50%; border: 1.5px solid var(--muted-2); background: var(--card);
  cursor: pointer; transition: background-color .15s, border-color .15s;
}
input[type=checkbox]::before {
  content: ''; width: 9px; height: 5px; margin-top: -2px; border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0); transition: transform .12s ease-out;
}
input[type=checkbox]:checked { background: var(--brand); border-color: var(--brand); }
input[type=checkbox]:checked::before { transform: rotate(-45deg) scale(1); }
input[type=checkbox]:indeterminate { background: var(--brand); border-color: var(--brand); }
input[type=checkbox]:indeterminate::before { width: 9px; height: 0; margin: 0; border-left: 0; border-bottom: 2px solid #fff; transform: none; }
input[type=checkbox]:hover:not(:disabled):not(:checked) { border-color: var(--brand); }
input[type=checkbox]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input[type=checkbox]:disabled { opacity: .45; cursor: not-allowed; }

input[type=checkbox][role="switch"] {
  position: relative; display: inline-block; width: 46px; height: 28px; border: 0; border-radius: 999px;
  background: var(--disabled); transition: background-color .2s;
}
input[type=checkbox][role="switch"]::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; margin: 0; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .22), 0 0 0 .5px rgba(0, 0, 0, .04); transform: none; transition: transform .2s ease;
}
input[type=checkbox][role="switch"]:checked { background: var(--ok); }
input[type=checkbox][role="switch"]:checked::before { transform: translateX(18px); }
input[type=checkbox][role="switch"]:hover:not(:disabled) { filter: brightness(.97); }
/* A setting row: the words on the left, the switch on the right, as in Apple's Settings. */
label.check:has(> input[role="switch"]), label.tf-check:has(> input[role="switch"]) {
  flex-direction: row-reverse; justify-content: space-between; align-items: center; gap: 16px;
}
label.check:has(> input[role="switch"]) > input, label.tf-check:has(> input[role="switch"]) > input { margin: 0; }
@media (prefers-reduced-motion: reduce) { input[type=checkbox], input[type=checkbox]::before { transition: none; } }

/* Inter details for a crisp, financial-product look: numbers line up in columns (amounts, scores,
   dates), and large headings sit slightly tighter, as Inter is designed to be set. */
table, .stat-value, .num, .tabular { font-variant-numeric: tabular-nums; }
h1, h2 { letter-spacing: -0.015em; }

/* Administration → System (system-admin.js) */
.sys-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.sys-field { min-width: 0; }
.sys-field input, .sys-field select { width: 100%; box-sizing: border-box; }
.sys-field-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.sys-field-head label { margin: 0; font-weight: 600; }
.sys-help { margin: 4px 0 0; }
.sys-reset { margin-top: 6px; }
.sys-badge { font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.sys-badge-screen { color: var(--brand-text); background: var(--brand-soft); border-color: var(--brand-line); }
.sys-badge-ok { color: var(--ok-ink); background: var(--ok-soft); border-color: var(--ok-line); }
.sys-badge-warn { color: var(--warn-ink); background: var(--warn-soft); border-color: var(--warn-line); }
.sys-save { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.sys-password { flex: 1 1 220px; max-width: 320px; }
.sys-password label { display: block; margin-bottom: 4px; }
.sys-password input { width: 100%; box-sizing: border-box; }
.sys-test { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.sys-test p { margin: 0 0 8px; }
.sys-test-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sys-test-phone { flex: 1 1 160px; max-width: 220px; }
/* Portal profile: new email address with its Send code button (candidate.js) */
.cr-email-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.cr-email-row input { flex: 1 1 220px; min-width: 0; }

/* A phone number that isn't right (phone-input.js) */
.phone-error { color: var(--danger-ink); font-size: 13px; margin: 4px 0 0; }
.phone-error[hidden] { display: none; }
input[aria-invalid="true"] { border-color: var(--danger) !important; }

/* An email address that isn't right, or a suggested fix (email-input.js) */
.email-note { color: var(--danger-ink); font-size: 13px; margin: 4px 0 0; }
.email-note.email-note-hint { color: var(--warn-ink); }
.email-note[hidden] { display: none; }
.email-note .link-button { font-size: 13px; font-weight: 600; }

/* People → Organisation chart (org-chart-admin.js): an indented tree, each level joined by lines */
.org-scroll { overflow-x: auto; padding: 4px 2px 12px; }
.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; }
.org-tree ul { margin-left: 22px; padding-left: 18px; border-left: 2px solid var(--brand-line); }
.org-tree li { position: relative; padding: 6px 0; }
.org-tree ul > li::before { content: ""; position: absolute; left: -18px; top: 28px; width: 16px; border-top: 2px solid var(--brand-line); }
.org-card { display: inline-flex; flex-direction: column; gap: 2px; min-width: 220px; max-width: 340px; padding: 9px 12px; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 10px; background: var(--card); box-shadow: var(--shadow); }
.org-card b { font-size: .95rem; }
.org-card span { font-size: .85rem; color: var(--ink-2); }
.org-card small { font-size: .78rem; color: var(--muted); }
.org-card .link-button { align-self: flex-start; margin-top: 2px; }
.org-card.org-top { border-left-color: var(--accent); }
.org-flag { font-style: normal; font-size: .78rem; color: var(--danger-ink); }
.org-note { font-style: normal; font-size: .78rem; color: var(--muted); }
.org-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.org-loose { display: flex; flex-wrap: wrap; gap: 10px; }
@media print {
  body.has-sidenav #tabs, .people-tabs, #btn-org-print, .org-card .link-button, .topbar { display: none !important; }
  .org-card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Reports → Overview charts (overview-charts.js) ----------
 * Series colours are the validated reference set (blue, orange, aqua), stepped separately for the dark
 * surface; checked with the dataviz palette validator against --card in both themes. Text never wears a
 * series colour: values and labels use the ink tokens, and the coloured mark beside them carries identity. */
:root {
  --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a;
  --viz-track: #cde2fb; --viz-grid: #e6e9ee; --viz-axis: #c3c8d0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-track: #1e3556; --viz-grid: #262e3a; --viz-axis: #3a4452; }
}
:root[data-theme="dark"] { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-track: #1e3556; --viz-grid: #262e3a; --viz-axis: #3a4452; }

.ov-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.ov-filters select { width: auto; }
.ov-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.ov-tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ov-tile span { display: block; font-size: .82rem; color: var(--muted); }
.ov-tile b { display: block; font-size: 1.6rem; font-weight: 600; color: var(--ink); margin-top: 2px; }
.ov-tile small { color: var(--muted); font-size: .78rem; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 14px; }
.ov-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; position: relative; }
.ov-card h3 { margin: 0 0 2px; font-size: 1rem; }
.ov-card .ov-sub { margin: 0 0 10px; font-size: .82rem; color: var(--muted); }
.ov-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--ink-2); margin-bottom: 8px; }
.ov-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ov-legend i.line { height: 2px; width: 16px; border-radius: 1px; vertical-align: 3px; }
.ov-svg { display: block; width: 100%; height: auto; overflow: visible; }
.ov-svg text { font: 11px system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--muted); font-variant-numeric: tabular-nums; }
.ov-svg text.ov-val { fill: var(--ink); font-weight: 600; }
.ov-svg .ov-hit:focus { outline: none; }
.ov-svg .ov-hit:focus-visible + .ov-mark, .ov-svg .ov-hit:hover + .ov-mark { opacity: .8; }
.ov-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 7px 10px; font-size: .8rem; min-width: 120px; }
.ov-tip .ov-tip-head { color: var(--muted); margin-bottom: 3px; }
.ov-tip .ov-tip-row { display: flex; align-items: center; gap: 6px; }
.ov-tip .ov-tip-row b { font-variant-numeric: tabular-nums; }
.ov-tip .ov-tip-row i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.ov-meters { display: grid; gap: 10px; }
.ov-meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; font-size: .85rem; }
.ov-meter .ov-bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--viz-track); overflow: hidden; }
.ov-meter .ov-bar i { display: block; height: 100%; border-radius: 4px; background: var(--viz-1); }
.ov-meter b { font-variant-numeric: tabular-nums; }
.ov-meter small { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; margin-top: -2px; }
.ov-rows { display: grid; gap: 9px; }
.ov-row { display: grid; grid-template-columns: minmax(90px, 32%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .85rem; }
.ov-row .ov-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ov-seg { display: flex; gap: 2px; height: 14px; }
.ov-seg span { display: block; height: 100%; min-width: 0; }
.ov-seg span:first-child { border-radius: 4px 0 0 4px; }
.ov-seg span:last-child { border-radius: 0 4px 4px 0; }
.ov-seg span:only-child { border-radius: 4px; }
.ov-seg span:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.ov-row .ov-count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.ov-table { margin-top: 10px; font-size: .82rem; }
.ov-table summary { cursor: pointer; color: var(--brand-text); }
.ov-table table { margin-top: 6px; }
.ov-empty { color: var(--muted); font-size: .9rem; padding: 18px 0; }
