/* ==========================================================================
   MHT-CET Mock Test Portal — design system (v1.2)
   Tokens → base → shell (topbar, sidebar) → components → page patterns.
   College brand colour (--brand) overrides the navy where a college sets one.
   ========================================================================== */
:root {
  --navy: #1E3A5F;
  --brand: #1E3A5F;
  --accent: #2563EB;
  --accent-600: #1D4ED8;
  --accent-50: #EFF4FF;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --ink: #0F1B2D;
  --ink-2: #334155;
  --muted: #64748B;
  --line: #E3E8EF;
  --line-2: #EEF2F6;
  --ok: #15803D;   --ok-50: #EAF7EE;
  --warn: #B45309; --warn-50: #FFF6E5;
  --bad: #B91C1C;  --bad-50: #FDECEC;
  --violet: #6D28D9; --violet-50: #F3EEFF;
  --orange: #C2410C; --orange-50: #FFF1E7;
  --pink: #BE185D; --pink-50: #FDEEF5;
  --r-sm: 8px; --r: 10px; --r-lg: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 2px 8px rgba(15, 27, 45, .04);
  --shadow-lg: 0 10px 30px rgba(15, 27, 45, .12);
  --sb-w: 248px; --sb-w-collapsed: 72px; --top-h: 64px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", Arial, sans-serif;
  --bs-body-font-family: var(--font);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-primary: var(--accent);
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 37, 99, 235;
  --bs-link-hover-color: var(--accent-600);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--r-sm);
}

