/* ==========================================================================
   Aspirants Exam Platform - application styles on top of Bootstrap 5.3.
   Every colour comes from theme.css roles (var(--primary) ...), never a hex here.
   ========================================================================== */

/* The hidden attribute always wins. Bootstrap's display utilities (.d-flex, .d-grid) are !important and come after its
   own [hidden] rule, so "hidden" on such an element silently showed it (D-41). This file loads after Bootstrap. */
[hidden] { display: none !important; }
/* Same trap for tabs: a .d-grid tab pane stayed laid out (only faded out) when inactive, pushing the active one down (D-48). */
.tab-content > .tab-pane:not(.active) { display: none !important; }

/* A grid item defaults to min-width:auto, so a wide table inside one (even inside .table-responsive) widens the whole
   grid instead of scrolling in its box, and the phone zooms the page out (D-7 for the admin shell; D-42 for these). */
.d-grid > *, .result-page > * { min-width: 0; }

/* ---- Bootstrap mapped onto the brand roles ---- */
:root {
  --bs-body-font-family: var(--font-body);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-secondary-color: var(--text-muted);
  --bs-border-color: var(--border);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 7, 86, 158;
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary-hover);
  --bs-link-color-rgb: 7, 86, 158;
  --bs-focus-ring-color: color-mix(in srgb, var(--focus-ring) 45%, transparent);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-md);
  --bs-tertiary-bg: var(--surface-2);
  --bs-emphasis-color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bs-primary-rgb: 91, 159, 224; --bs-link-color-rgb: 91, 159, 224; }
}
:root[data-theme="dark"] { --bs-primary-rgb: 91, 159, 224; --bs-link-color-rgb: 91, 159, 224; }

body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; }
h1, h2, h3, h4, h5, .display-font { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
code, .mono, .tabular { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
code { color: var(--accent-text); font-size: .86em; }
.text-muted, .form-text { color: var(--text-muted) !important; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

.btn { font-weight: 600; border-radius: var(--radius-sm); }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-color: var(--on-primary);
  --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-hover-color: var(--on-primary);
  --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary); --bs-btn-hover-color: var(--on-primary); }
.btn-accent { background: var(--accent); color: var(--on-accent); border: 0; }
.btn-accent:hover { filter: brightness(.95); color: var(--on-accent); }
.form-control, .form-select { background-color: var(--surface); color: var(--text); border-color: var(--border); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--focus-ring) 40%, transparent); background-color: var(--surface); color: var(--text); }
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.invalid-feedback { color: var(--danger); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); }
.card { background: var(--surface); border-color: var(--border); border-radius: var(--radius-md); }
.modal-content { background: var(--surface); color: var(--text); border-radius: var(--radius-lg); }
.table { --bs-table-bg: var(--surface); --bs-table-color: var(--text); --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--surface-2); --bs-table-hover-bg: var(--primary-soft); }
.dropdown-menu { background: var(--surface); border-color: var(--border); }
.dropdown-item { color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }

