/* IDAM Education — portal styles */
:root {
  --brand: #0b3d5c;
  --brand-2: #0e7490;
  --accent: #e0a526;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #5b6678;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --warn: #a16207;
  --warn-bg: #fef9c3;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.06);
  --sidebar-w: 264px;
  --topbar-h: 60px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; font-size: 16px; }
a { color: var(--brand-2); }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: .75rem; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); min-width: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-size: 1.05rem; white-space: nowrap; }
.brand-text strong { color: var(--brand); }
.brand-text > span { font-weight: 600; }
.brand-text small { font-size: .7rem; color: var(--muted); }
.search { flex: 1; max-width: 560px; margin-left: auto; display: flex; align-items: center; gap: .5rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 .9rem; color: var(--muted); }
.search input { border: 0; background: transparent; padding: .55rem 0; width: 100%; outline: none; color: var(--text); }
.icon-btn { border: 0; background: transparent; padding: .45rem; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-toggle { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; text-decoration: none; font-weight: 700; flex: none; }
.sidebar { align-self: start; background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .75rem 2rem; overflow-y: auto; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group a, .nav-domains a { display: flex; gap: .6rem; align-items: center; padding: .5rem .7rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); font-size: .94rem; }
.nav-group a:hover, .nav-domains a:hover { background: var(--surface-2); }
.nav-group a.active { background: var(--info-bg); color: var(--info); font-weight: 600; }
.nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1.1rem .7rem .35rem; font-weight: 600; }
.nav-domains { margin-top: .4rem; }
.nav-domains a { font-size: .85rem; padding: .35rem .7rem; color: var(--muted); }
.nav-domains .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.main { padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 4rem; min-width: 0; outline: none; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: min(86vw, 300px); z-index: 40; transform: translateX(-102%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .brand-text small { display: none; }
}
@media (max-width: 600px) {
  .brand-text { display: none; }
  .main { padding: 1rem 1rem 4rem; }
  .topbar { gap: .4rem; padding: 0 .6rem; }
}

/* ---------- Generic components ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head p { color: var(--muted); margin: 0; max-width: 70ch; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.crumbs a { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0; }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tiny { font-size: .76rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: .55rem 1rem; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; font-weight: 600; font-size: .93rem; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: .35rem .7rem; font-size: .84rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge-bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; }

.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 999px; transition: width .3s; }
.progress.ok > span { background: var(--ok); }

.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat .value { font-size: 1.7rem; font-weight: 750; color: var(--brand); line-height: 1.1; }
.stat .label { font-size: .82rem; color: var(--muted); }

.hero { background: linear-gradient(135deg, #0b3d5c, #0e7490 60%, #13837a); color: #fff; border-radius: calc(var(--radius) + 4px); padding: clamp(1.2rem, 3vw, 2rem); position: relative; overflow: hidden; margin-bottom: 1.25rem; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.hero h1 { color: #fff; }
.hero p { color: rgba(255,255,255,.88); max-width: 70ch; }
.hero .btn { border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; }
.hero .btn-primary { background: #fff; color: #0b3d5c; border-color: #fff; }

.table-wrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }

.form-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field.full { grid-column: 1 / -1; }
label, .label { font-size: .84rem; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: .55rem .7rem; width: 100%;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.checkbox-row { display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.checkbox-row label { font-weight: 500; color: var(--text); display: inline-flex; gap: .3rem; align-items: center; font-size: .85rem; }

.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; border: 2px dashed var(--border); border-radius: var(--radius); }
.loading { display: flex; gap: .6rem; align-items: center; color: var(--muted); padding: 2rem; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand-2); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.2rem; overflow-x: auto; scrollbar-width: thin; }
.tabs a, .tabs button { padding: .6rem .9rem; border: 0; background: none; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; cursor: pointer; font-size: .93rem; }
.tabs .active { color: var(--brand); border-bottom-color: var(--brand); }

.toast { visibility: hidden; position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--text); color: var(--bg); padding: .7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); transition: transform .25s; z-index: 200; max-width: min(92vw, 520px); font-size: .92rem; }
.toast.show { visibility: visible; transform: translateX(-50%) translateY(0); }

.notice { border-radius: var(--radius-sm); padding: .8rem 1rem; background: var(--info-bg); color: var(--text); border-left: 4px solid var(--info); font-size: .92rem; }
.notice.warn { background: var(--warn-bg); border-left-color: var(--warn); }

/* ---------- Module cards ---------- */
.module-card { display: flex; flex-direction: column; gap: .55rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); text-decoration: none; color: var(--text); border-top: 4px solid var(--dc, var(--brand)); transition: transform .12s, box-shadow .12s; }
.module-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,.1); }
.module-card .code { font-size: .78rem; font-weight: 700; color: var(--dc, var(--brand)); letter-spacing: .03em; }
.module-card h3 { margin: 0; font-size: 1.02rem; }
.module-card p { font-size: .86rem; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.module-card .meta { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; }
.domain-tile { display: flex; gap: .9rem; align-items: center; text-decoration: none; color: var(--text); }
.domain-tile .ico { font-size: 1.6rem; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--dc) 14%, transparent); flex: none; }
.domain-tile h3 { margin: 0 0 .2rem; font-size: .98rem; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: center; }
.filters select, .filters input { width: auto; min-width: 150px; }
.chip { border: 1px solid var(--border); background: var(--surface); padding: .3rem .75rem; border-radius: 999px; cursor: pointer; font-size: .84rem; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Module page ---------- */
.module-head { border-left: 6px solid var(--dc, var(--brand)); padding-left: 1rem; margin-bottom: 1rem; }
.module-head .code { font-weight: 700; color: var(--dc, var(--brand)); font-size: .85rem; }
.module-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .module-layout { grid-template-columns: 1fr; } }
.side-panel { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.prose { max-width: 78ch; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: .25rem 0; }
.objectives li::marker { color: var(--brand-2); }
.refs li { margin-bottom: .5rem; font-size: .9rem; word-break: break-word; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: .55rem; align-items: center; padding: .35rem 0; font-size: .92rem; }
.checklist .tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: .7rem; flex: none; }
.checklist .done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }

