/* EasyPaisa × Aqqal AI portal — design system.
   White and green, matched to the EasyPaisa brand. IBM Plex Sans (OFL), Lucide icons (ISC).
   No inline styles anywhere: the Content-Security-Policy allows only this file. */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin.d28498895ed7.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;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-ext.d313794bd9fd.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* Brand. --brand is EasyPaisa green for accents; text and buttons use the darker steps (WCAG AA). */
  --brand: #00a651;
  --brand-strong: #00843d;
  --brand-deep: #006b35;
  --brand-darker: #00532a;
  --brand-50: #effaf3;
  --brand-100: #d9f3e3;
  --brand-200: #b3e6c7;

  /* Neutrals with a hint of green. */
  --ink: #0f2419;
  --text: #1f2a24;
  --text-2: #475750;
  --muted: #5f6f67;
  --line: #e2ebe5;
  --line-strong: #cbd9d0;
  --bg: #f4f8f5;
  --surface: #ffffff;
  --surface-2: #f8fbf9;

  /* Status. */
  --warn: #b45309;
  --warn-bg: #fff7e6;
  --warn-line: #f2d39b;
  --danger: #b91c1c;
  --danger-bg: #fdecec;
  --danger-line: #f3c4c4;
  --na: #475569;

  --focus: #00532a;
  --ring: 0 0 0 4px rgba(0, 132, 61, 0.18);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 36, 25, 0.05), 0 1px 3px rgba(15, 36, 25, 0.04);
  --shadow-md: 0 2px 4px rgba(15, 36, 25, 0.04), 0 8px 24px rgba(15, 36, 25, 0.07);
  --shadow-lg: 0 6px 12px rgba(15, 36, 25, 0.06), 0 18px 44px rgba(15, 36, 25, 0.12);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --header-h: 68px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 20px); scroll-padding-bottom: 110px; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0 0 0.5rem; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 30px; letter-spacing: -0.02em; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 0.75rem; }
a { color: var(--brand-deep); text-underline-offset: 3px; }
a:hover { color: var(--brand-darker); }
img, svg { display: block; }
.icon { flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--brand-100); color: var(--ink); }