/* ---- status pills (form + colour, never colour alone) ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--success-soft); color: var(--success); }
.pill-off { background: var(--surface-2); color: var(--text-muted); }
.pill-warn { background: var(--warning-soft); color: var(--warning); }
.pill-bad { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }

/* ======================================================================= auth pages (redesign 2026-10) */
/* A full-bleed brand scene (blue, skylight glass, gold arc) with the brand on the left and a floating card on the right. */
.auth-body { background: var(--anc-blue-950); }
.auth-page { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 470px);
  gap: clamp(20px, 4vw, 72px); padding: clamp(18px, 3vw, 44px); overflow: hidden; color: #fff; isolation: isolate;
  background: radial-gradient(120% 90% at 0% 0%, #0b6cc4 0%, transparent 55%), radial-gradient(90% 80% at 100% 100%, #4a2f8f 0%, transparent 60%),
              linear-gradient(135deg, var(--anc-blue-900) 0%, var(--anc-blue-950) 55%, #120f3a 100%); }
.auth-scene { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.auth-skylight { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-arc { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-arc path { fill: none; stroke: var(--anc-gold-400); stroke-width: 2.5; opacity: .75; }
.auth-arc path.thin { stroke-width: 1.2; opacity: .45; }
.auth-glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .45; }
.auth-glow.g1 { width: 420px; height: 420px; left: -120px; bottom: -160px; background: var(--anc-gold-400); opacity: .18; }
.auth-glow.g2 { width: 520px; height: 520px; right: -160px; top: -200px; background: #7c5cff; opacity: .28; }

.auth-brand { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; min-width: 0; }
.auth-brand-top { display: inline-flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; width: fit-content; }
.auth-logo { background: #fff; border-radius: 16px; padding: 8px 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: grid; place-items: center; }
.auth-logo img { display: block; width: 64px; height: auto; }
.auth-brand-name { display: grid; line-height: 1.15; }
.auth-brand-name .n { font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 2.4vw, 30px); letter-spacing: -.01em; }
.auth-brand-name .t { color: var(--anc-gold-300); font-size: 14px; margin-top: 4px; }
.auth-brand-bottom { display: grid; gap: 14px; max-width: 640px; }
.auth-motto { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: clamp(34px, 5vw, 64px); line-height: 1.05; margin: 0;
  letter-spacing: -.02em; text-shadow: 0 6px 30px rgba(0,0,0,.35); }
.auth-rule { display: block; width: min(320px, 60%); height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--anc-gold-400), transparent); }
.auth-lede { margin: 0; font-size: clamp(15px, 1.4vw, 19px); color: color-mix(in srgb, #fff 88%, transparent); }
.auth-features { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 18px 26px; }
.auth-features li { display: grid; justify-items: center; gap: 8px; font-size: 13px; font-weight: 600; text-align: center; width: 92px; }
.auth-features .fi { width: 54px; height: 54px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(0,0,0,.25); }
.auth-features svg { width: 24px; height: 24px; fill: none; stroke: var(--anc-blue-700); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-legal { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: color-mix(in srgb, #fff 70%, transparent); margin-top: 8px; }

.auth-form-side { display: flex; align-items: center; justify-content: center; min-width: 0; }
.auth-card { width: 100%; background: var(--surface); color: var(--text); border-radius: 26px; padding: clamp(24px, 3vw, 38px);
  box-shadow: 0 30px 80px rgba(3, 20, 50, .45), 0 2px 0 rgba(255,255,255,.6) inset; display: grid; gap: 16px; }
.auth-card-head { display: grid; gap: 4px; }
.auth-card .welcome { margin: 0; color: var(--text-muted); font-size: 15px; }
.auth-card h2 { font-size: clamp(24px, 2.4vw, 30px); margin: 0; font-weight: 700; letter-spacing: -.01em; }
.auth-card h2 span { color: var(--primary); }
.auth-card .sub { color: var(--text-muted); margin: 4px 0 0; font-size: 14px; }
.auth-card .form-label { font-weight: 600; }
.auth-card .form-control { min-height: 48px; border-radius: 12px; background: var(--surface-2); border-color: var(--border); }
.auth-card .form-control:focus { background: var(--surface); }
.input-icon { position: relative; }
.input-icon .ii { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); pointer-events: none; z-index: 1; }
.input-icon .ii svg { width: 17px; height: 17px; fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.input-icon .form-control { padding-left: 50px; }
.btn-signin { min-height: 50px; border: 0; border-radius: 14px; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(90deg, var(--anc-blue-900), var(--anc-blue-600)); box-shadow: 0 10px 24px color-mix(in srgb, var(--anc-blue-700) 35%, transparent); }
.btn-signin:hover, .btn-signin:focus-visible { background: linear-gradient(90deg, var(--anc-blue-950), var(--anc-blue-700)); }
.btn-signin svg, .btn-register svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alt-tile { display: grid; justify-items: center; gap: 6px; padding: 14px 10px; border-radius: 14px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface)); color: var(--text); font-weight: 700; font-size: 15px; transition: transform .12s, box-shadow .12s, border-color .12s; }
.alt-tile svg { width: 26px; height: 26px; fill: none; stroke: var(--primary); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.alt-tile:hover { border-color: var(--primary); box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 18%, transparent); transform: translateY(-1px); }
.alt-tile:disabled { opacity: .7; transform: none; }
.auth-alt-note { margin: -4px 0 0; font-size: 12px; color: var(--text-muted); text-align: center; }
.btn-register { min-height: 48px; border-radius: 14px; border-width: 2px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-size: 15px; }
.auth-help { margin: 0; text-align: center; font-size: 14px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-help svg { width: 18px; height: 18px; fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-foot { font-size: 14px; color: var(--text-muted); text-align: center; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 600; padding: 4px 8px; z-index: 1; }
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 64px; }
@media (max-width: 960px) {
  .auth-page { grid-template-columns: 1fr; align-content: start; }
  .auth-brand { gap: 16px; }
  .auth-brand-bottom .auth-lede, .auth-features, .auth-rule { display: none; }
  .auth-motto { font-size: 30px; }
  .auth-legal { order: 3; }
}
@media (max-width: 420px) {
  .auth-page { padding: 16px; }
  .auth-card { border-radius: 20px; }
  .auth-logo img { width: 48px; }
}

/* ======================================================================= app shell */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--anc-blue-900); color: #dce9f6; padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .logo { background: #fff; border-radius: var(--radius-md); padding: 8px 10px; }
.sidebar .logo img { width: 100%; height: auto; display: block; }
.nav-group { display: grid; gap: 2px; }
.nav-group .label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8db7e3; padding: 8px 10px 4px; }
.nav-link-app { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: #dce9f6; text-decoration: none; font-weight: 500; font-size: 14px; }
.nav-link-app:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link-app[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--anc-gold-400); }
.nav-link-app.soon { opacity: .5; pointer-events: none; }
.nav-link-app .soon-tag { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px, 3vw, 28px); background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.content { padding: clamp(16px, 3vw, 28px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }
.content > * { min-width: 0; }   /* wide tables scroll inside .grid-scroll instead of widening the page */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--text-muted); max-width: 70ch; }
.menu-toggle { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-2); }
  .menu-toggle { display: inline-flex; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ======================================================================= data grid */
.grid-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.grid-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.grid-toolbar .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grid-toolbar .form-control, .grid-toolbar .form-select { width: auto; min-width: 0; font-size: 14px; }
.grid-toolbar input[type="search"] { width: min(280px, 100%); }
.grid-scroll { overflow-x: auto; }
.grid-table { margin: 0; font-size: 14px; }
.grid-table thead th { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); background: var(--surface-2); white-space: nowrap; border-bottom-width: 1px; }
.grid-table th.sortable { cursor: pointer; user-select: none; }
.grid-table th.sortable button { all: unset; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.grid-table th.sortable button:focus-visible { outline: 2px solid var(--focus-ring); border-radius: 3px; }
.grid-table th .sort-ind { opacity: .35; font-size: 10px; }
.grid-table th[aria-sort="ascending"] .sort-ind, .grid-table th[aria-sort="descending"] .sort-ind { opacity: 1; color: var(--primary); }
.grid-table td { vertical-align: middle; }
.grid-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid-table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.grid-footer { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.grid-footer .pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.grid-footer .pager span, .grid-footer .pager .btn { white-space: nowrap; }
.grid-footer .pager .form-select { width: auto; }
.grid-state { padding: 40px 16px; text-align: center; color: var(--text-muted); display: grid; gap: 8px; justify-items: center; }
.grid-state strong { color: var(--text); font-family: var(--font-display); font-size: 16px; }
.skeleton { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ======================================================================= dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; display: grid; gap: 4px; }
.tile .k { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.tile .v { font-family: var(--font-display); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .h { font-size: 13px; color: var(--text-muted); }
.roadmap { display: grid; gap: 8px; }
.roadmap li { display: flex; gap: 10px; align-items: center; }

/* ======================================================================= toasts */
.toast-stack { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 1100; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast-app { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow-2); font-size: 14px; display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; }
.toast-app.ok { border-left-color: var(--success); }
.toast-app.bad { border-left-color: var(--danger); }
.toast-app .ref { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.toast-app button { border: 0; background: transparent; color: var(--text-muted); font-size: 18px; line-height: 1; }

.visually-hidden-focusable:focus { position: fixed; top: 8px; left: 8px; z-index: 2000; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }

/* ======================================================================= question bank */
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; margin-bottom: 10px;
  background: var(--primary-soft); border: 1px solid var(--border); border-radius: var(--radius-md); }
.bulk-bar[hidden] { display: none !important; }
.sel-col { width: 36px; }
.q-preview { max-width: 58ch; }
.q-preview-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.editor-form { display: grid; gap: 16px; min-width: 0; }
.editor-form fieldset { min-width: 0; }
.editor-side { position: sticky; top: 76px; display: grid; gap: 16px; min-width: 0; }
@media (max-width: 1100px) { .editor-layout { grid-template-columns: minmax(0, 1fr); } .editor-side { position: static; } }

/* Quill on the brand palette */
.rich { background: var(--surface); }
.rich .ql-editor { min-height: 140px; font-family: var(--font-body); font-size: 15px; color: var(--text); }
.rich-short .ql-editor { min-height: 90px; }
.rich-option .ql-editor { min-height: 44px; }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--border); }
.ql-toolbar.ql-snow { background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ql-container.ql-snow { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.ql-snow .ql-stroke { stroke: var(--text-muted); }
.ql-snow .ql-fill { fill: var(--text-muted); }
.ql-snow .ql-picker { color: var(--text-muted); }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--primary); }
.ql-snow.ql-toolbar button:hover .ql-fill, .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--primary); }
.ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; }
.ql-snow .ql-tooltip { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-2); z-index: 5; }
.ql-snow .ql-tooltip input[type=text] { background: var(--surface); color: var(--text); border-color: var(--border); }
.ql-disabled .ql-editor { background: var(--surface-2); }
.ql-editor img { max-width: 100%; height: auto; }

.options-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.option-item { border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 10px; display: grid; gap: 8px; background: var(--surface); }
.option-item.is-correct { border-color: var(--success); background: var(--success-soft); }
.option-item.has-error { border-color: var(--danger); }
.option-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.option-key { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--primary-soft); color: var(--primary); flex: none; }
.option-item.is-correct .option-key { background: var(--success); color: #fff; }
.attached-image { max-width: 100%; max-height: 260px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 8px; }

.tag-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-box .form-control { flex: 1 1 220px; }
.tag-list { list-style: none; margin: 0; padding: 0; display: contents; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--accent-soft);
  color: var(--accent-text); font-size: 13px; font-weight: 600; }
