/* ============ Design-Tokens ============ */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-ink: #3730a3;
  --ok: #059669; --ok-soft: #ecfdf5;
  --bad: #dc2626; --bad-soft: #fef2f2;
  --warn: #b45309; --warn-soft: #fffbeb;
  --info: #0369a1; --info-soft: #f0f9ff;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 272px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --ico-l: 94%; --ico-s: 80%; --ico-ink-l: 38%;
}
[data-bs-theme="dark"] {
  --bg: #0e1015;
  --surface: #161920;
  --surface-2: #1d2129;
  --border: #272b35;
  --text: #e8eaef;
  --muted: #9aa1ad;
  --accent: #818cf8;
  --accent-soft: #23264a;
  --accent-ink: #c7d2fe;
  --ok: #34d399; --ok-soft: #0f2a22;
  --bad: #f87171; --bad-soft: #2d1515;
  --warn: #fbbf24; --warn-soft: #2b2210;
  --info: #7dd3fc; --info-soft: #0c2230;
  --shadow: none;
  --ico-l: 20%; --ico-s: 45%; --ico-ink-l: 78%;
}
:root, [data-bs-theme] {
  --bs-body-font-family: var(--font);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--muted);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color-rgb: 55, 48, 163;
  --bs-font-monospace: var(--mono);
}
[data-bs-theme="dark"] { --bs-link-color-rgb: 129, 140, 248; --bs-link-hover-color-rgb: 199, 210, 254; }

html { scroll-padding-top: 76px; }
body { background: var(--bg); color: var(--text); font-size: 15.5px; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, kbd, pre { font-family: var(--mono); }
::selection { background: var(--accent-soft); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.text-muted, .muted { color: var(--muted) !important; }
.fw-semi { font-weight: 600; }
.small-caps { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--muted); }

/* ============ Layout ============ */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); }
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.sidebar .offcanvas-body { display: block; padding: 0; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1040px; margin: 0 auto; padding: 28px 28px 80px; }
@media (max-width: 575.98px) { .content { padding: 18px 16px 72px; } }

.topbar { position: sticky; top: 0; z-index: 1020; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 10px 28px; display: flex; gap: 10px; align-items: center; }
@media (max-width: 575.98px) { .topbar-inner { padding: 10px 16px; } }
.search-trigger { flex: 1 1 auto; max-width: 460px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; color: var(--muted); font-size: 14px; cursor: text; text-align: left; }
.search-trigger:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.search-trigger kbd { margin-left: auto; font-size: 11px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }
.icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 17px; }
.icon-btn:hover { background: var(--surface-2); }