.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; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--r-sm); background: var(--ink); color: #fff; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; color: #fff; }
.muted { color: var(--muted); }
.strong { font-weight: 600; color: var(--ink); }
.right { text-align: right; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 28px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.5) blur(10px); -webkit-backdrop-filter: saturate(1.5) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 32px; min-height: var(--header-h); }
/* Aqqal AI logo, then the client's name. */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand:hover { color: var(--ink); }
.brand-logo { height: 28px; width: auto; }
.brand-logo-lg { height: 34px; }
.brand-x { color: var(--muted); font-size: 17px; font-weight: 400; line-height: 1; }
.brand-ep { font-size: 19px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; color: var(--brand-strong); }
.brand-on-dark .brand-ep { color: #fff; font-size: 22px; }
.brand-on-dark .brand-x { color: rgba(255, 255, 255, 0.7); font-size: 19px; }

/* When the links do not fit, the nav scrolls sideways; a soft shade at either edge shows there is more. */
.main-nav {
  position: relative; display: flex; align-self: stretch; gap: 2px; overflow-x: auto; scrollbar-width: none;
  background:
    linear-gradient(to right, var(--surface) 40%, rgba(255, 255, 255, 0)) left / 28px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 40%, rgba(255, 255, 255, 0)) right / 28px 100% no-repeat local,
    linear-gradient(to right, rgba(15, 36, 25, 0.14), rgba(15, 36, 25, 0)) left / 14px 100% no-repeat scroll,
    linear-gradient(to left, rgba(15, 36, 25, 0.14), rgba(15, 36, 25, 0)) right / 14px 100% no-repeat scroll;
}
.main-nav::-webkit-scrollbar { display: none; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 0 11px; white-space: nowrap;
  color: var(--text-2); font-size: 15px; font-weight: 500; text-decoration: none; transition: color 0.15s;
}
.nav-link:hover { color: var(--ink); }
.nav-link.is-active { color: var(--brand-deep); font-weight: 600; }
.nav-link.is-active::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand);
}
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: none; }
.avatar {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--brand-100); color: var(--brand-deep); font-weight: 700; font-size: 14px; letter-spacing: 0.02em;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12.5px; }
.account-text { display: flex; flex-direction: column; line-height: 1.25; }
.account-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.account-org { font-size: 12.5px; color: var(--muted); }
.signout { margin: 0; }
/* Staff have extra links: the avatar alone identifies them, and Sign out is an icon (its name is still read out). */
.has-staff-nav { gap: 24px; }
.has-staff-nav .account-text { display: none; }
.has-staff-nav .signout-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-main { flex: 1; padding: 28px 0 56px; outline: none; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; font-size: 13.5px; color: var(--muted); }
.footer-inner span { display: inline-flex; align-items: center; gap: 7px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-2); border-color: #b5c7bc; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; box-shadow: 0 1px 2px rgba(0, 83, 42, 0.3); }
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); border-color: transparent; color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 14px; border-radius: 9px; }
.btn-lg { min-height: 52px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.stack { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > label { font-size: 14px; font-weight: 600; color: var(--ink); }
.label-hint { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="search"], textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 15.5px;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
textarea { line-height: 1.55; resize: vertical; min-height: 84px; }
input:hover, textarea:hover { border-color: #afc3b7; }
input:focus, textarea:focus { outline: none; border-color: var(--brand-strong); box-shadow: var(--ring); }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 44px; }
.input-icon.has-toggle input { padding-right: 52px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
  width: 42px; height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { background: var(--bg); color: var(--ink); }
.pw-toggle .when-shown, .pw-toggle[aria-pressed="true"] .when-hidden { display: none; }
.pw-toggle[aria-pressed="true"] .when-shown { display: block; }
.field-errors { display: grid; gap: 4px; }
.field-error { display: flex; align-items: flex-start; gap: 6px; margin: 0; color: var(--danger); font-size: 13.5px; }
.field-error .icon { margin-top: 3px; }
.checkbox {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; cursor: pointer;
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--r-md);
}
.checkbox input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand-strong); cursor: pointer; }
.rules { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.rules li { display: flex; align-items: center; gap: 8px; }
.rules .icon { color: var(--brand-strong); }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; margin-bottom: 18px; border: 1px solid; border-radius: var(--r-md); font-size: 14.5px; }
.alert p { margin: 0; }
.alert .icon { margin-top: 2px; }
.alert-success { background: #ecf9f1; border-color: #bfe6cd; color: #064e2b; }
.alert-info { background: #eef4ff; border-color: #c9d8fb; color: #1e3a8a; }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-line); color: #7c2d12; }
.alert-error { background: var(--danger-bg); border-color: var(--danger-line); color: #7f1d1d; }
/* Appears only if app.js has not removed it 6 s after it is shown: the page never finished loading. */
.js-pending { animation: js-pending-reveal 0s 6s both; }
@keyframes js-pending-reveal {
  from { visibility: hidden; max-height: 0; margin: 0; padding-top: 0; padding-bottom: 0; border-width: 0; overflow: hidden; }
  to { visibility: visible; }
}

/* ---------- Chips, badges, pills ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap; background: #eef2ef; color: var(--text-2);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-plain::before { display: none; }
.chip-not_started { background: #eef2ef; color: #4a5a52; }
.chip-in_progress { background: #fef3c7; color: #92400e; }
.chip-submitted { background: #e3f6ea; color: #00602f; }
.kind-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--brand-deep); background: var(--brand-50); border: 1px solid var(--brand-100);
}
.score-badge {
  display: inline-flex; justify-content: center; min-width: 56px; padding: 4px 10px; border-radius: 999px;
  font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.band-good { background: #e3f6ea; color: #00602f; }
.band-fair { background: #fef3c7; color: #92400e; }
.band-poor { background: #fee2e2; color: #991b1b; }
.band-none { background: #eef2ef; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 700; }
.pill-yes { background: #e3f6ea; color: #00602f; }
.pill-partial { background: #fef3c7; color: #92400e; }
.pill-no { background: #fee2e2; color: #991b1b; }
.pill-na { background: #e9edf2; color: #334155; }
.pill-none { background: #eef2ef; color: var(--muted); }

/* ---------- Progress ---------- */
.progress {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 999px;
  overflow: hidden; background: var(--brand-100); color: var(--brand);
}
.progress::-webkit-progress-bar { background: var(--brand-100); border-radius: 999px; }
.progress::-webkit-progress-value { background: linear-gradient(90deg, var(--brand-strong), var(--brand)); border-radius: 999px; transition: width 0.35s var(--ease); }
.progress::-moz-progress-bar { background: linear-gradient(90deg, var(--brand-strong), var(--brand)); border-radius: 999px; }
.progress-sm { height: 6px; }
.progress-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 7px; font-size: 13.5px; color: var(--text-2); }
.progress-meta strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.donut { position: relative; display: grid; place-items: center; width: 132px; height: 132px; flex: none; }
.donut-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.donut-track { fill: none; stroke: var(--brand-100); stroke-width: 3.4; }
.donut-value { fill: none; stroke: var(--brand-strong); stroke-width: 3.4; stroke-linecap: round; }
.donut-label { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.donut-label strong { font-size: 29px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.donut-label small { margin-top: 5px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.donut-on-dark .donut-track { stroke: rgba(255, 255, 255, 0.22); }
.donut-on-dark .donut-value { stroke: #fff; }
.donut-on-dark .donut-label strong { color: #fff; }
.donut-on-dark .donut-label small { color: rgba(255, 255, 255, 0.85); }

/* ---------- Cards and sections ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
fieldset.card { min-width: 0; margin: 0; }
.card-pad { padding: 24px; }
.card-title { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 18px; }
.card-title .icon { color: var(--brand-strong); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 0 0 16px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); }
.eyebrow { display: inline-block; margin-bottom: 10px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-deep); }
.eyebrow-on-dark { color: rgba(255, 255, 255, 0.85); }
.lead { font-size: 17.5px; color: var(--text-2); }
.meta { color: var(--muted); font-size: 14.5px; margin: 0; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 16px; text-align: center; color: var(--muted); }
.empty .icon { color: var(--brand-200); }
.empty p { margin: 0; max-width: 36ch; }

/* ---------- Homepage ---------- */
.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 36px;
  margin: 4px 0 36px; padding: 40px 44px; border-radius: var(--r-xl); color: #fff; box-shadow: var(--shadow-md);
  background:
    radial-gradient(760px 340px at 105% -10%, rgba(0, 166, 81, 0.75), transparent 62%),
    linear-gradient(135deg, #004d27 0%, #006b35 48%, #00843d 100%);
}
.hero::after {
  content: ""; position: absolute; right: -90px; bottom: -150px; width: 380px; height: 380px; border-radius: 50%;
  border: 56px solid rgba(255, 255, 255, 0.06); pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: 34px; margin-bottom: 10px; }
.hero p { color: rgba(255, 255, 255, 0.9); max-width: 62ch; margin: 0; font-size: 16.5px; }
.hero-stats { display: flex; align-items: center; gap: 28px; padding: 18px 24px; border-radius: var(--r-lg); background: rgba(0, 0, 0, 0.14); border: 1px solid rgba(255, 255, 255, 0.14); }
.hero-kpis { display: grid; gap: 14px; margin: 0; }
.hero-kpis dt { font-size: 13px; color: rgba(255, 255, 255, 0.82); }
.hero-kpis dd { margin: 0; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-kpis dd span { font-size: 15px; font-weight: 500; opacity: 0.8; }

.ws-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.ws-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 16px; padding: 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-sm);
  color: var(--text); text-decoration: none;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s;
}
.ws-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--brand-strong), var(--brand)); }
.ws-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--brand-200); color: var(--text); }
.ws-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.ws-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.ws-icon {
  display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 15px;
  background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-strong);
}
.ws-step { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; color: var(--brand-200); font-variant-numeric: tabular-nums; }
.ws-title { margin: 0; font-size: 22px; }
.ws-charter { margin: -8px 0 0; color: var(--text-2); }
.ws-sections { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 14.5px; }
.ws-sections li { display: flex; align-items: flex-start; gap: 9px; color: var(--text-2); }
.ws-sections .icon { margin-top: 3px; }
.state-submitted .icon { color: var(--brand-strong); }
.state-in_progress .icon { color: var(--warn); }
.state-not_started .icon { color: #9fb3a7; }
.ws-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.ws-open { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--brand-deep); }
.ws-open .icon { transition: transform 0.2s var(--ease); }
.ws-card:hover .ws-open .icon { transform: translateX(4px); }

