/* AP2-Lerntool – ruhiges, professionelles Design mit Hell/Dunkel-Modus */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e7eaef;
  --border: #dfe3e9;
  --text: #1b2330;
  --muted: #5c6777;
  --accent: #2f5fd0;
  --accent-strong: #234bb0;
  --accent-weak: #e7eefc;
  --on-accent: #ffffff;
  --good: #1d8048;
  --good-weak: #e3f4ea;
  --mid: #a86a12;
  --mid-weak: #fbf0dc;
  --bad: #c03939;
  --bad-weak: #fbe7e7;
  --code-bg: #f3f5f8;
  --code-text: #1f2a3a;
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.06), 0 2px 8px rgba(20, 30, 45, 0.04);
  --p-ga1: #2f5fd0;
  --p-ga2: #7a4cc4;
  --p-wiso: #13837a;
  --p-fg: #b5651d;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e131a;
    --surface: #151c25;
    --surface-2: #1b2430;
    --surface-3: #232e3c;
    --border: #2a3542;
    --text: #e4e8ee;
    --muted: #9aa5b3;
    --accent: #7ea2ff;
    --accent-strong: #a3bdff;
    --accent-weak: #1c2945;
    --on-accent: #0b1220;
    --good: #4cc184;
    --good-weak: #15301f;
    --mid: #e0a84a;
    --mid-weak: #342814;
    --bad: #f07272;
    --bad-weak: #3a1b1d;
    --code-bg: #0f1620;
    --code-text: #dbe3ee;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --p-ga1: #7ea2ff;
    --p-ga2: #b993ff;
    --p-wiso: #4fc7bb;
    --p-fg: #f0a463;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e131a;
  --surface: #151c25;
  --surface-2: #1b2430;
  --surface-3: #232e3c;
  --border: #2a3542;
  --text: #e4e8ee;
  --muted: #9aa5b3;
  --accent: #7ea2ff;
  --accent-strong: #a3bdff;
  --accent-weak: #1c2945;
  --on-accent: #0b1220;
  --good: #4cc184;
  --good-weak: #15301f;
  --mid: #e0a84a;
  --mid-weak: #342814;
  --bad: #f07272;
  --bad-weak: #3a1b1d;
  --code-bg: #0f1620;
  --code-text: #dbe3ee;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --p-ga1: #7ea2ff;
  --p-ga2: #b993ff;
  --p-wiso: #4fc7bb;
  --p-fg: #f0a463;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15.5px/1.55 var(--font);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.98rem; }
p { margin: 0 0 0.75em; }
code, kbd, pre, textarea.code { font-family: var(--mono); }
code { font-size: 0.9em; background: var(--code-bg); color: var(--code-text); padding: 0.1em 0.35em; border-radius: 4px; border: 1px solid var(--border); }
pre { background: var(--code-bg); color: var(--code-text); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 0.88rem; line-height: 1.5; tab-size: 4; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
kbd { font-size: 0.75em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.35em; background: var(--surface-2); color: var(--muted); }
.btn kbd { margin-left: 0.4em; background: transparent; color: inherit; opacity: 0.75; border-color: currentColor; }
table { border-collapse: collapse; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.warn { color: var(--mid); }
mark { background: var(--mid-weak); color: inherit; padding: 0 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--on-accent); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------------ Layout */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo { background: var(--accent); color: var(--on-accent); border-radius: 7px; padding: 3px 7px; font-size: 0.8rem; letter-spacing: 0.03em; }
.brand small { color: var(--muted); font-weight: 500; }
.topsearch { flex: 1; max-width: 460px; margin-left: auto; }
.topsearch .input { height: 36px; }
.aibadge { font-size: 0.75rem; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--border); white-space: nowrap; color: var(--muted); }
.aibadge.on { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: var(--good-weak); }
.aibadge:hover { text-decoration: none; }
.icon-btn.navtoggle { display: none; }
.layout { display: flex; min-height: calc(100vh - 56px); }
.nav {
  width: 216px; flex-shrink: 0; padding: 14px 10px;
  border-right: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 0.93rem; }
.nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); flex-shrink: 0; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-weak); color: var(--accent-strong); font-weight: 600; }
.nav a.active svg { color: var(--accent); }
.navfoot { margin-top: auto; padding: 10px; line-height: 1.8; }
.navscrim { display: none; }
.view { flex: 1; min-width: 0; padding: 24px 28px 64px; max-width: 1180px; outline: none; }
.exambanner { background: var(--mid-weak); color: var(--text); padding: 6px 16px; font-size: 0.9rem; border-bottom: 1px solid var(--border); text-align: center; }