.slide-list { list-style: none; padding: 0; margin: 0; counter-reset: s; display: grid; gap: .35rem; }
.slide-list a { display: flex; gap: .7rem; align-items: center; padding: .55rem .75rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); border: 1px solid var(--border); background: var(--surface); }
.slide-list a:hover { border-color: var(--brand-2); }
.slide-list .num { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.slide-list .seen .num { background: var(--ok-bg); color: var(--ok); }

/* Callouts inside rendered markdown */
.callout { border-radius: var(--radius-sm); padding: .65rem .9rem; margin: .8rem 0; border-left: 4px solid; font-size: .95em; }
.callout p:last-child { margin-bottom: 0; }
.callout-pearl { background: var(--ok-bg); border-color: var(--ok); }
.callout-pitfall { background: var(--bad-bg); border-color: var(--bad); }
.callout-malta { background: var(--info-bg); border-color: var(--info); }
.callout-malta strong:first-child::before { content: "🇲🇹 "; }
.callout-evidence { background: var(--warn-bg); border-color: var(--warn); }
.callout-note { background: var(--surface-2); border-color: var(--muted); }
blockquote { margin: .8rem 0; padding: .5rem 1rem; border-left: 4px solid var(--border); color: var(--muted); }
code { background: var(--surface-2); padding: .05rem .35rem; border-radius: 4px; font-size: .9em; }

/* ---------- Presentation player ---------- */
.player { position: fixed; inset: 0; z-index: 90; background: #0a1628; color: #e5edf7; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.player-body > * { min-width: 0; max-width: 100%; }
.player-top { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.08); }
.player-top .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; color: #b9c6d8; }
.player .icon-btn { color: #b9c6d8; }
.player .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.player-body { overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: clamp(.75rem, 2.5vw, 2rem); }
.player.notes-side .player-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .player.notes-side .player-body { grid-template-columns: 1fr; } }
.slide { width: 100%; max-width: 1080px; aspect-ratio: 16 / 9; background: #fff; color: #0f172a; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.45); padding: clamp(1rem, 3.2vw, 2.6rem) clamp(1.1rem, 4vw, 3.2rem); display: flex; flex-direction: column; position: relative; font-size: clamp(.82rem, 1.45vw, 1.2rem); flex: none; }
@media (max-width: 700px) { .slide { aspect-ratio: auto; min-height: 50vh; } .player-top .title { font-size: .8rem; } }
.slide::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--dc, #0e7490); border-radius: 14px 0 0 14px; }
.slide .slide-kicker { font-size: .72em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dc, #0e7490); margin-bottom: .4em; }
.slide h2 { font-size: 1.65em; color: #0b3d5c; margin-bottom: .6em; font-family: var(--font); }
.slide ul, .slide ol { padding-left: 1.2em; margin: 0 0 .6em; }
.slide li { margin: .25em 0; }
.slide table { font-size: .82em; }
.slide th { background: #f1f5f9; color: #334155; }
.slide td, .slide th { border-color: #e2e8f0; }
.slide .callout-pearl { background: #dcfce7; border-color: #15803d; }
.slide .callout-pitfall { background: #fee2e2; border-color: #b91c1c; }
.slide .callout-malta { background: #dbeafe; border-color: #1d4ed8; }
.slide .callout-evidence { background: #fef9c3; border-color: #a16207; }
.slide .callout-note { background: #f1f5f9; border-color: #64748b; }
.slide code { background: #f1f5f9; }
.slide a { color: #0e7490; }
.slide .slide-foot { margin-top: auto; padding-top: .8em; display: flex; justify-content: space-between; font-size: .62em; color: #64748b; }
.slide.title-slide { justify-content: center; background: linear-gradient(135deg, #0b3d5c, #0e7490); color: #fff; }
.slide.title-slide h2 { color: #fff; font-size: 2.2em; }
.slide.title-slide .slide-kicker { color: #fde68a; }
.slide.title-slide .slide-foot { color: rgba(255,255,255,.7); }
.slide.title-slide ul { color: rgba(255,255,255,.92); }
.notes { width: 100%; max-width: 1080px; background: #111f36; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 1rem 1.25rem; font-size: 1rem; line-height: 1.7; color: #dbe5f2; }
.notes h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: #7dd3fc; margin-bottom: .6rem; }
.notes a { color: #7dd3fc; }
.notes .callout { color: #0f172a; }
.player-bottom { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: rgba(255,255,255,.04); border-top: 1px solid rgba(255,255,255,.08); }
.player-bottom .progress { flex: 1; background: rgba(255,255,255,.1); border: 0; }
.player-bottom .counter { font-variant-numeric: tabular-nums; font-size: .88rem; color: #b9c6d8; min-width: 70px; text-align: center; }
.player .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #fff; }
.player .btn:hover { background: rgba(255,255,255,.16); }
.player .btn-primary { background: #22d3ee; border-color: #22d3ee; color: #0a1628; }
.player-toc { position: absolute; top: 52px; right: 0; bottom: 56px; width: min(360px, 90vw); background: #0f1d33; border-left: 1px solid rgba(255,255,255,.1); overflow: auto; padding: .75rem; z-index: 2; }
.player-toc a { display: flex; gap: .6rem; padding: .45rem .6rem; border-radius: 8px; text-decoration: none; color: #cbd5e1; font-size: .88rem; }
.player-toc a:hover, .player-toc a.current { background: rgba(255,255,255,.08); color: #fff; }
.player-toc .n { color: #64748b; min-width: 1.6rem; }

/* ---------- Quiz ---------- */
.question { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); }
.question .q-meta { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-bottom: .6rem; gap: .5rem; flex-wrap: wrap; }
.options { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .5rem; }
.option { display: flex; gap: .75rem; align-items: flex-start; width: 100%; text-align: left; padding: .7rem .9rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; line-height: 1.45; }
.option:hover:not([disabled]) { border-color: var(--brand-2); background: var(--surface-2); }
.option .letter { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: .82rem; }
.option.selected { border-color: var(--brand-2); background: var(--info-bg); }
.option.correct { border-color: var(--ok); background: var(--ok-bg); }
.option.correct .letter { background: var(--ok); color: #fff; border-color: var(--ok); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.option.wrong .letter { background: var(--bad); color: #fff; border-color: var(--bad); }
.option[disabled] { cursor: default; }
.explanation { margin-top: 1rem; padding: .9rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.q-nav { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0; }
.q-nav button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: .8rem; font-weight: 600; }
.q-nav button.answered { background: var(--info-bg); border-color: var(--info); }
.q-nav button.current { outline: 2px solid var(--brand); }
.q-nav button.c { background: var(--ok-bg); border-color: var(--ok); }
.q-nav button.w { background: var(--bad-bg); border-color: var(--bad); }
.q-nav button.flag::after { content: "⚑"; font-size: .6rem; position: relative; top: -8px; left: 1px; color: var(--warn); }
.score-ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; background: conic-gradient(var(--brand-2) calc(var(--p) * 1%), var(--surface-2) 0); display: grid; place-items: center; margin: 0 auto; }
.score-ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: var(--brand); }

/* ---------- Cases ---------- */
.case { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.case + .case { margin-top: 1rem; }
.case-head { padding: .9rem 1.1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 700; }
.case-body { padding: 1rem 1.1rem; }
.case-q { border-top: 1px dashed var(--border); padding-top: .8rem; margin-top: .8rem; }
.case-q .qtext { font-weight: 600; margin-bottom: .5rem; }
.case-q textarea { min-height: 70px; }
.model-answer { margin-top: .6rem; padding: .8rem 1rem; background: var(--ok-bg); border-radius: var(--radius-sm); border-left: 4px solid var(--ok); }

/* ---------- EPA ---------- */
.epa-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.epa-row:last-child { border-bottom: 0; }
.epa-id { font-weight: 800; color: var(--brand); }
.levels { display: inline-flex; gap: 3px; }
.levels button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; font-size: .85rem; }
.levels button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.levels button.expected { box-shadow: inset 0 -3px 0 var(--accent); }
@media (max-width: 700px) { .epa-row { grid-template-columns: 1fr; } }
.gauge { display: flex; gap: 2px; }
.gauge i { width: 14px; height: 8px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--border); }
.gauge i.on { background: var(--brand-2); border-color: var(--brand-2); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: .8rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.timeline time { color: var(--muted); font-size: .8rem; }

/* ---------- Search ---------- */
.result { display: block; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; color: var(--text); }
.result + .result { margin-top: .5rem; }
.result:hover { border-color: var(--brand-2); }
.result mark { background: #fde68a; color: inherit; border-radius: 2px; }

/* ---------- Handbook ---------- */
.handbook { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.handbook nav { position: sticky; top: calc(var(--topbar-h) + 1rem); display: flex; flex-direction: column; gap: 2px; font-size: .88rem; }
.handbook nav a { padding: .35rem .6rem; border-radius: 6px; text-decoration: none; color: var(--muted); }
.handbook nav a:hover { background: var(--surface-2); color: var(--text); }
.handbook section { scroll-margin-top: calc(var(--topbar-h) + 1rem); }
@media (max-width: 900px) { .handbook { grid-template-columns: 1fr; } .handbook nav { position: static; flex-direction: row; flex-wrap: wrap; } }

/* ---------- Year timeline ---------- */
.years { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; }
@media (max-width: 900px) { .years { grid-template-columns: 1fr; } }
.year { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; border-top: 4px solid var(--brand-2); }
.year.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.year h3 { font-size: .95rem; margin-bottom: .3rem; }
.year p { font-size: .84rem; color: var(--muted); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(2,6,23,.55); z-index: 95; display: grid; place-items: center; padding: 1rem; }
.modal { background: var(--surface); border-radius: var(--radius); max-width: 640px; width: 100%; max-height: 90vh; overflow: auto; padding: 1.3rem 1.4rem; box-shadow: var(--shadow); }
.modal h2 { margin-bottom: 1rem; }
.modal .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; }

/* ---------- Print (portfolio) ---------- */
.print-only { display: none; }
@media print {
  @page { margin: 16mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .topbar, .sidebar, .scrim, .no-print, .toast, .skip-link { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-only { display: block; }
  a { color: #000; text-decoration: none; }
  .progress { border: 1px solid #999; }
  .progress > span { background: #555 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  h2 { break-after: avoid; }
  table { font-size: 9.5pt; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Accounts ---------- */
[hidden] { display: none !important; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: linear-gradient(135deg, #0b3d5c, #0e7490 60%, #13837a); }
.auth > .loading { color: #fff; }
.auth-card { width: min(100%, 640px); padding: clamp(1.2rem, 4vw, 2rem); }
.auth-card h1 { font-size: 1.5rem; margin-top: .4rem; }
.auth-brand { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; font-size: 1.25rem; font-weight: 600; line-height: 1.15; }
.auth-brand strong { color: var(--brand); }
.auth-brand small { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); }
.auth-card .tabs { margin: 1.2rem 0 1rem; }
label.checkbox-row { flex-wrap: nowrap; align-items: flex-start; gap: .6rem; font-size: .88rem; }
label.checkbox-row input { margin-top: .2rem; flex: none; }
.nav-account { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; margin: 1.4rem .7rem .4rem; padding-top: 1rem; border-top: 1px solid var(--border); }
#syncStatus[data-state="offline"], #syncStatus[data-state="error"] { color: var(--warn); font-weight: 600; }
.nav-group a .badge { margin-left: auto; }
.view-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: center; padding: .7rem 1rem; background: var(--warn-bg); color: var(--text); border-top: 2px solid var(--warn); font-size: .92rem; }
body.viewing .main { padding-bottom: 7rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.admin-table td, .admin-table th { white-space: nowrap; }
.admin-table td:first-child { white-space: normal; min-width: 12rem; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; font-size: .92rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
@media print { .nav-account, .view-banner { display: none !important; } }

/* ---------- Figures (module images) ---------- */
.fig { margin: .9rem auto; text-align: center; max-width: 100%; }
.fig img { max-width: 100%; max-height: 420px; height: auto; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: zoom-in; }
.fig figcaption { font-size: .72rem; color: var(--muted); margin-top: .3rem; line-height: 1.3; }
/* On slides: text on the left, the picture on the right. */
.slide-content:has(> .fig) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 42%); column-gap: 1.4em; align-content: start; }
.slide-content:has(> .fig) > * { grid-column: 1; }
.slide-content > .fig { grid-column: 2; grid-row: 1 / span 30; margin: 0; align-self: start; }
.slide-content > .fig:only-child { grid-column: 1 / -1; }
.slide .fig img { max-height: min(48vh, 26em); border-color: #e2e8f0; }
.slide .fig figcaption { color: #64748b; font-size: .6em; }
.slide.title-slide .fig figcaption { color: rgba(255,255,255,.75); }
@media (max-width: 700px) {
  .slide-content:has(> .fig) { display: block; }
  .slide-content > .fig { margin: .8em 0 0; }
}
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(5, 12, 24, .92); display: grid; place-items: center; padding: 1rem; cursor: zoom-out; }
.lightbox figure { margin: 0; max-width: 100%; text-align: center; }
.lightbox img { max-width: 96vw; max-height: 86vh; border-radius: 6px; background: #fff; }
.lightbox figcaption { color: #cbd5e1; font-size: .85rem; margin-top: .5rem; }
.lightbox .alt { color: #fff; font-size: .95rem; margin-top: .4rem; }

/* ---------- Narration controls (slide player) ---------- */
.player-bottom .narr-btn { min-width: 7.2em; }
.narr-panel { position: absolute; right: 1rem; bottom: 4.2rem; z-index: 5; background: #fff; color: #0f172a; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.45); padding: .9rem 1rem; width: min(92vw, 320px); display: grid; gap: .6rem; font-size: .9rem; }
.narr-row { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; }
.narr-row > span, .narr-row > label[for] { font-weight: 600; min-width: 3.5em; }
.narr-row label { display: inline-flex; gap: .35rem; align-items: center; }
.narr-engine { margin: 0; color: #64748b; }
@media (max-width: 600px) { .player-bottom .narr-btn { min-width: 0; padding: .55rem .7rem; } }
