/* ==========================================================================
   Lernplattform ask-4.it
   Farb- und Formensprache uebernommen aus der IT-Sicherheits-Checkliste:
   ruhige Flaechen, 14px-Radien, Pillen fuer Zustaende, Segoe UI.
   ========================================================================== */

:root {
  --bg: #f4f5f7;
  --bg-accent: #eceff3;
  --card: #ffffff;
  --card-2: #fafbfc;
  --ink: #1c2330;
  --ink-soft: #3b4557;
  --muted: #5b6472;
  --line: #dce0e6;

  --brand: #0d5bd4;
  --brand-soft: #e8f0fe;
  --brand-line: #bcd3f7;
  --brand-ink: #0a4bb0;

  --ok: #1f9d55;
  --ok-soft: #eefaf1;
  --ok-line: #bfe6cd;
  --ok-ink: #1f7a43;

  --warn: #d97706;
  --warn-soft: #fdf6e6;
  --warn-line: #f2dcac;
  --warn-ink: #8a5a00;

  --bad: #b3271e;
  --bad-soft: #fdeceb;
  --bad-line: #f2c2be;
  --bad-ink: #b3271e;

  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 4px 16px rgba(20, 30, 50, .06);
  --shadow-lift: 0 2px 6px rgba(20, 30, 50, .10), 0 10px 28px rgba(20, 30, 50, .10);
  --shadow-pop: 0 12px 40px rgba(20, 30, 50, .18);

  --radius: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --topbar-h: 60px;
}

:root[data-theme="dark"] {
  --bg: #0f1319;
  --bg-accent: #141a22;
  --card: #171c25;
  --card-2: #1d2430;
  --ink: #e7ebf1;
  --ink-soft: #c3ccd9;
  --muted: #909db0;
  --line: #28303c;

  --brand: #4d8ef7;
  --brand-soft: #152238;
  --brand-line: #2b4470;
  --brand-ink: #8bb6fb;

  --ok: #33b56b;
  --ok-soft: #102619;
  --ok-line: #23492f;
  --ok-ink: #5ed08e;

  --warn: #e0930f;
  --warn-soft: #251d0e;
  --warn-line: #4a3814;
  --warn-ink: #e6b155;

  --bad: #e0655a;
  --bad-soft: #2a1512;
  --bad-line: #57281f;
  --bad-ink: #ef8d83;

  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .55), 0 10px 28px rgba(0, 0, 0, .45);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .6);
}

/* --- Grundlagen --------------------------------------------------------- */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; letter-spacing: -.2px; font-weight: 600; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.noscript {
  margin: 24px auto;
  max-width: 640px;
  padding: 16px 20px;
  border: 1px solid var(--bad-line);
  background: var(--bad-soft);
  color: var(--bad-ink);
  border-radius: var(--radius);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Ladeanzeige -------------------------------------------------------- */

.boot {
  min-height: 60vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
}

.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Kopfzeile ---------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  /* Erst deckend, dann leicht transparent: faellt color-mix() aus, bleibt die
     Leiste sichtbar statt durchscheinend. */
  background: var(--card);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15.5px; color: var(--ink);
  flex: none; white-space: nowrap;
}
.topbar .brand:hover { text-decoration: none; }

.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--brand);
  display: grid; place-items: center;
  /* Schriftfarbe kommt aus dem Erscheinungsbild: helle Marken brauchen dunkle Schrift. */
  color: var(--on-brand, #fff); flex: none;
}
.brand-mark svg { width: 17px; height: 17px; }

/* Firmenlogo. Im Dunkelmodus liegt es auf einer hellen Fläche: die dunkelblaue
   Wortmarke wäre auf dunklem Grund sonst nicht lesbar, und ein CSS-Filter würde
   die CI-Farben verfälschen. Geometrie bleibt in beiden Modi gleich. */
.brand-logo {
  height: 26px; width: auto; display: block; flex: none;
  padding: 3px 6px; border-radius: 5px;
  box-sizing: content-box;
}
:root[data-theme="dark"] .brand-logo { background: #fff; }

.brand-name {
  font-weight: 700; font-size: 16px; letter-spacing: -.3px;
  color: var(--ink);
}

.brand-sub {
  font-weight: 400; color: var(--muted); font-size: 13px;
  padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line);
}

.topnav { display: flex; gap: 4px; flex: 1; min-width: 0; }

.topnav a {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.topnav a:hover { background: var(--bg-accent); color: var(--ink); text-decoration: none; }
.topnav a.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 17px; height: 17px; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-2);
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: border-color .16s var(--ease);
}
.user-chip:hover { border-color: var(--brand); }

.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand, #fff);
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; flex: none;
  letter-spacing: .02em;
}

.user-chip .who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-chip .who b { font-size: 13px; font-weight: 600; }
.user-chip .who span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* --- Menue -------------------------------------------------------------- */

.menu {
  /* fixed, nicht absolute: das Menü hängt an <body>, und body ist nicht
     positioniert - absolute würde ab Dokumentanfang zählen und auf einer
     gescrollten Seite oberhalb des Sichtfensters landen. */
  position: fixed;
  top: calc(var(--topbar-h) - 6px);
  right: 20px;
  z-index: 40;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  animation: popIn .14s var(--ease);
}

.menu button {
  width: 100%; text-align: left;
  font: inherit; font-size: 13.5px;
  padding: 9px 11px;
  border: 0; background: none; color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; gap: 9px;
}
.menu button:hover { background: var(--bg-accent); }
.menu button.danger { color: var(--bad); }
.menu .menu-head {
  padding: 8px 11px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
}
.menu .menu-head b { display: block; font-size: 13.5px; }
.menu .menu-head span { font-size: 12px; color: var(--muted); }

@keyframes popIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* --- Seitengeruest ------------------------------------------------------ */

