/* ASCENTIUM CBT - one hand-written stylesheet. System fonts, CSS variables, no external requests.
   The organisation colour (--primary & friends) is injected by brand_css() in the page head. */

:root {
  --primary: #1d4ed8; --primary-hover: #1943b8; --primary-ink: #1d4ed8; --primary-soft: #e8eefc; --on-primary: #ffffff;
  --primary-2: #6d3fd9; --primary-glow: rgba(29, 78, 216, .35);
  --brand-deep: #0f1f4d; --brand-deeper: #0a1433; --hero-1: #0f1f4d; --hero-2: #1d4ed8; --hero-3: #6d3fd9;

  --bg: #f3f5fb; --surface: #ffffff; --surface-2: #eef1f8; --text: #172033; --muted: #5a6479;
  --border: #e1e6f0; --border-strong: #c9d0df; --focus: #2563eb;
  --ok: #166534; --ok-bg: #e3f6ea; --ok-border: #b3e2c3;
  --warn: #92400e; --warn-bg: #fef2d6; --warn-border: #f5d58f;
  --err: #b91c1c; --err-bg: #fde8e8; --err-border: #f3b4b4;
  --info: #1e40af; --info-bg: #e6eefe; --info-border: #b9cdf6;

  --radius: 14px; --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 10px rgba(16, 24, 40, .05);
  --shadow-2: 0 6px 12px -4px rgba(16, 24, 40, .10), 0 18px 38px -8px rgba(16, 24, 40, .16);
  --gutter: 16px; --sidebar-w: 264px; --topbar-h: 62px;

  /* z-index scale: sticky bars < nav < overlay < modal < toast, so nothing covers a dialog */
  --z-sticky: 100; --z-nav: 200; --z-overlay: 900; --z-modal: 1000; --z-toast: 1100;

  /* "CBT Sans" is an optional font file the owner can drop into assets/fonts/ (see brand_css); the rest are the best faces each device already has. */
  --font: "CBT Sans", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "CBT Sans", "Inter", "Segoe UI Variable Display", "Segoe UI Semibold", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c1018; --surface: #151a26; --surface-2: #1e2535; --text: #e8ebf3; --muted: #a2abc0;
  --border: #283046; --border-strong: #39435f; --focus: #7aa2ff;
  --ok: #7ee2a0; --ok-bg: #11301f; --ok-border: #245a3a;
  --warn: #f6c778; --warn-bg: #33270f; --warn-border: #5f4a1c;
  --err: #ff9d9d; --err-bg: #3a1717; --err-border: #6b2a2a;
  --info: #a9c3ff; --info-bg: #172342; --info-border: #2c427a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 12px 28px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); letter-spacing: -.003em; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: var(--z-toast); }
.skip-link:focus { left: 8px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.center { text-align: center; align-items: center; }
.right { text-align: right; }
.spacer { flex: 1 1 auto; }
.icon { flex: none; vertical-align: -4px; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-0 { display: block; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.section { margin-top: 16px; }

/* ---------- colour tones: one hue per area of the system, used on icon chips, the menu and the dashboard ---------- */
.t-blue { --tone: #2563eb; } .t-violet { --tone: #7c3aed; } .t-teal { --tone: #0d9488; } .t-amber { --tone: #d97706; } .t-rose { --tone: #e11d48; } .t-green { --tone: #16a34a; }
.t-sky { --tone: #0284c7; } .t-orange { --tone: #ea580c; } .t-pink { --tone: #db2777; } .t-indigo { --tone: #4f46e5; } .t-slate { --tone: #475569; }
.ico-chip { display: inline-flex; width: 46px; height: 46px; flex: none; align-items: center; justify-content: center; border-radius: 14px; color: var(--tone, var(--primary));
  background: rgba(100, 116, 139, .14); background: color-mix(in srgb, var(--tone, var(--primary)) 14%, var(--surface)); }
:root[data-theme="dark"] .ico-chip { color: color-mix(in srgb, var(--tone, var(--primary)) 60%, #ffffff); }
.ico-chip .icon { width: 23px; height: 23px; }
.ico-chip-sm { width: 36px; height: 36px; border-radius: 11px; }
.ico-chip-sm .icon { width: 19px; height: 19px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-h { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-h h2 { font-size: 16px; font-weight: 750; display: flex; align-items: center; gap: 9px; }
.card-h h2 .icon { color: var(--primary); }
.card-b { padding: 20px; }
.card-f { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.panel { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: var(--surface); }
.group-title { font-size: 12px; font-weight: 750; margin: 0 0 10px; display: flex; gap: 8px; align-items: center; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.stat-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 18px; font: inherit; font-weight: 650;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; line-height: 1.2;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06); transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s, filter .15s; }
.btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { color: var(--on-primary); background: var(--primary); background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; box-shadow: 0 8px 18px -8px var(--primary-glow); }
.btn-primary:hover { color: var(--on-primary); background: var(--primary); background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 12px 22px -8px var(--primary-glow); }
.btn-danger { color: #fff; background: #dc2626; border-color: #dc2626; box-shadow: 0 8px 18px -10px rgba(220, 38, 38, .7); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-sm { min-height: 32px; padding: 4px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: var(--radius-sm); cursor: pointer; transition: background-color .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-weight: 650; font-size: 14px; }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 10px 13px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; }
.textarea { resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); box-shadow: 0 0 0 5px rgba(37, 99, 235, .14); box-shadow: 0 0 0 5px color-mix(in srgb, var(--focus) 18%, transparent); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--surface-2); color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
.error-text { font-size: 13px; color: var(--err); font-weight: 600; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.checkbox input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--primary); }
.input-group { display: flex; gap: 6px; align-items: center; }
.input-group .input { flex: 1; }
.color-input { width: 46px; height: 44px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.pw-meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.pw-meter-bar { display: block; height: 100%; width: 0; background: var(--err); transition: width .2s, background .2s; }
.pw-meter[data-level="2"] .pw-meter-bar { background: #d97706; }
.pw-meter[data-level="3"] .pw-meter-bar { background: #65a30d; }
.pw-meter[data-level="4"] .pw-meter-bar { background: var(--ok); }
.logo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 4px; }

/* ---------- feedback ---------- */
.alert { padding: 13px 16px 13px 18px; border-radius: var(--radius-sm); border: 1px solid; border-left-width: 5px; font-size: 14px; }
.alert + .alert { margin-top: 8px; }
.alert-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); border-left-color: var(--ok); }
.alert-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); border-left-color: var(--warn); }
.alert-err { color: var(--err); background: var(--err-bg); border-color: var(--err-border); border-left-color: var(--err); }
.alert-info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); border-left-color: var(--info); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; font-size: 12px; font-weight: 700; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge-ok, .badge-warn, .badge-err { padding-left: 9px; }
.badge-ok::before, .badge-warn::before, .badge-err::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-warn { color: var(--warn); background: var(--warn-bg); }
.badge-err { color: var(--err); background: var(--err-bg); }
.badge-primary { color: var(--primary-ink); background: var(--primary-soft); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: var(--z-toast); max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-2); font-size: 14px; }
.empty { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; color: var(--primary); opacity: .55; }
.empty h3 { color: var(--text); }
.big-icon { display: inline-flex; width: 64px; height: 64px; align-items: center; justify-content: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); }
.big-icon.ok { background: var(--ok-bg); color: var(--ok); }
.big-icon .icon { width: 32px; height: 32px; }
.address-box { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 15px; word-break: break-all; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th { font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover { background: var(--surface-2); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.table tbody tr:last-child td { border-bottom: 0; }
.table.kv th { width: 38%; color: var(--muted); font-weight: 600; background: transparent; text-transform: none; font-size: 14px; letter-spacing: 0; position: static; }
.detail-cell { max-width: 320px; word-break: break-word; }
.pager { display: flex; align-items: center; gap: 8px; width: 100%; }
.filters .filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }
.filter-actions { flex-direction: row; gap: 8px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 11px 16px; font-weight: 650; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; text-decoration: none; border-radius: 8px 8px 0 0; }
.tab:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.tab.active { color: var(--primary-ink); border-bottom-color: var(--primary); }

/* ---------- staff shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; color: #e9edf9; background: var(--brand-deep); background: linear-gradient(185deg, var(--brand-deep), var(--brand-deeper)); display: flex; flex-direction: column; z-index: var(--z-nav); scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.sidebar-brand { display: flex; gap: 12px; align-items: center; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar-brand-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-family: var(--font-display); font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.sidebar-brand-text small { color: rgba(255, 255, 255, .6); font-size: 12px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; flex: none; background: #fff; padding: 2px; }
.brand-mono { display: inline-flex; width: 40px; height: 40px; flex: none; align-items: center; justify-content: center; border-radius: 12px; background: var(--primary); background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: var(--on-primary); font-family: var(--font-display); font-weight: 800; font-size: 19px; box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .5); }
.nav { padding: 8px 12px 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { padding: 16px 10px 6px; font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .58); }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 6px 10px 6px 7px; border-radius: 12px; color: rgba(255, 255, 255, .86); font-weight: 600; text-decoration: none; transition: background-color .15s, color .15s; }
.nav-ico { display: inline-flex; width: 32px; height: 32px; flex: none; align-items: center; justify-content: center; border-radius: 10px; color: #fff; background: rgba(255, 255, 255, .12); background: color-mix(in srgb, var(--tone, #fff) 40%, transparent); transition: background-color .15s, box-shadow .15s; }
.nav-item .icon { width: 18px; height: 18px; }
.nav-item:hover { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; }
.nav-item.active { background: #fff; color: var(--brand-deep); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .6); }
.nav-item.active .nav-ico { background: var(--tone, var(--primary)); box-shadow: 0 6px 14px -6px var(--tone, var(--primary)); }
.sidebar-foot { padding: 12px 18px 16px; border-top: 1px solid rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .62); }
.nav-scrim { display: none; }
.app-main { min-width: 0; display: flex; flex-direction: column; background: radial-gradient(900px 360px at 88% -120px, rgba(37, 99, 235, .09), transparent 70%); background: radial-gradient(900px 360px at 88% -120px, color-mix(in srgb, var(--primary) 11%, transparent), transparent 70%); }
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 3px var(--gutter) 0 20px; background-color: var(--surface); background-color: color-mix(in srgb, var(--surface) 90%, transparent); background-image: linear-gradient(90deg, var(--primary), var(--primary-2)); background-size: 100% 3px; background-repeat: no-repeat; backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-title { font-family: var(--font-display); font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { display: none; }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: inline; }
:root[data-theme="dark"] .theme-moon { display: none; }
.content { padding: 26px; max-width: 1240px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
.page-sub { color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px; border-radius: 99px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); }
.avatar { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; align-items: center; justify-content: center; background: var(--primary); background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: var(--on-primary); font-family: var(--font-display); font-weight: 800; box-shadow: 0 6px 14px -6px var(--primary-glow); }
.user-menu-name { display: flex; flex-direction: column; line-height: 1.15; font-weight: 650; font-size: 14px; }
.user-menu-name small { font-weight: 400; color: var(--muted); font-size: 12px; }
.user-menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); padding: 6px; z-index: var(--z-overlay); }
.user-menu-pop a, .user-menu-pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: none; font: inherit; color: var(--text); border-radius: 8px; cursor: pointer; text-decoration: none; }
.user-menu-pop a:hover, .user-menu-pop button:hover { background: var(--surface-2); }
.user-menu-pop .icon { color: var(--primary); }

/* ---------- sign-in / standalone pages ---------- */
body.auth { background: radial-gradient(1200px 500px at 50% -10%, var(--primary-soft), transparent 70%), var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px var(--gutter); gap: 14px; }
.auth-card { width: 100%; max-width: 420px; box-shadow: var(--shadow-2); }
.auth-wrap.wide .auth-card { max-width: 720px; }
.auth-brand { display: flex; gap: 14px; align-items: center; }
.auth-brand .brand-logo, .auth-brand .brand-mono { width: 52px; height: 52px; font-size: 24px; }
.auth-title { font-size: 20px; }

/* ---------- installer ---------- */
body.install-body { background: radial-gradient(1200px 520px at 50% -10%, var(--primary-soft), transparent 70%), var(--bg); }
.wizard { max-width: 820px; margin: 0 auto; padding: 28px var(--gutter) 40px; display: flex; flex-direction: column; gap: 20px; }
.wiz-brand { display: flex; gap: 12px; align-items: center; }
.wiz-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.wiz-brand small { color: var(--muted); }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-align: center; position: relative; }
.step::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step-dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); border: 2px solid var(--border-strong); font-weight: 700; }
.step-dot .icon { width: 16px; height: 16px; }
.step.done .step-dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.step.done::before, .step.current::before { background: var(--primary); }
.step.current .step-dot { border-color: var(--primary); color: var(--primary-ink); }
.step.current { color: var(--text); font-weight: 650; }
.wiz-card { overflow: hidden; }
.wiz-card > .alert { margin: 16px 20px 0; }
.wiz-actions { display: flex; gap: 10px; align-items: center; }
.card-b.wiz-actions { border-top: 0; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.check-item { display: flex; gap: 12px; align-items: flex-start; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.check-ico { display: inline-flex; width: 24px; height: 24px; flex: none; align-items: center; justify-content: center; border-radius: 50%; margin-top: 1px; }
.check-ico .icon { width: 14px; height: 14px; }
.check-item.ok .check-ico { background: var(--ok-bg); color: var(--ok); }
.check-item.warn .check-ico { background: var(--warn-bg); color: var(--warn); }
.check-item.fail .check-ico { background: var(--err-bg); color: var(--err); }
.check-item.fail { background: var(--err-bg); }
.check-text { min-width: 0; }
.fix { color: var(--muted); margin-top: 2px; }
.mode-cards { display: grid; gap: 12px; }
.mode-card { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.mode-card:hover { border-color: var(--border-strong); }
.mode-card input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); }
.mode-card.is-checked { border-color: var(--primary); background: var(--primary-soft); }
.mode-card-body { display: flex; flex-direction: column; gap: 2px; }
.mode-card-body small { color: var(--muted); font-size: 13px; }
.progress-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.progress-list li { display: flex; gap: 10px; align-items: center; font-size: 14px; padding: 4px 0; animation: fadein .25s ease both; }
.progress-list li.ok .icon { color: var(--ok); }
.progress-list li.fail { color: var(--err); }
.quick-start { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
@keyframes fadein { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 24, .55); display: flex; align-items: center; justify-content: center; padding: var(--gutter); z-index: var(--z-modal); }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-2); width: 100%; max-width: 440px; }
.modal-b { padding: 22px 22px 8px; }
.modal-b h2 { font-size: 18px; margin-bottom: 8px; }
.modal-f { padding: 16px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 86vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-2); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(10, 14, 24, .45); z-index: calc(var(--z-nav) - 1); }
  .nav-toggle { display: inline-flex; }
  .content { padding: 16px var(--gutter); }
  .user-menu-name { display: none; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .step-label { display: none; }
  .wiz-actions .btn { flex: 1; }
  .page-title { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- print ---------- */
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .btn, .icon-btn, .toasts, .stepper, .wiz-actions, .nav-scrim, .wiz-brand, .wiz-foot-note, .no-print { display: none !important; }
  .app { display: block; }
  .card, .panel { box-shadow: none; border-color: #999; }
  .content { padding: 0; max-width: none; }
  a { color: #000; }
}

/* =====================================================================================
   Phase 2: question bank, editor, exam editor, import, print, exam screen
   ===================================================================================== */

.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-edit { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.grow { flex: 1 1 auto; min-width: 0; }
.block { display: block; }
form.inline { display: inline; }
.crumbs { margin: 0 0 8px; color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
.check-col { width: 36px; }
.table-compact th, .table-compact td { padding: 8px 12px; }
.table-bank td { vertical-align: top; }
.badge-type { background: var(--primary-soft); color: var(--primary-ink); }
.input-sm, .select-sm { min-height: 34px; padding: 4px 10px; font-size: 14px; width: auto; }
.select-auto { width: auto; flex: 0 0 auto; }
.input-marks { width: 72px; min-height: 34px; padding: 4px 8px; text-align: right; }
.input-marks.is-saved { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.input-marks.is-bad { border-color: var(--err); }
tr.left-out, li.left-out { opacity: .6; }
tr.left-out .input-marks, li.left-out .input-marks { background: var(--warn-bg); border-color: var(--warn); }
.q-excerpt { font-weight: 550; color: var(--text); }
a.q-excerpt:hover { color: var(--primary-ink); }
.filters .field.grow { min-width: 220px; }
.filter-row .field { min-width: 130px; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.bulk-bar.has-selection { background: var(--primary-soft); }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); padding: 6px; z-index: var(--z-overlay); display: flex; flex-direction: column; }
.menu-pop a { padding: 9px 12px; border-radius: 6px; color: var(--text); text-decoration: none; }
.menu-pop a:hover { background: var(--surface-2); }
.sticky-actions { position: sticky; bottom: 0; z-index: var(--z-sticky); margin-top: 16px; box-shadow: 0 -4px 14px rgba(16, 24, 40, .08); }
.sticky-actions .card-f { border-radius: var(--radius); }
.btn-danger-text { color: var(--err); }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); } .err-text { color: var(--err); }
.hint.block { display: block; margin-top: 2px; font-weight: 400; }
.radio-line { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.rot-up { transform: rotate(90deg); }
.rot-down { transform: rotate(-90deg); }

/* picker */
.picker-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.picker-filters .input { flex: 1 1 180px; min-width: 140px; }
.picker-filters .select { width: auto; flex: 0 0 auto; max-width: 180px; }
.picker-foot { margin-top: 10px; }
.picker-wrap { padding-top: 12px; }
.add-questions > summary { cursor: pointer; list-style: none; display: inline-flex; }
.add-questions > summary::-webkit-details-marker { display: none; }
.summary-row .stat-value { font-size: 22px; }

/* sortable lists */
.sort-list { list-style: none; margin: 0; padding: 0; }
.sort-list > li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.sort-list > li:last-child { border-bottom: 0; }
.dragging { opacity: .5; background: var(--primary-soft); }
.drag { cursor: grab; color: var(--muted); user-select: none; letter-spacing: -2px; padding: 0 4px; }
.num-col { min-width: 22px; text-align: right; }
.marks-field { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.is-draft .q-excerpt { font-style: italic; }
.section-card .card-h .drag { margin-right: 4px; }

/* exam editor */
.mix-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mix-field { display: flex; flex-direction: column; gap: 2px; }
.mix-field .input { width: 72px; }
.pool-hint { font-size: 14px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.pool-hint:empty { display: none; }
.pool-hint.is-ok { background: var(--ok-bg); color: var(--ok); }
.pool-hint.is-bad { background: var(--err-bg); color: var(--err); }
.form-grid > [hidden], .form-grid[hidden] { display: none; }

/* import */
.import-table td, .import-table th { vertical-align: top; }
.status-ico { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; }
.status-ico .icon { width: 13px; height: 13px; }
.status-ok { background: var(--ok-bg); color: var(--ok); } .status-warn { background: var(--warn-bg); color: var(--warn); } .status-error { background: var(--err-bg); color: var(--err); }
tr.row-error { background: var(--err-bg); }
tr.row-warn { background: var(--warn-bg); }
.child-row { padding-left: 28px !important; }
.msg { font-size: 13px; } .msg-error { color: var(--err); font-weight: 600; } .msg-warn { color: var(--warn); }

/* rich content (question text, options, passages) */
.rich img { max-width: 100%; height: auto; border-radius: 4px; }
.rich table { border-collapse: collapse; margin: .5em 0; max-width: 100%; }
.rich th, .rich td { border: 1px solid var(--border-strong); padding: 6px 10px; }
.rich p { margin: 0 0 .7em; } .rich p:last-child { margin-bottom: 0; }
.rich ul, .rich ol { margin: .4em 0 .7em 1.4em; padding: 0; }
.rich blockquote { margin: .5em 0; padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.opt-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.opt-list li.correct { font-weight: 600; }

/* maths (assets/math.js) */
.math { display: inline-block; font-family: "Cambria Math", "STIX Two Math", Cambria, "Times New Roman", serif; font-size: 1.05em; white-space: nowrap; line-height: 1.3; vertical-align: middle; }
.math i { font-style: italic; }
.math-block { display: block; text-align: center; margin: .6em 0; }
.mfn { font-style: normal; }
.mfrac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .2em; }
.mnum { border-bottom: 1px solid currentColor; padding: 0 .25em; }
.mden { padding: 0 .25em; }
.msqrt { display: inline-flex; align-items: stretch; }
.mrad { font-size: 1.15em; padding-right: 1px; }
.mbody { border-top: 1px solid currentColor; padding: 0 .2em; }
.msidx { font-size: .6em; align-self: flex-start; margin-right: -2px; }
.msubsup { display: inline-flex; flex-direction: column; vertical-align: middle; font-size: .75em; line-height: 1.05; }
.msubsup sup, .msubsup sub { position: static; vertical-align: baseline; font-size: 1em; line-height: 1.05; }
.mover { text-decoration: overline; }
.mvec { display: inline-block; }
.mvec::before { content: "\2192"; display: block; font-size: .6em; line-height: .6; text-align: center; }
.math-preview { min-height: 52px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: 1.3em; }
.modal-wide { max-width: 560px; }

/* question form */
.opt-rows { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.opt-row { display: grid; grid-template-columns: 28px 92px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.opt-letter { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; align-items: center; justify-content: center; margin-top: 6px; }
.opt-correct { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; }
.opt-tools { display: flex; gap: 2px; }
.opt-tools .icon-btn { width: 32px; height: 32px; }

/* rich-text editor */
.rte { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.rte:focus-within { outline: 3px solid var(--focus); border-color: var(--focus); }
.rte.is-busy { opacity: .6; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rte-btn { min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.rte-btn:hover { background: var(--surface); border-color: var(--border); }
.rte-btn[hidden] { display: none; }
.rte-area { min-height: 130px; padding: 10px 12px; outline: none; overflow-wrap: anywhere; }
.rte-mini-area { min-height: 44px; padding: 8px 10px; }

/* print */
.print-body { background: #fff; color: #000; }
.print-bar { display: flex; align-items: center; gap: 8px; max-width: 820px; margin: 12px auto; padding: 0 16px; }
.paper-sheet { max-width: 820px; margin: 0 auto 40px; padding: 28px 36px; background: #fff; color: #000; box-shadow: var(--shadow-1); font-size: 15px; line-height: 1.5; }
.p-head { display: flex; gap: 16px; align-items: center; border-bottom: 2px solid #000; padding-bottom: 12px; margin-bottom: 16px; }
.p-logo { width: 60px; height: 60px; object-fit: contain; }
.p-org { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.p-title { font-size: 22px; margin: 2px 0; }
.p-sec-title { font-size: 17px; margin: 22px 0 10px; padding: 4px 8px; background: #eee; }
.p-q { margin: 0 0 16px; break-inside: avoid; }
.p-qhead { display: flex; gap: 8px; align-items: baseline; font-weight: 700; }
.p-marks { font-weight: 400; font-size: 12px; color: #444; }
.p-body { margin: 2px 0 6px 0; }
.p-opts { list-style-type: upper-alpha; margin: 4px 0 0 28px; padding: 0; }
.p-opts li { margin: 2px 0; }
.p-passage { margin: 14px 0; padding: 10px 14px; border: 1px solid #999; background: #fafafa; }
.p-lines { margin-top: 6px; } .p-line { border-bottom: 1px dotted #666; height: 28px; }
.p-instr { margin-bottom: 14px; padding: 8px 12px; border: 1px solid #ccc; }
.page-break { break-before: page; }

/* =====================================================================================
   The exam screen (assets/exam.js): calm, large targets, light, works on a lab PC or a tablet
   ===================================================================================== */
body.exam-body { background: var(--bg); }
.ex { display: flex; flex-direction: column; min-height: 100vh; font-size: 16px; }
.ex-loading { margin: 20vh auto; text-align: center; color: var(--muted); }
.ex-error { color: var(--err); font-weight: 600; }
.spinner { width: 36px; height: 36px; margin: 0 auto 12px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ex-top { position: sticky; top: 0; z-index: var(--z-sticky); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.ex-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ex-title { font-weight: 700; font-size: 1.05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-badge { background: var(--warn-bg); color: var(--warn); font-size: .7em; font-weight: 800; letter-spacing: .08em; padding: 2px 8px; border-radius: 99px; }
.ex-timer { display: inline-flex; gap: 8px; align-items: center; padding: 6px 16px; border-radius: 99px; background: var(--surface-2); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.25em; }
.ex-timer.warn { background: var(--warn-bg); color: var(--warn); }
.ex-timer.crit { background: var(--err-bg); color: var(--err); }
.ex-tools { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.ex-status { font-size: .8em; color: var(--muted); margin-right: 6px; }
.ex-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; font: inherit; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; text-decoration: none; }
.ex-btn:hover { background: var(--surface-2); }
.ex-btn:disabled { opacity: .45; cursor: not-allowed; }
.ex-btn.on, .ex-btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); }
.ex-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.ex-primary:hover { background: var(--primary-hover); }
.ex-block { width: 100%; }
.ex-icon { min-width: 44px; padding: 8px 10px; }
.ex-banner { padding: 8px 20px; background: var(--warn-bg); color: var(--warn); font-size: .9em; text-align: center; }
.ex-banner.warn { background: var(--info-bg); color: var(--info); }
.ex-tabs { display: flex; gap: 6px; padding: 10px 20px 0; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--border); }
.ex-tab { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 8px 18px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.ex-tab.on { background: var(--surface); border-color: var(--primary); border-bottom: 3px solid var(--primary); font-weight: 700; }
.ex-tab:disabled { opacity: .5; cursor: not-allowed; }
.ex-tab-count { font-size: .75em; color: var(--muted); }
.ex-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; padding: 20px; max-width: 1400px; width: 100%; margin: 0 auto; }
.ex-main { min-width: 0; outline: none; display: flex; flex-direction: column; gap: 18px; padding-bottom: 80px; }
.ex-side { position: sticky; top: 84px; align-self: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 110px); overflow-y: auto; }
.ex-side-title { font-size: .85em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.pal { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.pal-btn { min-height: 42px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.pal-btn:hover { background: var(--surface-2); }
.pal-btn.pb-answered { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pal-btn.pb-flagged { box-shadow: inset 0 -5px 0 #f59e0b; }
.pal-btn.pb-current { outline: 3px solid var(--focus); outline-offset: 1px; }
.pal-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: .78em; color: var(--muted); }
.pal-legend i { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--border-strong); border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.pal-legend i.pb-answered { background: var(--primary); border-color: var(--primary); }
.pal-legend i.pb-flagged { box-shadow: inset 0 -4px 0 #f59e0b; }
.pal-legend i.pb-current { outline: 2px solid var(--focus); }
.q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow-1); }
.q.is-flagged { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
.q-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.q-no { font-weight: 800; font-size: 1.05em; color: var(--primary-ink); }
.q-marks { font-size: .8em; color: var(--muted); padding: 2px 8px; background: var(--surface-2); border-radius: 99px; }
.q-flag { min-height: 36px; padding: 4px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--muted); font: inherit; font-size: .85em; cursor: pointer; }
.q-flag.on { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.q-body { font-size: 1.1em; line-height: 1.6; margin-bottom: 16px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface); }
.opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt.is-on { border-color: var(--primary); background: var(--primary-soft); }
.opt:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.opt-l { display: inline-flex; flex: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border-strong); align-items: center; justify-content: center; font-weight: 700; font-size: .9em; }
.opt.is-on .opt-l { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.opt-t { padding-top: 3px; }
.opt.is-correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.is-wrong { border-color: var(--err); background: var(--err-bg); }
.ans-input { width: 100%; max-width: 520px; min-height: 52px; padding: 10px 14px; font: inherit; font-size: 1.1em; border: 2px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); }
.ans-input:focus, .ans-essay:focus, .blank:focus { outline: 3px solid var(--focus); border-color: var(--focus); }
.ans-essay { width: 100%; padding: 12px 14px; font: inherit; font-size: 1.05em; border: 2px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); resize: vertical; }
.blank { display: inline-block; width: 9em; max-width: 100%; margin: 0 4px; padding: 4px 10px; font: inherit; border: 0; border-bottom: 2px solid var(--primary); background: var(--primary-soft); color: var(--text); border-radius: 6px 6px 0 0; }
.q-passage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.passage { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; line-height: 1.7; }
.passage-title { font-size: .8em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.passage-qs { display: flex; flex-direction: column; gap: 18px; }
.q-key { margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: var(--info-bg); color: var(--info); font-size: .9em; }
.q-result { margin-top: 12px; font-weight: 700; font-size: .9em; }
.q-result.res-correct { color: var(--ok); } .q-result.res-wrong { color: var(--err); } .q-result.res-partial, .q-result.res-pending { color: var(--warn); } .q-result.res-blank { color: var(--muted); }
.ex-nav { position: sticky; bottom: 0; z-index: var(--z-sticky); display: flex; justify-content: space-between; gap: 10px; padding: 10px 20px; background: var(--surface); border-top: 1px solid var(--border); }
.ex-empty { padding: 40px; text-align: center; color: var(--muted); }
.ex-modal-back { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 14, 24, .55); }
.ex-modal { width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-2); }
.ex-modal h2 { margin: 0 0 12px; font-size: 1.2em; }
.ex-table-wrap { overflow-x: auto; }
.ex-table { width: 100%; border-collapse: collapse; font-size: .95em; }
.ex-table th, .ex-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.ex-link { border: 0; padding: 2px 6px; margin: 1px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-ink); font: inherit; font-weight: 700; cursor: pointer; }
.ex-warn { color: var(--warn); font-weight: 600; margin: 10px 0; }
.ex-modal-f { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.ex-bigscore { font-size: 2.2em; font-weight: 800; margin: 4px 0 8px; }
.ex-bigscore span { font-size: .5em; color: var(--muted); }
.ex-toasts { position: fixed; right: 16px; bottom: 76px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; }
.ex-toast { background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-2); }
@media (max-width: 1000px) {
  .grid-sidebar, .grid-edit { grid-template-columns: minmax(0, 1fr); }
  .ex-body { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .ex-side { position: static; max-height: none; order: 2; }
  .q-passage { grid-template-columns: minmax(0, 1fr); }
  .passage { position: static; max-height: none; }
  .ex-top { grid-template-columns: 1fr auto; }
  .ex-tools { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .opt-row { grid-template-columns: 28px minmax(0, 1fr); }
  .opt-row .opt-correct, .opt-row .opt-tools { grid-column: 2; }
  .q { padding: 16px; }
}
@media print {
  .print-bar, .no-print { display: none !important; }
  .paper-sheet { box-shadow: none; padding: 0; max-width: none; }
  .p-sec-title { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.rte-area img { max-width: 100%; height: auto; }
.rte-area table { border-collapse: collapse; margin: .5em 0; }
.rte-area th, .rte-area td { border: 1px solid var(--border-strong); padding: 6px 10px; min-width: 40px; }
.rte-area p { margin: 0 0 .6em; }
.rte-area ul, .rte-area ol { margin: .4em 0 .6em 1.4em; padding: 0; }
.table-bank td:nth-child(2) { min-width: 260px; }
.table-bank .btn-ghost { white-space: nowrap; }

/* option rows: letter | editor | tools, with the "correct" tick underneath the editor */
.opt-row { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "letter body tools" ". correct ."; row-gap: 6px; }
.opt-row .opt-letter { grid-area: letter; }
.opt-row .opt-body { grid-area: body; min-width: 0; }
.opt-row .opt-tools { grid-area: tools; }
.opt-row .opt-correct { grid-area: correct; margin-top: 0; }
.opt-row:has(input[name="opt_correct[]"]:checked) { border-color: var(--ok); background: var(--ok-bg); }
@media (max-width: 1180px) {
  .grid-edit { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .opt-row { grid-template-columns: 28px minmax(0, 1fr); grid-template-areas: "letter body" ". correct" ". tools"; }
  .opt-row .opt-correct, .opt-row .opt-tools { grid-column: auto; }
}

/* ==========================================================================
   Phase 3: people, sessions, check-in, slips
   ========================================================================== */
.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; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.checks .checkbox { margin: 0; }
.thumb-col { width: 48px; padding-right: 0; }
.avatar-img, .avatar-ph { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: 14px; }
.avatar-img { background: var(--surface-2); }
.input-lg { font-size: 22px; padding: 12px 14px; letter-spacing: .04em; }
.btn-lg { padding: 12px 20px; font-size: 16px; }
.seat-input { width: 76px; text-align: center; }
.stat-link { text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.stat-link:hover { box-shadow: var(--shadow-2, 0 6px 18px rgba(16, 24, 40, .12)); text-decoration: none; transform: translateY(-1px); }
.code-big { font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: .18em; text-align: center; padding: 12px; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.session-card { text-decoration: none; color: inherit; }
.session-card:hover { text-decoration: none; box-shadow: var(--shadow-2, 0 6px 18px rgba(16, 24, 40, .12)); }
.session-card .icon { width: 15px; height: 15px; vertical-align: -2px; }
.field.span-2 { grid-column: 1 / -1; }

/* getting-started list on the dashboard */
.start-list { list-style: none; margin: 0; padding: 4px 16px 12px; display: flex; flex-direction: column; }
.start-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.start-item:last-child { border-bottom: 0; }
.start-mark { display: inline-flex; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; border: 2px solid var(--border-strong); align-items: center; justify-content: center; }
.start-mark .icon { width: 14px; height: 14px; }
.start-item.is-done .start-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.start-item.is-done strong { color: var(--muted); font-weight: 500; text-decoration: line-through; }

/* check-in desk */
.desk-counts .stat-value { font-size: 28px; }
.desk-scan .card-b { padding: 16px 20px; }
.ci-result { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.ci-result[hidden] { display: none; }
.ci-result.is-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.ci-result.is-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.ci-result.is-err { background: var(--err-bg); border-color: var(--err-border); color: var(--err); }
.ci-photo { width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; flex: 0 0 64px; }
.ci-name { font-size: 18px; font-weight: 700; }
.ci-msg { font-weight: 600; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 99px; padding: 5px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.roll tr[hidden] { display: none; }
.roll tr.is-flash td { animation: ci-flash 1.6s ease-out; }
@keyframes ci-flash { from { background: var(--ok-bg); } to { background: transparent; } }
.roll tr[data-status="present"] .badge { background: var(--ok-bg); color: var(--ok); }
.roll tr[data-status="released"] .badge { background: var(--surface-2); color: var(--muted); }
.roll tr[data-status="absent"] .badge { background: var(--warn-bg); color: var(--warn); }
.roll button[hidden] { display: none; }
.photo-btn { cursor: pointer; }
.cam { width: 100%; max-height: 60vh; border-radius: var(--radius-sm); background: #000; }
.desk-foot { margin-top: 8px; text-align: right; }

/* candidate slips (printed) */
.slips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 900px; margin: 0 auto 40px; padding: 0 16px; }
.slips-alert { max-width: 900px; margin: 0 auto 10px; padding: 0 16px; }
.slips-empty { grid-column: 1 / -1; padding: 40px 0; }
.slip { background: #fff; color: #000; border: 1.5px dashed #777; border-radius: 8px; padding: 14px 16px; break-inside: avoid; page-break-inside: avoid; display: flex; flex-direction: column; gap: 10px; }
.slip-head { display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #ccc; padding-bottom: 8px; }
.slip-logo { width: 38px; height: 38px; object-fit: contain; }
.slip-org { font-weight: 700; font-size: 14px; line-height: 1.2; }
.slip-kind { font-size: 12px; color: #444; text-transform: uppercase; letter-spacing: .06em; }
.slip-main { display: flex; gap: 12px; align-items: center; }
.slip-photo { width: 62px; height: 72px; object-fit: cover; border: 1px solid #aaa; }
.slip-name { font-size: 17px; font-weight: 700; line-height: 1.25; }
.slip-sub { font-size: 13px; color: #444; }
.slip-creds, .slip-exam { margin: 0; display: grid; gap: 6px; }
.slip-creds { grid-template-columns: 1fr 1fr; }
.slip-creds div, .slip-exam div { min-width: 0; }
.slip-creds dt, .slip-exam dt { font-size: 11px; color: #555; text-transform: uppercase; letter-spacing: .05em; }
.slip-creds dd, .slip-exam dd { margin: 0; }
.slip-code { font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: .06em; padding: 4px 8px; border: 1px solid #999; border-radius: 4px; background: #f6f6f6; overflow-wrap: anywhere; }
.slip-nopin { font-family: inherit; font-size: 12px; font-weight: 400; letter-spacing: 0; color: #666; }
.slip-exam { grid-template-columns: 1fr 1fr; font-size: 13px; }
.slip-subjects { font-size: 12px; }
.slip-note { font-size: 12px; color: #333; border-top: 1px solid #ccc; padding-top: 8px; }
@media (max-width: 700px) { .slips { grid-template-columns: minmax(0, 1fr); } }
@media print {
  .slips { max-width: none; padding: 0; gap: 8px; }
  .slip { border-color: #555; }
  .sheet-table .sig { width: 130px; }
}

/* attendance sheet */
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th, .sheet-table td { border: 1px solid #888; padding: 7px 8px; }
.sheet-table td.sig { height: 34px; }
.p-foot { margin-top: 14px; color: #444; }
@media (max-width: 640px) {
  .ci-result { flex-direction: column; align-items: flex-start; }
  .roll .btn { padding: 8px 10px; }
  .code-big { font-size: 28px; }
}

/* wide tables beside a side panel (session roll): stack the panel under the table before it gets cramped */
.card-h { flex-wrap: wrap; }
.grid-roll { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 1280px) { .grid-roll { grid-template-columns: minmax(0, 1fr); } }
.table-people .thumb-col { width: 52px; }
.table-people td { vertical-align: middle; }

/* the check-in desk on a phone: four counts in a row, each candidate as a card */
@media (max-width: 640px) {
  .desk-counts { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .desk-counts .card-b { padding: 10px 8px; }
  .desk-counts .stat-label { font-size: 10px; letter-spacing: 0; }
  .desk-counts .stat-value { font-size: 22px; margin: 2px 0 0; }
  .roll, .roll tbody { display: block; }
  .roll thead { display: none; }
  .roll tr { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "av who stat" "av seat stat" "act act act"; gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: start; }
  .roll td { display: block; padding: 0; border: 0; }
  .roll td:nth-child(1) { grid-area: av; }
  .roll td:nth-child(2) { grid-area: who; }
  .roll td:nth-child(3) { grid-area: seat; }
  .roll td:nth-child(4) { grid-area: stat; text-align: right; }
  .roll td:nth-child(5) { grid-area: act; text-align: left; white-space: normal; margin-top: 8px; }
  .roll td[data-cell="seat"]::before { content: attr(data-label) " "; color: var(--muted); }
  .roll td[data-cell="seat"]:empty { display: none; }
  .roll .btn { padding: 9px 14px; }
}

/* ==========================================================================
   Phases 4-10: candidate portal, exam overlays, monitor, results, studio
   ========================================================================== */
.notice h3 { font-size: 15px; margin: 0 0 2px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pre-card { max-width: 760px; margin: 0 auto; }
.pre-who { display: flex; gap: 14px; align-items: center; }
.pre-photo { width: 64px; height: 76px; border-radius: 8px; object-fit: cover; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; }
.pre-name { font-size: 20px; font-weight: 700; }
.pre-title { font-size: 26px; margin: 4px 0; }
.pre-h { font-size: 15px; margin: 4px 0 6px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pre-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pre-facts > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 14px; display: flex; flex-direction: column; }
.pre-facts span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pre-facts strong { font-size: 18px; }
.pre-facts small { color: var(--muted); }
.pre-instr { max-height: 34vh; overflow: auto; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.receipt { margin: 0; display: grid; gap: 8px; text-align: left; width: 100%; max-width: 460px; }
.receipt > div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; font-weight: 600; text-align: right; }
.receipt-code { font-family: var(--mono); font-size: 22px; letter-spacing: .12em; }
.sub-h { font-size: 14px; margin: 10px 0 0; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* exam overlays, tools, watermark */
.dl-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(10, 14, 24, .86); display: flex; align-items: center; justify-content: center; padding: 20px; }
.dl-box { background: var(--surface, #fff); color: var(--text, #111); border-radius: 14px; padding: 26px 28px; max-width: 480px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.dl-box h2 { margin: 0; font-size: 22px; }
.dl-box p { margin: 0; color: var(--muted); }
.ex-status[data-state="offline"] { color: #b45309; font-weight: 700; }
.ex-status[data-state="saving"], .ex-status[data-state="pending"] { opacity: .75; }
.ex-panel { position: fixed; right: 16px; bottom: 72px; width: min(340px, calc(100vw - 32px)); z-index: 8000; background: var(--surface, #fff); color: var(--text, #111); border: 1px solid var(--border-strong, #bbb); border-radius: 12px; box-shadow: var(--shadow-2); }
.ex-panel[hidden] { display: none; }
.ex-panel header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.ex-panel-b { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ex-pad { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: inherit; resize: vertical; }
.calc-in { width: 100%; font-size: 18px; }
.calc-out { text-align: right; font-family: var(--mono); font-size: 24px; min-height: 32px; padding: 2px 4px; }
.calc-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.calc-grid .ex-btn { padding: 8px 0; justify-content: center; }
.ex-watermark { position: fixed; inset: 0; z-index: 7000; pointer-events: none; overflow: hidden; opacity: .07; font: 700 18px/3.2 var(--mono); word-break: break-all; transform: rotate(-24deg) scale(1.6); color: #000; user-select: none; }
.ex-nocopy { -webkit-user-select: none; user-select: none; }
.ex-nocopy input, .ex-nocopy textarea { -webkit-user-select: text; user-select: text; }
.ex-contrast { filter: contrast(1.25); background: #000 !important; color: #fff !important; }
.ex-contrast .q, .ex-contrast .ex-top, .ex-contrast .ex-side, .ex-contrast .ex-nav, .ex-contrast .opt { background: #000 !important; color: #fff !important; border-color: #fff !important; }
.ex-contrast .opt.is-on { background: #ffeb3b !important; color: #000 !important; }

/* monitor */
.mon-table td, .mon-table th { vertical-align: middle; }
.mon-prog { width: 90px; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.mon-prog i { display: block; height: 100%; background: var(--primary); }
.badge.mon-in_progress { background: var(--ok-bg); color: var(--ok); }
.badge.mon-submitted { background: var(--primary-soft); color: var(--primary-ink); }
.badge.mon-disconnected, .badge.mon-paused { background: var(--warn-bg); color: var(--warn); }
.badge.mon-locked { background: var(--err-bg); color: var(--err); }
.mon-viol { color: var(--err); font-weight: 700; }
.chip-n { opacity: .7; font-weight: 400; margin-left: 2px; }

/* results, studio, misc */
.grade { display: inline-block; min-width: 28px; text-align: center; font-weight: 700; border-radius: 6px; padding: 1px 8px; background: var(--primary-soft); color: var(--primary-ink); }
.bar-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 14px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); }
.studio { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); align-items: start; }
.studio-preview { position: sticky; top: 76px; }
.prev-frame { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-height: 340px; display: flex; align-items: center; justify-content: center; }
.prev-card { background: #fff; color: #1b2333; width: 100%; max-width: 300px; border-radius: 12px; padding: 18px; box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 8px; }
.prev-card h3 { margin: 0; font-size: 17px; }
.prev-card p { margin: 0; font-size: 13px; color: #566073; }
.prev-field { border: 1px solid #c3c9d8; border-radius: 6px; padding: 7px 9px; font-size: 12px; color: #566073; }
.prev-btn { border-radius: 6px; padding: 8px; text-align: center; font-weight: 700; font-size: 13px; }
.result-card { max-width: 640px; margin: 0 auto; }
.result-line { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 8px 0; }
.big-grade { font-size: 54px; font-weight: 800; line-height: 1; }
.pass-badge { display: inline-block; padding: 3px 12px; border-radius: 99px; font-weight: 700; }
.pass-yes { background: var(--ok-bg); color: var(--ok); }
.pass-no { background: var(--err-bg); color: var(--err); }
@media (max-width: 900px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .studio-preview { position: static; }
  .pre-facts { grid-template-columns: 1fr; }
}
@media print { .result-card .no-print { display: none !important; } }

.grade-grid { display: grid; grid-template-columns: 90px 90px minmax(0, 1fr); gap: 8px; align-items: center; max-width: 560px; }
.stat-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 99px; }
.essay-answer { white-space: pre-wrap; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); max-height: 40vh; overflow: auto; }

/* ---------- Portal Studio ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.studio-preview { position: sticky; top: 12px; }
.studio-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.studio-opts { display: flex; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.studio-stage { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 8px; overflow: auto; }
.studio-frame { display: block; width: 100%; height: 78vh; min-height: 520px; border: 0; margin: 0 auto; background: #fff; border-radius: var(--radius-sm); }
.notice-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin: 0; min-width: 0; }
.notice-row[hidden] { display: none; }
img.thumb { max-width: 160px; max-height: 80px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 4px; }
@media (max-width: 1100px) { .studio { grid-template-columns: minmax(0, 1fr); } .studio-preview { position: static; } .studio-frame { height: 70vh; } }

/* ---------- Help ---------- */
.help-body { padding: 8px 0 4px; }
.help-body p { margin: 0 0 8px; }
.help-grid > .card { align-self: start; }
dl.glossary { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
dl.glossary dt { font-weight: 650; }
dl.glossary dd { margin: 0; color: var(--muted); }
@media (max-width: 640px) { dl.glossary { grid-template-columns: minmax(0, 1fr); } }

/* ==========================================================================
   Candidate-facing design (themeable): sign-in, pre-exam, finished, result pages, and the exam screen.
   Every colour, radius and font below comes from the theme's custom properties (see includes/modules/theme.php).
   ========================================================================== */
.th { background: var(--bg); color: var(--text); font-family: var(--t-font, inherit); }
.th a { color: var(--primary-ink); }
body.sp-body { margin: 0; }

/* ---- the split sign-in page ---- */
.sp { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
.sp--split-right .sp-hero { order: 2; }
.sp-hero { position: relative; display: flex; align-items: center; overflow: hidden; color: var(--t-hero-ink); background: linear-gradient(var(--t-angle, 135deg), var(--t-hero-from) 0%, var(--t-hero-to) 100%); }
.sp-hero::before, .pg-bar::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
.sp-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(620px 420px at 25% 105%, var(--t-hero-glass), transparent 70%); }
.sp-pat-dots::before { background-image: radial-gradient(var(--t-hero-line) 1.3px, transparent 1.6px); background-size: 28px 28px; }
.sp-pat-grid::before { background-image: linear-gradient(var(--t-hero-line) 1px, transparent 1px), linear-gradient(90deg, var(--t-hero-line) 1px, transparent 1px); background-size: 46px 46px; opacity: .55; }
.sp-pat-rings::before { background: radial-gradient(circle at 88% 10%, transparent 0 110px, var(--t-hero-line) 111px 112px, transparent 113px 190px, var(--t-hero-line) 191px 192px, transparent 193px), radial-gradient(circle at 6% 94%, transparent 0 80px, var(--t-hero-line) 81px 82px, transparent 83px 150px, var(--t-hero-line) 151px 152px, transparent 153px); }
.sp-hero-in { position: relative; z-index: 1; width: 100%; max-width: 640px; padding: 56px clamp(28px, 7vw, 120px); }
.sp-badge { display: inline-flex; align-items: center; gap: 9px; padding: 8px 16px; border: 1px solid var(--t-hero-line); border-radius: 99px; background: var(--t-hero-glass); font-size: 13px; font-weight: 700; letter-spacing: .02em; backdrop-filter: blur(6px); }
.sp-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--t-accent); box-shadow: 0 0 0 4px var(--t-hero-glass); }
.sp-hero h2 { font-size: clamp(42px, 5.2vw, 68px); line-height: 1.04; font-weight: 800; letter-spacing: -.025em; margin: 26px 0 16px; }
.sp-hero h2 em { font-style: normal; color: var(--t-accent); }
.sp-hero p { max-width: 32em; margin: 0; color: var(--t-hero-sub); font-size: 17px; line-height: 1.7; }
.sp-stats { display: flex; flex-wrap: wrap; list-style: none; margin: 46px 0 0; padding: 0; }
.sp-stats li { display: flex; flex-direction: column; gap: 3px; padding: 2px 30px; border-left: 1px solid var(--t-hero-line); }
.sp-stats li:first-child { padding-left: 0; border-left: 0; }
.sp-stats b { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.sp-stats span { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--t-hero-sub); }
.sp-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.sp-panel { width: 100%; max-width: 410px; }
.sp-brand { text-align: center; margin-bottom: 34px; }
.sp-logo { display: block; margin: 0 auto 14px; max-width: 150px; max-height: 110px; width: auto; height: auto; }
.sp-mono { display: inline-flex; align-items: center; justify-content: center; min-width: 76px; height: 76px; margin-bottom: 14px; padding: 0 16px; border-radius: calc(var(--t-radius, 12px) + 8px); font-size: 25px; font-weight: 800; letter-spacing: .03em; color: var(--t-btn-ink, var(--on-primary)); background: var(--t-btn-bg, var(--primary)); box-shadow: 0 12px 28px var(--t-shadow, rgba(0, 0, 0, .2)); }
.pg-mono { min-width: 42px; height: 42px; margin: 0; padding: 0 10px; font-size: 15px; border-radius: 12px; color: inherit; background: var(--t-hero-glass); border: 1px solid var(--t-hero-line); box-shadow: none; }
.sp-org { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: .01em; text-transform: uppercase; }
.sp-title { margin: 0; font-size: 31px; font-weight: 800; letter-spacing: -.02em; }
.sp-sub { margin: 6px 0 26px; color: var(--muted); }
.sp-field { margin-bottom: 18px; }
.sp-field label { display: block; margin: 0 0 7px; font-size: 13px; font-weight: 700; }
.sp-input { position: relative; }
.sp-ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); display: inline-flex; color: var(--muted); pointer-events: none; }
.sp-ico .icon { width: 18px; height: 18px; }
.sp-input input { width: 100%; height: 52px; padding: 0 48px 0 46px; font: inherit; font-size: 15px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--t-radius, 12px); transition: border-color .15s, box-shadow .15s, background .15s; }
.sp-input input.mono { letter-spacing: .04em; }
.sp-input input::placeholder { color: var(--muted); opacity: .8; }
.sp-input input:focus { outline: 0; background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.sp-input input:disabled { opacity: .75; cursor: not-allowed; }
.sp-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.sp-eye:hover { color: var(--text); background: var(--surface); }
.sp-hint, .sp-help { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.sp-btn { display: block; width: 100%; height: 52px; margin-top: 10px; border: 0; border-radius: var(--t-radius, 12px); cursor: pointer; font: inherit; font-size: 16px; font-weight: 700; letter-spacing: .01em; color: var(--t-btn-ink, var(--on-primary)); background: var(--t-btn-bg, var(--primary)); box-shadow: 0 10px 26px var(--t-shadow, rgba(0, 0, 0, .2)); transition: transform .12s, filter .12s, box-shadow .12s; }
.sp-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.sp-btn:active { transform: none; box-shadow: none; }
.sp-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sp-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.sp-or { display: flex; align-items: center; gap: 16px; margin: 24px 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.sp-or::before, .sp-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sp-alt { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 15px 16px; text-align: center; text-decoration: none; color: var(--text) !important; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--t-radius, 12px); transition: border-color .15s, background .15s, transform .12s; }
.sp-alt:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.sp-alt strong { display: inline-flex; align-items: center; gap: 9px; font-size: 15px; }
.sp-alt small { color: var(--muted); font-size: 12.5px; }
.sp-card { margin-top: 18px; padding: 16px 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--t-radius, 12px); font-size: 14px; }
.sp-card h3, .sp-card summary { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 700; cursor: default; }
.sp-card summary { cursor: pointer; list-style: none; }
.sp-card summary::-webkit-details-marker { display: none; }
.sp-card[open] summary { margin-bottom: 10px; }
.sp-card .notice + .notice { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.sp-card .notice h4 { margin: 8px 0 2px; font-size: 14px; }
.sp-card .rich { margin-top: 6px; }
.sp-tag { margin: 28px 0 0; text-align: center; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primary-ink); }
.sp-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }
.sp-foot a { color: var(--muted); }
.sp-links a + a { margin-left: 12px; }
/* centred variant: the hero becomes the page background */
.sp--centered { grid-template-columns: minmax(0, 1fr); background: linear-gradient(var(--t-angle, 135deg), var(--t-hero-from), var(--t-hero-to)); }
.sp--centered .sp-main { background: transparent; padding: 32px 16px; }
.sp--centered .sp-panel { padding: 36px 34px; background: var(--surface); border-radius: calc(var(--t-radius, 12px) + 8px); box-shadow: var(--shadow-2); }
.sp--centered .sp-brand { margin-bottom: 24px; }

/* ---- the shell of the simpler pages ---- */
.pg { min-height: 100vh; display: flex; flex-direction: column; }
.pg-bar { position: relative; overflow: hidden; color: var(--t-hero-ink); background: linear-gradient(var(--t-angle, 135deg), var(--t-hero-from), var(--t-hero-to)); }
.pg-bar-in { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; max-width: 1100px; margin: 0 auto; padding: 14px 20px; }
.pg-logo { height: 42px; width: auto; border-radius: 9px; background: rgba(255, 255, 255, .92); padding: 3px; }
.pg-mark { display: inline-flex; }
.pg-org { font-size: 17px; font-weight: 800; letter-spacing: .01em; }
.pg-link { color: inherit !important; font-weight: 600; font-size: 14px; text-decoration: none; padding: 7px 14px; border-radius: 99px; background: var(--t-hero-glass); }
.pg-link:hover { background: var(--t-hero-line); }
.pg-main { flex: 1; width: 100%; margin: 0 auto; padding: 30px 16px 36px; }
.pg-narrow { max-width: 780px; }
.pg-wide { max-width: 1100px; }
.pg-card { max-width: 520px; margin: 0 auto 22px; border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-2); }
.pg-card .card-b { padding: 28px; }
.pg-title { margin: 0 0 4px; font-size: 25px; font-weight: 800; letter-spacing: -.015em; }
.pg-results { max-width: 640px; margin: 0 auto; }
.pg-foot { padding: 0 16px 26px; text-align: center; color: var(--muted); }
.pre-card { border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-2); }
.pre-card .card-b { padding: 28px 30px; }
.pre-facts > div { border: 1px solid var(--border); background: var(--surface-2); }
.pre-title { font-weight: 800; letter-spacing: -.015em; }
.th .btn-primary, .th .ex-primary { background: var(--t-btn-bg, var(--primary)); border-color: transparent; color: var(--t-btn-ink, var(--on-primary)); }
.th .btn-primary:hover, .th .ex-primary:hover { filter: brightness(1.08); }
.th .big-icon.ok { background: var(--ok-bg); color: var(--ok); }
.th .result-card { border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-1); }
.th .card { background: var(--surface); border-color: var(--border); }

/* ---- the exam screen ---- */
.ex { background: var(--bg); color: var(--text); font-family: var(--t-font, inherit); }
.ex-top { background: var(--ex-top-bg, var(--surface)); color: var(--ex-top-ink, var(--text)); border-bottom: 1px solid var(--ex-top-line, var(--border)); padding: 12px 24px; gap: 16px; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); box-shadow: 0 1px 0 rgba(16, 24, 40, .03); }
.ex-brand { gap: 12px; }
.ex-logo { height: 40px; width: auto; border-radius: 9px; background: rgba(255, 255, 255, .95); padding: 3px; }
.ex-mono { flex: none; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; font-weight: 800; font-size: 18px; color: var(--t-btn-ink, var(--on-primary)); background: var(--t-btn-bg, var(--primary)); }
.ex-brand-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ex-org { font-size: .68em; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ex-top-sub, var(--muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-title { font-size: 1.08em; font-weight: 800; letter-spacing: -.01em; }
.ex-timer { background: var(--ex-pill-bg, var(--surface-2)); color: var(--ex-pill-ink, var(--text)); font-size: 1.32em; padding: 8px 22px; letter-spacing: .03em; }
.ex-timer.warn { background: var(--warn-bg); color: var(--warn); }
.ex-timer.crit { background: var(--err-bg); color: var(--err); animation: ex-pulse 1.1s ease-in-out infinite; }
@keyframes ex-pulse { 50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, .18); } }
.ex-status { color: var(--ex-top-sub, var(--muted)); }
.ex-top .ex-btn { background: var(--ex-pill-bg, var(--surface)); color: var(--ex-pill-ink, var(--text)); border-color: transparent; min-height: 40px; padding: 6px 14px; }
.ex-top .ex-btn:hover { filter: brightness(.96); }
.ex-who { display: flex; align-items: center; gap: 10px; margin-left: 6px; padding: 4px 14px 4px 4px; border-radius: 99px; background: var(--ex-pill-bg, var(--surface-2)); color: var(--ex-pill-ink, var(--text)); }
.ex-av { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 800; color: var(--t-btn-ink, var(--on-primary)); background: var(--t-btn-bg, var(--primary)); }
.ex-who-t { display: flex; flex-direction: column; line-height: 1.2; max-width: 180px; }
.ex-who-t b { font-size: .84em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-who-t small { font-size: .7em; opacity: .75; font-family: var(--mono); }
.ex-progress { height: 4px; background: var(--border); }
.ex-progress i { display: block; width: 0; height: 100%; background: var(--t-btn-bg, var(--primary)); transition: width .35s ease; }
.ex-tabs { padding: 12px 24px 0; background: var(--surface); }
.ex-tab { border-radius: 10px 10px 0 0; }
.ex-body { padding: 24px; }
.ex-count { font-weight: 700; font-size: .95em; margin: -4px 0 2px; }
.ex-side { border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-1); }
.pal { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.pal-btn { border-radius: 10px; transition: transform .08s, background .12s; }
.pal-btn:hover { transform: translateY(-1px); }
.pal-btn.pb-answered { background: var(--primary); color: var(--on-primary); }
.q { padding: 28px 32px; border-radius: calc(var(--radius) + 4px); }
.q-no { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-ink); font-size: .9em; }
.q-body { font-size: 1.16em; line-height: 1.7; }
.opts { gap: 12px; }
.opt { padding: 15px 18px; border-radius: var(--radius); transition: border-color .12s, background .12s, box-shadow .12s; }
.opt:hover { border-color: var(--primary); background: var(--primary-soft); }
.opt.is-on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.opt-l { width: 34px; height: 34px; background: var(--surface); }
.ex-nav { padding: 12px 24px; background: var(--surface); box-shadow: 0 -8px 24px rgba(16, 24, 40, .06); }
.ex-btn { border-radius: var(--radius-sm); }
.ex-modal { border-radius: calc(var(--radius) + 4px); }
@media (max-width: 760px) {
  .sp { grid-template-columns: minmax(0, 1fr); }
  .sp--split-right .sp-hero { order: 0; }
  .sp-hero { align-items: flex-start; }
  .sp-hero-in { padding: 28px 22px 26px; }
  .sp-hero h2 { font-size: 36px; margin: 16px 0 8px; }
  .sp-hero p { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .sp-stats { display: none; }
  .sp-main { padding: 28px 18px 36px; align-items: flex-start; }
  .sp-brand { margin-bottom: 24px; }
  .pg-bar-in { padding: 12px 16px; }
  .pg-card .card-b, .pre-card .card-b { padding: 20px; }
  .ex-top { padding: 10px 14px; grid-template-columns: minmax(0, 1fr) auto; }
  .ex-who-t, .ex-org { display: none; }
  .ex-body { padding: 12px; }
  .q { padding: 18px; }
  .ex-nav { padding: 10px 14px; }
  .ex-tabs { padding: 10px 14px 0; }
}

/* ---- Themes (software provider) ---- */
.theme-grid { gap: 18px; }
.theme-card { overflow: hidden; }
.theme-card.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.theme-sw { position: relative; height: 112px; }
.theme-sw-btn { position: absolute; left: 18px; bottom: 18px; width: 46%; height: 12px; border-radius: 99px; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.theme-dots { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 6px; }
.theme-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); }
.theme-actions { flex-wrap: wrap; gap: 6px; }
.row.grow, .grow { flex: 1; min-width: 0; }

/* =====================================================================================
   Dashboard: welcome banner, figures, sessions, results at a glance, shortcuts
   ===================================================================================== */

.hero { position: relative; overflow: hidden; display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 30px 32px; border-radius: 22px; color: #fff;
  background: var(--hero-2); background: linear-gradient(120deg, var(--hero-1), var(--hero-2) 58%, var(--hero-3)); box-shadow: 0 22px 44px -22px var(--primary-glow); }
.hero::before { content: ""; position: absolute; width: 360px; height: 360px; right: -90px; top: -190px; border-radius: 50%; background: rgba(255, 255, 255, .10); }
.hero::after { content: ""; position: absolute; width: 230px; height: 230px; right: 190px; bottom: -160px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; opacity: .85; }
.hero h1 { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 6px; }
.hero p { opacity: .9; max-width: 54ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { color: #fff; background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .32); box-shadow: none; }
.hero .btn:hover { color: #fff; background: rgba(255, 255, 255, .28); border-color: rgba(255, 255, 255, .55); }
.hero .btn-light { color: #0f172a; background: #fff; border-color: #fff; box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .55); }
.hero .btn-light:hover { color: #0f172a; background: #fff; filter: brightness(.96); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 16px; margin-top: 18px; }
.kpi { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 18px 18px 18px 22px; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tone, var(--primary)); }
a.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--tone, var(--primary)); }
.kpi-val { font: 800 30px/1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-lab { font-weight: 700; margin-top: 5px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }

.attn { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.attn-item { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; font-weight: 650; text-decoration: none; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-border); }
.attn-item:hover { text-decoration: none; filter: brightness(.97); }
.attn-item.live { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .55); } 80%, 100% { box-shadow: 0 0 0 9px rgba(22, 163, 74, 0); } }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.list { list-style: none; margin: 0; padding: 4px 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-main { min-width: 0; flex: 1; }
.list-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-title a { color: inherit; }
.list-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--muted); }
.list-meta .icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.datebox { width: 54px; flex: none; text-align: center; border-radius: 13px; padding: 7px 0; line-height: 1.1; color: var(--primary-ink); background: var(--primary-soft); }
.datebox b { display: block; font: 800 20px/1.1 var(--font-display); }
.datebox span { font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.datebox.live { color: var(--ok); background: var(--ok-bg); }
.score-pill { display: inline-flex; min-width: 54px; justify-content: center; padding: 3px 10px; border-radius: 99px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ok); background: var(--ok-bg); }
.score-pill.fail { color: var(--err); background: var(--err-bg); }
.score-pill.none { color: var(--muted); background: var(--surface-2); }

.glance { display: flex; gap: 20px; align-items: center; }
.ring { position: relative; width: 116px; height: 116px; flex: none; }
.ring svg { display: block; width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; }
.ring-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 800 25px/1 var(--font-display); letter-spacing: -.03em; }
.ring-num small { font: 650 11px/1.3 var(--font); letter-spacing: 0; color: var(--muted); }
.glance-facts { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fact b { display: block; font: 800 22px/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fact span { font-size: 13px; color: var(--muted); }
.bars { display: block; width: 100%; height: 86px; margin-top: 18px; }
.dbar { fill: var(--primary); opacity: .9; }
.dbar.pass { fill: var(--ok); }
.dbar.fail { fill: var(--err); opacity: .85; }
.dbar.empty { fill: var(--surface-2); opacity: 1; }
.bars-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }

.shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shortcut { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-weight: 650; line-height: 1.25; text-decoration: none; background: var(--surface); transition: transform .15s, box-shadow .15s, border-color .15s; }
.shortcut:hover { text-decoration: none; border-color: var(--tone, var(--primary)); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.help-card { display: flex; gap: 16px; align-items: center; padding: 18px 20px; }
.help-card p { color: var(--muted); font-size: 14px; }

@media (max-width: 1000px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .hero { padding: 22px 20px; border-radius: 18px; }
  .hero h1 { font-size: 25px; }
  .glance { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 22px; }
  .page-head-main .ico-chip { display: none; }
  .list-item { padding: 12px 16px; }
}
.kpi { padding: 16px 14px 16px 20px; gap: 12px; }
.kpi .ico-chip { width: 44px; height: 44px; }
@media (max-width: 640px) {
  .list-item { flex-wrap: wrap; row-gap: 8px; }
  .list-main { flex: 1 1 calc(100% - 70px); }
  .list-main + .badge { margin-left: 68px; }
  .list-title { white-space: normal; }
}
.table .btn-ghost { color: var(--primary-ink); }
.table .btn-ghost:hover { background: var(--primary-soft); color: var(--primary-ink); }
.alert + .card, .alert + form.card { margin-top: 12px; }
.card-h h2:not(:has(.icon))::before { content: ""; flex: none; width: 5px; height: 18px; border-radius: 4px; background: var(--primary); background: linear-gradient(180deg, var(--primary), var(--primary-2)); }
.content > .card + .card, .content > form > .card + .card, .content > form > .card + .section { margin-top: 16px; }

/* =====================================================================================
   The exam screen, third pass: icons, colour and a calm layout. Every colour comes from the active theme's variables,
   so it follows all nine themes (and dark mode) without a rule of its own.
   ===================================================================================== */
.th { --primary-2: var(--t-primary2, #1e40af); --primary-glow: var(--t-shadow, rgba(37, 99, 235, .3)); }
.ex { --ex-grad: var(--t-btn-bg, linear-gradient(135deg, var(--primary), var(--primary-2))); --ex-on: var(--t-btn-ink, var(--on-primary)); }
.ex-ic { flex: none; width: 18px; height: 18px; vertical-align: -3px; }

/* header: school, timer, saving state, tools, who */
.ex-top { padding: 12px 28px; gap: 18px; }
.ex-timer { gap: 12px; padding: 7px 24px 7px 8px; font-size: 1em; letter-spacing: 0; }
.ex-timer-ico { display: inline-flex; width: 42px; height: 42px; flex: none; align-items: center; justify-content: center; border-radius: 50%; color: var(--ex-on); background: var(--ex-grad); }
.ex-timer-ico .ex-ic { width: 22px; height: 22px; }
.ex-timer-t { display: flex; flex-direction: column; line-height: 1.1; }
.ex-timer-t small { font-size: .62em; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; opacity: .72; }
.ex-timer-t b { font-size: 1.5em; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.ex-timer.warn .ex-timer-ico { background: #d97706; color: #fff; }
.ex-timer.crit .ex-timer-ico { background: #dc2626; color: #fff; }
.ex-status { display: inline-flex; align-items: center; gap: 8px; margin: 0 2px 0 0; padding: 6px 13px; border-radius: 99px; background: var(--ex-pill-bg, var(--surface-2)); color: var(--ex-pill-ink, var(--text)); font-size: .8em; font-weight: 650; white-space: nowrap; }
.ex-status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.ex-status[data-state="pending"]::before, .ex-status[data-state="saving"]::before { background: #f59e0b; animation: ex-blink 1s ease-in-out infinite; }
.ex-status[data-state="offline"]::before { background: #ef4444; }
.ex-status[data-state="preview"]::before { background: var(--muted); }
@keyframes ex-blink { 50% { opacity: .35; } }
.ex-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--ex-pill-bg, var(--surface-2)); }
.ex-top .ex-seg .ex-btn { min-height: 34px; min-width: 38px; padding: 0 8px; border-radius: 9px; background: transparent; font-weight: 800; }
.ex-top .ex-seg .ex-btn:hover { background: rgba(127, 127, 127, .2); filter: none; }
.ex-top .ex-btn { border-radius: 12px; font-weight: 650; }
.ex-progress { height: 6px; background: var(--border); }
.ex-progress i { background: var(--ex-grad); border-radius: 0 6px 6px 0; }

/* section tabs */
.ex-tabs { gap: 8px; padding: 12px 28px; border-bottom: 1px solid var(--border); }
.ex-tab { flex-direction: row; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border: 1px solid var(--border-strong); border-radius: 99px; background: var(--surface); font-weight: 650; transition: border-color .12s, background .12s; }
.ex-tab:hover:not(:disabled) { border-color: var(--primary); }
.ex-tab.on { color: var(--ex-on); background: var(--ex-grad); border-color: transparent; border-bottom: 1px solid transparent; font-weight: 750; }
.ex-tab-count { padding: 2px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .78em; font-weight: 750; }
.ex-tab.on .ex-tab-count { background: rgba(255, 255, 255, .24); color: inherit; }

/* the question card */
.q { position: relative; overflow: hidden; padding: 30px 34px 32px 38px; }
.q::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--ex-grad); }
.q.is-flagged { box-shadow: 0 0 0 3px rgba(245, 158, 11, .22); }
.q.is-flagged::before { background: #f59e0b; }
.q-head { gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.q-no { gap: 10px; height: 42px; padding: 0 16px 0 5px; font-size: .92em; font-weight: 750; }
.q-n { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 9px; border-radius: 99px; color: var(--ex-on); background: var(--ex-grad); font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }
.q-marks { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; font-size: .82em; font-weight: 650; }
.q-marks .ex-ic { width: 15px; height: 15px; color: #f59e0b; }
.q-flag { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 16px; border-radius: 99px; font-weight: 650; font-size: .88em; transition: background-color .12s, border-color .12s; }
.q-flag:hover { border-color: #f59e0b; color: var(--text); }
.q-flag.on, #ex-flag.on { background: var(--warn-bg); border-color: #f59e0b; color: var(--warn); }
.q-body { font-size: 1.2em; line-height: 1.7; }

/* answers */
.opts { gap: 12px; }
.opt { align-items: center; gap: 16px; min-height: 64px; padding: 12px 18px; }
.opt-l { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); font-weight: 800; transition: background-color .12s, color .12s, border-color .12s; }
.opts:not(.multi) .opt-l { border-radius: 50%; }
.opt:hover .opt-l { border-color: var(--primary); color: var(--primary-ink); }
.opt.is-on .opt-l { color: var(--ex-on); background: var(--ex-grad); border-color: transparent; }
.opt-t { flex: 1; padding-top: 0; font-size: 1.05em; }
.opt-ck { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; color: var(--ex-on); background: var(--ex-grad); opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s; }
.opt-ck .ex-ic { width: 16px; height: 16px; stroke-width: 3; }
.opt.is-on .opt-ck { opacity: 1; transform: none; }
.opt.is-correct .opt-ck, .opt.is-wrong .opt-ck { opacity: 1; transform: none; color: #fff; background: var(--ok); }
.opt.is-wrong .opt-ck { background: var(--err); }
.ans-input { max-width: 580px; min-height: 58px; border-radius: var(--radius-sm); }
.ans-input:focus, .ans-essay:focus, .blank:focus { box-shadow: 0 0 0 5px rgba(37, 99, 235, .14); box-shadow: 0 0 0 5px color-mix(in srgb, var(--focus) 20%, transparent); }
.ans-essay { border-radius: var(--radius-sm); min-height: 180px; }
.ans-count { margin-top: 6px; text-align: right; color: var(--muted); font-size: .82em; font-variant-numeric: tabular-nums; }

/* the question map */
.ex-side { padding: 20px; gap: 14px; }
.ex-side-title { display: flex; align-items: center; gap: 8px; font-size: .78em; font-weight: 800; letter-spacing: .08em; }
.ex-side-title .ex-ic { color: var(--primary); }
.ex-count { margin: 0; font-size: 1.1em; font-weight: 800; letter-spacing: -.01em; }
.ex-meter { height: 8px; margin-top: -6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.ex-meter i { display: block; width: 0; height: 100%; border-radius: 99px; background: var(--ex-grad); transition: width .3s ease; }
.pal { gap: 8px; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
.pal-btn { position: relative; min-height: 44px; border-radius: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.pal-btn.pb-answered { color: var(--ex-on); background: var(--ex-grad); border-color: transparent; }
.pal-btn.pb-flagged { box-shadow: none; }
.pal-btn.pb-flagged::after { content: ""; position: absolute; top: -1px; right: -1px; width: 15px; height: 15px; border-radius: 0 12px 0 14px; background: #f59e0b; }
.pal-btn.pb-current { outline: 3px solid var(--focus); outline-offset: 2px; transform: scale(1.05); }
.pal-legend { gap: 6px 10px; }
.pal-legend i { width: 14px; height: 14px; border-radius: 5px; }
.pal-legend i.pb-answered { background: var(--ex-grad); border-color: transparent; }
.pal-legend i.pb-flagged { background: #f59e0b; border-color: #f59e0b; box-shadow: none; }
.ex-side .ex-primary { min-height: 48px; border-radius: 99px; }

/* bottom bar */
.ex-nav { align-items: center; justify-content: flex-start; padding: 12px 28px; }
.ex-nav .ex-btn { min-height: 48px; padding: 8px 22px; border-radius: 99px; font-weight: 700; }
.ex-nav .ex-primary { padding: 8px 28px; box-shadow: 0 10px 22px -10px var(--primary-glow); }
.ex-kbd { flex: 1; text-align: center; color: var(--muted); font-size: .8em; }
.ex-btn .ex-ic { width: 18px; height: 18px; }
.ex-primary { color: var(--ex-on); }

/* review dialog, notices, toasts */
.ex-modal { max-width: 680px; padding: 28px; }
.ex-modal h2 { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-size: 1.35em; font-weight: 800; letter-spacing: -.015em; }
.ex-modal h2 .ex-ic { width: 28px; height: 28px; padding: 5px; box-sizing: content-box; border-radius: 12px; color: var(--primary-ink); background: var(--primary-soft); }
.rv-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.rv-tile { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.rv-tile b { display: block; font-size: 1.9em; line-height: 1.05; font-weight: 800; font-variant-numeric: tabular-nums; }
.rv-tile span { color: var(--muted); font-size: .82em; font-weight: 650; }
.rv-tile.ok { background: var(--ok-bg); border-color: var(--ok-border); } .rv-tile.ok b { color: var(--ok); }
.rv-tile.bad { background: var(--err-bg); border-color: var(--err-border); } .rv-tile.bad b { color: var(--err); }
.rv-tile.flag { background: var(--warn-bg); border-color: var(--warn-border); } .rv-tile.flag b { color: var(--warn); }
.ex-table thead th { color: var(--muted); font-size: .74em; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.ex-warn { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--warn-border); border-radius: 12px; background: var(--warn-bg); }
.ex-warn .ex-ic { margin-top: 2px; }
.ex-modal-f .ex-btn { min-height: 48px; padding: 8px 26px; border-radius: 99px; }
.ex-toast { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-left: 5px solid #f59e0b; border-radius: 12px; font-weight: 600; }
.dl-box { padding: 34px 30px; border-radius: calc(var(--radius) + 6px); box-shadow: var(--shadow-2); }
.dl-ic { display: inline-flex; align-self: center; align-items: center; justify-content: center; width: 68px; height: 68px; margin-bottom: 4px; border-radius: 50%; color: var(--primary-ink); background: var(--primary-soft); }
.dl-ic .ex-ic { width: 32px; height: 32px; }

/* high-contrast mode keeps working with the colourful pieces */
.ex-contrast .q::before { display: none; }
.ex-contrast .opt-l, .ex-contrast .q-n, .ex-contrast .opt-ck, .ex-contrast .pal-btn.pb-answered, .ex-contrast .ex-timer-ico, .ex-contrast .ex-tab.on { background: #fff !important; color: #000 !important; border-color: #fff !important; }

@media (max-width: 760px) {
  .ex-top { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 14px; gap: 10px; }
  .ex-tools { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .ex-timer { padding: 6px 16px 6px 6px; }
  .ex-timer-ico { width: 36px; height: 36px; }
  .ex-timer-t small { display: none; }
  .ex-timer-t b { font-size: 1.3em; }
  .ex-tabs { padding: 10px 14px; }
  .ex-body { padding: 12px; }
  .q { padding: 22px 18px 24px 22px; }
  .q-body { font-size: 1.1em; }
  .opt { gap: 12px; padding: 10px 14px; min-height: 58px; }
  .ex-nav { padding: 10px 12px; gap: 8px; }
  .ex-nav .ex-btn { padding: 8px 18px; }
  .ex-kbd, .ex-nav .ex-lbl { display: none; }
  .ex-nav #ex-flag { margin-left: auto; padding: 8px 14px; }
  .ex-nav #ex-prev { padding: 8px 14px; }
  .ex-modal { padding: 22px 18px; }
  .rv-tile { padding: 10px 12px; }
  .rv-tile b { font-size: 1.5em; }
}

@media (max-width: 760px) {
  .q-flag { padding: 6px 12px; }
  .q-flag span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* the pre-exam page */
.pre-facts { gap: 12px; }
.pre-facts > .pre-fact { flex-direction: row; align-items: center; gap: 14px; padding: 12px 14px; }
.pre-fact > div { display: flex; flex-direction: column; min-width: 0; }
.pre-fact strong { font-weight: 800; letter-spacing: -.01em; }
.pre-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.pre-h .icon { color: var(--primary); }
.pre-instr { border-radius: var(--radius); background: var(--surface); }
.pre-rules { display: flex; gap: 12px; align-items: flex-start; }
.pre-rules-ico { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 12px; background: rgba(245, 158, 11, .18); }
.pre-rules ul { margin-top: 4px; }
.pre-agree { align-items: center; gap: 12px; padding: 14px 16px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; font-weight: 600; transition: border-color .12s, background-color .12s; }
.pre-agree:hover, .pre-agree:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pre-agree input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--primary); }
#start-btn { gap: 10px; min-height: 54px; border-radius: 99px; font-size: 1.05em; }
#start-btn[disabled] { opacity: .45; filter: grayscale(.3); }
.check-item { align-items: center; padding: 10px 14px; border-radius: var(--radius-sm); }
.check-ico { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; }
.check-item .check-ico { margin-top: 0; }
@media (max-width: 640px) { .pre-facts > .pre-fact { padding: 10px 12px; } }.pre-fact strong { font-size: 16px; }

/* session candidates: roster and picker */
.roster-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1180px) { .roster-grid { grid-template-columns: minmax(0, 1fr); } }
.scroll-box { max-height: 560px; overflow: auto; }
.scroll-box.short { max-height: 380px; }
.roster-bar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.roster-find { width: min(260px, 100%); }
.seat-meter { height: 8px; margin-bottom: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.seat-meter i { display: block; width: 0; height: 100%; border-radius: 99px; background: var(--primary); background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .3s; }
.seat-meter.full i { background: var(--warn); }
.pick-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pick-filters .span-all { grid-column: 1 / -1; }
.pick-note { padding: 0 20px 10px; }
.pick-foot { flex-wrap: wrap; }
[data-pick] tr[data-row] { cursor: pointer; }
.pager { flex-wrap: wrap; }
.input-sm { min-height: 36px; padding: 6px 10px; }

/* the pre-exam page: how to answer */
.how-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
@media (max-width: 640px) { .how-grid { grid-template-columns: minmax(0, 1fr); } }
.how-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.how-card h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .95em; font-weight: 800; }
.how-card h3 .icon { color: var(--primary); }
.how-keys { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: .92em; }
.how-keys li { display: flex; align-items: center; gap: 10px; }
.how-keys li > span { display: inline-flex; flex: none; gap: 4px; min-width: 76px; }
.how-mouse li { display: list-item; list-style: disc; margin-left: 18px; }
kbd { display: inline-block; min-width: 28px; padding: 3px 8px; border: 1px solid var(--border-strong); border-bottom-width: 3px; border-radius: 8px; background: var(--surface); color: var(--text); font: 800 .88em var(--mono); text-align: center; }.how-keys li { display: grid; grid-template-columns: 138px minmax(0, 1fr); align-items: center; gap: 10px; }
.how-keys li > span { min-width: 0; }
.how-mouse li { display: list-item; grid-template-columns: none; }

.slip-how { grid-column: 1 / -1; padding: 6px 0; font-weight: 600; }

.alert + .page-head, .alert + .alert + .page-head { margin-top: 18px; }

/* a switch: a checkbox drawn as a sliding toggle */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 650; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; flex: none; width: 48px; height: 28px; border-radius: 99px; background: var(--border-strong); transition: background-color .15s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--primary); background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--focus); outline-offset: 2px; }