:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #162033;
  --muted: #667085;
  --line: #d9e0ea;
  --accent: #1f6feb;
  --accent-dark: #174ea6;
  --good: #137333;
  --bad: #b3261e;
  --warn: #9a6700;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { border: 0; border-radius: 7px; padding: 11px 14px; cursor: pointer; font-weight: 700; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar { background: #0f172a; color: white; padding: 22px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: #e0ecff; color: #0f172a; font-weight: 900; }
.brand small, .target-card small { display: block; color: #bac5d8; margin-top: 3px; }
nav { display: grid; gap: 8px; }
.nav-btn { background: transparent; color: #d7def0; text-align: left; }
.nav-btn.active, .nav-btn:hover { background: #1e293b; color: white; }
.target-card { margin-top: auto; background: #1e293b; border: 1px solid #334155; padding: 16px; border-radius: var(--radius); }
.target-card span { color: #bac5d8; }
.target-card strong { display: block; margin: 6px 0; font-size: 32px; }
main { padding: 28px; min-width: 0; }
.view { display: none; }
.view.active { display: block; }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 22px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
h1 { max-width: 780px; margin: 0 0 10px; font-size: clamp(30px, 5vw, 54px); line-height: 1.02; letter-spacing: 0; }
h2 { margin: 0; font-size: 24px; }
p { color: var(--muted); line-height: 1.55; }
.hero-actions, .exam-actions, .dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: #e8eef8; color: #1f2a44; }
.danger { background: #ffe8e6; color: var(--bad); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.stats-grid article, .panel, .question-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stats-grid span { color: var(--muted); font-size: 13px; }
.stats-grid strong { display: block; margin-top: 8px; font-size: 28px; }
.panel-title { margin: 8px 0 16px; }
.panel-title p { margin: 6px 0 0; }
.setup-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }
label { color: var(--muted); font-size: 13px; font-weight: 700; }
select, input { width: 100%; margin-top: 7px; border: 1px solid var(--line); border-radius: 7px; padding: 11px 12px; background: white; color: var(--ink); }
.exam-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 12px; }
.exam-header small { color: var(--muted); font-weight: 700; }
.score-pill { background: #e8f1ff; color: var(--accent-dark); padding: 10px 14px; border-radius: 999px; font-weight: 900; }
.progress { height: 9px; border-radius: 999px; background: #dce5f2; overflow: hidden; margin-bottom: 16px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
.scenario-box { background: #f7fafc; border-left: 4px solid var(--accent); padding: 14px; margin-bottom: 18px; max-height: 260px; overflow: auto; color: #344054; line-height: 1.5; }
.hidden { display: none !important; }
.prompt { color: var(--ink); font-size: 21px; line-height: 1.45; }
.options { display: grid; gap: 10px; margin: 18px 0; }
.option { width: 100%; text-align: left; background: white; border: 1px solid var(--line); color: var(--ink); font-weight: 650; }
.option:hover { border-color: var(--accent); background: #f5f9ff; }
.option.selected { border-color: var(--accent); box-shadow: 0 0 0 3px #dbeafe; }
.option.correct { border-color: var(--good); background: #eaf7ef; }
.option.incorrect { border-color: var(--bad); background: #fff0ee; }
.feedback { border-radius: var(--radius); padding: 14px; background: #f7fafc; border: 1px solid var(--line); }
.feedback.good { border-color: #9ad8ad; background: #eefaf1; }
.feedback.bad { border-color: #f3aaa4; background: #fff2f0; }
.feedback.warn { border-color: #e7c36d; background: #fff8e6; }
.reasoning { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(102, 112, 133, .25); }
.reasoning span { display: block; color: var(--ink); font-size: 13px; font-weight: 900; margin-bottom: 7px; }
.reasoning ul { margin: 0; padding-left: 20px; color: #344054; line-height: 1.45; }
.reasoning li + li { margin-top: 5px; }
.reasoning p { margin: 0; color: #344054; }
.full-notes { margin-top: 12px; border-top: 1px solid rgba(102, 112, 133, .25); padding-top: 10px; }
.full-notes summary { cursor: pointer; color: var(--ink); font-weight: 900; font-size: 13px; }
.full-explanation { margin-top: 10px; display: grid; gap: 6px; max-width: 1100px; }
.full-explanation .line { margin: 0; color: #344054; line-height: 1.45; }
.full-explanation .step-line { margin-top: 6px; color: #172033; font-weight: 800; }
.full-explanation .option-line { padding-left: 10px; border-left: 3px solid #d0d8e6; }
.full-explanation .correct-line { color: var(--good); font-weight: 800; }
.notes-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.note h3 { margin: 0 0 8px; }
.note ul { padding-left: 18px; color: var(--muted); line-height: 1.45; }
.note a { color: var(--accent-dark); font-weight: 700; }
.filters { display: grid; grid-template-columns: 1fr 220px 220px; gap: 12px; margin-bottom: 14px; }
.bank-list { display: grid; gap: 10px; }
.bank-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.bank-item strong { display: block; margin-bottom: 7px; }
.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 800; margin-right: 6px; background: #eef2f7; color: #475467; }
.tag.ok { background: #eaf7ef; color: var(--good); }
.tag.warn { background: #fff8e6; color: var(--warn); }
dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: 720px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
.result-box { padding: 22px; }
.breakdown { display: grid; gap: 8px; margin: 14px 0; }
.breakdown div { display: flex; justify-content: space-between; background: #f7fafc; padding: 10px; border-radius: 7px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  nav { grid-template-columns: repeat(2, 1fr); }
  .hero, .setup-grid, .stats-grid, .notes-list, .filters { grid-template-columns: 1fr; }
  main { padding: 16px; }
}