.view {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 20px 80px;
  animation: viewIn .22s var(--ease);
}
.view.wide { max-width: 1320px; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { font-size: 23px; }
.page-head .sub { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }
.page-head .actions { display: flex; gap: 9px; flex-wrap: wrap; }

.section-label {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 26px 0 12px;
}
.section-label:first-child { margin-top: 0; }

/* --- Karten ------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.card + .card { margin-top: 16px; }
.card > h2 { font-size: 16px; margin-bottom: 14px; }
.card.tight { padding: 0; overflow: hidden; }
.card.tight > h2 { padding: 15px 20px; border-bottom: 1px solid var(--line); margin: 0; background: var(--card-2); }
.card.tight > .card-body { padding: 18px 20px; }

/* --- Kennzahlen --------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat .k {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
}
.stat .v {
  font-size: 26px; font-weight: 700; line-height: 1.15; margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat.accent .v { color: var(--brand); }
.stat.ok .v { color: var(--ok-ink); }
.stat.warn .v { color: var(--warn-ink); }

/* --- Pillen und Kennzeichnungen ----------------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.pill.brand { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); font-weight: 600; }
.pill.ok    { color: var(--ok-ink); border-color: var(--ok-line); background: var(--ok-soft); font-weight: 600; }
.pill.warn  { color: var(--warn-ink); border-color: var(--warn-line); background: var(--warn-soft); font-weight: 600; }
.pill.bad   { color: var(--bad-ink); border-color: var(--bad-line); background: var(--bad-soft); font-weight: 600; }
.pill.dash  { border-style: dashed; }

.pill-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

/* --- Schaltflaechen ----------------------------------------------------- */

.btn {
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              color .16s var(--ease), transform .12s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
/* Grundgroesse fuer alle Symbole aus icon(). Bewusst nur eine Klasse, damit
   jede kontextbezogene Regel (.btn svg, .icon-btn svg, ...) weiter gewinnt. */
.ico { width: 16px; height: 16px; flex: none; vertical-align: -0.15em; }

.btn svg { width: 15px; height: 15px; flex: none; }

.btn-primary { background: var(--brand); color: var(--on-brand, #fff); }
.btn-primary:hover:not(:disabled) { background: var(--brand-ink); }

.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }

.btn-subtle { background: var(--card-2); border-color: var(--line); color: var(--muted); }
.btn-subtle:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }

.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover:not(:disabled) { filter: brightness(.93); }

.btn-danger { background: var(--card); border-color: var(--bad-line); color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-soft); }

.btn-sm { font-size: 12.5px; padding: 6px 11px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* --- Formularfelder ----------------------------------------------------- */

.field { display: block; margin-bottom: 15px; }
.field > label,
.field-label {
  display: block;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 6px;
}
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

input[type="text"], input[type="password"], input[type="email"],
input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input.invalid, textarea.invalid {
  border-color: var(--bad);
  background: var(--bad-soft);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%235b6472' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
}

/* Der Pfeil steckt als data:-URL im Hintergrund, dort greift var() nicht.
   Im Dunkelmodus braucht er darum eine eigene, hellere Fassung. */
:root[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23909db0' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; cursor: pointer; user-select: none;
}
.check input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* Scrollbare Auswahlliste, z. B. für Freischaltbedingungen. */
.picker-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  max-height: 190px;
  overflow-y: auto;
  padding: 5px;
}
.picker-row {
  padding: 7px 9px;
  border-radius: 6px;
  transition: background .13s var(--ease);
}
.picker-row:hover { background: var(--bg-accent); }
.picker-row:has(input:checked) {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

/* --- Werkzeugleiste ----------------------------------------------------- */

.toolbar {
  display: flex; gap: 9px; flex-wrap: wrap; align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 13px;
  margin-bottom: 18px;
}
.toolbar .grow { flex: 1; min-width: 180px; }
.toolbar input[type="text"] { background: var(--card-2); }

.chip {
  font: inherit; font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .16s var(--ease), color .16s var(--ease), background .16s var(--ease);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active {
  border-color: var(--brand-line); background: var(--brand-soft);
  color: var(--brand); font-weight: 600;
}

/* --- Kursraster --------------------------------------------------------- */

.grid-courses {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.course-card {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
  text-align: left;
  cursor: pointer;
  font: inherit; color: var(--ink);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.course-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--brand-line);
}
.course-card:hover .course-title { color: var(--brand); }

.course-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.course-icon {
  width: 38px; height: 38px; flex: none;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  color: var(--brand);
  display: grid; place-items: center;
  font-size: 18px; font-weight: 700;
}
.course-icon svg { width: 19px; height: 19px; }

.course-title {
  font-size: 15.5px; font-weight: 600; line-height: 1.35;
  transition: color .16s var(--ease);
}
.course-summary {
  color: var(--muted); font-size: 13.5px; line-height: 1.5;
  margin: 0 0 14px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.course-meta {
  display: flex; gap: 7px; flex-wrap: wrap; align-items: center;
  margin-top: auto; padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted);
}

/* Hervorgehobener Kurs: farbige Kante links, sonst unverändert ruhig. */
.course-card.featured {
  border-color: var(--brand-line);
  box-shadow: inset 3px 0 0 var(--brand), var(--shadow);
}
.course-card.featured .course-icon { background: var(--brand); color: var(--on-brand, #fff); }

/* Gesperrter Kurs: sichtbar zurückgenommen, aber nicht unleserlich. */
.course-card.locked { border-style: dashed; }
.course-card.locked .course-icon { background: var(--bg-accent); color: var(--muted); }
.course-card.locked .course-title { color: var(--muted); }
.course-card.locked:hover .course-title { color: var(--ink); }

.lock-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 10px 0 0;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font-size: 12.5px; line-height: 1.45;
}
.lock-note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }

/* --- Fortschritt -------------------------------------------------------- */

.progress {
  height: 7px;
  background: var(--bg-accent);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 8px;
}
.progress .fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width .5s var(--ease);
}
.progress .fill.done { background: var(--ok); }

.progress-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 12.5px; color: var(--muted);
}
.progress-line b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* --- Tabellen ----------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th, table.data td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
  background: var(--card-2);
  white-space: nowrap;
}
table.data tbody tr { transition: background .13s var(--ease); }
table.data tbody tr:hover { background: var(--bg-accent); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.right { text-align: right; }
table.data td.actions { white-space: nowrap; text-align: right; }
table.data .mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12.5px; }

/* --- Registerkarten ----------------------------------------------------- */

.tabs {
  display: flex; gap: 3px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tabs button {
  font: inherit; font-size: 13.5px; font-weight: 500;
  padding: 10px 15px;
  background: none; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* --- Leerzustaende ------------------------------------------------------ */

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty .glyph {
  width: 46px; height: 46px; margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bg-accent);
  display: grid; place-items: center;
  color: var(--muted);
}
.empty .glyph svg { width: 22px; height: 22px; }
.empty h3 { font-size: 15.5px; color: var(--ink); margin-bottom: 6px; }
.empty p { margin: 0 0 16px; font-size: 13.5px; }

/* --- Anmeldung ---------------------------------------------------------- */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(1100px 520px at 50% -10%, var(--brand-soft), transparent 70%),
    var(--bg);
}

.auth-card {
  width: 100%; max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 30px 30px 26px;
  animation: viewIn .28s var(--ease);
}
.auth-card .auth-brand {
  display: flex; align-items: center; gap: 13px;
  margin-bottom: 22px;
}
.auth-card .auth-brand .brand-logo { height: 38px; }
.auth-card .auth-brand b { font-size: 17px; letter-spacing: -.3px; }
.auth-card .auth-brand span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.auth-card h1 { font-size: 18px; margin-bottom: 5px; }
.auth-card .lead { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }
.auth-foot {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); text-align: center;
}

.alert {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  animation: shakeIn .3s var(--ease);
}
.alert.bad  { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad-ink); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.alert.ok   { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.alert.info { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }

@keyframes shakeIn {
  0%   { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: none; }
}

/* --- Kursansicht: Seitenleiste und Inhalt ------------------------------- */

.learn {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.learn-side {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: calc(100vh - var(--topbar-h) - 44px);
  display: flex; flex-direction: column;
}
.learn-side .side-head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--card-2);
}
.learn-side .side-head h2 { font-size: 14.5px; line-height: 1.35; margin-bottom: 10px; }
.learn-side .side-list { overflow-y: auto; padding: 8px; }