.tag-chip button { border: 0; background: transparent; color: inherit; font-size: 16px; line-height: 1; padding: 0 6px; }

.dup-panel { border: 1.5px solid var(--warning); background: var(--warning-soft); border-radius: var(--radius-md); padding: 14px 16px; }
.dup-panel[hidden] { display: none !important; }
.dup-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }

/* Student preview - same classes the exam screen will use */
.preview-body { border: 1px dashed var(--border); border-radius: var(--radius-md); padding: 14px; display: grid; gap: 12px; background: var(--bg); }
.pv-question { font-size: 16px; line-height: 1.65; overflow-wrap: anywhere; }
.pv-question p, .pv-option-body p, .pv-explanation p { margin: 0 0 .4em; }
.pv-question img, .pv-option-body img, .pv-image { max-width: 100%; height: auto; }
.pv-question table, .pv-explanation table { border-collapse: collapse; margin: 6px 0; }
.pv-question td, .pv-question th, .pv-explanation td { border: 1px solid var(--border); padding: 4px 8px; }
.pv-options { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.pv-option { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.pv-option .k { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--surface-2); color: var(--text-muted); }
.pv-option.correct { border-color: var(--success); background: var(--success-soft); }
.pv-option.correct .k { background: var(--success); color: #fff; }
.pv-answer-box { display: flex; gap: 8px; align-items: center; }
.pv-blank { min-width: 120px; border-bottom: 2px solid var(--border); padding: 2px 6px; font-family: var(--font-mono); }
.pv-explanation { border-left: 3px solid var(--accent); padding-left: 10px; }
.version-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.version-item.current { border-color: var(--primary); background: var(--primary-soft); }

/* ======================================================================= review workflow */
.queue-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.queue-chips [aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.bulk-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.workflow-card { border-color: var(--primary); }
.wf-steps { display: flex; flex-wrap: wrap; gap: 4px; }
.wf-step { font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-muted); }
.wf-step.done { background: var(--success-soft); color: var(--success); }
.wf-step.now { background: var(--primary); color: var(--on-primary); }
.wf-history { list-style: none; padding: 0 0 0 14px; margin: 0; display: grid; gap: 10px; border-left: 2px solid var(--border); max-height: 360px; overflow-y: auto; }
.wf-entry { position: relative; font-size: 13px; }
.wf-entry::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--border); border: 2px solid var(--surface); }
.wf-entry.wf-publish::before, .wf-entry.wf-approve::before { background: var(--success); }
.wf-entry.wf-reject::before { background: var(--danger); }
.wf-entry.wf-submit::before, .wf-entry.wf-review::before { background: var(--primary); }
.wf-comment { margin: 4px 0 0; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: pre-wrap; }

