:root {
  --bg: #0f1418;
  --bg-soft: #141b21;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8edf1;
  --text-dim: #9aa7b1;
  --text-faint: #6b7882;
  --accent: #7fd1c4;
  --accent-2: #a7b8d8;
  --accent-soft: rgba(127, 209, 196, 0.14);
  --good: #7fd1a4;
  --warn: #e6c27a;
  --bad: #e08a8a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --orb-opacity: 0.18;
  --body-grad-top: #1a242c;
}

/* ---------- light theme ---------- */
[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-soft: #ffffff;
  --surface: rgba(15, 28, 40, 0.03);
  --surface-2: rgba(15, 28, 40, 0.06);
  --border: rgba(15, 28, 40, 0.12);
  --text: #1b2630;
  --text-dim: #4a5a67;
  --text-faint: #7d8b96;
  --accent: #1f9e8b;
  --accent-2: #5b6fa6;
  --accent-soft: rgba(31, 158, 139, 0.12);
  --good: #2f9e6a;
  --warn: #b8862f;
  --bad: #c75151;
  --shadow: 0 18px 50px rgba(31, 54, 74, 0.12);
  --orb-opacity: 0.10;
  --body-grad-top: #e3ebf2;
}

/* Smooth transition when switching themes. The `.review-item` / `.hist-row`
   selectors are intentionally omitted — long history or review lists would
   thrash on theme toggle. Inheritance handles their colour change. */
body, .card, .option, .seg, .btn {
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

/* Visible focus ring for keyboard users; mouse-only clicks stay quiet. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Screen-reader-only live region (used by app.js for timer milestones). */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}


* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 800px at 70% -10%, var(--body-grad-top), var(--bg));

  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ambient orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: var(--orb-opacity);
  z-index: 0;

  pointer-events: none;
}
.orb-1 { width: 420px; height: 420px; background: #5fd6c2; top: -120px; right: -80px; }
.orb-2 { width: 360px; height: 360px; background: #6f8fd6; bottom: -120px; left: -100px; }

/* topbar */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 32px;
  max-width: 920px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.2px; }
.brand-mark { color: var(--accent); font-size: 1.3rem; }
.brand-name em { color: var(--text-dim); font-style: normal; font-weight: 400; }
.topnav { display: flex; gap: 4px; }
.nav-link {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 0.9rem; padding: 8px 14px; border-radius: 999px;
  transition: all 0.25s var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.is-active { color: var(--bg); background: var(--accent); }

/* theme toggle */
.theme-toggle {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer;
  width: 38px; height: 38px; border-radius: 999px; margin-left: 6px;
  display: grid; place-items: center; font-size: 1.05rem;
  transition: all 0.25s var(--ease);
}
.theme-toggle:hover { color: var(--text); background: var(--surface-2); border-color: var(--accent); }
.theme-toggle .theme-icon { line-height: 1; }


main { position: relative; z-index: 1; max-width: 920px; margin: 0 auto; padding: 12px 32px 80px; }

.hidden { display: none !important; }

/* hero */
.hero { text-align: center; padding: 36px 0 28px; }
.eyebrow { color: var(--accent); font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 14px; }
.hero h1 { font-size: 2.6rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }
.hero .sub { color: var(--text-dim); max-width: 520px; margin: 0 auto; font-weight: 300; }

/* card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.card-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 22px; }
.setup-card { max-width: 560px; margin: 0 auto; }

/* fields */
.field { margin-bottom: 24px; }
.field-label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 10px; }
.field-hint { font-size: 0.82rem; color: var(--text-faint); margin-top: 10px; }
.field-row { display: flex; gap: 28px; flex-wrap: wrap; }

/* segmented control */
.seg { display: flex; gap: 6px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px; }
.seg-btn {
  flex: 1; background: none; border: none; color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 0.85rem; padding: 11px 8px; border-radius: 9px;
  transition: all 0.25s var(--ease);
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--accent); color: var(--bg); font-weight: 600; }

/* range */
input[type=range] {
  width: 100%; height: 6px; border-radius: 99px; appearance: none;
  background: var(--surface-2); outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg); cursor: pointer;
  box-shadow: 0 0 0 1px var(--accent);
}