.home-lower { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; gap: 22px; margin-top: 30px; }
.steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.steps-list li { display: flex; gap: 14px; }
.steps-list strong { display: block; color: var(--ink); }
.steps-list p { margin: 2px 0 0; color: var(--text-2); font-size: 14.5px; }
.step-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-50); color: var(--brand-strong); flex: none; }
.activity-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.activity-list li { display: flex; gap: 12px; }
.activity-list p { margin: 0; font-size: 14.5px; color: var(--text-2); }
.activity-list p strong { color: var(--ink); font-weight: 600; }
.activity-list time { font-size: 12.5px; color: var(--muted); }

/* ---------- Breadcrumb and page heads ---------- */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-deep); text-decoration: underline; }
.breadcrumb .icon { color: #a7b8ae; }
.page-hero {
  display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(240px, 320px); align-items: center; gap: 22px;
  margin-bottom: 26px; padding: 28px 30px; border: 1px solid var(--brand-100); border-radius: var(--r-xl);
  background: linear-gradient(180deg, var(--brand-50) 0%, var(--surface) 100%);
}
.page-hero-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--brand-strong); color: #fff; box-shadow: 0 6px 18px rgba(0, 132, 61, 0.3); }
.page-hero h1 { margin: 0 0 4px; }
.page-hero .lead { margin: 0; }
.page-hero .muted { margin: 6px 0 0; font-size: 14.5px; }
.page-hero-progress { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }

