:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: #d9e0ea;
  --text: #172033;
  --muted: #5b6678;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --primary-soft: #e3ecff;
  --good: #15803d;
  --good-soft: #dcfce7;
  --mid: #b45309;
  --mid-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --focus: #f59e0b;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 2px 8px rgba(16, 24, 40, 0.05);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --erd-entity: #ffffff;
  --erd-entity-stroke: #2563eb;
  --erd-rel: #fff7e6;
  --erd-rel-stroke: #d97706;
  --erd-line: #64748b;
  --erd-text: #172033;
  --erd-card: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --surface: #171e2d;
    --surface-2: #1f2839;
    --border: #2d384d;
    --text: #e6eaf2;
    --muted: #9aa6ba;
    --primary: #5b8cff;
    --primary-ink: #0b1020;
    --primary-soft: #1e2b4d;
    --good: #4ade80;
    --good-soft: #14321f;
    --mid: #fbbf24;
    --mid-soft: #3a2c0c;
    --bad: #f87171;
    --bad-soft: #3b1515;
    --shadow: none;

    --erd-entity: #1b2436;
    --erd-entity-stroke: #5b8cff;
    --erd-rel: #33280f;
    --erd-rel-stroke: #fbbf24;
    --erd-line: #8391a7;
    --erd-text: #e6eaf2;
    --erd-card: #f87171;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; margin-top: 1.2em; }
p { margin: 0 0 0.8em; }
code, pre { font-family: var(--mono); font-size: 0.9em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* ------------------------------------------------------------ Layout */
.topbar {
  position: sticky; top: 0; z-index: 20;
  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: 10px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: var(--primary-ink); font-size: 18px; }
.topbar-progress { margin-left: auto; width: 220px; }
.menu-btn { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 40px; height: 40px; font-size: 20px; cursor: pointer; }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.sidebar {
  position: sticky; top: 56px; align-self: start;
  height: calc(100vh - 56px); overflow-y: auto;
  padding: 16px 12px; border-right: 1px solid var(--border); background: var(--surface);
}
.nav-group { margin: 16px 8px 6px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-icon { width: 22px; text-align: center; }
.nav-label { flex: 1; }
.nav-badge { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-note, .nav-warning { margin: 16px 8px 0; font-size: 0.8rem; color: var(--muted); }
.nav-warning { color: var(--bad); }

main { padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: 1400px; width: 100%; outline: none; }
main:focus, main:focus-visible { outline: none; }

@media (max-width: 900px) {
  .menu-btn { display: block; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 56px; bottom: 0; width: 280px; z-index: 30;
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow);
  }
  body.menu-open .sidebar { transform: none; }
  .topbar-progress { width: 120px; }
  .brand span:last-child { font-size: 0.95rem; }
  main { padding: 20px 16px 48px; }
}
@media (max-width: 480px) {
  .topbar-progress .progress-text { display: none; }
  .topbar-progress { width: 70px; }
}

/* ------------------------------------------------------------ Bausteine */
.page-head { margin-bottom: 20px; }
.back-link { display: inline-block; margin-bottom: 8px; text-decoration: none; font-size: 0.9rem; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 75ch; }

.box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.box.tip { background: var(--primary-soft); border-color: transparent; }
.box.warn, .hint.warn { background: var(--mid-soft); color: var(--text); }
.box.error { border-color: var(--bad); }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.box-head h2 { margin: 0; }
details.box > summary { cursor: pointer; font-weight: 600; }
.details-body { margin-top: 12px; }
.hint { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); margin: 12px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted);
  cursor: pointer; font: inherit; font-size: 0.85rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--bad); }