/* switch */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch-track { width: 42px; height: 24px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); position: relative; transition: all 0.25s var(--ease); }
.switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-faint); transition: all 0.25s var(--ease); }
.switch input:checked + .switch-track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .switch-track::after { left: 20px; background: var(--accent); }
.switch-label { font-size: 0.88rem; color: var(--text-dim); }

/* buttons */
.btn { font: inherit; cursor: pointer; border-radius: var(--radius-sm); padding: 12px 22px; border: 1px solid transparent; transition: all 0.22s var(--ease); font-weight: 500; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { box-shadow: 0 8px 24px var(--accent-soft); filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-lg { width: 100%; padding: 15px; font-size: 1rem; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }
.bank-note { text-align: center; font-size: 0.8rem; color: var(--text-faint); margin-top: 16px; }

/* quiz */
.quiz-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0; }
.progress-meta { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; color: var(--text-dim); flex-wrap: wrap; }
.pill { background: var(--accent-soft); color: var(--accent); padding: 4px 12px; border-radius: 99px; font-size: 0.74rem; font-weight: 600; }
.pill-ghost { background: var(--surface-2); color: var(--text-dim); font-weight: 400; }
.pill-l2 { background: rgba(167, 184, 216, 0.16); color: var(--accent-2); }
.pill-timer { background: var(--surface-2); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; letter-spacing: 0.05em; }
.pill-timer.timer-warn { background: rgba(230, 194, 122, 0.18); color: var(--warn); }
.pill-timer.timer-crit { background: rgba(224, 138, 138, 0.18); color: var(--bad); }
.exam-summary { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 12px 14px; border-radius: var(--radius-sm); }
.exam-summary p { margin: 0; color: var(--text); font-size: 0.86rem; }
.progress-bar { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 22px; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #9ad6cc); border-radius: 99px; transition: width 0.4s var(--ease); }

.quiz-card { animation: rise 0.4s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.q-text { font-size: 1.18rem; line-height: 1.5; margin-bottom: 24px; font-weight: 400; }
.q-text strong { color: var(--accent); font-weight: 600; }

.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex; align-items: flex-start; gap: 14px; text-align: left;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 18px; cursor: pointer; font: inherit; color: var(--text);
  transition: all 0.2s var(--ease); width: 100%;
}
.option:hover:not(.locked) { border-color: var(--accent); background: var(--surface-2); }
.option .opt-key { flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); display: grid; place-items: center; font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }
.option .opt-text { flex: 1; min-width: 0; }
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.option.selected .opt-key { background: var(--accent); color: var(--bg); }
.option.correct { border-color: var(--good); background: rgba(127, 209, 164, 0.12); }
.option.correct .opt-key { background: var(--good); color: var(--bg); }
.option.partial { border-color: var(--warn); background: rgba(230, 194, 122, 0.12); }
.option.partial .opt-key { background: var(--warn); color: var(--bg); }
.option.wrong { border-color: var(--bad); background: rgba(224, 138, 138, 0.1); }
.option.wrong .opt-key { background: var(--bad); color: var(--bg); }
.option.locked { cursor: default; }
.opt-score { margin-left: auto; font-size: 0.74rem; font-weight: 600; color: var(--text-faint); white-space: nowrap; }

.feedback { margin-top: 20px; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 3px solid var(--accent); font-size: 0.9rem; color: var(--text-dim); animation: rise 0.3s var(--ease); }
.feedback strong { color: var(--text); }
.feedback-ref { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--text-faint); font-style: italic; }
.feedback-ref strong { color: var(--text-dim); font-style: normal; }

.quiz-foot { display: flex; justify-content: space-between; margin-top: 22px; gap: 12px; }

/* results */
.result-card { text-align: center; max-width: 560px; margin: 24px auto; }
.score-ring { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 22px; display: grid; place-items: center; background: conic-gradient(var(--accent) var(--pct, 0%), var(--surface-2) 0); transition: all 0.8s var(--ease); }
.score-ring-inner { width: 116px; height: 116px; border-radius: 50%; background: var(--bg-soft); display: grid; place-items: center; }
.score-pct { font-size: 2rem; font-weight: 700; }
.score-lbl { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.12em; }
#resultVerdict { font-size: 1.5rem; margin-bottom: 8px; }
.result-sub { color: var(--text-dim); margin-bottom: 22px; }
.result-stats { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
.stat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 20px; min-width: 96px; }
.stat-num { font-size: 1.4rem; font-weight: 700; }
.stat-lbl { font-size: 0.74rem; color: var(--text-faint); }
.result-actions { display: flex; gap: 12px; justify-content: center; }

