/* AP1 Trainer – Stylesheet (no external dependencies) */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --text: #1b2333;
  --muted: #5d6882;
  --border: #dde3ee;
  --accent: #2f5bea;
  --accent-2: #f08a24;
  --accent-soft: #e6ecfe;
  --good: #1f9d63;
  --good-soft: #e2f6ec;
  --mid: #8a6100;
  --mid-soft: #fdf3dc;
  --bad: #c53a3a;
  --on-accent: #fff;
  --on-bad: #fff;
  --bad-soft: #fde8e8;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 16px rgba(20, 30, 60, .06);
  --radius: 14px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hm-0: #e8ecf4;
  --hm-1: #bfd0fb;
  --hm-2: #7f9ef3;
  --hm-3: #4a74ec;
  --hm-4: #1f45c4;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1422;
    --surface: #171e30;
    --surface-2: #1e2740;
    --text: #e6eaf3;
    --muted: #97a2bd;
    --border: #2a3450;
    --accent: #7b9bff;
    --accent-2: #ffa24d;
    --accent-soft: #22305a;
    --good: #4cc98b;
    --good-soft: #173628;
    --mid: #f0bb3c;
    --mid-soft: #3a3016;
    --bad: #ff7b7b;
    --bad-soft: #3f1d22;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --hm-0: #222b42;
    --hm-1: #2c417e;
    --hm-2: #3b5bc0;
    --hm-3: #5d80f0;
    --hm-4: #9db4ff;
    --on-accent: #0f1422;
    --on-bad: #0f1422;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .9em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; overflow-x: auto; }
pre code { background: none; padding: 0; }
img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pre-line { white-space: pre-line; }
.inline { display: inline; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .3rem 0; border-bottom: 1px solid var(--border); }
.plain li:last-child { border-bottom: 0; }
.ok { color: var(--good); }
.warn-text { color: var(--mid); font-weight: 600; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: .25rem; }