.lesson-link {
  width: 100%;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 11px;
  border: 0; background: none;
  border-radius: var(--radius-sm);
  text-align: left; font: inherit; font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.lesson-link:hover { background: var(--bg-accent); }
.lesson-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* Noch gesperrt: klar erkennbar, aber nicht ausgeblendet - der Lernende soll
   sehen, was noch kommt. */
.lesson-link.locked { color: var(--muted); cursor: not-allowed; }
.lesson-link.locked:hover { background: none; }
.lesson-link.locked .lesson-mark {
  border-style: dashed;
  background: var(--card-2);
}
.lesson-link.locked .lesson-mark svg { width: 11px; height: 11px; }
.lesson-link.locked .lesson-text small { font-style: italic; }

.lesson-mark {
  width: 20px; height: 20px; flex: none; margin-top: 1px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  display: grid; place-items: center;
  font-size: 10.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.lesson-link.done .lesson-mark {
  background: var(--ok); border-color: var(--ok); color: #fff;
}
.lesson-link.done .lesson-mark svg { width: 11px; height: 11px; }
.lesson-link .lesson-text { min-width: 0; }
.lesson-link .lesson-text small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; margin-top: 2px; }

.learn-main {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.learn-main .lesson-head {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
}
.learn-main .lesson-head h1 { font-size: 21px; line-height: 1.3; }
.learn-main .lesson-body { padding: 24px 28px 28px; }

/* Ab genug Breite: Lektionsliste linksbündig am Bildschirmrand, Lektionsinhalt
   echt auf dem Bildschirm zentriert. Der Umbruchpunkt ist gerechnet, nicht
   geraten: Inhalt 860px zentriert heisst linker Rand bei (Breite-860)/2, und
   das muss ueber der Spalte (296px) plus Abstaenden liegen. Darunter bleibt es
   beim gewohnten Zweispalter, sonst wuerde die Liste den Text ueberdecken.

   ACHTUNG, Reihenfolge: Dieser Block MUSS hinter den Basisregeln von
   .learn-side und .learn-main stehen. Eine Media Query erhoeht die Spezifitaet
   nicht - stand er davor, gewann das spaetere .learn-side{position:sticky} und
   die Leiste blieb im Textfluss. Folge: der Lektionsinhalt begann erst
   unterhalb der Leiste, man musste zu ihm hochscrollen. */
@media (min-width: 1500px) {
  .view.learn-view { max-width: none; padding-left: 0; padding-right: 0; }

  .learn { display: block; }

  .learn-side {
    position: fixed;
    left: 22px;
    top: calc(var(--topbar-h) + 20px);
    width: 296px;
    max-height: calc(100vh - var(--topbar-h) - 44px);
    z-index: 5;
  }

  .learn-main {
    max-width: 860px;
    margin: 0 auto;
  }

  /* Kopfzeile und Hinweise ueber dem zentrierten Inhalt ausrichten.
     Der Aufhaenger ist .learn-wrap, nicht .learn-view: die Kursansicht liefert
     eine Huelle als einziges Kind der View, ein Kindselektor auf .learn-view
     traf deshalb nie. */
  .learn-wrap > .page-head,
  .learn-wrap > .alert {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
  }
}

.lesson-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: var(--card-2);
}

/* Prüfungsmodus: der Kurs ist zu, solange diese Lektion offen ist. */
.focus-banner {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 28px;
  background: var(--warn-soft);
  border-bottom: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font-size: 13.5px;
}
.focus-banner svg { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.focus-banner b { display: block; margin-bottom: 2px; }

/* --- Inhaltsdarstellung (Markdown) -------------------------------------- */

.prose { color: var(--ink); font-size: 15px; line-height: 1.65; max-width: 76ch; }
.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }

.prose h1, .prose h2, .prose h3, .prose h4 {
  margin: 30px 0 12px; line-height: 1.3;
}
.prose h1 { font-size: 22px; }
.prose h2 {
  font-size: 18px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}
.prose h3 { font-size: 15.5px; }
.prose h4 { font-size: 14px; color: var(--ink-soft); }

.prose p { margin: 0 0 15px; }
.prose strong { font-weight: 600; }

.prose ul, .prose ol { margin: 0 0 15px; padding-left: 24px; }
.prose li { margin-bottom: 6px; }
.prose li > ul, .prose li > ol { margin: 6px 0 0; }

.prose ul.task { list-style: none; padding-left: 2px; }
.prose ul.task li { display: flex; align-items: flex-start; gap: 9px; }
.prose ul.task input { margin-top: 4px; accent-color: var(--brand); }

.prose code {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 13px;
  background: var(--bg-accent);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1.5px 5px;
  white-space: nowrap;
}
.prose pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--bg-accent);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.prose pre code {
  background: none; border: 0; padding: 0; white-space: pre;
  font-size: 12.8px; line-height: 1.6; color: var(--ink);
}

.prose blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
}
.prose blockquote > *:last-child { margin-bottom: 0; }

.prose hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }

.prose .table-scroll { overflow-x: auto; margin: 0 0 16px; }
.prose table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.prose th, .prose td {
  padding: 9px 12px; text-align: left;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.prose th { background: var(--card-2); font-weight: 600; font-size: 12.5px; }
.prose tr:last-child td { border-bottom: 0; }
.prose th:last-child, .prose td:last-child { border-right: 0; }

.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

/* --- Quiz --------------------------------------------------------------- */

.quiz {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.quiz > header {
  padding: 14px 18px;
  background: var(--card-2);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.quiz > header h3 { font-size: 14.5px; }
.quiz-body { padding: 18px; }

.qblock { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px dashed var(--line); }
.qblock:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.qblock .qtext { font-weight: 600; margin-bottom: 12px; display: flex; gap: 9px; }
.qblock .qnum {
  flex: none; width: 21px; height: 21px; border-radius: 6px;
  background: var(--brand); color: var(--on-brand, #fff);
  font-size: 11.5px; font-weight: 700;
  display: grid; place-items: center;
}

.qopts { display: flex; flex-direction: column; gap: 8px; }
.qopt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.qopt:hover { border-color: var(--brand-line); }
.qopt input { margin-top: 2px; accent-color: var(--brand); flex: none; }
.qopt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.qopt.correct { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok-ink); }
.qopt.wrong   { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad-ink); }
.qopt.locked  { cursor: default; }

.qexpl {
  margin-top: 11px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-accent);
  font-size: 13px;
  color: var(--ink-soft);
  border-left: 3px solid var(--muted);
  animation: shakeIn .25s var(--ease);
}
.qexpl.ok { border-left-color: var(--ok); }
.qexpl.bad { border-left-color: var(--bad); }

.quiz-result {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--card-2);
}
.quiz-score {
  font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.quiz-score.pass { color: var(--ok-ink); }
.quiz-score.fail { color: var(--warn-ink); }

/* --- Editor ------------------------------------------------------------- */

.editor-cols {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.lesson-tray {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
}
.lesson-tray .tray-head {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--card-2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.lesson-tray .tray-head h3 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.lesson-tray .tray-list { padding: 7px; max-height: 55vh; overflow-y: auto; }

.tray-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background .14s var(--ease);
}
.tray-item:hover { background: var(--bg-accent); }
.tray-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tray-item .grip {
  flex: none; color: var(--muted); font-size: 11px;
  font-variant-numeric: tabular-nums; min-width: 15px;
}
.tray-item .tray-title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tray-item .tray-btns { display: flex; gap: 1px; opacity: 0; transition: opacity .14s var(--ease); }
.tray-item:hover .tray-btns, .tray-item.active .tray-btns { opacity: 1; }
.tray-item .tray-btns button {
  border: 0; background: none; cursor: pointer;
  color: var(--muted); padding: 2px 3px; border-radius: 4px;
  font-size: 12px; line-height: 1;
}
.tray-item .tray-btns button:hover { color: var(--brand); background: var(--card); }

.md-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.md-editor.single { grid-template-columns: 1fr; }
.md-editor textarea {
  border-radius: 0;
  border: 0; border-right: 1px solid var(--line);
  min-height: 460px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 13px;
  background: var(--card);
}
.md-editor textarea:focus { box-shadow: none; }
.md-editor .md-preview {
  padding: 18px 20px;
  overflow-x: auto;
  max-height: 620px;
  overflow-y: auto;
  background: var(--card-2);
}
.md-editor.single .md-preview { display: none; }
.md-editor.single textarea { border-right: 0; }

.editor-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--card-2);
}
.dirty-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--warn-ink);
}
.dirty-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* --- API-Dokumentation -------------------------------------------------- */