.review-list { margin-top: 30px; display: flex; flex-direction: column; gap: 16px; }
.review-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px; }
.review-q { font-weight: 500; margin-bottom: 14px; }
.review-q strong { color: var(--accent); }
.review-opt { padding: 9px 14px; border-radius: 9px; font-size: 0.88rem; margin-bottom: 8px; border: 1px solid var(--border); display: flex; gap: 8px; }
.review-opt.correct { background: rgba(127,209,164,0.12); border-color: var(--good); }
.review-opt.partial { background: rgba(230,194,122,0.12); border-color: var(--warn); }
.review-opt.chosen-wrong { background: rgba(224,138,138,0.1); border-color: var(--bad); }
.review-expl { font-size: 0.84rem; color: var(--text-dim); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.review-ref { font-size: 0.78rem; color: var(--text-faint); margin-top: 8px; font-style: italic; }
.review-ref strong { color: var(--text-dim); font-style: normal; }
.review-opt-score { margin-left: auto; color: var(--text-faint); }

/* history */
.view-header { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 22px; }
.view-header h2 { font-size: 1.4rem; }
.history-tools { display: flex; gap: 8px; }
.hist-row { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 12px; }
.hist-badge { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 1rem; flex-shrink: 0; color: var(--bg); }
.hist-badge-good { background: var(--good); }
.hist-badge-warn { background: var(--warn); }
.hist-badge-bad  { background: var(--bad); }
.hist-meta { flex: 1; min-width: 0; }
.hist-mode { font-weight: 600; }
.hist-date { font-size: 0.8rem; color: var(--text-faint); }
.hist-score { text-align: right; font-weight: 700; font-size: 1.1rem; }
.hist-score small { display: block; font-weight: 400; font-size: 0.74rem; color: var(--text-faint); }
.empty { text-align: center; color: var(--text-faint); padding: 50px 0; }

/* about */
.about-card { max-width: 640px; margin: 24px auto; }
.about-card h2 { margin-bottom: 16px; }
.about-card p { color: var(--text-dim); margin-bottom: 14px; }
.about-list { margin: 0 0 18px 18px; color: var(--text-dim); }
.about-list li { margin-bottom: 8px; }
.disclaimer { font-size: 0.84rem; color: var(--text-faint); background: var(--bg-soft); border-radius: var(--radius-sm); padding: 14px 16px; border: 1px solid var(--border); }

/* glossary */
.glossary-intro { color: var(--text-dim); max-width: 720px; margin-bottom: 22px; font-size: 0.92rem; }
.glossary-controls { display: flex; flex-direction: column; gap: 14px; margin-bottom: 26px; }
.glossary-search {
  width: 100%; font: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 16px; outline: none; transition: border-color 0.2s var(--ease);
}
.glossary-search:focus { border-color: var(--accent); }
.glossary-search::placeholder { color: var(--text-faint); }
.glossary-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  font: inherit; font-size: 0.8rem; cursor: pointer; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; transition: all 0.2s var(--ease);
}
.cat-chip:hover { color: var(--text); border-color: var(--accent); }
.cat-chip.is-active { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.cat-chip-special { border-style: dashed; }
.cat-chip-special::before { content: "◆"; margin-right: 6px; opacity: 0.75; font-size: 0.7em; vertical-align: 1px; }

/* diagram deck */
.diagram-hint { font-size: 0.78rem; color: var(--text-faint); margin-bottom: 10px; font-style: italic; }
.diagram-deck { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 30px; }
.diagram-deck-only { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 40px; }
.diagram-deck-only .svg-diagram { max-height: 320px; }
.diagram-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px; text-align: center;
  cursor: zoom-in; transition: all 0.2s var(--ease); position: relative;
}
.diagram-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.18); }
.diagram-card:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
.diagram-card::after {
  content: "⤢"; position: absolute; top: 8px; right: 10px;
  font-size: 0.85rem; color: var(--text-faint); opacity: 0;
  transition: opacity 0.2s var(--ease); pointer-events: none;
}
.diagram-card:hover::after, .diagram-card:focus-visible::after { opacity: 1; }
.diagram-card figcaption { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 12px; font-weight: 600; }
.svg-diagram { width: 100%; height: auto; max-height: 240px; pointer-events: none; }