.icon-btn.ok { color: var(--good); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.actions .spacer { flex: 1; }

input[type="text"], select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0;
}
input[type="text"]:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 2px solid var(--primary-soft); }
.form-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.add-row input { flex: 1 1 120px; width: 100%; min-width: 0; }
.add-row.small input { padding: 6px 8px; font-size: 0.9rem; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.mid { background: var(--mid-soft); color: var(--mid); }
.pill.low { background: var(--bad-soft); color: var(--bad); }
.chip { display: inline-flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.chip:hover { border-color: var(--primary); }
.chip.small { display: inline-block; padding: 2px 10px; font-size: 0.8rem; border-radius: 999px; background: var(--surface-2); }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.level { display: inline-block; margin-top: 8px; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.level-leicht { background: var(--good-soft); color: var(--good); }
.level-mittel { background: var(--mid-soft); color: var(--mid); }
.level-schwer { background: var(--bad-soft); color: var(--bad); }

.progress { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress:has(.progress-text) { height: 20px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.3s ease; }
.progress-fill.good { background: var(--good); }
.progress-fill.mid { background: var(--mid); }
.progress-fill.low, .progress-fill.none { background: var(--primary); }
.progress-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.75rem; font-weight: 600; color: var(--text); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px;
  transition: all 0.25s ease; z-index: 50; pointer-events: none; max-width: calc(100vw - 32px);
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

.pager { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

/* ------------------------------------------------------------ Dashboard */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; align-items: center; margin-bottom: 28px; }
.hero h1 { font-size: 2rem; }
.hero-progress { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.big-number { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.module-grid, .task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 28px; }
.module-card, .task-card {
  display: flex; gap: 14px; padding: 18px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}
.module-card:hover, .task-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.module-icon { font-size: 1.6rem; width: 40px; text-align: center; }
.module-body { flex: 1; min-width: 0; }
.module-body h3 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.module-body p { font-size: 0.9rem; }
.exam-tag { font-size: 0.7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--bad-soft); color: var(--bad); }
.task-card { flex-direction: column; gap: 4px; }
.task-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.task-card p { font-size: 0.875rem; margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 700px) { .hero { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ Theorie */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); font-size: 0.9rem; }
.tab.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.theory { max-width: 980px; }
.theory .tip { background: var(--primary-soft); padding: 12px 14px; border-radius: 8px; margin: 16px 0; }
.theory li { margin-bottom: 6px; }
table.def, table.grid { border-collapse: collapse; width: 100%; margin: 12px 0 16px; }
table.def th { text-align: left; vertical-align: top; width: 210px; padding: 8px 12px 8px 0; }
table.def td { padding: 8px 0; }
table.def tr + tr { border-top: 1px solid var(--border); }
table.grid th, table.grid td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
table.grid thead th { background: var(--surface-2); }
table.grid.small { font-size: 0.9rem; width: auto; }
.schema-inline, .schema-block { font-family: var(--mono); font-size: 0.92em; }
.schema-block { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; }
@media (max-width: 640px) {
  table.def th { width: auto; display: block; padding-bottom: 0; }
  table.def td { display: block; }
  .theory table.grid { display: block; overflow-x: auto; }
}

/* ------------------------------------------------------------ Quiz */
.quiz-card { max-width: 820px; }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--muted); font-size: 0.9rem; }
.question { margin: 18px 0 10px; font-size: 1.2rem; }
.options { display: grid; gap: 10px; margin-top: 12px; }
.option {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.option:hover:not(:disabled) { border-color: var(--primary); }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option.correct { border-color: var(--good); background: var(--good-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option:disabled { cursor: default; }
.option-key { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--surface-2); font-weight: 700; font-size: 0.85rem; }
.explain { margin-top: 16px; padding: 12px 14px; border-radius: 10px; }
.explain.ok { background: var(--good-soft); }
.explain.err { background: var(--bad-soft); }
.topic-list { display: grid; gap: 8px; }
.topic-row { display: grid; grid-template-columns: 220px 1fr; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.topic-row:hover { background: var(--surface-2); }
.review-list li { margin-bottom: 12px; }
@media (max-width: 600px) { .topic-row { grid-template-columns: 1fr; gap: 4px; } }

/* ------------------------------------------------------------ Kardinalitäten */
.card-trainer { max-width: 820px; }
.card-pair { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 24px 0 12px; flex-wrap: wrap; }
.entity-chip { padding: 10px 18px; border: 2px solid var(--erd-entity-stroke); border-radius: 6px; font-weight: 700; background: var(--erd-entity); }
.card-q { font-size: 1.5rem; font-weight: 700; color: var(--muted); }
.card-text { font-size: 1.1rem; text-align: center; max-width: 60ch; margin: 0 auto 20px; }
.card-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.card-option { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.card-option:hover:not(:disabled) { border-color: var(--primary); }
.card-option.correct { border-color: var(--good); background: var(--good-soft); }
.card-option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.card-option-type { font-size: 1.4rem; font-weight: 700; }
.card-option-sub { font-size: 0.75rem; color: var(--muted); text-align: center; }
@media (max-width: 600px) { .card-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ------------------------------------------------------------ ER-Diagramm */
.erd-wrap { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 8px; overflow: hidden; }
.erd-wrap.small { max-width: 520px; margin: 16px auto 0; }
svg.erd { display: block; width: 100%; height: auto; max-height: 560px; touch-action: none; user-select: none; }
svg.erd.draggable .erd-entity { cursor: grab; }
svg.erd.draggable .erd-entity:active { cursor: grabbing; }
.erd-box { fill: var(--erd-entity); stroke: var(--erd-entity-stroke); stroke-width: 2; }
.erd-title { font-weight: 600; font-size: 15px; fill: var(--erd-text); }
.erd-sep { stroke: var(--erd-entity-stroke); stroke-width: 1; opacity: 0.5; }
.erd-attr-line { font-size: 14px; fill: var(--erd-text); }
.erd-attr-line.pk { font-weight: 600; }
.erd-underline { stroke: var(--erd-text); stroke-width: 1.2; }
.erd-line { fill: none; stroke: var(--erd-line); stroke-width: 1.8; }
.erd-line.thin { stroke-width: 1.2; }
.erd-rel { fill: var(--erd-rel); stroke: var(--erd-rel-stroke); stroke-width: 2; }
.erd-rel-text { font-size: 13px; fill: var(--erd-text); }
.erd-attr { fill: var(--erd-entity); stroke: var(--erd-line); stroke-width: 1.2; }
.erd-attr-text { font-size: 13px; fill: var(--erd-text); font-style: italic; }
.erd-card { font-size: 16px; font-weight: 700; fill: var(--erd-card); }
.erd-empty { fill: var(--muted); font-size: 15px; }

/* ------------------------------------------------------------ ERM-Builder */
.scenario p:last-child { margin-bottom: 0; }
.builder { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.builder-view .sticky { position: sticky; top: 72px; }
@media (max-width: 1100px) {
  .builder { grid-template-columns: minmax(0, 1fr); }
  .builder-view .sticky { position: static; }
}
.entity-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.entity-card { border: 1px solid var(--border); border-left: 4px solid var(--erd-entity-stroke); border-radius: 10px; padding: 10px; background: var(--surface); }
.entity-card-head { display: flex; gap: 6px; align-items: center; }
.entity-name { flex: 1 1 0; width: 100%; min-width: 0; font-weight: 600; }
.attr-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.attr-list li { display: flex; gap: 6px; align-items: center; }
.attr-list input { flex: 1 1 0; width: 100%; min-width: 0; padding: 6px 8px; font-size: 0.95rem; }
.pk-toggle { flex: none; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; filter: grayscale(1); opacity: 0.45; font-size: 0.9rem; }
.pk-toggle.on { filter: none; opacity: 1; background: var(--mid-soft); border-color: var(--mid); }
.rel-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.rel-card { border: 1px solid var(--border); border-left: 4px solid var(--erd-rel-stroke); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.rel-row { display: flex; gap: 6px; align-items: center; }
.rel-row select, .rel-row input { flex: 1 1 0; width: 100%; min-width: 0; }
.rel-row .rel-type { flex: 0 0 76px; font-weight: 700; text-align: center; }
@media (max-width: 480px) { .rel-row { flex-wrap: wrap; } .rel-row input { flex-basis: 100%; } }
.solution-list li { margin-bottom: 6px; }

/* ------------------------------------------------------------ Schema-Editor */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.notation-help { margin-left: auto; font-size: 0.9rem; }
.notation-help summary { cursor: pointer; color: var(--primary); }
.notation-help > div { position: absolute; right: 0; z-index: 5; width: min(440px, 90vw); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.notation-help { position: relative; }
.notation-help ul { padding-left: 18px; margin: 8px 0 0; }
.schema-input { width: 100%; font-family: var(--mono); font-size: 0.95rem; line-height: 1.6; resize: vertical; min-height: 170px; }
.parse-errors { margin: 8px 0 0; padding-left: 18px; color: var(--mid); font-size: 0.9rem; }
.parse-errors:empty { display: none; }
.preview-label { margin-top: 12px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; }
.schema-preview { margin-top: 6px; padding: 12px; border-radius: 8px; background: var(--surface-2); min-height: 48px; }
.schema { font-family: var(--mono); font-size: 0.95rem; display: grid; gap: 6px; }
.schema-line { overflow-wrap: anywhere; }
.schema-table { font-weight: 700; }
.schema-attr.pk { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.schema-attr.fk { color: var(--primary); }
.schema-target { font-size: 0.7em; color: var(--muted); margin-left: 1px; }
.solution .schema { background: var(--surface-2); padding: 12px; border-radius: 8px; }
.step { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 12px; }
.fd-list { padding-left: 18px; }
.stage-picker { display: flex; align-items: center; gap: 8px; }
.stage-score { font-size: 0.75em; opacity: 0.8; }

/* ------------------------------------------------------------ Feedback */
.feedback { border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; border: 1px solid var(--border); background: var(--surface); }
.feedback-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.feedback-score { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.feedback.good .feedback-score { color: var(--good); }
.feedback.mid .feedback-score { color: var(--mid); }
.feedback.low .feedback-score { color: var(--bad); }
.fb-group { padding: 10px 0; border-top: 1px solid var(--border); }
.fb-group-title { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.fb-group ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 30px; display: grid; gap: 4px; }
.fb-group li { display: flex; gap: 8px; align-items: baseline; }
.fb-icon { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 0.75rem; font-weight: 800; }
.fb-icon.ok { background: var(--good-soft); color: var(--good); }
.fb-icon.warn { background: var(--mid-soft); color: var(--mid); }
.fb-icon.err { background: var(--bad-soft); color: var(--bad); }

/* ------------------------------------------------------------ Tabellen */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
table.data th, table.data td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
table.data thead th { background: var(--surface-2); white-space: nowrap; }
table.unnormalized td { line-height: 1.7; }
table.data td.pk { font-weight: 600; }
table.data td.fk { color: var(--primary); }
.null { font-style: italic; color: var(--muted); }
tr.flash td { animation: flash 1.6s ease; }
@keyframes flash { 0% { background: var(--mid-soft); } 100% { background: transparent; } }
.row-actions { white-space: nowrap; display: flex; gap: 6px; }
.inline-edit { display: inline-flex; gap: 4px; align-items: center; }
.inline-input { width: 70px; padding: 4px 6px !important; }

.grid-editor { border-collapse: separate; border-spacing: 0; }
.grid-editor th, .grid-editor td { border-bottom: 1px solid var(--border); padding: 4px; vertical-align: top; }
.grid-editor thead th { background: var(--surface-2); }
.grid-editor thead th:first-child { border-top-left-radius: 8px; }
.grid-editor thead th:last-child { border-top-right-radius: 8px; }
.grid-editor input { width: 100%; min-width: 110px; padding: 6px 8px; font-size: 0.92rem; }
.grid-editor .header-input { font-weight: 600; }
.col-head { display: flex; gap: 4px; }
.col-tools { display: flex; justify-content: flex-end; gap: 2px; margin-top: 2px; }
.row-tools { white-space: nowrap; }
.row-tools-head { width: 72px; }

/* ------------------------------------------------------------ Integritäts-Simulator */
.rule-grid { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 12px; }
.rule-control { display: flex; flex-direction: column; gap: 6px; }
.rule-label { font-family: var(--mono); font-weight: 700; font-size: 0.9rem; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.segmented button { border: 0; background: var(--surface); color: var(--text); padding: 7px 14px; font: inherit; font-size: 0.9rem; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--primary); color: var(--primary-ink); font-weight: 600; }
pre.sql { margin: 0; }
.log { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.log li { padding: 8px 10px; border-radius: 8px; font-size: 0.92rem; }
.log li.ok { background: var(--good-soft); }
.log li.err { background: var(--bad-soft); }
.log code { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 2px; overflow-wrap: anywhere; }
.missions { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.missions li { display: flex; gap: 10px; align-items: flex-start; }
.mission-check { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 700; }
.missions li.done .mission-check { background: var(--good-soft); color: var(--good); }
.missions li.done strong { text-decoration: line-through; text-decoration-color: var(--good); }

/* ------------------------------------------------------------ Fortschritt */
.stat-list { display: grid; gap: 10px; margin-bottom: 12px; }
.stat-row { display: grid; grid-template-columns: 220px 1fr; gap: 12px; align-items: center; }
@media (max-width: 600px) { .stat-row { grid-template-columns: 1fr; gap: 4px; } }