.section-card { padding: 26px; margin-bottom: 22px; }
.section-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.section-card h2 { margin: 12px 0 4px; font-size: 21px; }
.section-intro { margin: 14px 0 0; color: var(--text-2); max-width: 75ch; }
.section-card-foot { display: flex; align-items: flex-end; gap: 22px; margin-top: 20px; }
.section-progress { flex: 1; }
.start-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.start-form .field { flex: 1 1 340px; }

/* ---------- Tables ---------- */
/* position: relative keeps absolutely positioned screen-reader text inside the scroll box. */
.table-wrap { position: relative; overflow-x: auto; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--r-md); }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  padding: 11px 14px; text-align: left; white-space: nowrap; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot th, .table tfoot td { background: var(--surface-2); border-top: 2px solid var(--line-strong); color: var(--ink); font-size: 14.5px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.progress-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.progress-cell .progress { width: 110px; }
.progress-cell span { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.actions-cell { text-align: right; white-space: nowrap; }
.actions-cell .btn + .btn { margin-left: 6px; }

/* ---------- Questionnaire ---------- */
.form-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.form-hero h1 { margin: 12px 0 6px; font-size: 29px; }
.form-hero .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.form-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.q-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 30px; align-items: start; }
.q-sidebar { position: sticky; top: calc(var(--header-h) + 20px); }
.q-sidebar-inner { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.q-nav { list-style: none; margin: 16px -6px; padding: 0; display: grid; gap: 2px; }
.q-nav a, .q-nav button {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 10px; color: var(--text); font-size: 14.5px; text-decoration: none; transition: background-color 0.15s;
}
/* The page list is made of submit buttons (moving saves the page first) that look like the links they replace. */
.q-nav button { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.q-nav a:hover, .q-nav button:hover { background: var(--brand-50); color: var(--ink); }
.q-nav .is-current button { background: var(--brand-50); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-strong); }
.q-nav-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2);
}
.q-nav .when-complete { display: none; color: var(--brand-strong); }
.q-nav .is-complete .when-complete { display: block; }
.q-nav .is-complete .when-open { display: none; }
.q-nav-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.answer-key { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.key-item { display: flex; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13.5px; color: var(--text-2); }
.key-item strong { display: block; color: var(--ink); font-size: 14px; }
.key-item .icon { margin-top: 2px; }
.key-yes .icon { color: var(--brand-strong); }
.key-partial .icon { color: var(--warn); }
.key-no .icon { color: var(--danger); }
.key-na .icon { color: var(--na); }
.key-note { display: flex; align-items: center; gap: 8px; margin: 0 0 22px; font-size: 13.5px; color: var(--muted); }
.lead-sm { color: var(--text-2); max-width: 75ch; }

.header-card { margin: 0 0 28px; padding: 22px 24px 24px; }
.card-legend { padding: 0 6px; margin-left: -6px; font-size: 16px; font-weight: 700; color: var(--ink); }
.header-grid { display: grid; grid-template-columns: 2fr 2fr 1.3fr; gap: 16px; margin-top: 10px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; }
.facts dt { font-size: 12.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-weight: 600; color: var(--ink); }

.area { margin-bottom: 30px; }
.area-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 6px 0 16px; padding-bottom: 12px; border-bottom: 2px solid var(--brand-100); }
.area-index { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-deep); }
.area-head h2, .area-head h3 { margin: 3px 0 0; font-size: 22px; }
.area-note { display: flex; align-items: center; gap: 9px; margin: -4px 0 16px; padding: 11px 14px; border: 1px solid var(--brand-100); border-radius: var(--r-md); background: var(--brand-50); font-size: 14px; color: var(--text-2); }
.area-note .icon { color: var(--brand-strong); }