/* ---------- base ---------- */
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14.5px; line-height: 1.5; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.015em; margin-bottom: .2rem; color: var(--ink); }
h2.h5, h2.h6, .h6 { font-weight: 650; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
.tabular { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid #93B4FF; outline-offset: 2px; }
.skip { position: absolute; left: 1rem; top: .5rem; z-index: 2000; background: #fff; padding: .4rem .7rem; border-radius: var(--r-sm); }
.text-muted { color: var(--muted) !important; }
.ic { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- buttons, forms ---------- */
.btn { border-radius: var(--r-sm); font-weight: 550; padding: .45rem .9rem; display: inline-flex; align-items: center; gap: .4rem; justify-content: center; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
/* Buttons stretched in narrow grid columns (e.g. a col-md-1 "Filter" button) must not outgrow the column. */
.d-grid > .btn { padding-left: .4rem; padding-right: .4rem; min-width: 0; }
.btn-lg { padding: .65rem 1.2rem; }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-600); --bs-btn-hover-border-color: var(--accent-600); --bs-btn-active-bg: #1E40AF; --bs-btn-active-border-color: #1E40AF; --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: #BFD1FB; --bs-btn-bg: #fff; --bs-btn-hover-bg: var(--accent-50); --bs-btn-hover-color: var(--accent-600); --bs-btn-hover-border-color: var(--accent); --bs-btn-active-bg: var(--accent-50); --bs-btn-active-color: var(--accent-600); --bs-btn-active-border-color: var(--accent); }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line); --bs-btn-bg: #fff; --bs-btn-hover-bg: #F1F5F9; --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #CBD5E1; --bs-btn-active-bg: #E2E8F0; --bs-btn-active-color: var(--ink); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #F1F5F9; --bs-btn-hover-border-color: #CBD5E1; }
.btn-link { padding-left: 0; padding-right: 0; }
.form-control, .form-select { border-radius: var(--r-sm); border-color: #D5DCE5; padding: .48rem .75rem; font-size: .93rem; }
.form-control-sm, .form-select-sm { padding: .3rem .55rem; font-size: .84rem; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.form-label { font-weight: 550; color: var(--ink-2); margin-bottom: .3rem; font-size: .9rem; }
.form-text { color: var(--muted); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-control[type=file] { padding: .38rem .6rem; }
fieldset legend { font-size: 1rem; }

/* ---------- badges, alerts ---------- */
.badge { font-weight: 600; border-radius: 6px; padding: .32em .6em; letter-spacing: .01em; }
.text-bg-success { background: var(--ok-50) !important; color: var(--ok) !important; border: 1px solid #BFE5CB; }
.text-bg-secondary { background: #EEF2F6 !important; color: #475569 !important; border: 1px solid #DCE3EB; }
.text-bg-warning { background: var(--warn-50) !important; color: var(--warn) !important; border: 1px solid #F5D9A8; }
.text-bg-danger { background: var(--bad-50) !important; color: var(--bad) !important; border: 1px solid #F5C2C2; }
.text-bg-info { background: var(--accent-50) !important; color: var(--accent-600) !important; border: 1px solid #C9D8FB; }
.text-bg-light { background: #F1F5F9 !important; color: #475569 !important; border: 1px solid var(--line); }
.alert { border-radius: var(--r); border-width: 1px; padding: .8rem 1rem; }
.alert-success { background: var(--ok-50); border-color: #BFE5CB; color: #14532D; }
.alert-info { background: var(--accent-50); border-color: #C9D8FB; color: #1E3A8A; }
.alert-warning { background: var(--warn-50); border-color: #F5D9A8; color: #7C2D12; }
.alert-danger { background: var(--bad-50); border-color: #F5C2C2; color: #7F1D1D; }
.alert-secondary { background: #F1F5F9; border-color: var(--line); color: var(--ink-2); }
.credentials { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9rem; }

/* ---------- shell: topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 1030; height: var(--top-h); background: var(--navy); color: #fff; display: flex; align-items: center; gap: .6rem; padding: 0 1rem; box-shadow: 0 1px 0 rgba(255,255,255,.06); }
.icon-btn { background: transparent; border: 0; color: inherit; width: 40px; height: 40px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; position: relative; }
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.icon-btn .ic { width: 22px; height: 22px; }
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; min-width: 0; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: var(--r-sm); background: #fff; color: var(--navy); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.brand-mark .ic { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: rgba(255, 255, 255, .75); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.notif-dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: #F59E0B; color: #1F2937; font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--navy); }
.notif-menu { width: 320px; padding: 0; border-radius: var(--r); border-color: var(--line); box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.notif-item { display: flex; flex-direction: column; padding: .6rem .9rem; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.notif-item:hover { background: #F8FAFC; text-decoration: none; }
.notif-title { font-weight: 550; font-size: .88rem; } .notif-time { color: var(--muted); font-size: .76rem; }
.notif-empty { margin: 0; padding: 1rem .9rem; color: var(--muted); font-size: .88rem; }
.user-btn { display: flex; align-items: center; gap: .6rem; background: transparent; border: 0; color: #fff; padding: .3rem .5rem; border-radius: var(--r-sm); }
.user-btn:hover { background: rgba(255, 255, 255, .1); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #DCE7F7; color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.user-meta { flex-direction: column; text-align: left; line-height: 1.2; }
.user-meta strong { font-size: .9rem; } .user-meta small { color: rgba(255, 255, 255, .75); font-size: .76rem; }
.dropdown-menu { border-radius: var(--r); border-color: var(--line); box-shadow: var(--shadow-lg); font-size: .9rem; }
.dropdown-item { display: flex; align-items: center; gap: .55rem; padding: .45rem 1rem; }
.dropdown-item .ic { color: var(--muted); }

/* ---------- shell: sidebar + content ---------- */
.shell { display: flex; min-height: calc(100vh - var(--top-h)); }
.sidebar { width: var(--sb-w); flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
@media (min-width: 992px) {
  .sidebar { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; }
  body.sb-collapsed .sidebar { width: var(--sb-w-collapsed); }
  body.sb-collapsed .side-link span, body.sb-collapsed .side-card, body.sb-collapsed .side-foot { display: none; }
  body.sb-collapsed .side-link { justify-content: center; padding: .65rem; }
}
.side-nav { padding: .9rem .7rem; display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: .8rem; padding: .62rem .85rem; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 550; font-size: .93rem; }
.side-link .ic { width: 20px; height: 20px; color: #64748B; }
.side-link:hover { background: #F1F5F9; color: var(--ink); text-decoration: none; }
.side-link.active { background: var(--navy); color: #fff; box-shadow: 0 2px 6px rgba(30, 58, 95, .25); }
.side-link.active .ic { color: #fff; }
.side-card { margin: auto .9rem .8rem; border: 1px solid var(--line); border-radius: var(--r); padding: .85rem; font-size: .85rem; background: #FBFCFE; }
.side-plan { font-weight: 650; margin-top: .25rem; } .side-muted { color: var(--muted); font-size: .8rem; }
.side-days { margin-top: .45rem; display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; font-size: .82rem; color: var(--ink-2); }
.side-days.warn { color: var(--warn); background: var(--warn-50); padding: .15rem .45rem; border-radius: 6px; }
.side-storage { display: flex; justify-content: space-between; margin: .7rem 0 .3rem; font-size: .8rem; color: var(--ink-2); } .side-storage .ic { width: 15px; height: 15px; }
.side-foot { padding: .7rem 1rem 1rem; font-size: .72rem; color: var(--muted); }
.content { flex: 1; min-width: 0; padding: 1.5rem clamp(1rem, 2.2vw, 2rem) 2.5rem; max-width: 1480px; }
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { width: min(300px, 86vw); } .content { padding-top: 1.1rem; } }

/* ---------- meters ---------- */
.meter { height: 6px; background: #E8EDF3; border-radius: 4px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.meter.warn span { background: #F59E0B; } .meter.bad span { background: #DC2626; } .meter.ok span { background: #16A34A; }
.progress { height: 6px; background: #E8EDF3; border-radius: 4px; } .progress-bar { background: var(--accent); }

/* ---------- page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head > div:first-child { min-width: 0; }
.page-sub { color: var(--muted); margin: 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.date-chip { display: inline-flex; align-items: center; gap: .6rem; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: .45rem .8rem; line-height: 1.2; font-size: .84rem; }
.date-chip .ic { color: var(--muted); width: 20px; height: 20px; } .date-chip small { color: var(--muted); display: block; }

/* ---------- cards / panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.15rem 1.25rem; box-shadow: var(--shadow); }
.panel > h2.h6, .panel-title { display: flex; align-items: center; gap: .55rem; font-size: 1rem; font-weight: 650; margin-bottom: .85rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .85rem; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 1.02rem; font-weight: 650; display: flex; align-items: center; gap: .55rem; }
.panel-head h2 .ic { color: var(--accent); width: 20px; height: 20px; }
.panel-head a { font-size: .87rem; font-weight: 550; }
details.panel > summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
details.panel[open] > summary::before { transform: rotate(45deg); }
.card-plain { background: #fff; border-radius: var(--r-lg); padding: 1.75rem; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.narrow { max-width: 660px; } .narrow-wide { max-width: 980px; }

/* ---------- KPI / stat cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 1199.98px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .7rem; }
.kpi-top { display: flex; gap: .9rem; align-items: center; }
.kpi-ic { width: 52px; height: 52px; border-radius: var(--r); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-ic .ic { width: 26px; height: 26px; }
.kpi-n { font-size: 1.65rem; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-n small { font-size: 1rem; font-weight: 600; color: var(--muted); }
.kpi-label { color: var(--ink-2); font-weight: 550; font-size: .9rem; }
.kpi-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; gap: .5rem; }
.kpi-meter { display: flex; align-items: center; gap: .6rem; font-size: .78rem; color: var(--muted); } .kpi-meter .meter { flex: 1; }
.tone-blue .kpi-ic { background: var(--accent-50); color: var(--accent); } .tone-blue .kpi-n { color: var(--accent-600); }
.tone-green .kpi-ic { background: var(--ok-50); color: var(--ok); } .tone-green .kpi-n { color: var(--ok); } .tone-green .meter span { background: #16A34A; }
.tone-violet .kpi-ic { background: var(--violet-50); color: var(--violet); } .tone-violet .kpi-n { color: var(--violet); } .tone-violet .meter span { background: #7C3AED; }
.tone-orange .kpi-ic { background: var(--orange-50); color: var(--orange); } .tone-orange .kpi-n { color: var(--orange); } .tone-orange .meter span { background: #EA580C; }
.tone-blue { background: linear-gradient(180deg, #F7FAFF, #fff 60%); } .tone-green { background: linear-gradient(180deg, #F6FCF8, #fff 60%); }
.tone-violet { background: linear-gradient(180deg, #FAF7FF, #fff 60%); } .tone-orange { background: linear-gradient(180deg, #FFF9F4, #fff 60%); }
/* legacy stat tiles (used by several pages) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; }
.stat-grid.three { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: .9rem 1rem; display: flex; gap: .8rem; align-items: baseline; box-shadow: var(--shadow); border-left: 4px solid var(--accent); }
.stat.ok { border-left-color: #16A34A; } .stat.bad { border-left-color: #DC2626; }
.stat-n { font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; color: var(--ink); }
.stat span:last-child { color: var(--muted); font-size: .85rem; line-height: 1.3; }

/* ---------- usage rows (subscription) ---------- */
.usage-row { display: grid; grid-template-columns: 26px 1fr auto; gap: .15rem .65rem; align-items: center; font-size: .87rem; margin-bottom: .75rem; }
.usage-row .ic { color: var(--muted); grid-row: span 2; }
.usage-row .meter, .usage-row .progress { grid-column: 2 / 4; }
.usage-row .pct { font-size: .74rem; color: var(--muted); text-align: right; grid-column: 3; }
.usage-row.no-icon { grid-template-columns: 1fr auto; } .usage-row.no-icon .progress, .usage-row.no-icon .meter { grid-column: 1 / -1; }
.renew-warn { display: flex; gap: .55rem; align-items: center; background: #FFF8E6; border: 1px solid #F5DDA2; color: #7C4A03; border-radius: var(--r-sm); padding: .6rem .8rem; font-size: .87rem; font-weight: 550; margin: .6rem 0 .9rem; }
.renew-warn.bad { background: var(--bad-50); border-color: #F5C2C2; color: #7F1D1D; }

/* ---------- tables ---------- */
.table { --bs-table-bg: #fff; --bs-table-color: var(--ink); margin-bottom: 0; font-size: .9rem; }
.table > :not(caption) > * > * { padding: .65rem .75rem; border-bottom-color: var(--line-2); }
.table thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; background: #F8FAFC; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-sm > :not(caption) > * > * { padding: .45rem .6rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #F8FAFC; }
.table-responsive { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
.table-responsive > .table thead th:first-child { border-top-left-radius: var(--r-lg); } .table-responsive > .table thead th:last-child { border-top-right-radius: var(--r-lg); }
.table-responsive > .table tbody tr:last-child > * { border-bottom: 0; }
.panel .table-responsive { border: 1px solid var(--line-2); box-shadow: none; border-radius: var(--r); }
.q-cell { max-width: 460px; }
.details-cell { max-width: 320px; font-size: .75rem; color: var(--muted); word-break: break-word; }
.code-badge { display: inline-block; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .74rem; background: #F1F5F9; border: 1px solid var(--line); color: var(--ink-2); border-radius: 6px; padding: .1rem .4rem; white-space: nowrap; }
.cell-title { font-weight: 600; color: var(--ink); } .cell-sub { display: block; color: var(--muted); font-size: .78rem; }

/* ---------- filters, pagination, empty states ---------- */
.filters { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: .7rem; box-shadow: var(--shadow); }
.filters .form-control, .filters .form-select { width: auto; flex: 1 1 180px; max-width: 320px; }
.pagination { --bs-pagination-color: var(--ink-2); --bs-pagination-active-bg: var(--accent); --bs-pagination-active-border-color: var(--accent); --bs-pagination-border-radius: var(--r-sm); }
.empty, .empty-state { border: 1px dashed #CBD5E1; border-radius: var(--r-lg); padding: 2rem 1.25rem; text-align: center; color: var(--muted); background: #fff; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.5rem 1rem; }
.panel .empty-state { border: 0; padding: 1.2rem .5rem; }
.empty-ic { width: 34px; height: 34px; color: #94A3B8; stroke-width: 1.6; }
.empty-title { margin: 0; font-weight: 650; color: var(--ink-2); } .empty-text { margin: 0; font-size: .87rem; max-width: 420px; }
.checklist { list-style: none; padding: 0; margin: 0 0 .5rem; font-size: .9rem; }
.checklist li { padding: .25rem 0 .25rem 1.5rem; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .6rem; width: .7rem; height: .7rem; border-radius: 50%; }
.checklist .ok::before { background: #16A34A; } .checklist .bad::before { background: #DC2626; } .checklist .warn::before { background: #F59E0B; }
.list-group-item.unread { border-left: 4px solid var(--accent); }
.list-group { border-radius: var(--r-lg); box-shadow: var(--shadow); }

/* ---------- dashboard patterns ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(300px, 4fr) minmax(0, 8fr); gap: 1rem; margin-bottom: 1rem; }
.dash-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.dash-grid-r { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1rem; margin-bottom: 1rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (max-width: 1199.98px) { .dash-grid, .dash-grid-2, .dash-grid-r { grid-template-columns: minmax(0, 1fr); } }
/* Grid items default to min-width:auto, which lets wide tables push cards past the screen; tables scroll instead. */
.dash-grid > *, .dash-grid-2 > *, .dash-grid-r > *, .kpi-grid > *, .qa-grid > *, .panel { min-width: 0; }
.qa-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .8rem; }
@media (max-width: 1399.98px) { .qa-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .qa-grid { grid-template-columns: 1fr 1fr; } }
.qa { position: relative; display: flex; flex-direction: column; gap: .2rem; padding: .9rem; border-radius: var(--r); border: 1px solid var(--line); background: #fff; color: var(--ink); min-height: 112px; }
.qa:hover { text-decoration: none; border-color: #BFD1FB; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.qa-ic { width: 40px; height: 40px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; margin-bottom: .45rem; }
.qa-go { position: absolute; top: .8rem; right: .8rem; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.qa-go .ic { width: 15px; height: 15px; }
.qa strong { font-size: .92rem; } .qa small { color: var(--muted); font-size: .8rem; }
.qa.c1 { background: #F7FAFF; } .qa.c1 .qa-ic { background: #DCE8FF; color: var(--accent); }
.qa.c2 { background: #F6FCF8; } .qa.c2 .qa-ic { background: #D8F2E1; color: var(--ok); }
.qa.c3 { background: #FAF7FF; } .qa.c3 .qa-ic { background: #E9DEFF; color: var(--violet); }
.qa.c4 { background: #FFF9F4; } .qa.c4 .qa-ic { background: #FFE2CC; color: var(--orange); }
.qa.c5 { background: #F5F9FF; } .qa.c5 .qa-ic { background: #D7E6FB; color: #1D4ED8; }
.qa.c6 { background: #FFF7FA; } .qa.c6 .qa-ic { background: #FBD7E6; color: var(--pink); }
.act-ic { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: #EEF2F6; color: #475569; margin-right: .5rem; vertical-align: middle; }
.act-ic .ic { width: 15px; height: 15px; }
.act-ic.g { background: var(--ok-50); color: var(--ok); } .act-ic.b { background: var(--accent-50); color: var(--accent); } .act-ic.v { background: var(--violet-50); color: var(--violet); } .act-ic.o { background: var(--orange-50); color: var(--orange); } .act-ic.r { background: var(--bad-50); color: var(--bad); }
.tip-next { display: flex; gap: .8rem; align-items: center; background: #F5F8FF; border: 1px solid #DCE6FB; border-radius: var(--r); padding: .8rem .9rem; margin-bottom: .8rem; flex-wrap: wrap; }
.tip-next .ic { color: var(--accent); width: 26px; height: 26px; }
.tip-next > div { flex: 1; min-width: 180px; } .tip-next strong { display: block; } .tip-next span { color: var(--muted); font-size: .85rem; }
.tip-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .35rem 1rem; font-size: .86rem; }
@media (max-width: 575.98px) { .tip-list { grid-template-columns: 1fr; } }
.tip-list li { display: flex; gap: .45rem; align-items: center; color: var(--ink-2); } .tip-list .ic { width: 16px; height: 16px; }
.tip-list li.done { color: var(--muted); } .tip-list li.done .ic { color: #16A34A; } .tip-list li.todo .ic { color: #CBD5E1; }
.tip-list li.done span { text-decoration: line-through; text-decoration-color: #CBD5E1; }
.panel-close { background: transparent; border: 0; color: var(--muted); padding: .2rem; border-radius: 6px; } .panel-close:hover { background: #F1F5F9; color: var(--ink); }
.mini-list { list-style: none; padding: 0; margin: 0; } .mini-list li { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--line-2); font-size: .89rem; } .mini-list li:last-child { border-bottom: 0; }

/* ---------- plain pages (sign in, installer, errors) ---------- */
body.plain { background: radial-gradient(1200px 500px at 20% -10%, #2B4E7A 0, transparent 60%), linear-gradient(180deg, var(--navy) 0 260px, var(--bg) 260px); min-height: 100vh; }
.plain-wrap { max-width: 440px; margin: 0 auto; padding: 3.2rem 1rem; }
.plain-wrap:has(.wide) { max-width: 740px; }
.plain-head { color: #fff; display: flex; align-items: center; gap: .8rem; margin-bottom: 1.6rem; }
.plain-head .brand-mark { width: 44px; height: 44px; } .plain-head strong { display: block; font-size: 1.1rem; } .plain-head small { color: rgba(255, 255, 255, .75); }
.plain-mark { border: 2px solid #fff; border-radius: var(--r-sm); padding: .1rem .45rem; font-weight: 800; letter-spacing: .04em; }
.plain-foot { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 1.4rem; }

/* ---------- question rendering ---------- */
.q-preview .q-body { font-size: 1rem; margin-bottom: .7rem; }
.q-options { padding-left: 1.6rem; margin-bottom: .4rem; } .q-options li { padding: .3rem .45rem; border-radius: 6px; }
.q-options li.key { background: var(--ok-50); } .q-options li.chosen-wrong { background: var(--bad-50); }
.q-img { max-width: 100%; max-height: 320px; border: 1px solid var(--line); border-radius: var(--r-sm); margin: .4rem 0; background: #fff; }
.opt-img { max-width: min(100%, 320px); max-height: 180px; border: 1px solid var(--line); border-radius: var(--r-sm); margin: .3rem 0; background: #fff; }
.explain { border-top: 1px solid var(--line); padding-top: .55rem; margin-top: .55rem; color: var(--ink-2); }
.verdict.right { color: var(--ok); font-weight: 650; } .verdict.wrong { color: var(--bad); font-weight: 650; } .verdict.blank { color: var(--muted); }

/* ---------- test builder ---------- */
.pattern-choices { display: grid; gap: .65rem; }
.pattern-choice { display: flex; gap: .8rem; border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; cursor: pointer; background: #fff; }
.pattern-choice:hover { border-color: #BFD1FB; }
.pattern-choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent), 0 0 0 3px rgba(37, 99, 235, .08); }
.pattern-choice input { margin-top: .3rem; }
.publish-bar.blocked { border-left: 4px solid #F59E0B; } .publish-bar.ready { border-left: 4px solid #16A34A; }
.count-chip { display: inline-block; font-size: .78rem; padding: .12rem .55rem; border-radius: 999px; margin: .15rem .2rem 0 0; border: 1px solid; font-variant-numeric: tabular-nums; font-weight: 550; }
.count-chip.ok { color: var(--ok); border-color: #BFE5CB; background: var(--ok-50); } .count-chip.short { color: var(--warn); border-color: #F5D9A8; background: var(--warn-50); }
.tq-list { margin: .85rem 0 0; padding-left: 1.8rem; }
.tq-list li { display: flex; justify-content: space-between; gap: .8rem; padding: .55rem 0; border-top: 1px solid var(--line-2); }
.tq-list li.archived { background: #FFF6F5; } .tq-list li:target { background: #FFF9E6; }
.tq-meta { display: block; font-size: .75rem; color: var(--muted); } .tq-text { font-size: .9rem; min-width: 0; }
.tq-actions { display: flex; gap: .25rem; flex-shrink: 0; align-items: flex-start; } .tq-actions form { margin: 0; }
.sticky-actions { position: sticky; top: var(--top-h); background: var(--bg); padding: .55rem 0; z-index: 5; }
.section-edit { border-top: 1px solid var(--line); padding-top: .85rem; margin-top: .85rem; }
.compact-form .col-md-4, .compact-form .col-md-6, .compact-form .col-md-8 { width: 100%; }
.option-field { background: #FBFCFE; border: 1px solid var(--line-2); border-radius: var(--r); padding: .75rem; }

/* ---------- reports ---------- */
.matrix td.low { background: var(--bad-50); }
.acc-bar { display: inline-block; width: 90px; height: 7px; background: #E8EDF3; border-radius: 4px; vertical-align: middle; overflow: hidden; }
.acc-bar span { display: block; height: 100%; background: #16A34A; } .acc-bar span.low { background: #DC2626; }
.row-error td { background: #FFF5F5; } .row-duplicate td { background: #FFFAEF; } .row-inserted td, .row-valid td { background: #F6FBF8; }

/* ---------- results ---------- */
.score-hero { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem 1.35rem; box-shadow: var(--shadow); }
.score-main { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.score-n { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--accent-600); font-variant-numeric: tabular-nums; }
.score-of { color: var(--muted); } .score-pct { margin-left: auto; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem 1rem; margin: 0 0 .8rem; }
.score-facts > div { background: #F8FAFC; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: .5rem .7rem; }
.score-facts dt { font-size: .74rem; color: var(--muted); font-weight: 550; } .score-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- student ---------- */
.test-cards { display: grid; gap: .7rem; }
.test-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.15rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; box-shadow: var(--shadow); border-left: 4px solid #CBD5E1; }
.test-card.in_progress { border-left-color: #F59E0B; } .test-card.available { border-left-color: var(--accent); } .test-card.done { border-left-color: #16A34A; }
.test-card h3 { font-size: 1rem; font-weight: 650; }
.test-meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; color: var(--muted); font-size: .84rem; } .test-meta span { display: inline-flex; align-items: center; gap: .3rem; } .test-meta .ic { width: 15px; height: 15px; }
.section-title { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; font-weight: 650; margin: 1.5rem 0 .75rem; }
.section-title .count { background: #E8EDF3; color: var(--ink-2); font-size: .75rem; border-radius: 999px; padding: .1rem .55rem; }
.instructions h2 { margin-top: 1.1rem; } .instructions h2:first-child { margin-top: 0; }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; font-size: .85rem; } .legend span { display: inline-flex; align-items: center; gap: .4rem; }
.pal { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; font-style: normal; font-size: .75rem; font-weight: 600; border-radius: 6px; position: relative; }
.pal.not-visited { background: #EEF0F2; border: 1px solid #B8C0C8; color: #333; }
.pal.not-answered { background: #D93025; color: #fff; clip-path: polygon(0 0, 100% 0, 100% 72%, 50% 100%, 0 72%); }
.pal.answered { background: #188038; color: #fff; clip-path: polygon(0 28%, 50% 0, 100% 28%, 100% 100%, 0 100%); }
.pal.marked, .pal.answered-marked { background: #6A3FB5; color: #fff; border-radius: 50%; }
.pal.answered-marked::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #34A853; border: 2px solid #fff; }

@media (max-width: 575.98px) { h1 { font-size: 1.35rem; } .page-actions .btn { flex: 1 1 auto; } .content { padding-left: .85rem; padding-right: .85rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } .qa:hover { transform: none; } }

/* ---------- Test Module V2: wizard, availability preview, health check ---------- */
.wizard-steps { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 1rem; counter-reset: none; }
.wizard-steps li { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem .2rem .25rem; }
.wizard-steps li span { width: 20px; height: 20px; border-radius: 50%; background: #E8EDF3; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .72rem; }
.wizard-steps li.now { color: var(--ink); border-color: #BFD1FB; } .wizard-steps li.now span { background: var(--accent); color: #fff; }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; }
.gen-report.ok { border-left: 4px solid #16A34A; } .gen-report.bad { border-left: 4px solid #DC2626; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem 1rem; }
.chapter-subj { grid-column: 1 / -1; font-weight: 650; margin-top: .4rem; border-bottom: 1px solid var(--line); padding-bottom: .2rem; }
.chapter-cell { display: grid; grid-template-columns: 1fr 80px; gap: .5rem; align-items: center; font-size: .88rem; }
.rules-table select, .rules-table input { min-width: 90px; }
.type-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.health-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.health-list li { display: grid; grid-template-columns: 110px 130px 1fr; gap: .6rem; align-items: start; padding: .45rem .6rem; border-radius: var(--r-sm); border: 1px solid var(--line-2); font-size: .88rem; }
.health-list li.ok { background: #F6FBF8; } .health-list li.warn { background: #FFFAEF; } .health-list li.bad { background: #FFF5F5; }
.health-level { font-weight: 700; display: inline-flex; gap: .3rem; align-items: center; } .health-check { color: var(--ink-2); font-weight: 600; }
.health-list li.ok .health-level { color: var(--ok); } .health-list li.warn .health-level { color: var(--warn); } .health-list li.bad .health-level { color: var(--bad); }
@media (max-width: 575.98px) { .health-list li { grid-template-columns: 1fr; gap: .1rem; } }

.centre-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
@media (max-width: 767.98px) { .centre-links { grid-template-columns: 1fr; } }
.centre-links .qa { min-height: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .25rem .75rem; font-size: .84rem; color: var(--ink-2); }
.chip span { background: #EEF2F6; border-radius: 999px; padding: 0 .4rem; margin-left: .2rem; font-size: .75rem; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); } .chip.on span { background: rgba(255,255,255,.2); color: #fff; } .chip:hover { text-decoration: none; }
.series-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.series-list li { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: .5rem .7rem; }
.series-list .badge .ic { width: 13px; height: 13px; }