/* ---------- Layout ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--text); font-size: 1.05rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: .2rem; flex: 1; }
.nav > a, .nav-user > a { color: var(--muted); padding: .45rem .7rem; border-radius: 8px; font-weight: 500; }
.nav > a:hover, .nav-user > a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: .3rem; }
.nav-user > a { display: flex; align-items: center; gap: .45rem; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; font-size: .85rem; font-weight: 700; }
.btn-link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: .45rem .5rem; border-radius: 8px; }
.btn-link:hover { color: var(--bad); background: var(--surface-2); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 8px; width: 42px; height: 38px; cursor: pointer; }
.burger, .burger::before, .burger::after { display: block; width: 18px; height: 2px; background: var(--text); margin: 0 auto; position: relative; content: ""; }
.burger::before { position: absolute; top: -6px; }
.burger::after { position: absolute; top: 6px; }

.main { max-width: 1180px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }
.main-bare { width: 100%; flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 1.5rem 1rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.2rem 1rem 2rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-head p { max-width: 70ch; }
.grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.grid > .card { margin-bottom: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.35rem; margin-bottom: 1rem; min-width: 0; }
.card.narrow { max-width: 560px; margin: 2rem auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1.05rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.btn-danger:hover { background: var(--bad); filter: brightness(1.08); }
.btn-small { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-large { padding: .85rem 1.6rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.form-actions.center { justify-content: center; }

label { display: block; font-weight: 600; margin: .8rem 0 .3rem; font-size: .92rem; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit;
}
textarea { resize: vertical; min-height: 6rem; line-height: 1.5; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px; border-color: var(--accent); }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 500; }
label.check input { margin-top: .3rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: .4rem; }

.alert { border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.alert .btn-small { margin-left: .4rem; }
.alert-success { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.alert-error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.alert-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.alert-warn { background: var(--mid-soft); border-color: color-mix(in srgb, var(--mid) 35%, transparent); }

.badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge-warn { background: var(--mid-soft); color: var(--mid); border-color: transparent; }
.badge-auto { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.topic { border-color: transparent; }
.topic-projektmanagement { background: #ede7fe; color: #5b3cc4; }
.topic-wirtschaft { background: #fdf0dc; color: #9a5a00; }
.topic-hardware { background: #e3f1fb; color: #1d6a9e; }
.topic-netzwerk { background: #e0f4f1; color: #117264; }
.topic-sicherheit { background: #fde6e6; color: #b42f2f; }
.topic-datenschutz { background: #f5e7f7; color: #8b2f95; }
.topic-programmierung { background: #e7ecfe; color: #3148b8; }
.topic-datenbanken { background: #eaf6e0; color: #467a1e; }
.topic-qualitaet { background: #fff4d6; color: #8a6400; }
.topic-kommunikation { background: #ffe9dd; color: #b04e12; }
.topic-support { background: #e4f3fb; color: #1e6d8c; }
.topic-berechnungen { background: #eceff4; color: #3f4a60; }
.topic-systeme { background: #e9e8fb; color: #4b43a8; }
@media (prefers-color-scheme: dark) {
  .topic { background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--border) !important; }
}

.chip { display: inline-block; font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin: 0 .3rem .35rem 0; border: 1px solid var(--border); }
.chip-ok { background: var(--good-soft); color: var(--good); border-color: transparent; }

.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; min-width: 2px; }
.bar-small { height: 8px; flex: 1; min-width: 60px; }
.bar-large { height: 14px; margin: .4rem 0 .6rem; }
.bar-bad > span { background: var(--bad); }
.bar-mid > span { background: var(--mid); }
.progress-label { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin: .8rem 0 .3rem; }

.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.good { color: var(--good); }
.score.mid { color: var(--mid); }
.score.bad { color: var(--bad); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table th.num, .table td.num { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
.bar-cell { display: flex; align-items: center; gap: .5rem; min-width: 140px; }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 980px; width: 100%; margin: 0 auto; display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: center; }
.auth-hero h1 { font-size: 2.1rem; margin-top: .6rem; }
.auth-hero p { color: var(--muted); font-size: 1.05rem; }
.auth-card { padding: 1.8rem; }
.auth-card .btn-block { margin-top: 1.2rem; margin-bottom: .8rem; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: .3rem 0 .3rem 1.8rem; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 0; top: .25rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--good-soft); color: var(--good); display: grid; place-items: center; font-size: .8rem; font-weight: 700; }

/* ---------- Dashboard ---------- */
.countdown { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem 1rem; display: flex; align-items: baseline; gap: .5rem; box-shadow: var(--shadow); color: var(--text); }
.countdown strong { font-size: 1.8rem; color: var(--accent); line-height: 1; }
.countdown-empty { color: var(--accent); font-weight: 600; }
.daily { display: flex; gap: 1.4rem; align-items: center; }
.daily.is-done { background: linear-gradient(135deg, var(--good-soft), var(--surface) 60%); }
.daily-ring { flex: 0 0 132px; }
.daily-body { flex: 1; min-width: 0; }
.daily-task { background: var(--surface-2); border-radius: 12px; padding: .9rem 1rem; margin-top: .6rem; }
.daily-title { font-weight: 700; font-size: 1.08rem; margin-bottom: .35rem; }
.daily-task .actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.meta { display: flex; flex-wrap: wrap; gap: .45rem .7rem; align-items: center; color: var(--muted); font-size: .85rem; }
.ring { width: 100%; height: auto; }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray .6s; }
.ring-done { stroke: var(--good); }
.ring-text { font-size: 20px; font-weight: 800; fill: var(--text); }
.ring-sub { font-size: 10px; fill: var(--muted); }
.streak { text-align: center; }
.streak.at-risk { border-color: color-mix(in srgb, var(--mid) 50%, var(--border)); }
.streak-num { font-size: 3rem; font-weight: 800; line-height: 1.1; }
.flame { font-size: 2.2rem; margin-right: .2rem; }
.streak-label { color: var(--muted); font-weight: 600; margin-bottom: .6rem; }
.week-strip { display: flex; justify-content: center; gap: .4rem; margin: .8rem 0 .5rem; }
.wk { display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: .7rem; color: var(--muted); }
.wk i { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: block; }
.wk.on i { background: var(--accent-2); border-color: var(--accent-2); }
.wk.today span { color: var(--text); font-weight: 700; }
.tiles .tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; color: var(--text); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.tiles .tile:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.tile-icon { font-size: 1.5rem; margin-bottom: .2rem; }
.tile .muted { font-size: .85rem; }
.tile-accent { background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%) !important; }
.kpis { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.kpi { flex: 1; min-width: 110px; background: var(--surface-2); border-radius: 12px; padding: .7rem .8rem; display: flex; flex-direction: column; }
.kpi-value { font-size: 1.45rem; font-weight: 800; line-height: 1.2; }
.kpi-value small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.kpi-label { color: var(--muted); font-size: .8rem; }
.kpi-card { display: flex; flex-direction: column; }
.topic-list { list-style: none; padding: 0; margin: 0; }
.topic-list li { display: flex; align-items: center; gap: .7rem; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.topic-list li:last-child { border-bottom: 0; }
.topic-list li > a { flex: 0 0 45%; font-weight: 500; }

/* ---------- Task ---------- */
.crumbs { font-size: .85rem; color: var(--muted); display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.task-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.task-head h1 { margin-bottom: .35rem; }
.difficulty { display: inline-flex; gap: 3px; }
.difficulty i { width: 8px; height: 14px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--border); display: block; }
.difficulty i.on { background: var(--accent-2); border-color: var(--accent-2); }
.parts { display: flex; gap: .3rem; flex-wrap: wrap; }
.part { min-width: 2.2rem; height: 2.2rem; padding: 0 .4rem; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; font-size: .85rem; }
.part:hover { text-decoration: none; border-color: var(--accent); }
.part.current { outline: 2px solid var(--accent); }
.part.good { background: var(--good-soft); color: var(--good); }
.part.mid { background: var(--mid-soft); color: var(--mid); }
.part.bad { background: var(--bad-soft); color: var(--bad); }
.task-card { padding: 1.4rem 1.5rem; }
.scenario { background: var(--surface-2); border-radius: 10px; padding: .6rem .9rem; margin-bottom: 1rem; }
.scenario summary, .task-recap summary { cursor: pointer; font-weight: 600; }
.scenario[open] summary { margin-bottom: .5rem; }
.intro { border-left: 4px solid var(--accent); padding: .2rem 0 .2rem 1rem; margin-bottom: 1rem; }
.context { margin-bottom: 1rem; }
.question { background: var(--accent-soft); border-radius: 12px; padding: 1rem 1.1rem .4rem; margin-bottom: 1rem; }
.question-head { display: flex; justify-content: space-between; margin-bottom: .3rem; }
.part-label { font-weight: 800; color: var(--accent); }
.points-tag { font-size: .8rem; font-weight: 700; color: var(--accent); background: var(--surface); padding: .1rem .55rem; border-radius: 999px; }
.task-recap { padding-top: .9rem; padding-bottom: .9rem; }
.task-recap[open] summary { margin-bottom: 1rem; }
.answer-inputs { margin-top: .5rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .2rem 1rem; margin-bottom: .6rem; }
.field label { font-weight: 500; }
.input-unit { display: flex; align-items: center; gap: .4rem; }
.input-unit .unit { color: var(--muted); font-weight: 600; white-space: nowrap; }
.choices .choice { display: flex; gap: .7rem; align-items: flex-start; font-weight: 500; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px; margin: .4rem 0; cursor: pointer; background: var(--surface); }
.choices .choice:hover { border-color: var(--accent); }
.choices .choice input { margin-top: .3rem; }

/* Markdown content */
.md { overflow-wrap: break-word; }
.md > :last-child { margin-bottom: 0; }
.md ul, .md ol { padding-left: 1.4rem; margin: 0 0 .9em; }
.md li { margin: .15rem 0; }
.md blockquote { margin: 0 0 .9em; padding: .4rem 1rem; border-left: 4px solid var(--border); color: var(--muted); }
.md h3, .md h4, .md h5, .md h6 { margin-top: 1rem; }
.md-table { border-collapse: collapse; margin: 0 0 1em; font-size: .92rem; background: var(--surface); }
.md-table th, .md-table td { border: 1px solid var(--border); padding: .4rem .6rem; vertical-align: top; }
.md-table th { background: var(--surface-2); font-weight: 600; }
.md-img { display: block; margin: .6rem 0 1rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; max-height: 80vh; object-fit: contain; }

/* Review */
.review .card { margin-bottom: 0; }
.answer-text { white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; font-size: .95rem; overflow-wrap: anywhere; }
.keywords { margin-top: .8rem; }
.solution-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.solution-head h3 { margin: 0; font-size: 1.2rem; }
.check-table tr.correct td:nth-child(2) { color: var(--good); font-weight: 600; }
.check-table tr.wrong td:nth-child(2) { color: var(--bad); font-weight: 600; }
.choice-review { list-style: none; padding: 0; margin: 0 0 1rem; }
.choice-review li { display: flex; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 10px; margin-bottom: .35rem; }
.choice-review li.correct { border-color: var(--good); background: var(--good-soft); }
.choice-review li.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice-review .mark { width: 1.2rem; font-weight: 800; }
.rating .auto-result { background: var(--accent-soft); border-radius: 10px; padding: .6rem .9rem; }
.quick-scores { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; margin: .8rem 0; }
.quick-scores.compact { display: flex; margin: 0; gap: .3rem; }
.btn-score { flex-direction: column; gap: .1rem; padding: .55rem .4rem; }
.btn-score strong { font-size: 1.15rem; }
.btn-score span { font-size: .75rem; color: var(--muted); font-weight: 500; }
.btn-score.selected, .quick-scores .btn.selected { border-color: var(--accent); background: var(--accent-soft); }
.score-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-top: .6rem; }
.score-row label { margin: 0; }
.score-row input[type=number] { width: 7rem; }
.rating.done h2 { margin-bottom: 0; }

/* Catalog */
.filters { display: flex; flex-wrap: wrap; gap: .2rem 1rem; align-items: flex-end; }
.filter { flex: 1 1 170px; }
.filter-grow { flex: 2 1 220px; }
.filter-actions { flex: 0 0 auto; display: flex; gap: .4rem; padding-bottom: .05rem; }
.exam-block-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.aufgabe-title { margin-top: 1.1rem; font-size: 1rem; color: var(--muted); }
.task-list { list-style: none; padding: 0; margin: 0; }
.task-row { display: flex; align-items: center; gap: .7rem; padding: .5rem .2rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.task-row:last-child { border-bottom: 0; }
.task-row-title { flex: 1 1 260px; color: var(--text); font-weight: 500; }
.task-row-meta { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.pts { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3rem; text-align: right; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; border: 2px solid var(--border); }
.status-dot.good { background: var(--good); border-color: var(--good); }
.status-dot.mid { background: var(--mid); border-color: var(--mid); }
.status-dot.bad { background: var(--bad); border-color: var(--bad); }

/* Mock exams */
.mode-card { display: flex; flex-direction: column; }
.mode-card p { color: var(--muted); flex: 1; }
.mode-card.featured { border-color: var(--accent); }
.mode-card .btn-block { margin-top: 1rem; }
.grade { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 8px; font-weight: 800; color: #fff; margin-right: .3rem; }
.grade-1, .grade-bg-1 { background: #16a36a; }
.grade-2, .grade-bg-2 { background: #5cae2e; }
.grade-3, .grade-bg-3 { background: #c9a200; }
.grade-4, .grade-bg-4 { background: #e07b1b; }
.grade-5, .grade-bg-5 { background: #c53a3a; }
.grade-6, .grade-bg-6 { background: #9c2b2b; }
.grade-key td { padding: .45rem .5rem; }
.exam-mode .topbar { position: static; }
html:has(body.exam-mode) { scroll-padding-top: calc(var(--exam-bar-h, 80px) + .75rem); }
.exam-bar { position: sticky; top: 0; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; overflow: hidden; }
.exam-bar-inner { display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; flex-wrap: wrap; }
.exam-bar-title { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.timer { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.warn { color: var(--mid); }
.timer.critical { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.exam-bar-actions { display: flex; align-items: center; gap: .7rem; }
.timer-progress { height: 4px; background: var(--surface-2); }
.timer-progress span { display: block; height: 100%; background: var(--accent); width: 100%; transition: width 1s linear; }
.exam-group-head { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; }
.exam-item { border-top: 1px dashed var(--border); padding-top: 1rem; margin-top: 1rem; }
.grade-item-head { display: flex; justify-content: space-between; gap: .4rem 1rem; align-items: flex-start; flex-wrap: wrap; }
.grade-item .review { margin: 1rem 0 .4rem; }
.grade-footer { position: sticky; bottom: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; z-index: 10; }
.grade-footer strong { font-size: 1.3rem; }
.result-hero { display: flex; gap: 1.5rem; align-items: center; }
.result-hero > div:last-child { flex: 1; min-width: 0; }
.result-grade { flex: 0 0 auto; width: 118px; height: 118px; border-radius: 22px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
/* Grades 1-4 have light backgrounds: dark text for sufficient contrast */
.grade-1, .grade-2, .grade-3, .grade-4,
.result-grade.grade-bg-1, .result-grade.grade-bg-2, .result-grade.grade-bg-3, .result-grade.grade-bg-4 { color: #1b2333; }
.result-grade-num { font-size: 3.4rem; font-weight: 800; line-height: 1; }
.result-grade-label { font-size: .85rem; font-weight: 600; }
.result-points { font-size: 2rem; font-weight: 800; }
.result-points small { font-size: 1rem; color: var(--muted); }
.forecast { display: flex; gap: 1rem; align-items: center; margin-bottom: .6rem; }
.forecast .result-grade { width: 88px; height: 88px; border-radius: 18px; }
.forecast .result-grade-num { font-size: 2.4rem; }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart .gridline { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .cbar { fill: var(--accent); opacity: .85; }
.chart .line { fill: none; stroke: var(--accent-2); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot { fill: var(--accent-2); stroke: var(--surface); stroke-width: 1.5; }
.chart .band { opacity: .13; }
.chart .band-1 { fill: #16a36a; }
.chart .band-2 { fill: #5cae2e; }
.chart .band-3 { fill: #c9a200; }
.chart .band-4 { fill: #e07b1b; }
.chart .band-5 { fill: #d64545; }
.chart .band-6 { fill: #9c2b2b; }
.heatmap-wrap, .chart-scroll { overflow-x: auto; }
.heatmap { min-width: 520px; max-width: 760px; }
.heatmap .axis { font-size: 8px; }
.hm-0 { fill: var(--hm-0); background: var(--hm-0); }
.hm-1 { fill: var(--hm-1); background: var(--hm-1); }
.hm-2 { fill: var(--hm-2); background: var(--hm-2); }
.hm-3 { fill: var(--hm-3); background: var(--hm-3); }
.hm-4 { fill: var(--hm-4); background: var(--hm-4); }
.hm-today { stroke: var(--accent-2); stroke-width: 2; }
.legend { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.lg-bar { background: var(--accent); margin-left: .2rem; }
.lg-line { background: var(--accent-2); height: 3px; width: 16px; margin-left: .8rem; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg a { padding: .3rem .7rem; font-size: .85rem; color: var(--muted); }
.seg a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg a:hover { text-decoration: none; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.danger-zone form .btn { margin-top: .8rem; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .nav-user-name { display: none; }
}
@media (max-width: 860px) {
  .js .nav-toggle { display: block; }
  .topbar-inner { flex-wrap: wrap; }
  .nav { flex-basis: 100%; flex-direction: column; align-items: stretch; padding: .4rem 0; }
  .js .nav { display: none; }
  .js .nav.open { display: flex; }
  .nav-user { margin-left: 0; justify-content: space-between; border-top: 1px solid var(--border); padding-top: .4rem; }
  .nav-user-name { display: inline; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .auth-wrap { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .auth-hero .checklist { display: none; }
}
@media (max-width: 560px) {
  h1 { font-size: 1.4rem; }
  .main { padding: 1rem .75rem 2.5rem; }
  .card { padding: 1rem; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .daily { flex-direction: column; text-align: center; }
  .daily-ring { flex-basis: auto; width: 120px; }
  .daily-task { text-align: left; }
  .quick-scores { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hide-sm { display: none; }
  .result-hero { flex-direction: column; text-align: center; }
  .timer { font-size: 1.3rem; }
  .exam-bar-inner { gap: .5rem .6rem; padding: .5rem .75rem; }
  .exam-bar-title { min-width: 0; flex: 1 1 0; }
  .exam-bar-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .exam-bar-title .small { display: none; }
  .exam-bar-actions { display: contents; }
  .exam-bar .save-state { order: 9; flex-basis: 100%; font-size: .75rem; }
  .exam-bar .save-state:empty { display: none; }
  .exam-bar .btn { padding: .45rem .8rem; }
  .chart-scroll > .chart { min-width: 520px; }
  .chart-scroll .axis { font-size: 13px; }
  .topic-list li > a { flex-basis: 40%; }
}

@media print {
  .topbar, .footer, .form-actions, .exam-bar, .nav-toggle { display: none !important; }
  .card { box-shadow: none; }
}