.question {
  margin-bottom: 14px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); transition: border-color 0.2s, box-shadow 0.2s;
}
.question:focus-within { border-color: var(--brand-200); box-shadow: 0 0 0 4px var(--brand-50), var(--shadow-sm); }
.question.is-dirty { border-color: var(--warn-line); }
.question.has-conflict, .header-card.has-conflict { border-color: var(--danger-line); box-shadow: 0 0 0 4px var(--danger-bg); }
.q-head { display: flex; gap: 14px; }
.q-num {
  flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-deep); font-size: 14px; font-weight: 700;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.question.is-answered .q-num { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.q-body { min-width: 0; }
.q-text { margin: 5px 0 0; font-size: 16.5px; font-weight: 600; line-height: 1.45; color: var(--ink); }
.q-help { margin: 6px 0 0; font-size: 14.5px; color: var(--text-2); }
.question .notes { margin-top: 14px; }
.notes > label { font-size: 13.5px; color: var(--text-2); }
.q-foot { display: flex; justify-content: space-between; gap: 12px; min-height: 1.3em; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.q-count { font-variant-numeric: tabular-nums; }

.segmented { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0 0; padding: 0; border: 0; min-width: 0; }
.seg { position: relative; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 17px; border: 1.5px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--text); font-size: 14.5px; font-weight: 600;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.seg span .icon { color: var(--muted); transition: color 0.15s; }
.seg:hover span { border-color: var(--brand-strong); background: var(--brand-50); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg input:checked + span, .seg input:checked + span .icon { color: #fff; }
.seg-yes input:checked + span { background: var(--brand-strong); border-color: var(--brand-strong); }
.seg-partial input:checked + span { background: var(--warn); border-color: var(--warn); }
.seg-no input:checked + span { background: var(--danger); border-color: var(--danger); }
.seg-na input:checked + span { background: var(--na); border-color: var(--na); }

.answer-view { display: grid; gap: 10px; margin-top: 14px; }
.answer-text { padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); overflow-wrap: anywhere; }
/* Scored answers: what the notes still need before the questionnaire can be submitted. */
.q-need, .answer-missing { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--warn); }
.answer-missing { margin: 0; }
.question.needs-note .notes textarea { border-color: var(--warn-line); }
.q-edit { flex: none; margin-left: auto; align-self: flex-start; }
.review-answers { margin: 28px 0; }

.conflict { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--danger-line); border-radius: var(--r-md); background: var(--danger-bg); color: #7f1d1d; font-size: 14px; }
.conflict p { margin: 0 0 8px; }
.conflict .btn { margin: 0 8px 0 0; }

.actionbar {
  position: sticky; bottom: 16px; z-index: 40; display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 12px 14px 12px 18px;
  background: rgba(255, 255, 255, 0.97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 12px 34px rgba(15, 36, 25, 0.16);
}
.spacer { flex: 1; }
.page-of { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-deep); }
.save-state { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.ss-icon { display: none; }
.save-state[data-state="saved"] { color: var(--brand-deep); }
/* Before app.js runs: no claim either way; after 6 s its warning shows (.js-pending). */
.save-state[data-state="pending"] { color: var(--warn); }
.save-state[data-state="saved"] .ss-saved,
.save-state[data-state="saving"] .ss-saving,
.save-state[data-state="dirty"] .ss-dirty,
.save-state[data-state="error"] .ss-error { display: inline-flex; }
.save-state[data-state="dirty"] { color: var(--warn); }
.save-state[data-state="error"] { color: var(--danger); }
.save-state[data-state="saving"] .ss-saving .icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Review ---------- */
.score-overview { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 34px; margin-bottom: 22px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; margin: 0; }
.kpis > div { padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.kpis dt { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.kpis dd { margin: 4px 0 0; font-size: 25px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpis dd span { font-size: 15px; font-weight: 500; color: var(--muted); }
.issues-card { margin-bottom: 22px; border-left: 4px solid var(--brand-200); }
.issues-warn { border-left-color: var(--warn); background: #fffcf5; }
.issues-warn .card-title .icon { color: var(--warn); }
.issues { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.issues a { color: var(--text); }
.issues a:hover { color: var(--brand-deep); }
.submit-card .actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.score-note { margin: 14px 0 0; font-size: 13.5px; color: var(--muted); }

/* ---------- Staff overview ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.kpi-card { display: flex; align-items: center; gap: 16px; padding: 20px 22px; }
.kpi-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--brand-50); color: var(--brand-strong); flex: none; }
.kpi-card dt { font-size: 13px; color: var(--muted); }
.kpi-card dd { margin: 2px 0 0; font-size: 27px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Sign-in pages ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(900px 520px at -15% -20%, rgba(255, 255, 255, 0.13), transparent 60%),
    radial-gradient(700px 520px at 115% 115%, rgba(0, 166, 81, 0.7), transparent 60%),
    linear-gradient(155deg, #004d27 0%, #006b35 50%, #00843d 100%);
}
.auth-brand::before, .auth-brand::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.auth-brand::before { right: -140px; top: 18%; width: 420px; height: 420px; border: 70px solid rgba(255, 255, 255, 0.05); }
.auth-brand::after { left: -90px; bottom: -110px; width: 300px; height: 300px; border: 46px solid rgba(255, 255, 255, 0.05); }
.auth-brand-inner { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; height: 100%; padding: 52px 60px; }
.auth-headline { margin: 0 0 16px; max-width: 16ch; font-size: 40px; line-height: 1.12; color: #fff; letter-spacing: -0.025em; }
.auth-lead { max-width: 44ch; margin: 0; font-size: 17.5px; color: rgba(255, 255, 255, 0.9); }
.auth-trust { list-style: none; margin: 0; padding: 22px 0 0; display: grid; gap: 12px; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.auth-trust li { display: flex; align-items: center; gap: 11px; font-size: 14.5px; color: rgba(255, 255, 255, 0.92); }
.auth-trust .icon { color: #8ff0b7; }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 28px; padding: 48px 28px; background: var(--surface); outline: none; }
.auth-card { width: 100%; max-width: 420px; }
.auth-title { margin: 0 0 8px; font-size: 30px; }
.auth-sub { margin: 0 0 26px; color: var(--text-2); }
.auth-help { display: flex; gap: 10px; margin-top: 22px; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.auth-help p { margin: 0; }
.auth-help .icon { color: var(--brand-strong); margin-top: 2px; }
.auth-footer { margin: 0; font-size: 13px; color: var(--muted); }
.state-icon { display: inline-grid; place-items: center; width: 60px; height: 60px; margin-bottom: 20px; border-radius: 18px; background: var(--brand-50); color: var(--brand-strong); }
.state-icon.warn { background: var(--warn-bg); color: var(--warn); }
.state-icon.danger { background: var(--danger-bg); color: var(--danger); }
.state-card { max-width: 560px; margin: 40px auto; padding: 36px; text-align: left; }
.state-card .btn { margin-top: 8px; }

/* ---------- Selects and read-only fields ---------- */
select {
  -webkit-appearance: none; appearance: none; width: 100%; min-height: 46px; padding: 10px 42px 10px 14px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 11px; color: var(--text); font: inherit; font-size: 15.5px;
  background: var(--surface) url("chevron-down.dc91be2d81b8.svg") no-repeat right 14px center / 18px 18px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:hover { border-color: #afc3b7; }
select:focus { outline: none; border-color: var(--brand-strong); box-shadow: var(--ring); }
input[readonly] { background: var(--surface-2); color: var(--text-2); }

/* ---------- Admin console ---------- */
.console-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.console-head h1 { margin: 12px 0 6px; font-size: 29px; }
.console-head .meta { margin: 0; }
.console-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.person-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.tabs { position: relative; display: flex; gap: 4px; margin: 0 0 24px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; white-space: nowrap; color: var(--text-2); font-size: 15px; font-weight: 500; text-decoration: none; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-deep); font-weight: 600; }
.tab.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.tab-end { margin-left: auto; }

.stat-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.stat {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none;
}
.stat strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.stat:hover { border-color: var(--brand-200); color: var(--ink); }
.stat.is-active { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-deep); }
.stat .dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.stat-active .dot { background: var(--brand-strong); }
.stat-invited .dot { background: #2563eb; }
.stat-locked .dot { background: var(--danger); }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 18px; padding: 16px 18px; }
.filters .field { min-width: 200px; }
.filters .grow { flex: 1 1 260px; }
.filters-actions { display: flex; gap: 8px; }
.table-flush { margin-top: 0; border: 0; border-radius: var(--r-lg); }
.person-cell { display: flex; align-items: center; gap: 12px; }
.person-name { display: block; font-weight: 600; color: var(--ink); text-decoration: none; }
.person-name:hover { color: var(--brand-deep); text-decoration: underline; }
.person-email, .cell-sub { display: block; font-size: 13px; color: var(--muted); }
.cell-break { max-width: 300px; overflow-wrap: anywhere; }
.avatar-square { border-radius: 10px; }
.chip-status-active { background: #e3f6ea; color: #00602f; }
.chip-status-invited { background: #e8efff; color: #1e40af; }
.chip-status-locked { background: #fee2e2; color: #991b1b; }
.chip-status-deactivated { background: #eef1f4; color: #475569; }
.event { font-weight: 500; color: var(--ink); }

.form-card { display: grid; gap: 18px; align-content: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.role-picker { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.role-picker legend { margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.role-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.role-option {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; cursor: pointer; background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md); transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.role-option:hover { border-color: var(--brand-200); }
.role-option input { flex: none; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--brand-strong); }
.role-option:has(input:checked) { border-color: var(--brand-strong); background: var(--brand-50); box-shadow: var(--ring); }
.role-option:has(input:disabled) { cursor: not-allowed; }
.role-text strong { display: block; font-size: 15px; color: var(--ink); }
.role-text small { display: block; margin-top: 2px; font-size: 13px; line-height: 1.45; color: var(--text-2); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; gap: 22px; }
.detail-grid-wide { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.detail-grid .role-options { grid-template-columns: 1fr; }
.facts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; }
.action-list { list-style: none; display: grid; margin: 10px 0 0; padding: 0; }
.action-list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.action-list strong { font-size: 15px; color: var(--ink); }
.action-list p { margin: 2px 0 0; font-size: 13.5px; color: var(--text-2); }
.action-list form { flex: none; margin: 0; }
.btn-danger { color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: #7f1d1d; }
.history-list { list-style: none; display: grid; gap: 10px; margin: 0; padding: 0; font-size: 14px; }
.history-list li { display: flex; justify-content: space-between; gap: 12px; }
.history-list time { flex: none; font-size: 12.5px; color: var(--muted); }

.link-card { max-width: 780px; }
.link-card h2 { margin: 0 0 8px; }
.link-box { display: flex; gap: 10px; margin: 20px 0 12px; }
.link-box input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.link-card .meta { display: flex; align-items: center; gap: 8px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 14px; border-top: 1px solid var(--line); }
.alert-with-action { align-items: center; }
.alert-with-action p { flex: 1; }
.alert-with-action form { flex: none; margin: 0; }

/* ---------- Motion and print ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .q-sidebar, .actionbar, .form-hero-actions, .breadcrumb, .skip-link, .submit-card, .btn { display: none !important; }
  body { background: #fff; }
  .site-main { padding: 0; }
  .q-layout { display: block; }
  .card, .question, .kpis > div { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Responsive ---------- */
/* The nav moves to its own full-width row once brand, links and account no longer fit on one line.
   Administrators have the most links, so their header switches earlier. */
@media (max-width: 1280px) {
  :root:has(.has-admin-nav) { --header-h: 107px; }
  .has-admin-nav.header-inner { flex-wrap: wrap; gap: 0 12px; min-height: 0; padding-top: 12px; }
  .has-admin-nav .main-nav { order: 3; width: calc(100% + 56px); margin: 8px -28px 0; padding: 0 20px; min-height: 48px; border-top: 1px solid var(--line); }
}
@media (max-width: 1200px) {
  :root { --header-h: 107px; }
  .header-inner { flex-wrap: wrap; gap: 0 12px; min-height: 0; padding-top: 12px; }
  .main-nav { order: 3; width: calc(100% + 56px); margin: 8px -28px 0; padding: 0 20px; min-height: 48px; border-top: 1px solid var(--line); }
}
@media (max-width: 1180px) {
  .ws-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer-key { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .detail-grid, .detail-grid-wide { grid-template-columns: minmax(0, 1fr); }
  .role-options { grid-template-columns: minmax(0, 1fr); }
  .q-layout { grid-template-columns: minmax(0, 1fr); }
  .q-sidebar { position: static; }
  .account-text { display: none; }
  .page-hero { grid-template-columns: auto minmax(0, 1fr); }
  .page-hero-progress { grid-column: 1 / -1; }
  .hero { grid-template-columns: 1fr; }
  .hero-stats { justify-self: start; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand-inner { padding: 30px 28px; gap: 24px; }
  .auth-headline { font-size: 30px; max-width: 22ch; }
  .auth-trust { display: none; }
}
@media (max-width: 760px) {
  .container { padding: 0 16px; }
  .header-inner { padding-top: 12px; }
  .brand-logo { height: 23px; }
  .brand-ep { font-size: 16.5px; }
  .brand { gap: 8px; }
  .main-nav, .has-admin-nav .main-nav { width: calc(100% + 32px); margin: 8px -16px 0; padding: 0 8px; }
  .signout-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html { scroll-padding-bottom: 140px; }
  h1, .form-hero h1, .hero h1 { font-size: 26px; }
  .site-main { padding-top: 20px; }
  .hero { padding: 26px 22px; gap: 22px; }
  .hero-stats { flex-wrap: wrap; width: 100%; }
  .ws-grid, .home-lower, .header-grid, .facts, .answer-key { grid-template-columns: 1fr; }
  .score-overview { grid-template-columns: 1fr; justify-items: start; }
  .score-overview .kpis { justify-self: stretch; }
  .section-card, .card-pad, .question { padding: 18px; }
  .section-card-foot { flex-direction: column; align-items: stretch; }
  .page-hero { padding: 20px; }
  .actionbar { bottom: 8px; flex-wrap: wrap; }
  .actionbar .spacer { display: none; }
  .actionbar .save-state { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr; }
  .seg span { padding: 0 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .filters .field { min-width: 0; width: 100%; }
  .link-box { flex-direction: column; }
  .tab-end { margin-left: 0; }
  .action-list li { flex-direction: column; align-items: flex-start; }
}
/* Short screens (a phone held sideways, a desktop zoomed to 200 % or more): nothing sticks, so the
   header and the save bar never cover the field being edited. */
@media (max-height: 560px) {
  .site-header, .actionbar { position: static; }
  html { scroll-padding: 20px 0; }
}
/* Narrow phones: the two-row header scrolls away with the page; the save bar stays. */
@media (max-width: 400px) {
  .site-header { position: static; }
  html { scroll-padding-top: 20px; }
}