/* ======================================================================= series, sections, exams */
.min-w-0 { min-width: 0; }
.builder { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .builder { grid-template-columns: minmax(0, 1fr); } }
.builder-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.builder-row { display: grid; gap: 6px; }
.builder-item { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; width: 100%;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text); text-decoration: none; }
.builder-item:hover { border-color: var(--primary); color: var(--text); }
.builder-item:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.builder-item.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.builder-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.builder-add { border-top: 1px solid var(--border); padding-top: 12px; }
.exam-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.exam-side { position: sticky; top: 76px; }
@media (max-width: 1100px) { .exam-layout { grid-template-columns: minmax(0, 1fr); } .exam-side { position: static; } }
.cfg-group { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px 14px; }
.cfg-group legend { float: none; width: auto; font-size: 13px; font-weight: 600; padding: 0 6px; margin: 0 0 4px; }
.exam-q-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.exam-q { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.exam-q.not-in-pool { border-color: var(--danger); background: var(--danger-soft); }
.exam-q-no { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px; }
.exam-q-text { font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.exam-q-marks { display: flex; align-items: center; gap: 4px; }
.marks-input { width: 74px; }
@media (max-width: 720px) { .exam-q { grid-template-columns: 34px minmax(0, 1fr); } .exam-q-marks, .exam-q .builder-actions { grid-column: 2; } }
.report-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.report-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; font-size: 14px; }
.report-mark { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 2px; }
.report-item.ok .report-mark { background: var(--success-soft); color: var(--success); }
.report-item.bad .report-mark { background: var(--danger); color: #fff; }
.report-item.warn .report-mark { background: var(--warning-soft); color: var(--warning); }
/* ---------------------------------------------------------------- question structures */
.rule-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.rule { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: 10px 12px 12px; display: grid; gap: 8px; }
.rule.position { box-shadow: inset 3px 0 0 var(--primary); }
.rule.has-error { border-color: var(--danger); background: var(--danger-soft); }
.rule-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; }
.rule-title { font-weight: 600; font-size: 14px; }
.rule-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.rule-grid .span-2 { grid-column: span 2; }
.rule-grid label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; display: block; }
@media (max-width: 720px) { .rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.feas-wrap { overflow-x: auto; }
.feas-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.feas-table th, .feas-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.feas-table th { font-weight: 600; color: var(--text-muted); font-size: 12px; }
.feas-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.feas-table tr.short td { color: var(--danger); font-weight: 600; }
.sample-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; max-height: 360px; overflow: auto; font-size: 13px; }
.sample-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 6px; align-items: baseline; }
/* ---------------------------------------------------------------- plans and subscriptions */
.plan-series-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 720px) { .plan-series-settings { grid-template-columns: minmax(0, 1fr); } }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; align-items: stretch; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-1); }
.plan-card.featured { border: 2px solid var(--accent); box-shadow: var(--shadow-2); }
.plan-badge { position: absolute; top: -11px; left: 16px; padding: 2px 10px; border-radius: 99px; background: var(--accent); color: var(--on-accent);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.plan-price { font-size: 28px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.plan-desc { white-space: pre-line; }
.plan-facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 13px; }
.plan-facts li { padding-left: 18px; position: relative; }
.plan-facts li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700; }
.plan-cta { margin-top: auto; padding-top: 8px; }
.access-series { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; background: var(--surface); }
.access-series > summary { cursor: pointer; padding: 2px 0; }
.access-section { margin-top: 12px; }
.access-exams { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.access-exam { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md); }
.access-exam.locked { background: var(--surface-2); }
.access-exam-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 520px) { .access-exam { grid-template-columns: minmax(0, 1fr); } .access-exam-side { justify-content: flex-start; } }
/* ---------------------------------------------------------------- checkout, bills, payments */
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; max-width: 980px; }
@media (max-width: 860px) { .checkout-layout { grid-template-columns: minmax(0, 1fr); } }
.price-lines { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; font-size: 14px; }
.price-lines dt { font-weight: 400; color: var(--text-muted); }
.price-lines dd { margin: 0; text-align: right; }
.price-lines .total { font-size: 18px; font-weight: 700; color: var(--text); border-top: 1px solid var(--border); padding-top: 8px; }
.result-card { max-width: 560px; margin: 24px auto; }
.result-mark { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; font-size: 26px; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted); }
.result-mark.ok { background: var(--success-soft); color: var(--success); }
.result-mark.bad { background: var(--danger-soft); color: var(--danger); }
.result-mark.warn, .result-mark.wait { background: var(--warning-soft); color: var(--warning); }
.sandbox-card { max-width: 560px; border: 2px dashed var(--warning); }
.gateway-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 260px; }
.invoice { max-width: 860px; }
.invoice-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--primary); padding-bottom: 12px; }
.invoice-seller { font-size: 20px; font-weight: 700; color: var(--primary); }
.invoice-address { white-space: pre-line; }
.invoice-kind { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); }
.invoice-parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .invoice-parties { grid-template-columns: minmax(0, 1fr); } }
.invoice-table .sub td { border-bottom: 0; padding-top: 2px; padding-bottom: 2px; color: var(--text-muted); }
.invoice-table tfoot th { font-size: 16px; }
@media print {
  .sidebar, .topbar, .no-print, .toast-stack, .visually-hidden-focusable { display: none !important; }
  .shell, .main, main { display: block !important; margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .invoice { border: 0 !important; box-shadow: none !important; max-width: none; }
  .invoice .card-body { padding: 0 !important; }
  .invoice-seller { color: #000 !important; }
}
/* ---------------------------------------------------------------- exam player (NTA-style: question left, palette right) */
.exam-body { background: var(--bg); min-height: 100vh; }
.exam-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 100vh; min-height: 100dvh; }
.exam-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--anc-blue-900); color: #fff; }
.exam-title { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; }
.exam-logo { border-radius: 4px; background: #fff; padding: 2px; }
.exam-save { font-size: 12px; opacity: 0.9; max-width: 38ch; text-align: right; }
.exam-save.bad { color: #ffd3cc; font-weight: 600; }
.exam-save.ok { color: #c9f2dc; }
.exam-timer { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 20px; font-weight: 600; padding: 4px 12px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.12); font-variant-numeric: tabular-nums; min-width: 92px; text-align: center; }
.exam-timer.warning { background: var(--timer-warning); color: #1a1406; }
.exam-timer.critical { background: var(--timer-critical); color: #fff; animation: timer-pulse 1s steps(2, start) infinite; }
@keyframes timer-pulse { to { opacity: 0.75; } }
@media (prefers-reduced-motion: reduce) { .exam-timer.critical { animation: none; } }
.exam-palette-toggle { display: none; }
.exam-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; padding: 16px; align-items: start; max-width: 1280px; width: 100%; margin: 0 auto; }
.exam-question { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: grid; gap: 14px; outline: none; }
.exam-q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.exam-q-body { font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.exam-q-body img, .exam-q-img, .exam-opt-img { max-width: 100%; height: auto; }
.exam-passage { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; background: var(--surface-2); }
.exam-passage summary { cursor: pointer; font-weight: 600; }
.exam-answers { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.exam-option { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.exam-option.selected { border-color: var(--primary); background: var(--primary-soft); }
.exam-option .form-check-input { margin-top: 4px; width: 1.15em; height: 1.15em; }
.exam-option-body { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; cursor: pointer; overflow-wrap: anywhere; }
.exam-option-label { font-weight: 700; color: var(--primary); }
.exam-text-answer { max-width: 320px; font-size: 18px; }
.exam-palette { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; display: grid; gap: 12px;
  position: sticky; top: 76px; max-height: calc(100vh - 170px); overflow-y: auto; }
.palette-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; color: var(--text-muted); }
.palette-legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dot.answered { background: var(--q-answered); } .dot.not-answered { background: var(--q-not-answered); }
.dot.not-visited { background: var(--q-not-visited); } .dot.marked { background: var(--q-marked); }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.palette-btn { position: relative; height: 38px; border-radius: 6px; border: 0; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.palette-btn.not-visited { background: var(--q-not-visited); color: var(--q-not-visited-fg); }
.palette-btn.not-answered { background: var(--q-not-answered); color: var(--q-not-answered-fg); }
.palette-btn.answered { background: var(--q-answered); color: var(--q-answered-fg); }
.palette-btn.marked { background: var(--q-marked); color: var(--q-marked-fg); border-radius: 50%; }
.palette-btn.marked.answered::after { content: ""; position: absolute; right: 2px; bottom: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--q-answered-marked-dot); }
.palette-btn.current { outline: 3px solid var(--q-current-ring); outline-offset: 1px; }
.palette-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.palette-btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.exam-bottom { position: sticky; bottom: 0; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); }
.exam-overlay { position: fixed; inset: 0; z-index: 1080; display: grid; place-items: center; background: rgba(5, 20, 40, 0.65); padding: 16px; }
.exam-overlay-card { max-width: 460px; width: 100%; }
.exam-instructions { font-size: 14px; }
@media (max-width: 900px) {
  .exam-main { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .exam-palette-toggle { display: inline-block; }
  /* Closed, the drawer is also invisible, so keyboard focus and screen readers skip it; visibility flips after the slide. */
  .exam-palette { position: fixed; top: 60px; right: 0; bottom: 64px; width: min(320px, 88vw); max-height: none; z-index: 30; transform: translateX(105%);
    visibility: hidden; transition: transform 0.2s, visibility 0s linear 0.2s; box-shadow: var(--shadow-2); border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
  .exam-palette.open { transform: none; visibility: visible; transition: transform 0.2s; }
  /* The save line matters most on a phone (a lost connection), so it moves under the header instead of disappearing. */
  .exam-top { flex-wrap: wrap; row-gap: 4px; gap: 8px; padding: 8px 12px; }
  .exam-title { flex: 1 1 0; min-width: 0; }   /* the name truncates; timer and Questions stay on the first row */
  .exam-timer { font-size: 18px; min-width: 76px; padding: 3px 8px; }
  .exam-save { order: 5; flex: 1 0 100%; max-width: none; text-align: left; }
  .exam-save:empty { display: none; }
  .exam-question { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { .exam-palette { transition: none; } }
/* ---------------------------------------------------------------- exam guard (Phase 13): deterrence, not a promise */
.exam-guarded .exam-question, .exam-guarded .exam-palette { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.exam-guarded .exam-question input, .exam-guarded .exam-question textarea { -webkit-user-select: text; user-select: text; }
.exam-guarded img { -webkit-user-drag: none; }
/* The student's name across the paper: a leaked photo or screenshot says whose attempt it was. It never takes clicks. */
.exam-watermark { position: fixed; inset: 0; z-index: 25; pointer-events: none; overflow: hidden; display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 150px; align-items: center; justify-items: center; padding: 40px 0; }
.exam-watermark span { transform: rotate(-24deg); white-space: nowrap; font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--text); opacity: 0.07; }
.exam-watermark:empty { display: none; }
.exam-concealed { visibility: hidden; }
.exam-sec-warning { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px;
  padding: 10px 14px; border-radius: var(--radius-md); background: var(--danger); color: #fff; font-size: 14px; font-weight: 600; }
.exam-sec-warning[hidden] { display: none; }
.exam-sec-warning .btn-close { flex: none; padding: 8px; }   /* a 30 px target, not the default 14 px */
.exam-rules summary { cursor: pointer; font-weight: 600; }
.exam-rules li + li { margin-top: 4px; }
.exam-print-block { display: none; }
@media print {
  .exam-shell, .exam-overlay, .exam-watermark, .modal, .exam-sec-warning { display: none !important; }
  .exam-print-block { display: block !important; padding: 40px; font-size: 18px; color: #000; }
}
@media (max-width: 900px) { .exam-watermark { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 120px; } }
/* On a phone the header holds the timer, Questions and (optional full screen) its button; the logo gives way so the
   exam name keeps readable room. */
.exam-fs-toggle { display: inline-flex; align-items: center; gap: 6px; }
.exam-fs-toggle[hidden] { display: none; }
@media (max-width: 480px) { .exam-logo, .exam-fs-label { display: none; } .exam-fs-toggle { padding: 6px 8px; } }
/* ---------------------------------------------------------------- results (Phase 14) */
.result-page { max-width: 760px; margin: 24px auto; }
.result-page .result-card { max-width: none; margin: 0; }
.score-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 20px;
  border-radius: var(--radius-md); background: var(--primary-soft); }
.score-main { display: flex; align-items: baseline; gap: 4px; }
.score-value { font-size: 44px; font-weight: 700; line-height: 1; color: var(--primary); }
.score-max { font-size: 20px; color: var(--text-muted); }
.score-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.score-pct { font-size: 24px; font-weight: 600; }
.score-stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.score-stat { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.score-stat-value { font-size: 20px; font-weight: 700; }
.score-stat-label { font-size: 12px; color: var(--text-muted); }
.score-stat.ok .score-stat-value { color: var(--success); }
.score-stat.bad .score-stat-value { color: var(--danger); }
.score-stat.warn .score-stat-value { color: var(--warning); }
.result-bar { height: 8px; min-width: 60px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.result-bar-fill { display: block; height: 100%; width: 0; background: var(--primary); }
.review-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.review-filter .btn[aria-pressed="true"] { background: var(--primary); color: #fff; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.review-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-marks { margin-left: auto; font-weight: 600; }
.review-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.review-option { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md); }
.review-option.correct { border-color: var(--success); background: var(--success-soft); }
.review-option.wrong { border-color: var(--danger); background: var(--danger-soft); }
.review-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.review-answer { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; }
.review-answer dt { font-weight: 400; color: var(--text-muted); }
.review-answer dd { margin: 0; font-weight: 600; }
.review-explanation { padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
@media (max-width: 560px) { .review-option { grid-template-columns: auto minmax(0, 1fr); } .review-tags { grid-column: 2; justify-content: flex-start; } .score-value { font-size: 36px; } }
/* ---------------------------------------------------------------- study material (Phase 15) */
.study-editor { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 991px) { .study-editor { grid-template-columns: minmax(0, 1fr); } }
.study-pick { display: grid; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); }
.study-pick:hover { background: var(--surface-2); }
.study-pick.current { border-color: var(--primary); background: var(--primary-soft); }
.study-attachment { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md); }
.study-section + .study-section { margin-top: 4px; }
.study-section h2 { font-size: 15px; font-weight: 700; color: var(--primary); }
.study-formula { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-md); }
.study-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.study-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }

/* ---------------------------------------------------------------- reports (Phase 16) */
.report-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.report-charts > * { min-width: 0; }
.chart-box { position: relative; height: 240px; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--text-muted); font-size: 13px; text-align: center; }
.report-table { font-variant-numeric: tabular-nums; }
.report-table td.num, .report-table th.num { text-align: right; }
.bar-cell { display: grid; grid-template-columns: minmax(80px, 1fr) 3.5em; gap: 8px; align-items: center; min-width: 150px; }
.bar-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); }
.bar-fill.weak { background: var(--danger); }
.bar-fill.strong { background: var(--success); }
.topic-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.topic-list li { display: grid; grid-template-columns: minmax(0, 1fr) 9em; gap: 4px 12px; align-items: center; }
.topic-list small { grid-column: 1 / -1; color: var(--text-muted); }
@media (max-width: 560px) { .report-charts { grid-template-columns: minmax(0, 1fr); } .chart-box { height: 200px; } }

/* ---------------------------------------------------------------- notifications (Phase 17) */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 31px; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: var(--surface);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.bell-panel { width: min(360px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.bell-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.bell-list { list-style: none; margin: 0; padding: 0; max-height: min(60vh, 420px); overflow-y: auto; }
.bell-empty { padding: 14px; font-size: 13px; color: var(--text-muted); }
.bell-item { display: grid; gap: 2px; width: 100%; padding: 10px 14px 10px 24px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; color: var(--text); position: relative; }
.bell-item:hover, .bell-item:focus-visible { background: var(--surface-2); }
.bell-item.unread::before { content: ""; position: absolute; left: 10px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.bell-item.unread .bell-title { font-weight: 700; }
.bell-title { font-size: 14px; }
.bell-body { font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bell-time { font-size: 11px; color: var(--text-muted); }
.bell-all { display: block; padding: 10px 14px; text-align: center; font-size: 13px; }
.inbox-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.inbox-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.inbox-item.unread { border-left: 4px solid var(--primary); }
.inbox-item p { margin: 0; color: var(--text-muted); white-space: pre-line; grid-column: 1 / -1; }
.template-vars { display: flex; flex-wrap: wrap; gap: 6px; }
.email-preview { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; background: var(--surface); overflow-wrap: anywhere; }
.email-preview .subject { font-weight: 700; margin-bottom: 8px; }
.text-preview { white-space: pre-line; }
.inbox-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inbox-actions .btn { white-space: nowrap; }
/* On a phone the panel spans the screen with a gutter (Popper would pin it to the left edge). */
@media (max-width: 480px) {
  .bell-panel.show { position: fixed !important; inset: 60px 12px auto 12px !important; transform: none !important; width: auto; }
}

/* ---------------------------------------------------------------- installable app (Phase 19) */
/* Update notice and offline banner: stacked in one dock at the bottom, clear of the phone's home bar. */
.pwa-dock {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 1090;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(520px, calc(100vw - 32px));
  display: grid; gap: 8px; pointer-events: none;
}
.pwa-update, .pwa-offline {
  pointer-events: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-2); font-size: 14px;
}
.pwa-update { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--info); }
.pwa-offline { background: var(--anc-blue-900); color: #fff; }
.offline-page { min-height: 100vh; }
.offline-page .offline-logo { width: 160px; height: auto; }
.push-device { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.push-device p { margin: 0; }

/* ---------------------------------------------------------------- AI suggestions (Phase 20) */
.ai-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.ai-form > * { min-width: 0; }
.ai-form-wide { grid-column: 1 / -1; }
@media (max-width: 720px) { .ai-form { grid-template-columns: minmax(0, 1fr); } }
.ai-card.failed { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.ai-q-text { font-size: 15px; }
.ai-q-text p:last-child, .ai-expl p:last-child { margin-bottom: 0; }
.ai-options { margin: 0; padding-left: 1.5rem; display: grid; gap: 4px; }
.ai-options li.correct { font-weight: 600; }
.ai-options li p { display: inline; margin: 0; }
.ai-checks { margin: 0; padding-left: 1.1rem; }
.ai-raw { white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; }
/* The request's facts are words (provider, prompt version), not big numbers. */
.ai-facts .score-stat-value { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- audit and monitoring (Phase 21) */
.audit-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px 12px; }
.audit-filters > * { min-width: 0; }
@media (max-width: 720px) { .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.audit-json { white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }
.login-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .login-summary { grid-template-columns: minmax(0, 1fr); } }
.mon-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.mon-grid > * { min-width: 0; }
@media (max-width: 960px) { .mon-grid { grid-template-columns: minmax(0, 1fr); } }

/* ======================================================================= dashboards (redesign 2026-10) */
.dash-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px;
  border-radius: var(--radius-lg, 18px); padding: clamp(20px, 3vw, 34px); margin-bottom: 18px; color: #fff;
  background: radial-gradient(90% 120% at 100% 0%, #6a4bd6 0%, transparent 55%), linear-gradient(120deg, var(--anc-blue-900), var(--anc-blue-600));
  box-shadow: 0 16px 40px color-mix(in srgb, var(--anc-blue-900) 30%, transparent); }
.dash-hero > * { position: relative; z-index: 1; }
.dash-hero::after { content: ""; position: absolute; z-index: 0; left: -10%; right: -10%; bottom: -66px; height: 90px; border-top: 2px solid color-mix(in srgb, var(--anc-gold-400) 70%, transparent); border-radius: 50%; }
.dash-hero h1 { color: #fff; font-size: clamp(22px, 2.6vw, 32px); margin: 0 0 6px; letter-spacing: -.01em; }
.dash-eyebrow { margin: 0 0 4px; color: var(--anc-gold-300); font-weight: 600; font-size: 14px; }
.dash-sub { margin: 0; color: color-mix(in srgb, #fff 85%, transparent); max-width: 60ch; }
.dash-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.dash-hero .btn-light { color: var(--anc-blue-900); }
.dash-hero-art svg { width: clamp(120px, 16vw, 200px); height: auto; display: block; }
.dash-hero-art .a1 { fill: var(--anc-gold-400); }
.dash-hero-art .a2 { fill: rgba(255,255,255,.18); }
.dash-hero-art .a3 { fill: rgba(255,255,255,.55); }
.dash-hero-art .a4 { fill: rgba(255,255,255,.3); }
.dash-hero-art .a5 { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px;
  color: var(--text); text-decoration: none; transition: box-shadow .15s, transform .15s, border-color .15s; }
.kpi:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 12%, transparent); transform: translateY(-1px); }
.kpi-icon { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.kpi-icon.gold { background: var(--accent-soft); color: var(--accent-text); }
.kpi-icon.green { background: var(--success-soft); color: var(--success); }
.kpi-icon.violet { background: color-mix(in srgb, #6b3fa0 14%, var(--surface)); color: #6b3fa0; }
.kpi-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.kpi-body { display: grid; gap: 2px; min-width: 0; }
.kpi .k { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.kpi .v { font-family: var(--font-display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .h { font-size: 13px; color: var(--text-muted); }
.dash-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 2px; }
.dash-two > .card, .kpi-grid + .card { min-width: 0; }
.kpi-grid + .card { margin-bottom: 18px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.quick { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; }
.quick:hover { border-color: var(--primary); color: var(--primary); }
.quick .qi { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--primary); }
.quick .qi svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.mini-stats > div { background: var(--surface-2); border-radius: 12px; padding: 12px; display: grid; gap: 2px; min-width: 0; }
.mini-stats .v { font-family: var(--font-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-stats .k { font-weight: 600; font-size: 13px; }
.mini-stats .h { font-size: 12px; color: var(--text-muted); }
@media (max-width: 640px) {
  .dash-hero { grid-template-columns: 1fr; }
  .dash-hero-art { display: none; }
  .mini-stats { grid-template-columns: 1fr; }
}

/* ======================================================================= biometric sign-in page */
.bio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.bio-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bio-tile { display: grid; justify-items: center; gap: 8px; padding: 18px 12px; border-radius: 14px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface)); color: var(--text); font-weight: 700; }
.bio-tile svg, .bio-icon svg { width: 30px; height: 30px; fill: none; stroke: var(--primary); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bio-tile:hover { border-color: var(--primary); }
.bio-list { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 10px; }
.bio-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.bio-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); }
.bio-icon svg { width: 22px; height: 22px; }
.bio-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.bio-text strong { overflow-wrap: anywhere; }
@media (max-width: 420px) { .bio-actions { grid-template-columns: 1fr; } }