/* diagram zoom modal */
.diagram-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 24px;
  animation: fade-in 0.2s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.diagram-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px);
}
.diagram-modal-panel {
  position: relative; z-index: 1;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: min(1200px, 96vw); width: 100%;
  max-height: 92vh; display: flex; flex-direction: column;
  animation: rise 0.25s var(--ease);
}
.diagram-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.diagram-modal-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin: 0; }
.diagram-modal-close {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer;
  width: 36px; height: 36px; border-radius: 999px;
  display: grid; place-items: center; font-size: 1.4rem; line-height: 1;
  transition: all 0.2s var(--ease);
}
.diagram-modal-close:hover { color: var(--text); background: var(--surface-2); border-color: var(--accent); }
/* Side-by-side SVG + description on wide screens; stacks on narrow. */
.diagram-modal-content {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 0; flex: 1; min-height: 0; overflow: hidden;
}
.diagram-modal-body {
  padding: 28px 32px; overflow: auto; display: grid; place-items: center;
  min-height: 0;
}
.diagram-modal-aside {
  padding: 24px 28px; overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
}
.diagram-modal-desc {
  margin: 0; color: var(--text); font-size: 0.92rem; line-height: 1.6;
}
.svg-diagram-zoomed {
  width: 100%; height: auto;
  max-width: min(700px, 70vw);
  max-height: 72vh;
}
@media (max-width: 760px) {
  .diagram-modal-content { grid-template-columns: 1fr; }
  .diagram-modal-aside { border-left: none; border-top: 1px solid var(--border); max-height: 38vh; }
  .svg-diagram-zoomed { max-width: 92vw; max-height: 50vh; }
}

/* glossary entries */
.glossary-list { display: flex; flex-direction: column; gap: 12px; }
.gloss-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px 20px; }
.gloss-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.gloss-term { font-size: 1.02rem; font-weight: 600; color: var(--text); }
.gloss-cat { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; }
.gloss-def { color: var(--text-dim); font-size: 0.92rem; margin-bottom: 12px; }
.gloss-doc { display: inline-flex; align-items: center; gap: 5px; font-size: 0.82rem; color: var(--accent); text-decoration: none; }
.gloss-doc:hover { text-decoration: underline; }
.gloss-empty { text-align: center; color: var(--text-faint); padding: 40px 0; }
mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 2px; }

.footer { position: relative; z-index: 1; text-align: center; color: var(--text-faint); font-size: 0.78rem; padding: 28px; }


@media (max-width: 560px) {
  .hero h1 { font-size: 2rem; }
  main, .topbar { padding-left: 18px; padding-right: 18px; }
  .seg { flex-direction: column; }
  .result-actions { flex-direction: column; }
}

/* ---------- ADM Phases reference (special glossary mode) ---------- */
.adm-phases-view { margin-bottom: 30px; }
.adm-phases-hint { font-size: 0.78rem; color: var(--text-faint); margin-bottom: 14px; font-style: italic; }
.adm-phases-layout {
  display: grid; gap: 18px;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  align-items: start;
}
.adm-phase-picker {
  display: flex; flex-direction: column; gap: 6px;
}
.adm-phase-btn {
  display: flex; align-items: center; gap: 12px;
  font: inherit; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 14px;
  transition: all 0.18s var(--ease);
}
.adm-phase-btn:hover { border-color: var(--accent); background: var(--surface-2); }
.adm-phase-btn.is-active { background: var(--accent-soft); border-color: var(--accent); }
.adm-phase-code {
  flex-shrink: 0; min-width: 28px; height: 26px;
  display: grid; place-items: center;
  border-radius: 6px; background: var(--surface-2);
  font-size: 0.78rem; font-weight: 700; color: var(--text-dim);
  padding: 0 8px;
}
.adm-phase-btn.is-active .adm-phase-code { background: var(--accent); color: var(--bg); }
.adm-phase-name { font-size: 0.86rem; color: var(--text-dim); }
.adm-phase-btn.is-active .adm-phase-name { color: var(--text); font-weight: 500; }