.endpoint { border-bottom: 1px solid var(--line); }
.endpoint:last-child { border-bottom: 0; }

.endpoint-head {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: none; border: 0;
  font: inherit; color: var(--ink);
  cursor: pointer; text-align: left;
  transition: background .14s var(--ease);
}
.endpoint-head:hover { background: var(--bg-accent); }
.endpoint-head.open { background: var(--brand-soft); }
.endpoint-head > svg { flex: none; color: var(--muted); transition: transform .18s var(--ease); }
.endpoint-head.open > svg { transform: rotate(180deg); }
.endpoint-head > span:nth-child(3) { flex: 1 1 40%; min-width: 0; }

.endpoint-body > div { padding: 4px 18px 20px; }
.endpoint-body .section-label { margin: 18px 0 9px; }
.endpoint-body table.data { font-size: 13px; }

.regel-liste { display: flex; flex-direction: column; gap: 9px; }
.regel-zeile {
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 12px;
  padding-bottom: 9px; border-bottom: 1px dashed var(--line);
}
.regel-zeile:last-child { border-bottom: 0; padding-bottom: 0; }
.regel-schluessel { font-size: 12.5px; font-weight: 600; color: var(--brand); word-break: break-word; }
.regel-wert { font-size: 13.5px; color: var(--ink-soft); min-width: 0; }
.regel-wert .regel-liste { margin-top: 4px; }

@media (max-width: 700px) {
  .regel-zeile { grid-template-columns: 1fr; gap: 3px; }
  .endpoint-head { flex-wrap: wrap; }
}

/* --- Zertifikat --------------------------------------------------------- */

/* Bühne: hält die feste Urkundengröße zusammen und schneidet nichts ab. */
.urkunde-buehne {
  display: flex;
  justify-content: center;
  /* Skalierung erfolgt über transform - der Platzbedarf muss dazu passen,
     sonst bleibt Leerraum stehen. Werte je Stufe unten in den Medienabfragen. */
  height: 210mm;
  overflow: hidden;
}

/* Genau ein A4-Blatt im Querformat. 297mm x 210mm, randlos.
   Bei 96 dpi entspricht das 1122 x 794 px - Bildschirm und Druck stimmen
   deshalb 1:1 überein, ohne Umrechnung. */
.urkunde {
  /* Eigene Farben statt der Theme-Variablen: die Urkunde ist ein Dokument auf
     weißem Papier und muss im Dunkelmodus genauso aussehen wie im hellen.
     Mit var(--line)/var(--muted) waeren im Dunkelmodus fast schwarze Linien und
     blasse Schrift auf Weiss entstanden. */
  --papier-linie: #dce0e6;
  --papier-grau: #5b6472;
  --stufe: #5b6472;
  --stufe-hell: #eceff3;
  box-sizing: border-box;
  width: 297mm;
  height: 210mm;
  flex: none;
  background: #fff;
  color: #1c2330;
  box-shadow: var(--shadow-lift);
  transform-origin: top center;
  /* Schneidet ab, statt auf eine zweite Seite zu laufen - bei exakt
     ausgereizter Blatthöhe genügt schon ein Rundungsfehler. */
  overflow: hidden;
}