/* Sidebar */
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 18px; }
.brand-title { font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav-group { padding: 6px 10px; }
.nav-group + .nav-group { border-top: 1px solid var(--border); }
.nav-group .small-caps { padding: 8px 8px 4px; display: block; }
.nav-link-x { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; color: var(--text); font-size: 14px; line-height: 1.25; }
.nav-link-x:hover { background: var(--surface-2); text-decoration: none; }
.nav-link-x.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-link-x .bi { font-size: 15px; opacity: .85; flex: 0 0 auto; }
.nav-link-x .lf-no { flex: 0 0 34px; font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-link-x.active .lf-no { color: var(--accent-ink); }
.nav-link-x .nav-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link-x .nav-pct { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ============ Bausteine ============ */
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.tile-pad { padding: 20px; }
@media (max-width: 575.98px) { .tile-pad { padding: 16px; } }
a.tile, .tile.clickable { color: inherit; display: block; transition: border-color .15s, transform .15s; }
a.tile:hover, .tile.clickable:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: clamp(24px, 3.2vw, 32px); font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; text-wrap: balance; }
.page-head .lead { color: var(--muted); font-size: 16px; margin: 0; max-width: 70ch; }
.section-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 34px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .bi { color: var(--accent); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }

.mod-ico { --h: 230; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
  background: hsl(var(--h) var(--ico-s) var(--ico-l)); color: hsl(var(--h) 60% var(--ico-ink-l)); }
.mod-ico.lg { width: 56px; height: 56px; flex-basis: 56px; font-size: 26px; border-radius: 16px; }
.mod-ico.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 15px; border-radius: 9px; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.chip.ap1 { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.ap2 { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.chip.hot { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge-soft { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }

.progress-thin { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-thin > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.progress-thin.ok > span { background: var(--ok); }

.ring { --p: 0; --size: 84px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); flex: 0 0 auto; }
.ring::before { content: attr(data-label); width: calc(var(--size) - 16px); height: calc(var(--size) - 16px); border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.ring.sm { --size: 52px; }
.ring.sm::before { font-size: 12px; width: calc(var(--size) - 10px); height: calc(var(--size) - 10px); }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .l { font-size: 12.5px; color: var(--muted); }

.btn { border-radius: 10px; font-weight: 600; font-size: 14px; padding: 8px 14px; display: inline-flex; align-items: center; gap: 7px; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-accent { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
[data-bs-theme="dark"] .btn-accent { color: #0e1015; }
.btn-accent:hover { filter: brightness(1.08); color: #fff; }
[data-bs-theme="dark"] .btn-accent:hover { color: #0e1015; }
.btn-soft { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-soft:hover { background: var(--border); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid transparent; }
.btn-bad { background: var(--bad-soft); color: var(--bad); border: 1px solid transparent; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
[data-bs-theme="dark"] .tabs a.active { color: var(--accent); }
.tabs .cnt { font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); padding: 1px 6px; border-radius: 99px; }

/* Grids */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }

.mod-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; height: 100%; }
.mod-card .t { font-weight: 600; font-size: 15px; line-height: 1.3; text-wrap: balance; }
.mod-card .k { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.mod-card .foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.mod-card .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.mod-card.pending { opacity: .6; }

/* Listen */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); color: inherit; }
.list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-row .grow { flex: 1 1 auto; min-width: 0; }
.list-row .ttl { font-weight: 600; }
.list-row .sub { font-size: 13px; color: var(--muted); }
.num-badge { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.num-badge.done { background: var(--ok-soft); color: var(--ok); }

/* Termine */
.date-box { width: 48px; flex: 0 0 48px; text-align: center; border-radius: 10px; background: var(--surface-2); padding: 5px 0; line-height: 1.1; }
.date-box .d { font-weight: 700; font-size: 17px; }
.date-box .m { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* ============ Lernzettel (Prosa) ============ */
.prose { line-height: 1.7; font-size: 15.5px; }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 4px; }
.prose li > ul, .prose li > ol { margin-top: 4px; margin-bottom: 4px; }
.prose h5 { font-size: 17px; font-weight: 700; margin: 26px 0 10px; letter-spacing: -.01em; }
.prose h6 { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
.prose code { background: var(--surface-2); color: var(--text); padding: 1px 5px; border-radius: 5px; font-size: .88em; }
.prose pre { background: var(--surface-2); border: 1px solid var(--border); padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.55; overflow-x: auto; margin: 0 0 14px; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose pre.ascii { line-height: 1.35; }
.prose kbd { font-size: .82em; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom-width: 2px; }
.prose .table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.prose th, .prose td { padding: 8px 12px; border-top: 1px solid var(--border); vertical-align: top; text-align: left; }
.prose thead th { background: var(--surface-2); font-weight: 600; border-top: 0; white-space: nowrap; }
.prose tbody tr:first-child td { border-top: 0; }
.prose thead + tbody tr:first-child td { border-top: 1px solid var(--border); }
.prose .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 767.98px) { .prose .grid-2 { grid-template-columns: 1fr; } }
.prose .grid-2 > * { margin-bottom: 0; }

.callout { --c: var(--accent-ink); --b: var(--accent-soft); background: var(--b); color: var(--text); border-radius: var(--radius-sm); padding: 12px 14px 12px 44px; margin: 0 0 14px; position: relative; }
.callout > .callout-ico { position: absolute; left: 14px; top: 12px; font-size: 17px; line-height: 1; color: var(--c); }
.callout > *:last-child { margin-bottom: 0; }
.callout > .callout-ico + strong, .callout > .callout-ico + p > strong:first-child { color: var(--c); }
.callout.merke { --c: var(--accent-ink); --b: var(--accent-soft); }
.callout.tipp { --c: var(--ok); --b: var(--ok-soft); }
.callout.achtung { --c: var(--bad); --b: var(--bad-soft); }
.callout.beispiel { --c: var(--info); --b: var(--info-soft); }
.callout.formel { --c: var(--text); --b: var(--surface-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 14px; }
.callout.pruefung { --c: var(--warn); --b: var(--warn-soft); }
[data-bs-theme="dark"] .callout.merke > .callout-ico + strong { color: var(--accent); }

/* Topic-Navigation */
.topic-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.topic-nav a { padding: 14px 16px; }
.topic-nav .dir { font-size: 12px; color: var(--muted); }

/* ============ Checkliste ============ */
.check-list { display: flex; flex-direction: column; }
.check-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 16px; border-top: 1px solid var(--border); cursor: pointer; margin: 0; }
.check-item:first-child { border-top: 0; }
.check-item:hover { background: var(--surface-2); }
.check-item input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; flex: 0 0 20px; border: 2px solid var(--border); border-radius: 6px; margin-top: 2px; display: grid; place-items: center; cursor: pointer; background: var(--surface); transition: .12s; }
.check-item input:checked { background: var(--ok); border-color: var(--ok); }
.check-item input:checked::after { content: ""; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
[data-bs-theme="dark"] .check-item input:checked::after { border-color: #0e1015; }
.check-item .txt { flex: 1 1 auto; }
.check-item input:checked + .txt { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.check-item .aside { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.check-item .aside a { font-size: 12.5px; }
.area-head { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.area-head .ttl { font-weight: 700; }

/* ============ Übungen ============ */
.exercise { padding: 18px 20px; }
.exercise + .exercise { margin-top: 12px; }
.exercise .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.exercise .head .ttl { font-weight: 700; font-size: 16px; }
.lvl { display: inline-flex; gap: 3px; }
.lvl i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); display: inline-block; }
.lvl i.on { background: var(--warn); }
.solution { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 14px; }
.solution .small-caps { color: var(--ok); display: block; margin-bottom: 6px; }

/* ============ Quiz ============ */
.quiz-wrap { max-width: 760px; }
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.quiz-top .progress-thin { flex: 1 1 auto; }
.quiz-q { font-size: 18px; font-weight: 600; line-height: 1.45; margin-bottom: 16px; text-wrap: pretty; }
.quiz-q code { font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.quiz-q table { font-size: 14px; font-weight: 400; margin-top: 8px; }
.quiz-q table td, .quiz-q table th { border: 1px solid var(--border); padding: 4px 8px; }
.opt { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; color: var(--text); font-size: 15px; transition: border-color .12s, background .12s; }
.opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.opt .key { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .key { background: var(--accent); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .key { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .key { background: var(--bad); color: #fff; }
.opt:disabled { cursor: default; opacity: 1; }
.feedback { border-radius: 12px; padding: 14px 16px; margin-top: 12px; }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--bad-soft); }
.feedback .h { font-weight: 700; display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.feedback.ok .h { color: var(--ok); }
.feedback.bad .h { color: var(--bad); }
.quiz-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.timer.low { color: var(--bad); }
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-chips input { display: none; }
.pick-chips label { cursor: pointer; font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); user-select: none; }
.pick-chips input:checked + label { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg input { display: none; }
.seg label { cursor: pointer; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px; color: var(--muted); }
.seg input:checked + label { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
[data-bs-theme="dark"] .seg input:checked + label { background: var(--border); }

/* ============ Karteikarten ============ */
.fc-stage { perspective: 1400px; max-width: 640px; margin: 0 auto; }
.fc { position: relative; height: 300px; cursor: pointer; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2, .7, .2, 1); }
.fc.flipped { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; overflow-y: auto; }
.fc-face .txt { font-size: 20px; font-weight: 600; line-height: 1.45; text-wrap: balance; }
.fc-back .txt { font-size: 17px; font-weight: 500; }
.fc-back { transform: rotateY(180deg); }
.fc-face .hint { position: absolute; bottom: 12px; font-size: 12px; color: var(--muted); }
.fc-face .corner { position: absolute; top: 12px; left: 14px; }
@media (max-width: 575.98px) { .fc { height: 340px; } .fc-face .txt { font-size: 18px; } }
.fc-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.boxes { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.boxes span { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-weight: 600; }

/* ============ Suche ============ */
.search-modal .modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.search-modal input { border: 0; font-size: 17px; padding: 16px 18px 16px 48px; background: transparent; color: var(--text); width: 100%; outline: none; }
.search-modal .in-wrap { position: relative; border-bottom: 1px solid var(--border); }
.search-modal .in-wrap .bi { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 17px; }
.search-results { max-height: 60vh; overflow-y: auto; padding: 6px; }
.sr { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.sr:hover, .sr.focus { background: var(--surface-2); text-decoration: none; }
.sr .bi { color: var(--muted); margin-top: 3px; }
.sr .ttl { font-weight: 600; font-size: 14.5px; }
.sr .sub { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr mark { background: var(--warn-soft); color: inherit; padding: 0 1px; border-radius: 3px; }

/* ============ Tools ============ */
.tool-root .form-control, .tool-root .form-select, .form-control, .form-select { background-color: var(--surface); border-color: var(--border); color: var(--text); border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background-color: var(--surface); color: var(--text); }
.tool-root .mono, .mono { font-family: var(--mono); }
.result-box { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-family: var(--mono); }
.bits { font-family: var(--mono); letter-spacing: .02em; word-break: break-all; }
.bits .n { color: var(--accent); font-weight: 600; }
.bits .h { color: var(--ok); font-weight: 600; }

/* ============ Probeklausur ============ */
.task-card { padding: 20px; }
.task-card + .task-card { margin-top: 14px; }
.task-part { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.task-part textarea { font-size: 14px; min-height: 70px; }
.pts { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sticky-bar { position: sticky; top: 64px; z-index: 5; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); padding: 10px 0; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ============ Diverses ============ */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .bi { font-size: 36px; display: block; margin-bottom: 10px; opacity: .6; }
.hero { padding: 26px; display: flex; gap: 22px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); }
.hero h1 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 750; letter-spacing: -.025em; margin: 0 0 6px; }
.hero p { color: var(--muted); margin: 0 0 14px; max-width: 56ch; }
.qod .opt { font-size: 14px; padding: 9px 12px; }
.letter-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.letter-nav a { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text); }
.letter-nav a:hover { text-decoration: none; border-color: var(--accent); }
.gloss dt { font-weight: 700; margin-top: 12px; }
.gloss dd { margin: 2px 0 0; color: var(--text); }
.gloss .src { font-size: 12px; color: var(--muted); }
.toast-lite { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; opacity: 0; transition: .2s; z-index: 2000; pointer-events: none; }
.toast-lite.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.footer { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between; }
.offcanvas-backdrop { z-index: 1040; }
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { --bs-offcanvas-width: 300px; background: var(--surface); } }

/* ============ Druck ============ */
@media print {
  .sidebar, .topbar, .no-print, .tabs, .footer { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .content { max-width: none; padding: 0; }
  .tile { border: 0; box-shadow: none; }
  .solution { display: block !important; }
  .print-break { page-break-before: always; }
  .callout { border: 1px solid #ccc; }
  a { color: #000; }
}