.adm-phase-detail {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 22px 26px;
  min-height: 320px;
}
.adm-detail-head { margin-bottom: 14px; }
.adm-detail-title { font-size: 1.1rem; font-weight: 600; color: var(--text); margin: 0; }
.adm-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.adm-tab {
  font: inherit; cursor: pointer;
  background: none; border: none; color: var(--text-dim);
  padding: 9px 16px; border-radius: 8px 8px 0 0;
  font-size: 0.86rem; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.adm-tab:hover { color: var(--text); }
.adm-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-soft); }
.adm-tabpanel { animation: rise 0.25s var(--ease); }
.adm-objective {
  color: var(--text); font-size: 0.95rem; line-height: 1.6;
  margin: 0;
}
.adm-list {
  margin: 0; padding-left: 22px;
  color: var(--text); font-size: 0.92rem; line-height: 1.55;
}
.adm-list li { margin-bottom: 6px; }
.adm-list li::marker { color: var(--accent); }
.adm-ref {
  margin-top: 22px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem; color: var(--text-faint); font-style: italic;
}
.adm-ref strong { color: var(--text-dim); font-style: normal; }

@media (max-width: 640px) {
  .adm-phases-layout { grid-template-columns: 1fr; }
  .adm-phase-picker {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }
}


/* ---------- SVG diagram styling ----------
   Scoped to .svg-diagram to keep these rules from leaking. Previously these
   lived inline inside <svg><defs><style> blocks in index.html. */
