/* ===== Tokens ===== */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #dde3ea;
  --border-strong: #c3ccd7;
  --text: #16202c;
  --text-2: #4b5a6b;
  --text-3: #7a8797;
  --brand: #0f2a4a;
  --brand-2: #173a63;
  --accent: #1667d9;
  --accent-soft: #e5effc;
  --accent-ink: #ffffff;
  --cyan: #1aa6b8;
  --ok: #148a4c;
  --ok-soft: #e3f5ea;
  --bad: #c8322b;
  --bad-soft: #fcebea;
  --warn: #b26a00;
  --warn-soft: #fff3df;
  --mark: #c27c0e;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 16px rgba(16, 32, 48, .06);
  --shadow-lg: 0 20px 50px rgba(10, 25, 45, .22);
  --radius: 10px;
  --radius-sm: 6px;
  --mono: "Cascadia Mono", "Consolas", "SF Mono", Menlo, monospace;
  --sans: "Segoe UI", "Noto Sans Arabic", Tahoma, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d141d;
  --surface: #141e2a;
  --surface-2: #192533;
  --border: #253446;
  --border-strong: #34475d;
  --text: #e6edf5;
  --text-2: #a9b7c7;
  --text-3: #7d8da0;
  --brand: #0a1a2d;
  --brand-2: #10263f;
  --accent: #4c94ff;
  --accent-soft: #17304f;
  --accent-ink: #06121f;
  --cyan: #3cc8da;
  --ok: #3fbf7a;
  --ok-soft: #12301f;
  --bad: #f06a62;
  --bad-soft: #3a1817;
  --warn: #f0a640;
  --warn-soft: #3a2a10;
  --mark: #f0b040;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