.urkunde.tier-platin { --stufe: #5b6472; --stufe-hell: #eceff3; }
.urkunde.tier-gold   { --stufe: #b8860b; --stufe-hell: #fdf6e6; }
.urkunde.tier-silber { --stufe: #8a929e; --stufe-hell: #f1f3f6; }
.urkunde.tier-bronze { --stufe: #a2662f; --stufe-hell: #fbf1e8; }

/* Füllt das Blatt vollständig. Der Zierrahmen sitzt als Einfassung innen,
   das Papier selbst hat keinen weißen Rand. */
.urkunde-rahmen {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 18mm 22mm 12mm;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  /* Hintergrund läuft bis an die Blattkante - kein weißer Rand. */
  background:
    radial-gradient(760px 280px at 50% 0%, var(--stufe-hell), transparent 70%),
    #fff;
}

/* Zierrahmen als eingerücktes Element statt als Border: so bleibt der
   Hintergrund randlos und die Einfassung sitzt trotzdem im Blatt. */
.urkunde-rahmen::before {
  content: "";
  position: absolute;
  inset: 7mm;
  border: 2px solid var(--stufe);
  pointer-events: none;
}

.urkunde-kopf {
  display: flex; align-items: center; gap: 15px;
  text-align: left;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--papier-linie);
  margin-bottom: 0;
  flex: none;
}
.urkunde-logo { height: 62px; width: auto; flex: none; }

/* Mittelteil trägt die freie Höhe und zentriert den Inhalt senkrecht. */
.urkunde-mitte {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 0;
}
.urkunde-marke b { display: block; font-size: 17px; letter-spacing: -.3px; }
.urkunde-marke span { font-size: 12.5px; color: var(--papier-grau); }

.urkunde-siegel {
  position: absolute; top: 16mm; right: 20mm;
  width: 112px; height: 112px;
  border-radius: 50%;
  border: 3px solid var(--stufe);
  background: var(--stufe-hell);
  display: grid; place-content: center; gap: 1px;
  text-align: center;
}
.urkunde-stufe {
  font-size: 17px; font-weight: 700; color: var(--stufe);
  letter-spacing: .04em; text-transform: uppercase;
}
.urkunde-prozent { font-size: 13px; color: #5b6472; font-variant-numeric: tabular-nums; }

.urkunde-titel {
  font-size: 15px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .3em; color: var(--stufe);
  margin: 0 0 22px;
}
.urkunde-vorspann { font-size: 14px; color: #5b6472; margin: 0 0 6px; }
.urkunde-name {
  font-size: 34px; font-weight: 700; letter-spacing: -.5px;
  margin: 4px 0 16px; line-height: 1.15;
}
.urkunde-kurs {
  font-size: 22px; font-weight: 600; line-height: 1.3;
  margin: 4px auto 16px; max-width: 30ch;
}

/* Auflistung der Lektionen. Mehrspaltig, damit auch ein längerer Kurs auf das
   Blatt passt - die Dichtestufe setzt die Ansicht nach Anzahl der Titel. */
.urkunde-inhalte {
  margin-top: 6mm;
  padding-top: 4mm;
  border-top: 1px solid var(--papier-linie);
  text-align: left;
}
.urkunde-inhalte-titel {
  display: block; text-align: center;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .16em;
  color: var(--papier-grau);
  margin-bottom: 3.5mm;
}
.urkunde-inhalte ol {
  margin: 0;
  padding: 0 0 0 1.5em;
  columns: 2;
  column-gap: 14mm;
}
.urkunde-inhalte li {
  font-size: 11.5px;
  line-height: 1.4;
  margin-bottom: 1.4mm;
  color: #3b4557;
  /* Ein Titel darf nicht mitten im Umbruch zwischen zwei Spalten hängen. */
  break-inside: avoid;
  page-break-inside: avoid;
}
.urkunde-inhalte li::marker { color: var(--papier-grau); font-size: .85em; }

.urkunde-inhalte.dichte-2 li { font-size: 10.5px; margin-bottom: 1.1mm; }
.urkunde-inhalte.dichte-3 ol { columns: 3; column-gap: 10mm; }
.urkunde-inhalte.dichte-3 li { font-size: 9.5px; margin-bottom: .9mm; line-height: 1.35; }

.urkunde-inhalte-rest {
  list-style: none;
  font-style: italic;
  color: var(--papier-grau);
}

.urkunde-fuss {
  display: flex; justify-content: space-between; gap: 22px;
  margin-top: 0; padding-top: 16px;
  border-top: 1px solid var(--papier-linie);
  text-align: left; flex-wrap: wrap;
  flex: none;
}
.urkunde-fuss > div { min-width: 120px; }
.urkunde-label {
  display: block; font-size: 10.5px; color: var(--papier-grau);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px;
}
.urkunde-fuss b { font-size: 14px; }

table.data tr.stufe-erreicht { background: var(--brand-soft); }

/* Im Dunkelmodus bleibt die Urkunde hell - sie ist ein Dokument, kein
   Bildschirmelement, und wird so gedruckt wie sie aussieht. */
:root[data-theme="dark"] .urkunde { box-shadow: 0 12px 40px rgba(0, 0, 0, .6); }

/* Am Bildschirm herunterskalieren, wenn 297mm (rund 1122px) nicht passen.
   Die Bühnenhöhe wird mitgezogen, sonst bliebe Leerraum darunter stehen.
   Gedruckt wird davon nichts - dort gilt immer 1:1. */
@media (max-width: 1230px) {
  .urkunde { transform: scale(.78); }
  .urkunde-buehne { height: 164mm; }
}
@media (max-width: 980px) {
  .urkunde { transform: scale(.62); }
  .urkunde-buehne { height: 131mm; }
}
@media (max-width: 780px) {
  .urkunde { transform: scale(.46); }
  .urkunde-buehne { height: 97mm; }
}
@media (max-width: 560px) {
  .urkunde { transform: scale(.33); }
  .urkunde-buehne { height: 70mm; }
}

@media print {
  /* Randlos: das Blatt IST die Urkunde. */
  @page { size: A4 landscape; margin: 0; }

  .urkunde-buehne {
    height: auto; overflow: visible; display: block;
  }
  .urkunde {
    /* Keine Skalierung im Druck - die mm-Angaben treffen das Blatt exakt. */
    transform: none;
    box-shadow: none;
    width: 297mm; height: 210mm;
    margin: 0;
    break-inside: avoid; page-break-inside: avoid;
  }
  /* Flächen und Farben müssen mitgedruckt werden, sonst fehlen Siegel und
     Verlauf. Im Druckdialog zusätzlich "Hintergrundgrafiken" aktivieren. */
  .urkunde, .urkunde-rahmen, .urkunde-siegel, .urkunde-rahmen::before {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .no-print { display: none !important; }
}

/* --- Modal -------------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(12, 18, 28, .5);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 24px;
  animation: fadeIn .16s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%; max-width: 520px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  animation: modalIn .2s var(--ease);
}
.modal.wide { max-width: 760px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal > header {
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.modal > header h2 { font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal > footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--card-2);
  display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap;
}

/* --- Meldungen ---------------------------------------------------------- */

.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 80;
  display: flex; flex-direction: column; gap: 9px;
  max-width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  font-size: 13.5px;
  animation: toastIn .22s var(--ease);
  pointer-events: auto;
}
.toast.ok  { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast.leaving { animation: toastOut .18s var(--ease) forwards; }
.toast .toast-text { min-width: 0; word-break: break-word; }
/* Symbol der Meldung: feste Groesse und an der ersten Textzeile ausgerichtet. */
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.toast.ok svg  { color: var(--ok-ink); }
.toast.bad svg { color: var(--bad-ink); }
.toast.warn svg { color: var(--warn-ink); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

/* --- Kleinteile --------------------------------------------------------- */

.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; }

.key-reveal {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 13px;
  padding: 12px 14px;
  background: var(--bg-accent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  word-break: break-all;
  margin-bottom: 14px;
}

.divider { height: 1px; background: var(--line); margin: 22px 0; border: 0; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* --- Anpassung an kleine Bildschirme ------------------------------------ */

@media (max-width: 1000px) {
  .learn, .editor-cols { grid-template-columns: 1fr; }
  .learn-side, .lesson-tray { position: static; max-height: none; }
  .learn-side .side-list { max-height: 320px; }
  .md-editor { grid-template-columns: 1fr; }
  .md-editor textarea { border-right: 0; border-bottom: 1px solid var(--line); min-height: 320px; }
  .md-editor .md-preview { max-height: 400px; }
}

@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 0 13px; }
  .brand-sub, .user-chip .who { display: none; }
  .user-chip { padding: 5px; }
  .topnav { overflow-x: auto; }
  .topnav a { padding: 7px 10px; }
  .view { padding: 20px 14px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .learn-main .lesson-head, .learn-main .lesson-body, .lesson-foot { padding-left: 18px; padding-right: 18px; }
  .page-head h1 { font-size: 20px; }
  .menu { right: 13px; }
}

/* --- Ruhige Darstellung, wenn gewuenscht -------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Druck -------------------------------------------------------------- */

/* --- Versionsverlauf ---------------------------------------------------- */

.verlauf-cols {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.verlauf-liste { display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow-y: auto; }

.verlauf-eintrag {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  width: 100%; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); text-align: left; font: inherit;
  cursor: pointer;
  transition: background .14s var(--ease), border-color .14s var(--ease);
}
.verlauf-eintrag:hover { background: var(--bg-accent); }
.verlauf-eintrag.active { border-color: var(--brand-line); background: var(--brand-soft); }
/* Angefasste Loesungen sollen schon in der Liste ins Auge springen. */
.verlauf-eintrag.heikel { border-left: 3px solid var(--bad); }
.verlauf-zeile1 { display: flex; justify-content: space-between; gap: 10px; width: 100%; }

.diff-kopf { margin-bottom: 14px; }
.diff-kopf h3 { font-size: 16px; }

.diff-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.diff-block h4 {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; margin-bottom: 8px; color: var(--ink-soft);
}
.diff-zaehler { display: flex; gap: 8px; font-variant-numeric: tabular-nums; font-weight: 600; }
.diff-zaehler .plus { color: var(--ok-ink); }
.diff-zaehler .minus { color: var(--bad-ink); }

.diff-zeile {
  display: grid; grid-template-columns: 190px minmax(0, 1fr);
  gap: 10px; padding: 6px 0; align-items: baseline;
}
.diff-zeile + .diff-zeile { border-top: 1px dashed var(--line); }
.diff-feld { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.diff-zeile.heikel .diff-feld { color: var(--bad-ink); font-weight: 600; }

.diff-werte { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.diff-werte > span { overflow-wrap: anywhere; }
.diff-alt { color: var(--bad-ink); background: var(--bad-soft); padding: 1px 6px; border-radius: 5px; text-decoration: line-through; }
.diff-neu { color: var(--ok-ink); background: var(--ok-soft); padding: 1px 6px; border-radius: 5px; }
.diff-pfeil { color: var(--muted); display: inline-flex; }
.diff-pfeil svg { width: 13px; height: 13px; }

.diff-text {
  margin: 0; padding: 10px 12px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.55;
  overflow-x: auto; max-height: 420px; overflow-y: auto;
  white-space: pre;
}
.diff-text .dz { display: block; }
.diff-text .dz.rein { background: var(--ok-soft); color: var(--ok-ink); }
.diff-text .dz.raus { background: var(--bad-soft); color: var(--bad-ink); }
.diff-text .dz.luecke { color: var(--muted); font-style: italic; }

.diff-lektion { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.diff-lektion.neu { border-left: 3px solid var(--ok); }
.diff-lektion.entfernt { border-left: 3px solid var(--warn); }
.diff-lektion-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.diff-lektion .diff-block:first-of-type { border-top: 0; padding-top: 4px; }

.diff-frage { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--card-2); }
.diff-frage.heikel { background: var(--bad-soft); }
.diff-frage-kopf { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 4px; }

@media (max-width: 900px) {
  .verlauf-cols { grid-template-columns: 1fr; }
  .verlauf-liste { max-height: 320px; }
  .diff-zeile { grid-template-columns: 1fr; gap: 2px; }
}

/* --- Erscheinungsbild (Administration) ---------------------------------- */

.farbzeile { display: flex; align-items: center; gap: 10px; }
.farbwahl {
  width: 46px; height: 34px; padding: 2px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); cursor: pointer;
}
.logo-vorschau {
  display: flex; align-items: center; min-height: 44px; margin-bottom: 8px;
  padding: 6px 10px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--card-2);
}
.logo-vorschau img { max-height: 34px; max-width: 220px; }

.schalter { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.schalter input { margin-top: 2px; flex: none; }
.schalter span { display: flex; flex-direction: column; gap: 2px; }

/* --- Portmodul ---------------------------------------------------------- */

.filterleiste { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

.port-frage { margin-bottom: 16px; }
.port-frage h3 { font-size: 17px; margin-top: 8px; }

.port-optionen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.port-option {
  padding: 14px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink);
  font: inherit; font-size: 15px; cursor: pointer;
  transition: border-color .14s var(--ease), background .14s var(--ease);
}
.port-option:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.port-option:disabled { cursor: default; }
/* Auswertung: richtige Antwort immer gruen, auch wenn falsch geklickt wurde. */
.port-option.richtig { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-ink); }
.port-option.falsch  { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-ink); }

.port-hinweis { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.port-start { margin-bottom: 18px; }
.port-ergebnis h3 { font-size: 19px; margin-bottom: 6px; }
.port-ergebnis .pill-row { margin-top: 14px; }

@media (max-width: 700px) {
  .port-optionen { grid-template-columns: 1fr; }
}

/* --- Lernmodule: Uebersichtskarten und Regeln --------------------------- */

.modul-karten {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.modul-karte {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 17px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
  transition: border-color .14s var(--ease), transform .14s var(--ease);
}
.modul-karte:hover { border-color: var(--brand); transform: translateY(-1px); }
.modul-kopf { display: flex; align-items: flex-start; gap: 11px; }
.modul-symbol {
  width: 32px; height: 32px; flex: none;
  border-radius: 9px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
}
.modul-karte p { color: var(--ink-soft); margin: 0; }
.modul-fuss { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.regel { padding: 10px 0; }
.regel + .regel { border-top: 1px dashed var(--line); }
.regel p { margin: 3px 0 0; color: var(--ink-soft); }

/* --- Bewertungen und Meldungen ------------------------------------------ */

.sterne-anzeige { display: inline-flex; align-items: center; gap: 1px; white-space: nowrap; }
.sterne-anzeige .stern { color: var(--line); font-size: 13px; line-height: 1; }
.sterne-anzeige .stern.voll { color: #f0a92b; }

.sterne-wahl { display: flex; gap: 2px; margin: 8px 0 10px; }
.stern-knopf {
  border: 0; background: none; cursor: pointer; padding: 0 2px;
  font-size: 26px; line-height: 1; color: var(--line);
  transition: color .12s var(--ease), transform .12s var(--ease);
}
.stern-knopf:hover { transform: scale(1.12); }
.stern-knopf.voll, .stern-knopf.vorschau { color: #f0a92b; }

.bewertung-feld {
  margin: 18px 28px 24px;
  padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card-2);
}
.bewertung-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bewertung-feld textarea { width: 100%; margin-bottom: 10px; }
.bewertung-feld p { margin: 10px 0 0; }

.lesson-melden {
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  padding: 10px 28px 0;
}

.bewertung-zelle { display: flex; align-items: center; gap: 6px; }

.verteilung { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; max-width: 380px; }
.verteilung-zeile { display: grid; grid-template-columns: 32px 1fr 28px; align-items: center; gap: 8px; }
.verteilung-bahn { height: 8px; background: var(--bg-accent); border-radius: 99px; overflow: hidden; }
.verteilung-fuell { height: 100%; background: #f0a92b; border-radius: 99px; }

.kommentar { padding: 10px 0; border-top: 1px dashed var(--line); }
.kommentar-kopf { display: flex; align-items: center; gap: 10px; }
.kommentar p { margin: 4px 0 0; color: var(--ink-soft); }

.meldung.offen { border-left: 3px solid var(--warn); }
.meldung-kopf { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 8px; }
.meldung-text { white-space: pre-wrap; margin: 0 0 10px; }

@media (max-width: 700px) {
  .bewertung-feld, .lesson-melden { margin-left: 18px; margin-right: 18px; padding-left: 14px; padding-right: 14px; }
}

/* --- Benachrichtigungen -------------------------------------------------- */

.glocke-huelle { position: relative; display: inline-flex; }
.glocke { position: relative; }
.glocke.hat-neue { color: var(--brand); }
.glocke-zaehler {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px; background: var(--bad); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

.glocke-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: min(380px, calc(100vw - 32px));
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
  z-index: 60; overflow: hidden;
  animation: shakeIn .16s var(--ease);
}
.glocke-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px; border-bottom: 1px solid var(--line); background: var(--card-2);
}
.glocke-liste { max-height: 60vh; overflow-y: auto; }
.glocke-fuss { padding: 9px 13px; border-top: 1px solid var(--line); background: var(--card-2); }

.glocke-eintrag {
  display: flex; gap: 10px; width: 100%; text-align: left;
  padding: 11px 13px; border: 0; background: none; cursor: pointer; font: inherit;
  border-bottom: 1px solid var(--line);
}
.glocke-eintrag:hover { background: var(--bg-accent); }
/* Ungelesen: Markenfarbe am Rand statt fetter Schrift - bleibt ruhig. */
.glocke-eintrag.neu { box-shadow: inset 3px 0 0 var(--brand); }
.glocke-eintrag.neu.dringend { box-shadow: inset 3px 0 0 var(--bad); }
.glocke-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.glocke-text b { font-size: 13.5px; }
.glocke-symbol {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
}
.dringend .glocke-symbol { background: var(--bad-soft); color: var(--bad-ink); }

.benachrichtigungen { display: flex; flex-direction: column; gap: 10px; }
.benachrichtigung {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.benachrichtigung.neu { border-left: 3px solid var(--brand); }
.benachrichtigung.neu.dringend { border-left-color: var(--bad); }
.benachrichtigung-text { flex: 1; min-width: 0; }
.benachrichtigung-text p { margin: 3px 0; color: var(--ink-soft); }
.benachrichtigung-aktionen { display: flex; gap: 6px; align-items: center; flex: none; }

@media (max-width: 700px) {
  .glocke-panel { position: fixed; left: 16px; right: 16px; width: auto; top: 60px; }
  .benachrichtigung { flex-wrap: wrap; }
}

/* --- Sicherungen --------------------------------------------------------- */

.sicherung-kv {
  display: grid; gap: 14px; margin-top: 6px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.sicherung-code {
  margin: 0; padding: 12px 14px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.6; overflow-x: auto; white-space: pre;
}

/* --- Zuweisungen --------------------------------------------------------- */

.zuweisungs-gruppe + .zuweisungs-gruppe { margin-top: 14px; }
.gruppen-kopf {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--card-2);
}
.gruppen-kopf input { flex: none; }

.auswahl-leiste {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  border-radius: var(--radius-sm);
}

.zuweisen-spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.auswahl-liste {
  margin-top: 8px; max-height: 320px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
}
.auswahl-zeile {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; cursor: pointer;
}
.auswahl-zeile:hover { background: var(--bg-accent); }
.auswahl-zeile + .auswahl-zeile { border-top: 1px solid var(--line); }
.auswahl-zeile input { flex: none; }

@media (max-width: 800px) {
  .zuweisen-spalten { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .lesson-foot, .toasts, .learn-side, .quiz { display: none !important; }
  body { background: #fff; }
  .learn { grid-template-columns: 1fr; }
  .learn-main, .card { border: 1px solid #bbb; box-shadow: none; }
  .view { padding: 0; max-width: none; }
}

/* ==========================================================================
   Onboarding-Werkzeug: Ergaenzungen zum gemeinsamen Stylesheet.
   Alles darunter gehoert zum Fragebogen und kommt in der Lernplattform
   nicht vor. Farben, Radien und Abstaende stammen weiterhin von oben.
   ========================================================================== */

/* --- Kleine Helfer ------------------------------------------------------ */

.grow { flex: 1; min-width: 0; }
.stark { font-weight: 600; color: var(--ink); }

/* Ganze Tabellenzeile klickbar. Der Link in der ersten Spalte bleibt
   trotzdem ein echter Link - fuer Tastatur und "in neuem Tab oeffnen". */
tr.klickbar { cursor: pointer; }

.karten-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.karten-kopf h2 { margin: 0; }

/* --- Abschnittskacheln -------------------------------------------------- */

.grid-abschnitte {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.abschnitt-karte {
  display: block;
  padding: 16px 18px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease), transform .14s var(--ease);
}
.abschnitt-karte:hover {
  border-color: var(--brand-line);
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}
.abschnitt-karte.fertig { border-color: var(--ok-line); }

.abschnitt-kopf {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 12px;
}
.abschnitt-symbol {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
}
.abschnitt-symbol svg { width: 19px; height: 19px; }
.abschnitt-titel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.abschnitt-titel b { font-size: 15px; }
.abschnitt-titel span { font-size: 12.5px; line-height: 1.45; }
.abschnitt-fuss { margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.abschnitt-fuss.warn { color: var(--warn-ink); }

/* --- Felder im Fragebogen ----------------------------------------------- */

.feld-liste { display: flex; flex-direction: column; }
.feld + .feld { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }

.feld-kopf { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.feld-kopf .field-label { margin: 0; }
.feld > .hint { font-size: 12.5px; color: var(--muted); margin: 0 0 9px; line-height: 1.5; }
.feld > input,
.feld > select,
.feld > textarea { width: 100%; }
/* Kurze Werte brauchen kein Feld ueber die volle Breite - das laedt sonst
   dazu ein, eine PLZ in ein Textfeld von 700 px zu tippen. */
.feld-zahl > input,
.feld-datum > input { max-width: 220px; }
.feld-auswahl > select,
.feld-janein > select { max-width: 420px; }

.mehrfach {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.mehrfach-option {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  cursor: pointer;
  padding: 5px 0;
}
.mehrfach-option input { flex: none; }

/* --- Tabellenfeld ------------------------------------------------------- */

.liste-feld { margin-top: 4px; }
.liste-feld > .table-wrap { border: 1px solid var(--line); border-radius: var(--radius-md); }
.liste-feld > .btn { margin-top: 10px; }

.liste-tabelle { width: 100%; border-collapse: collapse; }
.liste-tabelle th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--card-2);
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.liste-tabelle td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.liste-tabelle tr:last-child td { border-bottom: 0; }
.liste-tabelle input,
.liste-tabelle select,
.liste-tabelle textarea {
  width: 100%;
  min-width: 120px;
  padding: 7px 9px;
  font-size: 13px;
}
.liste-tabelle .zeilen-aktion { width: 44px; text-align: right; }

/* --- Speicherstand ------------------------------------------------------ */

.speicher-leiste {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 11px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  font-size: 13px;
}
.speicher-punkt {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
}
.speicher-status { color: var(--muted); }
.speicher-status.gespeichert { color: var(--ok-ink); }
.speicher-status.offen,
.speicher-status.speichert { color: var(--warn-ink); }
.speicher-status.fehler { color: var(--bad-ink); font-weight: 600; }
/* Der Punkt faerbt sich mit - er ist aus dem Augenwinkel schneller zu
   erfassen als der Text daneben. */
.speicher-leiste:has(.speicher-status.offen) .speicher-punkt,
.speicher-leiste:has(.speicher-status.speichert) .speicher-punkt { background: var(--warn); }
.speicher-leiste:has(.speicher-status.fehler) .speicher-punkt { background: var(--bad); }

/* --- Blaettern zwischen Abschnitten ------------------------------------- */

.blaettern {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

@media (max-width: 640px) {
  .grid-abschnitte { grid-template-columns: 1fr; }
  .blaettern { flex-direction: column; }
  .blaettern .btn { width: 100%; justify-content: center; }
}

/* --- Meldungen ---------------------------------------------------------- */

/* Offenes Pflichtfeld sichtbar machen. Ein Zaehler am Fuss allein hilft
   nicht - man muss sehen, WO die Angabe fehlt. */
.feld.pflicht.fehlt {
  border-left: 3px solid var(--warn);
  margin-left: -14px;
  padding-left: 11px;
}
.feld.pflicht.fehlt .field-label { color: var(--warn-ink); }

/* Zusammenfassung einer abgeschickten Meldung: Beschriftung links, Wert
   rechts. Auf schmalen Fenstern untereinander, sonst wird es unlesbar. */
dl.werte {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 10px 20px;
  margin: 0;
  align-items: start;
}
dl.werte dt {
  font-size: 13px;
  color: var(--muted);
  padding-top: 1px;
}
dl.werte dd { margin: 0; font-size: 14px; }
/* Trennlinie ueber BEIDE Spalten derselben Zeile - deshalb dt und das
   zugehoerige dd gemeinsam, nicht die Zeile (ein dl kennt keine Zeilen). */
dl.werte dt:not(:first-of-type),
dl.werte dt:not(:first-of-type) + dd {
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

.mehrzeilig-wert { white-space: pre-wrap; }

/* Bearbeitungsleiste: hebt sich vom Formular ab, damit klar ist, was der
   Kunde sieht und was nur wir. */
.card.bearbeitung {
  border-color: var(--brand-line);
  background: linear-gradient(var(--brand-soft), var(--brand-soft)) padding-box, var(--card);
}
.card.bearbeitung .sicherung-kv { font-size: 13px; }

@media (max-width: 720px) {
  dl.werte { grid-template-columns: 1fr; gap: 2px; }
  dl.werte dt:not(:first-of-type) { padding-top: 11px; }
  dl.werte dt:not(:first-of-type) + dd { border-top: 0; padding-top: 0; }
  dl.werte dd { margin-bottom: 10px; }
}

/* --- Module und Formular-Editor ----------------------------------------- */

.modul-zeile { padding: 14px 0; border-top: 1px solid var(--line); }
.modul-zeile:first-of-type { border-top: 0; }
.modul-zeile > p { margin: 8px 0 0 28px; line-height: 1.55; }

/* Ausgeblendete Abschnitte und Felder: sichtbar, aber erkennbar stillgelegt.
   Loeschen ist keine Option, solange Angaben daran haengen. */
.card.ausgeblendet { border-style: dashed; }
.card.ausgeblendet > .karten-kopf h2 { color: var(--muted); }
tr.ausgeblendet td { opacity: .6; }
tr.ausgeblendet td:first-child b { text-decoration: line-through; }

.spalten-liste { display: flex; flex-direction: column; gap: 8px; }
.spalten-zeile { display: flex; gap: 8px; align-items: center; }
.spalten-zeile input { flex: 1 1 auto; min-width: 0; }
.spalten-zeile select { flex: 0 1 190px; }

/* Nur-Lese-Felder in der Mailvorschau: sichtbar als "zum Kopieren, nicht zum
   Tippen". Ohne das wirken sie wie ein kaputtes Eingabefeld. */
input[readonly], textarea[readonly] {
  background: var(--card-2);
  color: var(--ink-soft);
  cursor: text;
}
textarea[readonly].mono { font-size: 12.5px; line-height: 1.5; white-space: pre; }

/* Trenner zwischen Passwort- und Microsoft-Anmeldung. Eine Linie mit dem Wort
   "oder" darin - macht klar, dass es ZWEI Wege sind und nicht zwei Schritte. */
.oder-trenner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.oder-trenner::before,
.oder-trenner::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

/* Knoepfe mit dem Microsoft-Logo: das SVG darf nicht von der Schriftfarbe
   eingefaerbt werden, deshalb kein "currentColor" und etwas Abstand. */
.btn svg[viewBox="0 0 21 21"] { flex: 0 0 auto; }

.verknuepfung-zeile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.verknuepfung-zeile:first-of-type { border-top: 0; }

/* Nummerierte Anleitung (Einrichtung im Entra-Portal). Etwas luftiger als eine
   nackte <ol>, damit sich die Schritte beim Abarbeiten auseinanderhalten. */
ol.schritte { margin: 6px 0 14px; padding-left: 22px; line-height: 1.6; }
ol.schritte > li { margin-bottom: 7px; }
ol.schritte > li:last-child { margin-bottom: 0; }

/* --- Anleitung ---------------------------------------------------------- */

/* Aufklappbare Abschnitte: Die ganze Anleitung am Stück wäre eine Wand. Was
   noch offen ist, steht offen (siehe views/anleitung.js). */
.anleitung-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}
.anleitung-block > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  cursor: pointer;
  background: var(--card-2);
  /* Der Standardpfeil sitzt in jedem Browser anders - eigener unten. */
  list-style: none;
}
.anleitung-block > summary::-webkit-details-marker { display: none; }
.anleitung-block > summary::after {
  content: "▸";
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  transition: transform .15s ease;
}
.anleitung-block[open] > summary::after { transform: rotate(90deg); }
.anleitung-block > summary:hover { background: var(--brand-soft); }
.anleitung-titel { font-weight: 600; font-size: 15px; }
.anleitung-inhalt { padding: 4px 20px 20px; border-top: 1px solid var(--line); }
.anleitung-inhalt h3 {
  font-size: 13.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 20px 0 8px;
}
.anleitung-inhalt > p:first-child { margin-top: 14px; }
.anleitung-inhalt p { line-height: 1.65; }

ul.aufzaehlung { margin: 6px 0 14px; padding-left: 20px; line-height: 1.65; }
ul.aufzaehlung > li { margin-bottom: 8px; }
ul.aufzaehlung > li:last-child { margin-bottom: 0; }

/* Wert zum Abschreiben plus Kopierknopf - der häufigste Handgriff auf dieser
   Seite, deshalb nicht in einer Tabelle versteckt. */
.kopierzeile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0;
}
.kopierzeile code { font-size: 13px; }

pre.klein {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

/* In der Anleitung trägt eine Kachel eine Pille statt einer Zahl. */
.stat .v.pillenwert { font-size: 14px; font-weight: 500; }

/* ======================================================================== *
 * Bedienung mit dem Finger (Handy und Tablet)                              *
 * ======================================================================== *
 *
 * Bewusst als EIN Block ganz am Ende: So gewinnt er gegen die Regeln weiter
 * oben, ohne dass eine davon angefasst werden muss - und wer ihn wieder
 * herausnehmen will, loescht genau diesen Abschnitt.
 *
 * Ausloeser ist `pointer: coarse` UND zusaetzlich eine Breitenregel:
 *
 *  - `pointer: coarse` trifft Finger statt Maus, unabhaengig von der Breite.
 *    Ein iPad im Querformat ist 1024 px breit und braucht die Korrekturen
 *    trotzdem - eine reine Breitenregel wuerde es verfehlen.
 *  - `max-width: 700px` fuer den Fall, dass ein Geraet sich nicht als
 *    Fingergeraet meldet (aeltere Android-Browser, Geraete-Emulation im
 *    Entwicklerwerkzeug).
 *
 * Am Schreibtisch aendert sich dadurch nichts.
 */
@media (pointer: coarse), (max-width: 700px) {
  /**
   * 16px ist keine Geschmacksfrage, sondern eine Grenze:
   *
   * Safari auf dem iPhone ZOOMT die Seite automatisch hinein, sobald ein
   * angetipptes Eingabefeld kleiner als 16px schreibt - und zoomt danach nicht
   * von selbst zurueck. Der Nutzer muss jedes Mal wieder herauswischen. Bei
   * einem Meldeformular mit ueber 50 Feldern ist das der Unterschied zwischen
   * "geht am Handy" und "mache ich lieber spaeter am Rechner".
   *
   * Die Felder erben ihre Groesse ueber `font: inherit` vom body (15px) - hier
   * wird sie deshalb ausdruecklich gesetzt.
   */
  input[type="text"], input[type="password"], input[type="email"],
  input[type="date"], input[type="number"], input[type="tel"],
  input[type="search"], select, textarea {
    font-size: 16px;
  }

  /**
   * Ankreuz- und Auswahlfelder kommen sonst in Browservorgabe daher: 13x13 px.
   * WCAG 2.5.8 verlangt mindestens 24x24 px, Apple und Google empfehlen 44
   * bzw. 48. 22px plus der vergroesserte Klickbereich des Labels (unten)
   * bringen das in einen Bereich, in dem man nicht mehr zielen muss.
   */
  input[type="checkbox"], input[type="radio"] {
    width: 22px;
    height: 22px;
    /* Ohne accent-color wirkt ein vergroessertes Kaestchen in manchen Browsern
       ausgegraut, weil nur der Rahmen mitwaechst. */
    accent-color: var(--brand);
  }

  /* Das Label IST die Trefferflaeche - nicht nur das Kaestchen daneben. */
  .schalter { min-height: 44px; align-items: center; }
  .schalter input { margin-top: 0; }

  /* Mehrfachauswahl im Meldeformular ("Welche Zugaenge?"). Das tippt der Kunde,
     nicht wir - hier lohnt die vollen 44px. */
  .mehrfach-option { min-height: 44px; }

  /**
   * Knopfhoehe. `min-height` statt `height`, damit ein Knopf mit umbrechender
   * Beschriftung weiter mitwachsen kann. Die Breite bleibt unangetastet -
   * feste Breiten waeren genau der Weg, auf dem eine Knopfreihe unschoen
   * umbricht.
   */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }

  /* Filter-Pillen ueber den Listen: dieselbe Ueberlegung, etwas knapper, weil
     sie in Reihen stehen und sonst viel Platz kosten. */
  .chip { min-height: 36px; display: inline-flex; align-items: center; }

  /* Symbolknoepfe (Design umschalten, Kontomenue) waren 34x34 bzw. 38x38. */
  .icon-btn { min-width: 44px; min-height: 44px; }
}