.svg-diagram .adm-seg { fill: var(--surface-2); stroke: var(--border); stroke-width: 1; }
.svg-diagram .adm-lbl { fill: var(--text-dim); font-size: 8.5px; font-family: Inter, sans-serif; }
.svg-diagram .adm-lbl-key { fill: var(--accent); font-size: 10px; font-weight: 700; font-family: Inter, sans-serif; }
.svg-diagram .adm-core { fill: var(--accent-soft); stroke: var(--accent); }
.svg-diagram .adm-core-lbl { fill: var(--accent); font-size: 10px; font-weight: 600; font-family: Inter, sans-serif; }
.svg-diagram .adm-arrow { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.7; }
.svg-diagram .adm-prelim { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.svg-diagram .adm-prelim-lbl { fill: var(--accent); font-size: 9px; font-weight: 700; font-family: Inter, sans-serif; }
.svg-diagram .adm-connector { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.85; }

.svg-diagram .ec-box { fill: var(--surface-2); stroke: var(--border); }
.svg-diagram .ec-lbl { fill: var(--text); font-size: 11px; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .ec-row { fill: var(--text-dim); font-size: 10px; font-family: Inter, sans-serif; }
.svg-diagram .ec-arrow { fill: none; stroke: var(--accent); stroke-width: 2; }

.svg-diagram .bb-abb { fill: var(--accent-soft); stroke: var(--accent); }
.svg-diagram .bb-sbb { fill: var(--surface-2); stroke: var(--border); }
.svg-diagram .bb-lbl { fill: var(--text); font-size: 12px; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .bb-sub { fill: var(--text-dim); font-size: 9px; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .bb-arrow { fill: none; stroke: var(--accent); stroke-width: 2; }
.svg-diagram .bb-arrow-lbl { fill: var(--text-dim); font-size: 10px; font-family: Inter, sans-serif; text-anchor: middle; }

/* TOGAF Enterprise Metamodel */
.svg-diagram .mm-band-bg   { stroke: var(--border); }
.svg-diagram .mm-band-mot  { fill: rgba(167, 184, 216, 0.22); }
.svg-diagram .mm-band-biz  { fill: rgba(127, 209, 196, 0.22); }
.svg-diagram .mm-band-data { fill: rgba(127, 209, 164, 0.18); }
.svg-diagram .mm-band-app  { fill: rgba(230, 194, 122, 0.18); }
.svg-diagram .mm-band-tech { fill: rgba(224, 138, 138, 0.16); }
.svg-diagram .mm-band-real { fill: rgba(167, 184, 216, 0.14); }
.svg-diagram .mm-band-lbl  { fill: var(--text); font-size: 11px; font-weight: 700; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .mm-entity    { fill: var(--bg-soft); stroke: var(--border); }
.svg-diagram .mm-entity-lbl{ fill: var(--text); font-size: 10px; font-weight: 500; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .mm-trace     { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.6; }

/* Content Framework */
.svg-diagram .cf-domain { fill: var(--accent); }
.svg-diagram .cf-domain-lbl { fill: var(--bg); font-size: 11px; font-weight: 600; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .cf-deliv { fill: var(--surface-2); stroke: var(--border); }
.svg-diagram .cf-art   { fill: var(--accent-soft); stroke: var(--accent); }
.svg-diagram .cf-bb    { fill: var(--surface-2); stroke: var(--accent-2); }
.svg-diagram .cf-lbl-h { fill: var(--text); font-size: 12px; font-weight: 600; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .cf-lbl-s { fill: var(--text-dim); font-size: 9.5px; font-family: Inter, sans-serif; text-anchor: middle; }

/* Architecture Repository */
.svg-diagram .repo-shell { fill: var(--surface); stroke: var(--border); }
.svg-diagram .repo-title { fill: var(--accent); font-size: 12px; font-weight: 600; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .repo-cell  { fill: var(--bg-soft); stroke: var(--border); }
.svg-diagram .repo-cell-h { fill: var(--text); font-size: 10.5px; font-weight: 600; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .repo-cell-s { fill: var(--text-dim); font-size: 8.5px; font-family: Inter, sans-serif; text-anchor: middle; }

/* Iteration cycles */
.svg-diagram .iter2-ph          { fill: var(--surface-2); stroke: var(--border); stroke-width: 1; }
.svg-diagram .iter2-ph-lbl      { fill: var(--text); font-size: 13px; font-weight: 700; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .iter2-bar         { stroke-width: 0; }
.svg-diagram .iter2-bar-ctx     { fill: var(--accent-2); opacity: 0.55; }
.svg-diagram .iter2-bar-dev     { fill: var(--accent);   opacity: 0.85; }
.svg-diagram .iter2-bar-tran    { fill: var(--warn);     opacity: 0.65; }
.svg-diagram .iter2-bar-gov     { fill: var(--good);     opacity: 0.65; }
.svg-diagram .iter2-bar-lbl     { fill: var(--text); font-size: 11px; font-weight: 600; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .iter2-foot        { fill: var(--text-dim); font-size: 10px; font-style: italic; font-family: Inter, sans-serif; text-anchor: middle; }

/* Architecture Landscape (stacked trapezoids) */
.svg-diagram .land-strat { fill: var(--accent-soft); stroke: var(--accent); }
.svg-diagram .land-seg   { fill: rgba(167, 184, 216, 0.18); stroke: var(--accent-2); }
.svg-diagram .land-cap   { fill: var(--surface-2); stroke: var(--border); }
.svg-diagram .land-lbl   { fill: var(--text); font-size: 12px; font-weight: 600; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .land-axis  { fill: var(--text-faint); font-size: 9px; font-style: italic; font-family: Inter, sans-serif; }

/* Stakeholder Power / Interest matrix */
.svg-diagram .sm-q    { stroke: var(--border); }
.svg-diagram .sm-ks   { fill: rgba(230, 194, 122, 0.16); }
.svg-diagram .sm-kp   { fill: var(--accent-soft); stroke: var(--accent); }
.svg-diagram .sm-me   { fill: var(--surface-2); }
.svg-diagram .sm-ki   { fill: rgba(167, 184, 216, 0.16); }
.svg-diagram .sm-q-h  { fill: var(--text); font-size: 12px; font-weight: 600; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .sm-q-s  { fill: var(--text-dim); font-size: 9px; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .sm-axis { fill: var(--accent); font-size: 10px; font-weight: 600; font-family: Inter, sans-serif; }

/* Architecture Partitioning */
.svg-diagram .part-shell { fill: var(--surface); stroke: var(--border); }
.svg-diagram .part-title { fill: var(--accent); font-size: 12px; font-weight: 600; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .part-cell   { fill: var(--bg-soft); stroke: var(--border); }
.svg-diagram .part-cell-h { fill: var(--text); font-size: 11px; font-weight: 600; font-family: Inter, sans-serif; text-anchor: middle; }
.svg-diagram .part-cell-s { fill: var(--text-dim); font-size: 9px; font-family: Inter, sans-serif; text-anchor: middle; }