code {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 .3em;
}
h1, h2, h3 { line-height: 1.25; margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:focus-visible, .opt:focus-visible, .chip:focus-visible, .slot:focus-visible, .nav-cell:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { min-height: 46px; padding: 0 22px; font-size: 15px; }

/* ===== App shell ===== */
.topnav {
  background: var(--brand);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.topnav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 24px; min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .2px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: linear-gradient(135deg, #1b4a80, #0f2a4a); border: 1px solid rgba(255,255,255,.18);
}
.brand small { display: block; font-weight: 500; font-size: 11px; color: #9fb4cc; letter-spacing: .4px; text-transform: uppercase; }
.navlinks { display: flex; gap: 4px; flex: 1; }
.navlinks a {
  color: #c6d4e4; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 600; font-size: 14px;
}
.navlinks a:hover { color: #fff; background: rgba(255,255,255,.08); }
.navlinks a.active { color: #fff; background: rgba(255,255,255,.14); }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.18); background: transparent; color: #fff; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.1); }

.page { max-width: 1180px; margin: 0 auto; padding: 28px 16px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 6px 0 0; color: var(--text-2); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

/* ===== Home ===== */
.hero {
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 60%, #1b4a80 100%);
  color: #fff; border-radius: 14px; padding: 32px; margin-bottom: 28px;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: center;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 18px 18px; pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 30px; }
.hero p { color: #c6d4e4; margin: 10px 0 0; max-width: 560px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hero-stat { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 14px; }
.hero-stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.hero-stat span { font-size: 12px; color: #9fb4cc; text-transform: uppercase; letter-spacing: .4px; }

.resume {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-inline-start: 4px solid var(--warn); background: var(--warn-soft); color: var(--text);
  padding: 14px 18px; border-radius: var(--radius); margin-bottom: 24px;
}

.track { margin-bottom: 34px; }
.track-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.track-head h2 { font-size: 20px; }
.track-head p { margin: 0; color: var(--text-2); }
.exam-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.exam-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.exam-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.exam-code { font-size: 22px; font-weight: 800; letter-spacing: -.2px; }
.exam-code span { color: var(--accent); }
.exam-name { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  white-space: nowrap;
}
.badge.core { background: var(--accent-soft); color: var(--accent); }
.badge.conc { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge.pass { background: var(--ok-soft); color: var(--ok); }
.badge.fail { background: var(--bad-soft); color: var(--bad); }
.exam-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.exam-meta div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.exam-meta b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.exam-meta span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.domain-strip { display: flex; height: 6px; border-radius: 4px; overflow: hidden; gap: 2px; }
.domain-strip i { display: block; background: var(--accent); opacity: .35; }
.domain-strip i:nth-child(2n) { opacity: .6; }
.domain-strip i:nth-child(3n) { opacity: .85; }
.exam-actions { display: flex; gap: 8px; margin-top: auto; }

/* ===== Modal ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(8, 18, 32, .55); z-index: 100;
  display: grid; place-items: center; padding: 16px; overflow-y: auto;
  animation: fade .15s ease-out;
}
.modal {
  width: min(640px, 100%); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
}
.modal-sm { width: min(440px, 100%); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 18px; }
.modal-head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.modal-body { padding: 18px 22px; overflow-y: auto; display: grid; gap: 18px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

.field-label { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-2); margin-bottom: 8px; display: block; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-opt {
  text-align: start; padding: 12px 14px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer;
}
.seg-opt b { display: block; font-size: 14px; }
.seg-opt span { font-size: 12.5px; color: var(--text-2); }
.seg-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  cursor: pointer; font-weight: 600; font-size: 13px;
}
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.input {
  height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface);
  width: 90px;
}
.check-list { display: grid; gap: 6px; }
.check {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  cursor: pointer; background: var(--surface);
}
.check:hover { background: var(--surface-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.check .grow { flex: 1; }
.check .count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.inline-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ===== Exam shell ===== */
body.in-exam { background: var(--bg); }
.exam { min-height: 100vh; display: flex; flex-direction: column; }
.exam-bar {
  background: var(--brand); color: #fff; min-height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px;
  position: sticky; top: 0; z-index: 10;
}
.eb-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.eb-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-sub { font-size: 12px; color: #9fb4cc; }
.eb-right { display: flex; align-items: center; gap: 18px; }
.eb-count { font-size: 14px; color: #c6d4e4; white-space: nowrap; }
.eb-count b { color: #fff; }
.timer {
  font-family: var(--mono); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 5px 12px; border-radius: 6px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  display: inline-flex; align-items: center; gap: 8px;
}
.timer.warn { background: #b3261e; border-color: #e0574f; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .75; } }
.progress { height: 3px; background: var(--border); }
.progress i { display: block; height: 100%; background: var(--cyan); transition: width .25s; }

.exam-tools {
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; padding: 8px 20px; flex-wrap: wrap;
}
.exam-tools .spacer { flex: 1; }
.mark-toggle[aria-pressed="true"] { color: var(--mark); border-color: var(--mark); background: var(--warn-soft); }
.zoom-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.zoom-group button { border: 0; background: var(--surface); min-width: 34px; height: 30px; cursor: pointer; font-weight: 700; }
.zoom-group button + button { border-left: 1px solid var(--border-strong); }
.zoom-group button:hover { background: var(--surface-2); }

.exam-main { flex: 1; display: flex; min-height: 0; }
.exam-body {
  flex: 1; max-width: 920px; margin: 0 auto; width: 100%; padding: 28px 24px 120px;
  font-size: calc(16px * var(--zoom, 1));
}
.q-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--text-3); font-size: 12.5px; margin-bottom: 14px; }
.q-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-3); }
.q-stem { font-size: 1.06em; line-height: 1.6; margin-bottom: 18px; }
.q-hint { font-weight: 700; color: var(--text-2); font-size: .9em; margin: -6px 0 16px; }
.exhibit { margin: 0 0 20px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.exhibit-head {
  background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 6px 12px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2);
}
.exhibit pre {
  margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: .84em; line-height: 1.5;
  background: #0f1720; color: #d8e3ee;
}

/* Options */
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface);
  cursor: pointer; line-height: 1.5; font-size: 1em;
}
.opt:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.opt:disabled { cursor: default; }
.opt-key {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  border: 1.5px solid var(--border-strong); color: var(--text-2); background: var(--surface);
}
.opt[role="radio"] .opt-key { border-radius: 50%; }
.opt[role="checkbox"] .opt-key { border-radius: 5px; }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt[aria-checked="true"] .opt-key { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt-text { padding-top: 1px; flex: 1; }
.opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-correct .opt-key { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .opt-key { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt-flag { font-size: 12px; font-weight: 700; white-space: nowrap; padding-top: 3px; }
.opt.is-correct .opt-flag { color: var(--ok); }
.opt.is-wrong .opt-flag { color: var(--bad); }

/* Drag and drop: match */
.dnd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; }
.dnd-col h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); }
.pool {
  min-height: 120px; padding: 10px; border: 1.5px dashed var(--border-strong); border-radius: 8px;
  display: flex; flex-direction: column; gap: 8px; background: var(--surface-2);
}
.pool.over, .slot.over { border-color: var(--accent); background: var(--accent-soft); }
.pool-empty { color: var(--text-3); font-size: .85em; text-align: center; margin: auto; }
.chip {
  padding: 9px 12px; border-radius: 6px; background: var(--surface); border: 1.5px solid var(--border-strong);
  cursor: grab; font-weight: 600; font-size: .92em; user-select: none; text-align: left; width: 100%;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.chip:active { cursor: grabbing; }
.chip.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip.dragging { opacity: .4; }
.targets { display: grid; gap: 8px; }
.target { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.target-label { padding: 10px 12px; font-size: .92em; background: var(--surface-2); border-right: 1px solid var(--border); display: flex; align-items: center; }
.slot {
  min-height: 46px; padding: 6px; display: flex; align-items: center; border: 1.5px dashed transparent;
  cursor: pointer; background: transparent; text-align: left; width: 100%;
}
.slot .chip { cursor: grab; }
.slot-empty { color: var(--text-3); font-size: .85em; padding-left: 6px; }
.target.is-correct { border-color: var(--ok); }
.target.is-correct .slot { background: var(--ok-soft); }
.target.is-wrong { border-color: var(--bad); }
.target.is-wrong .slot { background: var(--bad-soft); }
.target-fix { grid-column: 1 / -1; padding: 6px 12px; font-size: .82em; color: var(--ok); border-top: 1px solid var(--border); background: var(--surface); }

/* Ordering */
.order-list { display: grid; gap: 8px; counter-reset: ord; }
.order-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  border: 1.5px solid var(--border-strong); background: var(--surface); cursor: grab;
}
.order-row.over { border-color: var(--accent); background: var(--accent-soft); }
.order-row.dragging { opacity: .4; }
.order-num { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.order-text { flex: 1; }
.order-btns { display: flex; gap: 4px; }
.order-btns button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.order-btns button:disabled { opacity: .35; cursor: default; }
.order-row.is-correct { border-color: var(--ok); background: var(--ok-soft); cursor: default; }
.order-row.is-wrong { border-color: var(--bad); background: var(--bad-soft); cursor: default; }
.order-key { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: var(--ok-soft); font-size: .9em; }
.order-key ol { margin: 6px 0 0; padding-left: 20px; }

.dnd-help { font-size: .82em; color: var(--text-3); margin-top: 10px; }

/* Feedback */
.feedback {
  margin-top: 22px; border-radius: 8px; padding: 14px 16px; border: 1px solid var(--border); background: var(--surface);
  border-inline-start: 4px solid var(--text-3);
}
.feedback.ok { border-inline-start-color: var(--ok); }
.feedback.bad { border-inline-start-color: var(--bad); }
.feedback h4 { margin: 0 0 6px; font-size: 14px; }
.feedback.ok h4 { color: var(--ok); }
.feedback.bad h4 { color: var(--bad); }
.feedback p { margin: 0; color: var(--text-2); font-size: .94em; }

/* Footer */
.exam-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,.05);
}
.exam-foot-inner { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 8px; }
.exam-foot .spacer { flex: 1; }

/* Navigator drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 100%); z-index: 50;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.drawer-body { padding: 16px 18px; overflow-y: auto; }
.drawer-scrim { position: fixed; inset: 0; z-index: 49; background: rgba(8,18,32,.3); }
.nav-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.nav-cell {
  position: relative; aspect-ratio: 1; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
}
.nav-cell.answered { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.nav-cell.correct { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.nav-cell.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.nav-cell.current { outline: 2px solid var(--text); outline-offset: 1px; }
.nav-cell.marked::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--mark);
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border-strong); display: inline-block; }
.legend i.a { background: var(--accent-soft); border-color: var(--accent); }
.legend i.m { background: var(--mark); border-color: var(--mark); border-radius: 50%; }

/* Review screen (pre-submit) */
.review-wrap { max-width: 920px; margin: 0 auto; padding: 28px 24px 120px; width: 100%; }
.review-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 20px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.review-table { width: 100%; border-collapse: collapse; }
.review-table th, .review-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: start; font-size: 14px; }
.review-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); background: var(--surface-2); }
.review-table tr:last-child td { border-bottom: 0; }
.review-table tbody tr { cursor: pointer; }
.review-table tbody tr:hover td { background: var(--surface-2); }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.status-dot.answered::before { background: var(--accent); }
.status-dot.incomplete::before { background: var(--bad); }
.status-dot.partial::before { background: var(--warn); }
.mark-flag { color: var(--mark); font-weight: 700; font-size: 13px; }
.trunc { max-width: 480px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ===== Results ===== */
.result-hero { display: grid; grid-template-columns: 260px 1fr; gap: 24px; padding: 24px; align-items: center; }
.score-ring { position: relative; width: 200px; height: 200px; margin: 0 auto; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.score-ring b { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.score-ring span { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.result-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.result-title h1 { font-size: 24px; }
.scale { margin: 18px 0 8px; position: relative; }
.scale-bar { height: 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.scale-bar i { display: block; height: 100%; }
.scale-pass { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--text); }
.scale-pass span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; white-space: nowrap; color: var(--text-2); }
.scale-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 6px; font-variant-numeric: tabular-nums; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.result-stats div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.result-stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.result-stats span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }

.section-title { font-size: 17px; margin: 30px 0 12px; }
.domains { padding: 8px 20px; }
.domain-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) 90px; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.domain-row:last-child { border-bottom: 0; }
.domain-name { font-weight: 600; font-size: 14px; }
.domain-name small { display: block; color: var(--text-3); font-weight: 500; font-size: 12px; }
.bar { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; }
.domain-pct { text-align: end; font-weight: 700; font-variant-numeric: tabular-nums; }
.domain-pct small { display: block; font-weight: 500; color: var(--text-3); font-size: 12px; }
.lvl-hi { background: var(--ok); }
.lvl-mid { background: var(--warn); }
.lvl-lo { background: var(--bad); }

.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }

/* Review answers */
.rq { padding: 20px; margin-bottom: 14px; }
.rq-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.rq-head .left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rq .q-stem { font-size: 15.5px; }
.rq .exhibit pre { font-size: 13px; }

/* ===== Tables / history / bank ===== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th, table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: start; font-size: 14px; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); background: var(--surface-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: end; font-variant-numeric: tabular-nums; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-2); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.summary-card { padding: 16px; }
.summary-card .code { font-weight: 800; }
.summary-card .code span { color: var(--accent); }
.summary-card .nums { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.summary-card .nums b { display: block; color: var(--text); font-size: 18px; font-variant-numeric: tabular-nums; }
.spark { margin-top: 10px; height: 34px; width: 100%; }

.bank-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.bank-card { padding: 18px 20px; }
.bank-card h3 { font-size: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bank-dom { display: grid; grid-template-columns: minmax(0, 1fr) 60px 40px; gap: 10px; align-items: center; font-size: 13.5px; padding: 6px 0; }
.bank-dom .bar { height: 7px; }
.bank-dom .n { text-align: end; font-variant-numeric: tabular-nums; font-weight: 700; }
.type-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.type-chips span { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.import-box { padding: 20px; margin-top: 22px; }
.import-box h3 { font-size: 16px; margin-bottom: 4px; }
.import-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.errors { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 13px; max-height: 200px; overflow: auto; }
.errors ul { margin: 0; padding-left: 18px; }
pre.schema { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; margin: 12px 0 0; }

/* ===== Toast ===== */
#toast-root { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; pointer-events: none; }
.toast {
  background: #15212e; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 14px;
  animation: fade .15s ease-out; max-width: calc(100vw - 32px);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .exam-grid, .bank-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .result-hero { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topnav-inner { gap: 10px; flex-wrap: wrap; padding: 8px 16px; }
  .navlinks { order: 3; flex-basis: 100%; overflow-x: auto; }
  .brand small { display: none; }
  .hero h1 { font-size: 24px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .seg { grid-template-columns: 1fr; }
  .exam-bar { padding: 0 12px; }
  .eb-sub, .eb-count .lbl { display: none; }
  .exam-tools { padding: 8px 12px; }
  .exam-body, .review-wrap { padding: 20px 16px 140px; }
  .dnd { grid-template-columns: 1fr; }
  .target { grid-template-columns: 1fr; }
  .target-label { border-right: 0; border-bottom: 1px solid var(--border); }
  .exam-foot-inner { padding: 10px 12px; flex-wrap: wrap; }
  .exam-foot .btn { padding: 0 12px; }
  .domain-row { grid-template-columns: 1fr 70px; }
  .domain-row .bar { grid-column: 1 / -1; grid-row: 2; }
  .summary-grid, .review-summary { grid-template-columns: 1fr 1fr; }
  .exam-meta { grid-template-columns: repeat(3, 1fr); }
  .trunc { max-width: 180px; }
  .page-head h1 { font-size: 22px; }
}

@media print {
  .topnav, .actions-row, .exam-foot { display: none !important; }
  body { background: #fff; }
}

/* Keep the exam layout inside narrow viewports */
.exam { overflow-x: hidden; }
.exam-body, .review-wrap, .dnd-col, .opt-text, .order-text { min-width: 0; }
.eb-left { flex: 1; }
.opt-text, .chip, .order-text, .target-label { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .zoom-label { display: none; }
  .eb-right { gap: 10px; }
  .timer { font-size: 15px; padding: 4px 8px; }
  .exam-bar .brand-mark { display: none; }
  .exam-foot-inner .btn { min-height: 36px; font-size: 13px; padding: 0 10px; }
  .exam-foot-inner .spacer { display: none; }
  .exam-foot-inner [data-action=end] { margin-right: auto; }
}

/* ===== Accounts, admin, editor ===== */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.loading { display: grid; place-items: center; padding: 80px 0; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 12px;
  border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.user-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18); background: transparent; color: #fff; cursor: pointer; font-weight: 600; font-size: 13px;
}
.user-btn:hover { background: rgba(255,255,255,.1); }
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--cyan); color: #06222a; font-size: 11px; font-weight: 800;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  background: linear-gradient(140deg, var(--brand) 0%, var(--brand-2) 55%, #1b4a80 100%); color: #fff;
  padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 22px;
}
.auth-side h1 { font-size: 30px; max-width: 480px; }
.auth-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; color: #c6d4e4; }
.auth-points li { padding-inline-start: 26px; position: relative; }
.auth-points li::before { content: ""; position: absolute; inset-inline-start: 0; top: 7px; width: 14px; height: 8px; border-left: 2px solid var(--cyan); border-bottom: 2px solid var(--cyan); transform: rotate(-45deg); }
.auth-main { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(400px, 100%); padding: 24px; display: grid; gap: 14px; }
.auth-card h2 { font-size: 20px; }
.auth-card .tab { flex: 1; text-align: center; text-decoration: none; }
.fld { display: grid; gap: 6px; }
.fld > span { font-weight: 600; font-size: 13px; color: var(--text-2); }
.fld em { font-style: normal; font-weight: 400; }
.input-wide { width: 100%; }
.textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface);
  resize: vertical; line-height: 1.5;
}
.textarea.mono { font-family: var(--mono); font-size: 13px; }
.input:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 9px 12px; border-radius: 6px; font-size: 13.5px; }
.form-error[hidden] { display: none; }
.link-btn {
  margin-top: 10px; border: 0; background: none; padding: 0; color: var(--text-3); font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.link-btn:hover { color: var(--bad); text-decoration: underline; }
.modal-body .input-wide { margin-bottom: 0; }

a.tab { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.count-badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }

.focus-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.focus-card { padding: 14px 16px; display: grid; gap: 8px; }
.focus-card b { font-size: 14px; }
.focus-card .bar { height: 7px; }

.me-row td { background: var(--accent-soft); }
.rank { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); font-weight: 800; font-size: 13px; }
.rank.r1 { background: #f2c94c; color: #3b2a00; border-color: #e0b232; }
.rank.r2 { background: #d5dbe3; color: #28323e; border-color: #bfc7d1; }
.rank.r3 { background: #e0a46b; color: #3a1d00; border-color: #c98a50; }

.card-title { font-weight: 700; font-size: 14px; padding: 14px 16px 10px; }
.card-pad .card-title { padding: 0 0 12px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
table.data.compact { min-width: 0; }
table.data.compact th, table.data.compact td { padding: 8px 14px; }
.pct { font-weight: 700; padding: 1px 6px; border-radius: 4px; color: #fff; font-size: 12.5px; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.filters .input { width: 100%; }
.row-off td { opacity: .55; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.import-summary { margin-top: 12px; font-size: 14px; }
.report { padding: 16px 18px; margin-bottom: 12px; }
.report blockquote { margin: 10px 0 0; padding: 10px 14px; border-inline-start: 3px solid var(--warn); background: var(--warn-soft); border-radius: 6px; font-size: 14px; }
.trunc-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.editor { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ed-form { display: grid; gap: 16px; }
.ed-grid { display: grid; grid-template-columns: 1.3fr 1.6fr 1.1fr 1fr; gap: 10px; }
.ed-grid select.input { min-width: 0; }
.ed-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.ed-row { display: flex; align-items: center; gap: 8px; }
.ed-correct { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; cursor: pointer; flex: none; width: 44px; }
.ed-correct input { width: 16px; height: 16px; accent-color: var(--ok); margin: 0; }
.ed-preview { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.preview-body { font-size: 14.5px; }
.preview-body .q-stem { font-size: 15px; }

@media (max-width: 1000px) {
  .focus-grid { grid-template-columns: repeat(2, 1fr); }
  .editor, .admin-grid { grid-template-columns: 1fr; }
  .ed-preview { position: static; max-height: none; }
  .ed-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 20px; }
  .auth-side h1 { font-size: 22px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters [type=search] { grid-column: 1 / -1; }
  .user-name { display: none; }
  .user-btn { padding: 0 4px; }
}
@media (max-width: 640px) {
  .focus-grid { grid-template-columns: 1fr; }
}
select.input { width: auto; min-width: 110px; }

/* ===== Arabic translation under English text ===== */
[lang="ar"], .tr, .opt-tr, .tr-inline, .input-ar { font-family: "Segoe UI", "Noto Sans Arabic", Tahoma, system-ui, sans-serif; }
.tr-toggle {
  display: inline-flex; align-items: center; gap: 6px; margin: -6px 0 14px;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer;
}
.tr-toggle:hover { background: var(--accent-soft); border-color: var(--accent); }
.tr-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.tr {
  direction: rtl; text-align: right; margin: -8px 0 14px; padding: 10px 14px;
  background: var(--accent-soft); border-right: 3px solid var(--accent); border-radius: 6px;
  color: var(--text); font-size: .95em; line-height: 1.8;
}
.tr.tr-explain { margin: 10px 0 0; font-size: .92em; }
.opt-tr { display: block; direction: rtl; text-align: right; margin-top: 4px; color: var(--text-2); font-size: .9em; line-height: 1.7; font-weight: 400; }
.chip .opt-tr { font-size: .85em; }
.tr-inline { display: inline-block; font-weight: 600; color: var(--text-2); margin-inline-start: 8px; }
.input-ar { text-align: right; }
.ed-pair { flex: 1; display: grid; gap: 4px; min-width: 0; }
.ed-pair .input-ar { height: 32px; font-size: 13px; background: var(--surface-2); }
.q-content { text-align: left; }
html[dir="rtl"] .exam, html[dir="rtl"] .q-content, html[dir="rtl"] #ed-preview { text-align: left; }
html[dir="rtl"] .modal[dir="ltr"] { text-align: left; }

/* ===== Language switch, settings, verification ===== */
.lang-btn { font-weight: 800; font-size: 14px; }
.lang-btn-light { min-width: 40px; font-weight: 800; }
a.user-btn { text-decoration: none; }
.user-btn.active { background: rgba(255,255,255,.14); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.auth-top .tabs { flex: 1; }
.ltr-block { text-align: left; }

.center-card { display: grid; place-items: center; padding: 24px 0; }
.gate { max-width: 480px; width: 100%; text-align: center; display: grid; gap: 6px; padding: 32px 28px; }
.gate h1 { font-size: 22px; margin: 6px 0 4px; }
.gate p { margin: 4px 0; }
.gate-icon { width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.gate-icon.ok { background: var(--ok-soft); color: var(--ok); }
.gate-icon.bad { background: var(--bad-soft); color: var(--bad); }
.gate-icon.bad svg { width: 36px; height: 36px; }
.public-page { min-height: 100vh; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.settings-wide { grid-column: 1 / -1; }
.stack { display: grid; gap: 12px; }
.email-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.signout-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cert-list { display: grid; gap: 8px; }
.cert-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border);
  text-decoration: none; color: var(--text); background: var(--surface-2);
}
.cert-item:hover { border-color: var(--accent); }
.cert-item .grow { flex: 1; display: grid; }
.cert-item-icon, .cert-banner-icon { color: #b8860b; display: grid; place-items: center; }
.cert-badge { background: #fff4d6; color: #a06d00; padding: 3px 6px; text-decoration: none; }
.cert-note {
  display: flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 10px 14px; border-radius: 8px;
  background: var(--warn-soft); color: var(--text); font-size: 14px;
}
.modal .cert-note { margin: 0; }
.cert-banner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 16px; border-color: #e6c35c; background: linear-gradient(90deg, #fff8e1, var(--surface)); }
:root[data-theme="dark"] .cert-banner { background: linear-gradient(90deg, #3a2f10, var(--surface)); border-color: #7a6220; }
.cert-banner .grow { flex: 1; }
.cert-banner-icon svg { width: 34px; height: 34px; }

/* ===== Certificate ===== */
.cert-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cert-wrap { overflow-x: auto; padding-bottom: 8px; }
.cert {

  width: 1000px; max-width: 100%; aspect-ratio: 297 / 210; margin: 0 auto; background: #fffdf7; color: #1d2633;
  padding: 18px; box-shadow: var(--shadow-lg); border-radius: 6px; font-family: Georgia, "Times New Roman", "Segoe UI", Tahoma, serif;
}
.cert[lang="ar"] { font-family: "Segoe UI", "Noto Naskh Arabic", Tahoma, serif; }
.cert-border {
  height: 100%; border: 3px double #b8954a; outline: 1px solid #d9c38f; outline-offset: -10px; padding: 28px 46px;
  display: flex; flex-direction: column; align-items: center; text-align: center; position: relative;
  background:
    radial-gradient(circle at 0 0, rgba(184,149,74,.12) 0 90px, transparent 91px),
    radial-gradient(circle at 100% 100%, rgba(184,149,74,.12) 0 90px, transparent 91px);
}
.cert-head { display: flex; align-items: center; gap: 10px; }
.cert-logo { background: #0f2a4a; }
.cert-brand { font-weight: 800; letter-spacing: 1px; color: #0f2a4a; font-family: "Segoe UI", Tahoma, sans-serif; }
.cert-kicker { font-size: 40px; font-weight: 700; color: #0f2a4a; margin-top: 14px; letter-spacing: .5px; }
.cert-sub { font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: #9a7a35; font-weight: 700; margin-top: 2px; }
.cert[lang="ar"] .cert-sub { letter-spacing: 0; font-size: 16px; }
.cert-line { margin: 14px 0 4px; color: #4b5a6b; font-size: 16px; }
.cert-name { font-size: 38px; font-weight: 700; color: #16202c; border-bottom: 1px solid #d9c38f; padding: 0 30px 6px; min-width: 50%; }
.cert-exam { font-size: 24px; font-weight: 800; color: #1667d9; margin-top: 4px; font-family: "Segoe UI", Tahoma, sans-serif; }
.cert-exam-name { font-size: 13.5px; color: #4b5a6b; font-family: "Segoe UI", Tahoma, sans-serif; }
.cert-stats { display: flex; gap: 40px; margin-top: 16px; font-family: "Segoe UI", Tahoma, sans-serif; }
.cert-stats div { display: grid; }
.cert-stats b { font-size: 20px; color: #16202c; }
.cert-stats b small { font-size: 12px; color: #7a8797; }
.cert-stats span { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #7a8797; }
.cert-foot { margin-top: auto; width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; font-family: "Segoe UI", Tahoma, sans-serif; }
.cert-id { display: grid; text-align: start; font-size: 12px; color: #4b5a6b; }
.cert-id b { font-size: 16px; color: #16202c; letter-spacing: 1px; }
.cert-id small { color: #7a8797; }
.cert-seal { color: #b8954a; }
.cert-disclaimer { margin: 10px 0 0; font-size: 10.5px; color: #7a8797; max-width: 720px; font-family: "Segoe UI", Tahoma, sans-serif; }

@page cert { size: A4 landscape; margin: 0; }
@media print {
  body.cert-view .topnav, body.cert-view .no-print { display: none !important; }
  body.cert-view .page { padding: 0; max-width: none; }
  body.cert-view .cert-wrap { overflow: visible; padding: 0; }
  body.cert-view .cert { width: 297mm; height: 210mm; max-width: none; box-shadow: none; border-radius: 0; aspect-ratio: auto; }
  body.cert-view { background: #fff; page: cert; margin: 0; }
  body.cert-view .cert { break-inside: avoid; overflow: hidden; }
}

@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
  .cert { width: 900px; max-width: none; }
}

/* ===== Topology exhibits ===== */
.diagram { background: #fff; padding: 8px 10px 0; border-bottom: 1px solid var(--border); }
.diagram:last-child { border-bottom: 0; }
.diagram-svg { display: block; width: 100%; height: auto; max-height: 420px; }