@media (max-width: 900px) {
  .icon-btn.navtoggle { display: inline-flex; }
  .nav { position: fixed; left: 0; top: 56px; bottom: 0; height: auto; z-index: 40; transform: translateX(-105%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  body.nav-open .nav { transform: none; }
  body.nav-open .navscrim { display: block; position: fixed; inset: 56px 0 0 0; background: rgba(0, 0, 0, 0.35); z-index: 35; }
  .view { padding: 18px 16px 56px; }
}
@media (max-width: 560px) {
  .brand .bt { display: none; }
  .topbar { gap: 8px; padding: 0 10px; }
  .aibadge { display: none; }
  h1 { font-size: 1.35rem; }
}

/* --------------------------------------------------------------- Elemente */
.page-head { margin-bottom: 18px; }
.page-head p { margin: 0; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
h2.sec { margin: 26px 0 12px; font-size: 1.1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
details.card > summary { cursor: pointer; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.kpi4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.parts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1240px) { .grid.parts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .grid.parts { grid-template-columns: 1fr; } }
.grid.parts2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
@media (max-width: 420px) { .grid.two, .grid.parts2 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.grow { flex: 1; min-width: 60px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 15px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 0.93rem; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.ghost.active { border-color: var(--mid); color: var(--mid); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); background: transparent; }
.btn.danger:hover { background: var(--bad-weak); }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 0.85rem; }
.btn.big { min-height: 46px; padding: 10px 24px; font-size: 1.02rem; }
.btn.good { border-color: var(--good); color: var(--good); background: var(--good-weak); }
.btn.mid { border-color: var(--mid); color: var(--mid); background: var(--mid-weak); }
.btn.bad { border-color: var(--bad); color: var(--bad); background: var(--bad-weak); }
label.btn input[type="file"] { display: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 6px;
  border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.input {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; min-height: 38px;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input.short { width: 96px; }
textarea.input { resize: vertical; line-height: 1.5; }
textarea.code { font-size: 0.9rem; tab-size: 4; background: var(--code-bg); color: var(--code-text); white-space: pre; overflow-x: auto; }
select.input[multiple] { padding: 4px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 0.9rem; font-weight: 550; margin-bottom: 10px; }
label > .row { gap: 8px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 600; font-size: 0.93rem; margin-bottom: 6px; padding: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.checks.topics { max-height: 260px; overflow-y: auto; padding: 8px 0; }
.check { flex-direction: row; align-items: center; gap: 7px; font-weight: 450; margin: 0; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.check input { accent-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.filters label { margin: 0; min-width: 180px; }

.badge { display: inline-flex; align-items: center; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.badge.part { color: #fff; border-color: transparent; letter-spacing: 0.02em; }
:root[data-theme="dark"] .badge.part { color: #0b1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.part { color: #0b1220; } }
.badge.part-ga1 { background: var(--p-ga1); }
.badge.part-ga2 { background: var(--p-ga2); }
.badge.part-wiso { background: var(--p-wiso); }
.badge.part-fg { background: var(--p-fg); }
.badge.ai { background: var(--accent-weak); color: var(--accent-strong); border-color: transparent; }
.badge.gen { background: var(--mid-weak); color: var(--mid); border-color: transparent; }
.badge.ok { background: var(--good-weak); color: var(--good); border-color: transparent; }
.badge.topic { color: var(--text); }
.diff { display: inline-flex; gap: 2px; vertical-align: middle; }
.diff i { width: 6px; height: 12px; border-radius: 2px; background: var(--surface-3); }
.diff i.on { background: var(--muted); }

.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 6px 0; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--muted); transition: width 0.3s; }
.bar.good > span { background: var(--good); }
.bar.mid > span { background: var(--mid); }
.bar.low > span { background: var(--bad); }
.bar.none > span { background: transparent; }
.bar.accent > span { background: var(--accent); }
.good-t { color: var(--good); } .mid-t { color: var(--mid); } .low-t { color: var(--bad); } .none-t { color: var(--muted); }

.grade { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; font-weight: 700; font-size: 0.9rem; color: #fff; vertical-align: middle; }
.grade.g1, .grade.g2 { background: var(--good); }
.grade.g3 { background: color-mix(in srgb, var(--good) 55%, var(--mid)); }
.grade.g4 { background: var(--mid); }
.grade.g5, .grade.g6 { background: var(--bad); }
.grade.none { background: var(--surface-3); color: var(--muted); }

.notice { border: 1px solid var(--border); border-left: 4px solid var(--accent); background: var(--accent-weak); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.notice.error { border-left-color: var(--bad); background: var(--bad-weak); }
.notice.ok { border-left-color: var(--good); background: var(--good-weak); }
.card.info { background: var(--surface); border-left: 4px solid var(--accent); }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } * { transition: none !important; } }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: 0.9rem; transition: opacity 0.4s, transform 0.4s; }
.toast.error { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* Tabellen */
table.list { width: 100%; font-size: 0.9rem; }
table.list th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.list td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list.compact td { padding: 5px 8px; }
table.list .bar { display: inline-block; width: 70%; min-width: 60px; vertical-align: middle; margin: 0 6px 0 0; }
.card { overflow-x: auto; }
.tablewrap { overflow-x: auto; margin: 8px 0; max-width: 100%; }
.tcap { font-size: 0.85rem; margin-bottom: 4px; color: var(--muted); }
table.data { font-family: var(--mono); font-size: 0.82rem; border: 1px solid var(--border); background: var(--surface); }
table.data th { background: var(--surface-2); text-align: left; padding: 4px 9px; border-bottom: 1px solid var(--border); font-weight: 600; white-space: nowrap; }
table.data td { padding: 3px 9px; border-top: 1px solid var(--border); white-space: nowrap; }
table.data td.null { color: var(--muted); font-style: italic; }
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

/* KPIs */
.kpis { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-bottom: 8px; }
.kpi .kv { font-size: 1.45rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.kpi .kl, .kpi-card .kl { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.kpi-card .kv { font-size: 1.7rem; font-weight: 680; font-variant-numeric: tabular-nums; margin: 2px 0; }
.kv.big { font-size: 2.2rem; }
.kpi-card .btn { margin-top: 4px; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; border-left: 4px solid var(--accent); }
.hero h2 { margin-bottom: 4px; }
.hero p { margin: 0; max-width: 640px; }
.partcard .kv { font-size: 1.35rem; font-weight: 680; white-space: nowrap; }
.partcard .plabel { margin: 2px 0 8px; min-height: 2.6em; }
.partcard .row.between { align-items: center; }
.pred { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }

ul.toplist, ul.mlist { list-style: none; padding: 0; margin: 0; }
ul.toplist li, ul.mlist li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.toplist li:last-child, ul.mlist li:last-child { border-bottom: 0; }
ul.toplist li > a, ul.mlist li > a { flex: 0 1 45%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
ul.mlist .num { min-width: 42px; }
ul.toplist .small { white-space: nowrap; min-width: 38px; text-align: right; }
ol.plan { list-style: none; padding: 0; margin: 0; }
ol.plan li { display: grid; grid-template-columns: 82px 104px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; align-items: baseline; }
ol.plan .pday { font-weight: 600; font-variant-numeric: tabular-nums; }
ol.plan .pkind { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
ol.plan li.sim .pkind { color: var(--bad); }
ol.plan li.review .pkind { color: var(--mid); }
ol.plan li.learn .pkind { color: var(--accent); }
@media (max-width: 520px) { ol.plan li { grid-template-columns: 70px 1fr; } ol.plan .pkind { display: none; } }

.topicgrid, .examgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.topictile, .examtile { display: block; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); }
.topictile:hover { border-color: var(--accent); text-decoration: none; }
.topictile .tt, .examtile .tt { font-weight: 620; margin: 2px 0 4px; }
.examtile .btnrow { margin-top: 8px; }
ul.qlist { padding-left: 18px; margin: 8px 0 0; }
ul.qlist li { margin: 6px 0; }
ul.hits { list-style: none; padding: 0; margin: 0; }
ul.hits li { padding: 10px 0; border-bottom: 1px solid var(--border); }
ul.hits li:last-child { border-bottom: 0; }
.snip { font-size: 0.87rem; color: var(--muted); margin-top: 3px; }
.searchform { display: flex; gap: 8px; }

/* Lernzettel */
.lernzettel .summary-html { max-width: 820px; }
.summary-html h4 { margin: 1.1em 0 0.4em; font-size: 1rem; }
.summary-html ul, .summary-html ol { padding-left: 22px; margin: 0 0 0.8em; }
.summary-html li { margin: 3px 0; }
.summary-html table, .qtext table, .qcontext table, .sol table { border-collapse: collapse; margin: 8px 0; font-size: 0.9rem; display: block; overflow-x: auto; max-width: 100%; }
.summary-html th, .summary-html td, .qtext th, .qtext td, .qcontext th, .qcontext td, .sol th, .sol td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; vertical-align: top; }
.summary-html th, .qtext th, .qcontext th, .sol th { background: var(--surface-2); }

/* ---------------------------------------------------------- Fragekarte */
.session .sess-head, .sess-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.sess-head h2 { margin: 0; }
.sess-card { margin-top: 14px; }
.qcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.qmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; font-size: 0.85rem; }
.qmeta .qnum { font-weight: 650; margin-right: 4px; }
.qmeta .pts { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.qmeta .report-link { font-size: 0.75rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.qmeta .report-link:hover, .qmeta .report-link:focus-visible { color: var(--text); text-decoration: underline; }
.qcontext { background: var(--surface-2); border-left: 3px solid var(--border); padding: 10px 14px; border-radius: 0 8px 8px 0; margin-bottom: 12px; font-size: 0.94rem; }
.qtext { font-size: 1.02rem; margin-bottom: 14px; }
.qtext p:last-child, .qcontext p:last-child { margin-bottom: 0; }
.qtext ul, .qtext ol, .sol ul, .sol ol { padding-left: 22px; }
.hint { font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { flex-direction: row; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; font-weight: 450; font-size: 0.97rem; background: var(--surface); transition: border-color 0.1s, background 0.1s; }
.opt:hover { border-color: var(--accent); }
.opt input { margin-top: 4px; accent-color: var(--accent); flex-shrink: 0; }
.opt .key { flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.75rem; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-family: var(--mono); margin-top: 1px; }
.opt .otext { flex: 1; min-width: 0; }
.opt.selected { border-color: var(--accent); background: var(--accent-weak); }
.opt.is-correct { border-color: var(--good); background: var(--good-weak); }
.opt.is-missed { border-color: var(--good); border-style: dashed; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-weak); }
.opt.is-correct .key, .opt.is-missed .key { background: var(--good); color: #fff; border-color: var(--good); }
.opt.is-wrong .key { background: var(--bad); color: #fff; border-color: var(--bad); }
input:disabled + .key { opacity: 1; }
.opt:has(input:disabled) { cursor: default; }
.numrow { display: flex; align-items: center; gap: 8px; max-width: 360px; }
.numrow .unit { font-weight: 600; color: var(--muted); }
.numrow .input { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
ol.order { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: ord; }
ol.order li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); counter-increment: ord; }
ol.order li::before { content: counter(ord); font-family: var(--mono); font-size: 0.8rem; color: var(--muted); width: 18px; text-align: right; }
ol.order li[draggable="true"] { cursor: grab; }
ol.order li.dragging { opacity: 0.5; border-style: dashed; border-color: var(--accent); }
ol.order li.is-correct { border-color: var(--good); background: var(--good-weak); }
ol.order li.is-wrong { border-color: var(--bad); background: var(--bad-weak); }
ol.order .handle { color: var(--muted); letter-spacing: -2px; user-select: none; }
ol.order .otext { flex: 1; min-width: 0; }
ol.order .obtns { display: flex; gap: 2px; }
ol.correct-order { padding-left: 22px; margin: 4px 0 8px; }
.sqlbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.sqlout { margin-top: 6px; }
.qactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.qactions:empty { display: none; }
.sess-next { justify-content: flex-end; }

.result { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; border-left-width: 4px; background: var(--surface); }
.result.ok { border-left-color: var(--good); }
.result.partial { border-left-color: var(--mid); }
.result.bad { border-left-color: var(--bad); }
.result.pending { border-left-color: var(--accent); }
.rhead { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.rhead .score { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.result.ok .rlabel { color: var(--good); font-weight: 600; }
.result.partial .rlabel { color: var(--mid); font-weight: 600; }
.result.bad .rlabel { color: var(--bad); font-weight: 600; }
.result.pending .rlabel { color: var(--accent); font-weight: 600; }
.result .sub { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; color: var(--muted); margin: 10px 0 4px; }
.result details { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.result summary { cursor: pointer; font-weight: 600; font-size: 0.93rem; }
.sol { margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 0.8rem; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--border); }
.chip.ok { background: var(--good-weak); color: var(--good); border-color: transparent; }
.chip.miss { color: var(--muted); }
.aifb { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
ul.good li::marker { color: var(--good); }
ul.miss li::marker { color: var(--bad); }
.tip { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--accent-weak); }
.selfassess { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.selfassess .sub { text-transform: none; letter-spacing: 0; font-size: 0.92rem; color: var(--text); }
.flashcard .qinput textarea, .flashcard .qinput .numrow, .flashcard .qinput .hint, .flashcard .sqlbar, .flashcard .obtns, .flashcard .handle { display: none; }
.flashcard .qinput .sqlout { display: none; }
.flashcard ol.order .obtns, .flashcard ol.order .handle { display: none; }
.flash-actions { justify-content: center; margin-top: 16px; }

/* Tutor */
.tutor { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.tutor-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tutor-head .icon-btn { margin-left: auto; }
.tlog { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 88%; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 0.93rem; overflow-x: auto; }
.msg.user .bubble { background: var(--accent-weak); border-color: transparent; }
.tquick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tquick .btn { white-space: normal; text-align: left; }
.tform .btnrow { margin-top: 6px; }

/* Prüfung */
.examtop { position: sticky; top: 56px; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin: -8px 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.et-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer { font-family: var(--mono); font-size: 1.1rem; font-weight: 650; padding: 3px 10px; border-radius: 7px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.timer.warn { background: var(--mid-weak); color: var(--mid); }
.timer.crit { background: var(--bad-weak); color: var(--bad); }
.scenario > div { margin-top: 10px; }
.examlayout { display: grid; grid-template-columns: 168px 1fr; gap: 16px; align-items: start; }
.tasknav { position: sticky; top: 120px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.tchip { width: 36px; height: 34px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; position: relative; }
.tchip.answered { background: var(--accent-weak); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-strong); }
.tchip.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.tchip.flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--mid); }
.navinfo { width: 100%; margin-top: 4px; }
.examnav { justify-content: space-between; }
@media (max-width: 760px) {
  .examlayout { grid-template-columns: 1fr; }
  .tasknav { position: static; }
  .qcard { padding: 16px 14px; }
}
.reviewitem { margin-bottom: 16px; }
.result-summary h3 { margin-top: 14px; }

/* Charts */
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
svg.chart .barfill { fill: var(--accent); }
svg.chart .barfill:hover { fill: var(--accent-strong); }
svg.chart .linepath { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
svg.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
svg.chart .passline { stroke: var(--good); stroke-dasharray: 5 4; stroke-width: 1.3; }

/* KI-Studio */
ul.genlog { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.9rem; }
ul.genlog li { padding: 4px 0; }
ul.genlog li.ok { color: var(--good); }
ul.genlog li.err { color: var(--bad); }

.summary .kpis { margin: 10px 0 16px; }
.summary h3 { margin-top: 18px; }

@media print {
  .topbar, .nav, .qactions, .btnrow, .examtop .btn { display: none !important; }
  .view { padding: 0; max-width: none; }
  .card, .qcard { box-shadow: none; break-inside: avoid; }
}

/* Speicherkarte (Speichern-Button in der Kopfzeile) */
.savebtn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 0.8rem; font-weight: 600; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; white-space: nowrap; }
.savebtn:hover { background: var(--surface-2); color: var(--text); }
.savebtn.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: var(--good-weak); }
.savebtn.dirty { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.savebtn.dirty:hover { background: var(--accent-strong); color: var(--on-accent); }
.savebtn.saving { color: var(--mid); background: var(--mid-weak); border-color: color-mix(in srgb, var(--mid) 40%, transparent); }
.savebtn.error { color: var(--on-accent); background: var(--bad); border-color: var(--bad); }
.warn-text { color: var(--mid); font-weight: 600; }
@media (max-width: 520px) { .savebtn span { display: none; } .savebtn { padding: 6px 8px; } }
@media print { .savebtn { display: none !important; } }

/* Level-Kennzeichnung (Leicht / Mittel / Schwer) */
.lvl { display: inline-flex; align-items: center; gap: 2px; font-size: 0.72rem; font-weight: 650; padding: 2px 8px 2px 6px; border-radius: 99px; vertical-align: middle; white-space: nowrap; border: 1px solid transparent; }
.lvl i { width: 4px; height: 10px; border-radius: 1px; background: currentColor; opacity: 0.22; }
.lvl i.on { opacity: 1; }
.lvl i:last-of-type { margin-right: 4px; }
.lvl-1 { color: var(--good); background: var(--good-weak); }
.lvl-2 { color: var(--mid); background: var(--mid-weak); }
.lvl-3 { color: var(--bad); background: var(--bad-weak); }

/* Lernpfad */
.placement-cta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; border-left: 4px solid var(--accent); }
.placement-cta h2 { margin-top: 0; }
.pathbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; flex-wrap: wrap; }
.segbtn { font: inherit; font-size: 0.85rem; padding: 6px 12px; border: 0; border-right: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.segbtn:last-child { border-right: 0; }
.segbtn:hover { background: var(--surface-2); color: var(--text); }
.segbtn.on { background: var(--accent); color: var(--on-accent); }
.segbtn.lv1.on { background: var(--good); } .segbtn.lv2.on { background: var(--mid); } .segbtn.lv3.on { background: var(--bad); }
.grid.kpi3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.lvlcard.lv1 { border-top: 3px solid var(--good); } .lvlcard.lv2 { border-top: 3px solid var(--mid); } .lvlcard.lv3 { border-top: 3px solid var(--bad); }
.tablewrap { overflow-x: auto; }
.pathgrid td, .pathgrid th { vertical-align: middle; }
.pathgrid td:first-child { min-width: 140px; }
.pcell { min-width: 150px; }
.pcellbtn { width: 100%; text-align: left; font: inherit; display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.pcellbtn:hover { border-color: var(--accent); background: var(--surface-2); }
.pcell .ptop { font-size: 0.75rem; font-weight: 650; color: var(--muted); }
.pcell.rec .pcellbtn { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.pcell.rec .ptop { color: var(--accent); }
.pcell.done .pcellbtn { background: var(--good-weak); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.pcell.done .ptop { color: var(--good); }
.pcell.early .pcellbtn { opacity: 0.6; }
.ldots { display: inline-flex; gap: 3px; vertical-align: middle; }
.ldots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); }
.ldots i.on:nth-child(1) { background: var(--good); } .ldots i.on:nth-child(2) { background: var(--mid); } .ldots i.on:nth-child(3) { background: var(--bad); }
.pathsum { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; }
.pathsum li { display: grid; grid-template-columns: 170px repeat(3, minmax(0, 1fr)); gap: 12px; align-items: center; }
.pathsum .plv { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; }
@media (max-width: 700px) { .pathsum li { grid-template-columns: 1fr; } }

/* Lernprofil: Rang-Abzeichen nach Note (6 rot → 1 gold) */
:root { --g6: #c03939; --g5: #d4652a; --g4: #b8901a; --g3: #5a9a2a; --g2: #1d8048; --g1: #c9a227; }
.rbadge { --c: var(--g6); position: relative; display: inline-grid; place-items: center; width: 44px; height: 50px; flex-shrink: 0; vertical-align: middle;
  clip-path: polygon(50% 0, 100% 22%, 100% 72%, 50% 100%, 0 72%, 0 22%); background: linear-gradient(160deg, color-mix(in srgb, var(--c) 75%, white), var(--c)); color: #fff; }
.rbadge .rn { font-weight: 800; font-size: 1.35rem; line-height: 1; margin-top: -4px; }
.rbadge .rr { position: absolute; bottom: 7px; font-size: 0.55rem; font-weight: 700; letter-spacing: 0.06em; opacity: 0.9; }
.rbadge.xl { width: 92px; height: 104px; } .rbadge.xl .rn { font-size: 2.8rem; } .rbadge.xl .rr { font-size: 0.8rem; bottom: 14px; }
.rbadge.lg { width: 60px; height: 68px; } .rbadge.lg .rn { font-size: 1.8rem; } .rbadge.lg .rr { bottom: 9px; }
.rbadge.sm { width: 34px; height: 38px; } .rbadge.sm .rn { font-size: 1.05rem; } .rbadge.sm .rr { display: none; }
.rbadge.xs { width: 22px; height: 25px; } .rbadge.xs .rn { font-size: 0.75rem; margin-top: 0; } .rbadge.xs .rr { display: none; }
.g6 { --c: var(--g6); } .g5 { --c: var(--g5); } .g4 { --c: var(--g4); } .g3 { --c: var(--g3); } .g2 { --c: var(--g2); }
.g1 { --c: var(--g1); }
.rbadge.g1 { background: linear-gradient(160deg, #fff3b0, #e0b532 45%, #a87d0e); color: #3b2a00; box-shadow: 0 0 12px rgba(224, 181, 50, 0.5); }
.rhero { display: flex; gap: 20px; align-items: center; }
.rhero .rinfo { flex: 1; min-width: 0; display: grid; gap: 4px; }
.rtitle { font-size: 1.35rem; font-weight: 750; color: var(--c); } .rtitle.sm { font-size: 1.05rem; }
.rprog .bar span { background: var(--c); }
.profilecard { border-left: 4px solid var(--accent); }
.rparts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.rpart { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); }
.rpart:hover { background: var(--surface-2); text-decoration: none; }
.rpartcard { display: flex; gap: 14px; align-items: center; }
.rpartcard > div { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ladder { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ladder li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--border); opacity: 0.6; }
.ladder li.done { opacity: 0.85; }
.ladder li.cur { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.rankchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); color: var(--text); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.rankchip:hover { text-decoration: none; background: var(--surface-2); }
.rankchip .rcn { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; font-size: 0.8rem; }
.rankchip.g1 .rcn { background: linear-gradient(160deg, #fff3b0, #e0b532 45%, #a87d0e); color: #3b2a00; }
.mlist li .rbadge { margin-right: 2px; }
@media (max-width: 700px) { .rankchip .rct { display: none; } .rhero { flex-direction: column; align-items: flex-start; } }

/* Beiblatt (SQL-Anlage) */
.bbtab { position: fixed; right: 0; top: 42%; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 1px solid var(--accent); border-right: 0; border-radius: 10px 0 0 10px;
  background: var(--accent); color: var(--on-accent); font: inherit; font-size: 0.78rem; font-weight: 650; cursor: pointer; box-shadow: var(--shadow); writing-mode: vertical-rl; }
.bbtab svg { writing-mode: horizontal-tb; }
.bbtab kbd { writing-mode: horizontal-tb; background: rgba(255,255,255,0.2); color: inherit; border-color: transparent; }
.bbtab:hover { background: var(--accent-strong); }
.bbtab.active { opacity: 0; pointer-events: none; }
.bbscrim { position: fixed; inset: 0; z-index: 70; background: rgba(10, 15, 25, 0.25); opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.bbscrim.open { opacity: 1; pointer-events: auto; }
.beiblatt { position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; width: min(760px, 62vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18); transform: translateX(102%); transition: transform 0.18s ease-out; }
.beiblatt.open { transform: none; }
.bbhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.bbbody { overflow: auto; padding: 12px 16px 40px; }
.bbnav { display: flex; flex-wrap: wrap; gap: 6px; position: sticky; top: -12px; padding: 8px 0; background: var(--surface); z-index: 1; }
.bbnav a { font-size: 0.8rem; padding: 3px 10px; border: 1px solid var(--border); border-radius: 99px; color: var(--text); font-family: var(--mono); }
.bbnav a:hover { border-color: var(--accent); text-decoration: none; }
.bbtable { margin: 14px 0 22px; scroll-margin-top: 44px; }
.bbtable h3 { margin: 0 0 6px; font-family: var(--mono); font-size: 0.98rem; }
.bbstruct { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--mono); font-size: 0.8rem; margin-bottom: 8px; }
.bbtable table.data { font-size: 0.8rem; }
@media (max-width: 760px) { .beiblatt { width: 100vw; } .bbtab { top: auto; bottom: 90px; } }
@media print { .bbtab, .beiblatt, .bbscrim { display: none !important; } }

/* Teilpunkte-Raster */
.rubric { margin: 10px 0; }
.rubrictab td.sym { width: 24px; font-weight: 700; text-align: center; }
.rubrictab tr.ok td.sym { color: var(--good); } .rubrictab tr.part td.sym { color: var(--mid); } .rubrictab tr.miss td.sym { color: var(--bad); }
.rubricself { display: grid; gap: 8px; margin: 8px 0; padding: 10px; border: 1px dashed var(--border); border-radius: 8px; }
.bbtab2 { top: calc(42% + 150px); background: var(--surface); color: var(--accent); }
.bbtab2:hover { background: var(--surface-2); }
.bbtab2 kbd { background: var(--accent-weak); }
.bbhead .seg kbd { font-size: 0.7rem; margin-left: 4px; }
.bbsearch { width: 100%; margin: 4px 0 6px; }
.bbref h3 { font-family: var(--font); }
.bbref pre { font-size: 0.8rem; }
.bbref table.list td:first-child { white-space: nowrap; }
@media (max-width: 760px) { .bbtab2 { bottom: 20px; top: auto; } }
/* Original-Belegsatz (PDF) */
.bbtab3 { top: calc(42% - 150px); background: var(--surface); color: var(--accent); }
.bbtab3:hover { background: var(--surface-2); }
.bbtab3 kbd { background: var(--accent-weak); }
.beiblatt.wide { width: min(980px, 78vw); }
.bbpdfbar { margin: 0 0 8px; }
.bbpage { display: block; width: 100%; height: auto; margin: 0 0 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
@media (max-width: 760px) {
  .beiblatt.wide { width: 100vw; }
  .bbtab span { display: none; }
  .bbtab { bottom: 100px; } .bbtab2 { bottom: 20px; } .bbtab3 { top: auto; bottom: 180px; }
}
/* Hinweis Online-Version */
.onlinehint { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: var(--accent-weak); color: var(--text); font-size: 0.88rem; border-bottom: 1px solid var(--border); }
