  /* Projekt-Anpassung: Design-System "Halo" (Designvorlagen/DESIGN.md) statt des
     mitgelieferten Astute-Portals-Farbschemas — matte, deckende Flächen statt
     Farbverlauf + Glasmorphismus; ein Indigo-Akzent statt Blau; drei klar
     gestufte, deckende Oberflächen-Ebenen (Hintergrund -> Fläche -> erhöht)
     statt teiltransparenter Karten mit Weichzeichner. Überschreibt die
     Design-System-Tokens gezielt, ohne die geteilten Token-Dateien selbst anzufassen. */
  :root {
    --bg-base: #0A0B0F;
    --bg-alt: #14151C;
    --surface-card: #14151C;
    --surface-raised: #1E2029;
    --surface-hover: #1E2029;
    --surface-tile: #14151C;
    --glass-blur: none;
    --glow-accent: none;
    --blur-glow: none;
    --content-max: 1440px;

    /* ---- Halo: Akzent (Indigo statt Blau), Status- und Textfarben ---- */
    --accent: #5B6BFF;
    --accent-hover: #7886FF;
    --accent-pressed: #4A59E6;
    --accent-soft: rgba(91, 107, 255, .14);
    --accent-ring: rgba(91, 107, 255, .35);
    --success: #2BE08C;
    --info: #3DD7E5;
    --warning: #F5D547;
    --danger: #FF3A5C;
    --text-primary: #F2F4F8;
    --text-body: #D3D7DE;
    --text-secondary: #9AA0AE;
    --text-muted: #5C6170;
    --text-on-accent: #FFFFFF;
    --border: #2A2D38;
    --border-weak: rgba(245, 244, 248, .06);
    --border-strong: #3A3D4A;

    /* ---- Halo: Radien (etwas kompakter als das Astute-Original) ---- */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-xl: 24px;

    /* ---- Halo: zurückhaltende Schatten statt Weichzeichner-Karten — Tiefe kommt
       aus der Oberflächen-Stufe + Haarlinie, Schatten nur noch dezent bei Hover/
       schwebenden Elementen (Modal, Popover). */
    --shadow-hairline-top: 0 1px 0 rgba(255,255,255,.02) inset, 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 8px 24px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.03) inset;
    --shadow-lg: 0 24px 60px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.04) inset;
    --ring: 0 0 0 3px var(--accent-ring);

    /* ---- Halo: Inter (Grotesk) für alles, JetBrains Mono für Zahlen/Kennwerte
       (ersetzt Archivo/Newsreader) — Einbindung via Google Fonts in index.html. */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-serif: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  }

  *, *::before, *::after { box-sizing: border-box; }
  /* Ohne das hier gewinnt jede Klasse mit eigenem "display" (z. B. .paragraph-list,
     .accordion-list mit display:flex) gegen die UA-Regel [hidden]{display:none},
     weil Autor-Styles Vorrang vor User-Agent-Styles haben — Elemente mit dem
     hidden-Attribut blieben dann sichtbar, obwohl sie zu sein sollten. */
  [hidden] { display: none !important; }
  /* Reserviert die Scrollbar-Spur dauerhaft: ohne das hier verschwindet/erscheint
     die Scrollbar je nach Höhe der aktiven Ebene (Übersicht/Lernfeld/Kapitel haben
     stark unterschiedliche Seitenlängen), was bei jedem Kachel-Wechsel die ganze
     Seite inkl. Sidebar für einen Frame seitlich verschiebt ("springt"). scrollbar-
     gutter wäre die modernere Lösung, wird von Safari aber nicht unterstützt —
     overflow-y: scroll läuft überall gleich und erreicht dasselbe. */
  html { overflow-y: scroll; }
  html, body { margin: 0; padding: 0; }
  body {
    background: var(--bg-base);
    color: var(--text-primary);
    font: var(--fw-regular) var(--fs-body)/var(--lh-relaxed) var(--font-sans);
    -webkit-font-smoothing: antialiased;
  }
  a { color: var(--accent); }
  h1, h2, h3 { margin: 0; font-family: var(--font-sans); font-weight: var(--fw-semibold); letter-spacing: var(--ls-heading); }
  p { margin: 0; }
  button, input, select { font-family: var(--font-sans); }
  ::selection { background: var(--accent-soft); }

  .accent-italic { font-family: var(--font-serif); font-style: italic; font-weight: var(--fw-regular); }

  .eyebrow {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
    color: var(--text-muted);
  }

  a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
  [tabindex]:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: var(--r-sm);
  }

  /* ---- Buttons ---- */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    border-radius: var(--r-pill);
    padding: var(--sp-3) var(--sp-5);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
  }
  .btn:active { transform: translateY(1px); }
  .btn-primary { background: var(--accent); color: var(--text-on-accent); }
  .btn-primary:hover { background: var(--accent-hover); }
  .btn-ghost { background: transparent; border-color: var(--border); color: var(--text-primary); }
  .btn-ghost:hover { background: var(--surface-hover); }
  .btn-block { width: 100%; }
  .btn-sm { padding: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); }

  /* ---- Cards ---- */
  .card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-hairline-top);
    padding: var(--sp-5);
  }
  .card-interactive {
    cursor: pointer;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  }
  .card-interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
  }

  /* ---- Badge / Tag ---- */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    white-space: nowrap;
  }
  .badge-accent { background: var(--accent-soft); border-color: transparent; color: var(--text-primary); }

  /* ---- Progress ---- */
  .progress-track { height: 6px; border-radius: 999px; background: var(--surface-raised); overflow: hidden; }
  .progress-fill { height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--dur-slow) var(--ease); }

  /* ---- Callout ---- */
  .callout {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--r-md);
    background: var(--surface-raised);
    border-left: 3px solid var(--info);
  }
  .callout svg { color: var(--info); flex-shrink: 0; margin-top: 2px; }
  .callout p { font-size: var(--fs-sm); color: var(--text-body); line-height: var(--lh-relaxed); }
  .callout strong { color: var(--text-primary); font-weight: var(--fw-medium); }

  /* ---- Inputs ---- */
  .field { display: flex; flex-direction: column; gap: var(--sp-2); }
  .field label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-secondary); }
  .field input, .field select {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-4);
    color: var(--text-primary);
    font-size: var(--fs-body);
  }
  .field input::placeholder { color: var(--text-muted); }

  /* ---- Switch ---- */
  .switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-4) 0; border-bottom: 1px solid var(--border-weak); }
  .switch-row:last-child { border-bottom: none; }
  .switch-row .switch-label { font-weight: var(--fw-medium); }
  .switch-row .switch-desc { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }
  .switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
  .switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
  .switch .track { position: absolute; inset: 0; background: var(--surface-hover); border: 1px solid var(--border); border-radius: 999px; transition: background var(--dur) var(--ease); }
  .switch .thumb { position: absolute; top: 2px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-secondary); transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
  .switch input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
  .switch input:checked + .track + .thumb { transform: translateX(18px); background: var(--accent); }

  /* ---- Layout: Topbar + Sidebar ---- */
  .topbar {
    position: sticky; top: 0; z-index: 40;
    min-height: 68px;
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-2) var(--sp-5);
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-weak);
  }
  .wordmark { display: flex; flex-direction: column; line-height: 1.15; cursor: pointer; background: none; border: none; padding: 0; text-align: left; }
  .wordmark .w1 { font: var(--fw-bold) 16px/1.15 var(--font-sans); color: var(--text-primary); letter-spacing: var(--ls-normal); }
  .wordmark .w2 { font: var(--fw-regular) 11px/1.2 var(--font-sans); color: var(--text-muted); letter-spacing: var(--ls-normal); margin-top: 3px; }

  /* ---- Fußzeile: Firmenmarke tritt bewusst zurück ---- */
  .app-footer {
    padding: var(--sp-5) var(--sp-6);
    border-top: 1px solid var(--border-weak);
    text-align: center;
  }
  .app-footer p { font-size: var(--fs-xs); color: var(--text-muted); }
  .app-footer .footer-brand { font-weight: var(--fw-medium); color: var(--text-secondary); }
  .topbar-actions { display: flex; align-items: center; gap: var(--sp-3); }
  .icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 999px;
    background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
    cursor: pointer; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .icon-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
  .avatar { width: 38px; height: 38px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-hover); display: flex; align-items: center; justify-content: center; font-weight: var(--fw-semibold); font-size: var(--fs-sm); }

  .app-body { display: flex; min-height: calc(100vh - 64px); padding-left: 240px; }
  /* Matte Flächen statt Verlauf/Sheen (Halo): Sidebar bleibt dieselbe deckende
     Grundfarbe wie die Seite, Abgrenzung ausschließlich über die Haarlinie. */
  .sidebar {
    width: 240px; flex-shrink: 0;
    padding: var(--sp-5) var(--sp-3);
    background: var(--bg-base);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; gap: var(--sp-1);
    /* position: fixed statt sticky — sticky brach in der Praxis beim Scrollen
       innerhalb eines langen Lernfelds ab; fixed pinnt die Sidebar unabhängig
       von jeder Scroll-Ancestor-Eigenart garantiert an Ort und Stelle.
       .app-body reserviert dafür 240px padding-left (siehe dort). */
    position: fixed; top: 64px; left: 0; z-index: 35;
    height: calc(100vh - 64px); overflow-y: auto;
  }
  .sidebar-back {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3);
    border-radius: var(--r-md); border: 1px solid rgba(245,244,247,.1);
    color: var(--text-secondary); font-size: var(--fs-sm); font-weight: var(--fw-medium);
    cursor: pointer; background: rgba(245,244,247,.03); text-align: left; width: 100%;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .sidebar-back:hover { background: rgba(245,244,247,.08); color: var(--text-primary); }
  /* Fester, weicher Leuchtfleck hinter der ganzen App — die Glasflächen der
     Karten/Kacheln bekommen dadurch etwas, das durchscheint, statt nur dunkel-
     transparent auf Dunkel zu liegen. */
  body::before {
    content: ""; position: fixed; inset: 0; z-index: -1;
    background: var(--glow-accent); filter: var(--blur-glow);
    pointer-events: none;
  }
  .nav-item {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    color: var(--text-secondary);
    font-size: var(--fs-sm); font-weight: var(--fw-medium);
    cursor: pointer; border: none; background: none; text-align: left; width: 100%;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
  .nav-item:hover { background: var(--surface-hover); color: var(--text-primary); }
  .nav-item.active { background: var(--accent-soft); color: var(--text-primary); }

  .main { flex: 1; padding: var(--sp-7) var(--sp-6); max-width: var(--content-max); margin: 0 auto; width: 100%; }

  /* ---- Views ---- */
  .view { display: none; }
  .view.active { display: block; }

  /* ---- Login ---- */
  #view-login.active { display: flex; min-height: 100vh; }
  .login-editorial {
    flex: 1.1; position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: center;
    padding: var(--sp-8) var(--sp-8);
    background: var(--bg-alt);
  }
  .login-editorial::before {
    content: ""; position: absolute; inset: 0;
    background: var(--glow-accent); filter: var(--blur-glow);
    pointer-events: none;
  }
  .login-editorial > * { position: relative; z-index: 1; }
  .login-editorial h1 { font: var(--fw-semibold) var(--fs-display)/var(--lh-tight) var(--font-sans); letter-spacing: var(--ls-display); max-width: 640px; }
  .login-editorial p.lede { margin-top: var(--sp-5); font-size: var(--fs-lg); color: var(--text-secondary); max-width: 480px; line-height: var(--lh-relaxed); }
  .login-form-pane { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--sp-6); }
  .login-form-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: var(--sp-5); }
  .login-form-card form { display: flex; flex-direction: column; gap: var(--sp-4); }

  /* ---- Übersicht ---- */
  .stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4); margin: var(--sp-6) 0; }
  .stat-card .stat-value { font: var(--fw-semibold) 32px/1 var(--font-mono); letter-spacing: 0; margin-top: var(--sp-2); }
  .stat-card .stat-label { font-size: var(--fs-sm); color: var(--text-muted); }

  /* ---- Pfad-Leiste: Dashboard-Sprung + klickbarer Breadcrumb ---- */
  .crumb-bar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
  .crumb-home {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--r-md); flex-shrink: 0;
    background: var(--surface-raised); border: 1px solid var(--border); color: var(--text-secondary);
    cursor: pointer; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .crumb-home:hover { background: var(--surface-hover); color: var(--text-primary); }
  .breadcrumb { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
  .breadcrumb .crumb-sep { color: var(--text-muted); flex-shrink: 0; }
  .crumb-item {
    font-size: var(--fs-sm); font-weight: var(--fw-medium);
    background: none; border: none; padding: var(--sp-1) var(--sp-2); margin: calc(var(--sp-1) * -1) calc(var(--sp-2) * -1);
    border-radius: var(--r-sm); cursor: pointer; color: var(--text-muted);
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
    max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  button.crumb-item:hover { background: var(--surface-hover); color: var(--text-primary); }
  .crumb-item.current { color: var(--text-primary); cursor: default; font-weight: var(--fw-semibold); }

  /* ---- Ebenen-Slider: Ämter -> Lernfelder -> Kapitel, horizontal geschoben ---- */
  /* Jede Ebene liegt absolut übereinander und wird per transform seitlich
     herausgeschoben — nur die aktive Ebene bestimmt die (animierte) Höhe des
     Viewports, sonst "springt" die Seite (und mit ihr die Sidebar) beim
     Wechsel zwischen unterschiedlich hohen Ebenen. */
  .screen-viewport { position: relative; overflow: hidden; transition: height var(--dur-slow) var(--ease); }
  .screen-pane { position: absolute; top: 0; left: 0; width: 100%; transition: transform var(--dur-slow) var(--ease); }

  /* ---- Kachelraster: Lernfeld-Kacheln (Baustein-Auswahl, Lektionen im Amt), einheitliche
     Höhe, max. 4 pro Zeile. Die Ämter-Übersicht selbst ist keine Kachel mehr, siehe .amt-list. */
  .tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); align-items: stretch; }
  @media (max-width: 1180px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }
  @media (max-width: 860px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
  @media (max-width: 560px) { .tile-grid { grid-template-columns: 1fr; } }
  .tile-group-label {
    font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted);
    letter-spacing: var(--ls-wide); padding: var(--sp-3) 0 var(--sp-1);
    border-bottom: 1px solid var(--border-weak); margin-bottom: var(--sp-1);
  }
  .tile-group-label:first-child { padding-top: 0; }
  .tile-card {
    height: 100%; min-height: 190px;
    background: var(--surface-tile);
    border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-hairline-top); padding: var(--sp-5);
    display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2);
    text-align: left; font: inherit; color: inherit; cursor: pointer;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  }
  .tile-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
  .tile-card.locked { cursor: default; opacity: .55; }
  .tile-card.locked:hover { transform: none; box-shadow: var(--shadow-hairline-top); border-color: var(--border); }
  .tile-title { font-weight: var(--fw-medium); color: var(--text-primary); }
  .tile-desc {
    font-size: var(--fs-sm); color: var(--text-secondary); line-height: var(--lh-relaxed);
    display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }

  /* ---- Ämter-Übersicht: schlanke, gegliederte Textliste statt Kachel-Raster (Vorbild:
     Amtsverzeichnis-Seiten wie freiburg.de/amtsaufbau) — unser dunkler Hintergrund,
     feine Trennlinien statt Kachel-Rahmen. Querschnittsthemen/Gremien stehen als eigene
     Gruppen vorneweg, "Ämter" folgt alphabetisch mit Buchstaben-Reitern wie Glossar/Behörden. */
  .amt-list { display: flex; flex-direction: column; padding-bottom: var(--sp-8); }
  .amt-group-heading {
    font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--accent-hover);
    text-transform: uppercase; letter-spacing: var(--ls-wide);
    padding: var(--sp-8) 0 var(--sp-3);
  }
  .amt-group-heading:first-child { padding-top: 0; }
  .amt-row {
    display: flex; align-items: center; gap: var(--sp-3);
    width: 100%; text-align: left; font: inherit; color: var(--text-primary);
    background: transparent; border: none; border-bottom: 1px solid var(--border-weak);
    padding: var(--sp-4) var(--sp-2); cursor: pointer;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  }
  .amt-row:hover { background: var(--surface-hover); border-color: var(--border-strong); }
  .amt-row-icon {
    width: 30px; height: 30px; border-radius: var(--r-md); flex-shrink: 0;
    background: var(--accent-soft); color: var(--accent-hover);
    display: flex; align-items: center; justify-content: center;
  }
  .amt-row-title { font-weight: var(--fw-medium); flex: 1; }
  .amt-row-tag { font-size: var(--fs-xs); font-family: var(--font-mono); color: var(--text-muted); flex-shrink: 0; }
  .amt-row-chevron { color: var(--text-muted); flex-shrink: 0; }
  /* Markiert Fachbereiche mit mindestens einer geschriebenen (nicht gesperrten) Lektion,
     damit man sie im Amt-Browser auf einen Blick von den noch leeren Themen unterscheiden
     kann, statt jedes Mal neu nachzuschauen. */
  .amt-row.has-content { border-left: 2px solid rgba(255,58,92,.5); padding-left: calc(var(--sp-2) - 2px); }
  .amt-row.has-content:hover { border-left-color: rgba(255,58,92,.75); }

  /* ---- Baustein-Auswahl: eigener Einstieg vor dem Dashboard ---- */
  .baustein-page-body { flex: 1; padding: var(--sp-8) var(--sp-6); max-width: var(--content-max); margin: 0 auto; width: 100%; }
  .baustein-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5);
    margin-top: var(--sp-7); align-items: stretch;
  }
  @media (max-width: 980px) { .baustein-grid { grid-template-columns: repeat(2, 1fr); } }
  @media (max-width: 620px) { .baustein-grid { grid-template-columns: 1fr; } }
  .baustein-tile {
    min-height: 220px;
    border-top: 3px solid var(--baustein-color, var(--accent));
  }
  .baustein-tile .tile-icon {
    width: 40px; height: 40px; border-radius: var(--r-md);
    background: color-mix(in srgb, var(--baustein-color, var(--accent)) 18%, transparent);
    color: var(--baustein-color, var(--accent));
    display: flex; align-items: center; justify-content: center; margin-bottom: var(--sp-1);
  }
  .baustein-tile .tile-title { font-size: var(--fs-lg); }
  .baustein-tile .tile-desc { -webkit-line-clamp: 4; line-clamp: 4; }
  .baustein-tile .badge { margin-top: auto; }
  .amt-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-5); flex-wrap: wrap; margin-bottom: var(--sp-5); }
  .amt-detail-head h2 { font-size: var(--fs-h2); }
  .amt-detail-head p { color: var(--text-secondary); margin-top: var(--sp-2); max-width: 640px; }

  /* ---- Amt-Detail: Steckbrief oben (volle Breite), Lernfeld-Kacheln darunter ---- */
  /* Vorher standen Steckbrief und Kacheln nebeneinander, mit den Kacheln in einer
     eigenen, höhenbegrenzten Scrollbox (Versuch, den Steckbrief beim Scrollen "stehen"
     zu lassen — #screen-viewport braucht overflow:hidden für den Slide-Effekt, das
     verhindert echtes position:sticky). Das schnitt Kacheln ab und ließ Hover-Schatten
     an der Boxkante verschwinden. Jetzt: beides läuft in einer Spalte auf voller
     Seitenbreite und scrollt normal mit der Seite. */
  .amt-split { display: flex; flex-direction: column; gap: var(--sp-6); margin-top: var(--sp-6); }
  .amt-split .steckbrief { margin-bottom: 0; }

  /* ---- Amt-Steckbrief ---- */
  .steckbrief { margin-bottom: var(--sp-6); border-left: 3px solid var(--accent); }
  .steckbrief-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
  .steckbrief-head h3 { font-size: var(--fs-lg); }
  .aufgabentyp-badge { font-size: var(--fs-xs); font-weight: var(--fw-medium); padding: 4px 12px; border-radius: var(--r-pill); }
  .aufgabentyp-badge.pflicht { background: var(--danger); color: #FFF5F4; }
  .aufgabentyp-badge.weisung { background: var(--warning); color: #211804; }
  .aufgabentyp-badge.freiwillig { background: var(--success); color: #F0FFFC; }
  .aufgabentyp-badge.gemischt { background: var(--accent); color: #F2F3FF; }
  .example-box { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); margin-top: var(--sp-4); }
  .example-box .example-label { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--accent-hover); text-transform: uppercase; letter-spacing: var(--ls-wide); margin-bottom: var(--sp-2); }
  .example-box p { font-size: var(--fs-sm); color: var(--text-body); line-height: var(--lh-relaxed); }
  .steckbrief-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
  .steckbrief-row { display: flex; flex-direction: column; gap: var(--sp-1); }
  .steckbrief-row .steckbrief-label { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--ls-wide); }
  .steckbrief-row p { font-size: var(--fs-sm); color: var(--text-body); line-height: var(--lh-relaxed); }
  /* ---- Lernfeld-Liste innerhalb eines Amts: schlanke Zeilen statt Kacheln, gleiches
     Muster wie Ämter-Übersicht/Glossar/Behörden. ---- */
  .lesson-list { display: flex; flex-direction: column; padding-bottom: var(--sp-4); }
  .lesson-row {
    display: flex; align-items: center; gap: var(--sp-3);
    border-bottom: 1px solid var(--border-weak);
    padding: var(--sp-3) var(--sp-2); cursor: pointer;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  }
  .lesson-row:hover { background: var(--surface-hover); }
  .lesson-row.locked { cursor: default; opacity: .55; }
  .lesson-row.locked:hover { background: transparent; }
  .lesson-row-title { font-weight: var(--fw-medium); color: var(--text-primary); flex: 1; }
  .lesson-row .lesson-meta { font-size: var(--fs-xs); color: var(--text-muted); flex-shrink: 0; }
  .lesson-row .lesson-status { width: 28px; height: 28px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .lesson-row .lesson-status.done { background: var(--success); color: var(--text-on-accent); }
  .lesson-row .lesson-status.available { background: var(--accent); color: var(--text-on-accent); }
  .lesson-row .lesson-status.locked { background: var(--surface-raised); color: var(--text-muted); border: 1px solid var(--border); }
  /* Rot = besucht, aber noch nicht bestanden; Grün = bestanden. Ein verfügbares,
     aber nie geöffnetes Kapitel bekommt bewusst keine Farbmarkierung. */
  .lesson-row.progress-open { border-left: 2px solid rgba(255,58,92,.5); padding-left: calc(var(--sp-2) - 2px); }
  .lesson-row.progress-done { border-left: 2px solid rgba(43,224,140,.5); padding-left: calc(var(--sp-2) - 2px); }

  /* ---- Einstellungen ---- */
  .settings-group { margin-bottom: var(--sp-6); }
  .settings-group h2 { font-size: var(--fs-h3); margin-bottom: var(--sp-2); }
  .settings-group .settings-group-desc { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-2); }

  .section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-2); flex-wrap: wrap; }

  /* ---- Kapitel-Reader ---- */
  .kapitel-intro { font-size: var(--fs-lg); color: var(--text-body); line-height: var(--lh-relaxed); }
  .kapitel-section h2 { font-size: var(--fs-h3); margin-bottom: var(--sp-3); }
  .kapitel-section p { font-size: var(--fs-body); color: var(--text-body); line-height: var(--lh-relaxed); }
  .law-ref {
    display: inline;
    color: var(--accent-hover);
    background: var(--accent-soft);
    border-radius: 4px;
    padding: 1px 5px;
    cursor: pointer;
    border: none;
    font: inherit;
    font-weight: var(--fw-medium);
  }
  .law-ref:hover { background: var(--accent); color: var(--text-on-accent); }
  .glossar-ref {
    background: none; border: none; padding: 0; font: inherit; color: inherit;
    cursor: pointer; border-bottom: 1px dotted var(--text-muted);
  }
  .glossar-ref:hover { border-bottom-color: var(--text-primary); color: var(--text-primary); }
  /* Dritter Verlinkungsstil neben .law-ref (gefüllter Chip) und .glossar-ref
     (gepunktete Linie) — bewusst derselbe Blau-Akzent, nur als Outline statt
     Fläche, damit alle drei zusammen nicht wie drei verschiedene Farbwelten wirken. */
  .behoerden-ref {
    display: inline;
    color: var(--accent-hover);
    background: none;
    border: 1px solid var(--accent-hover);
    border-radius: 4px;
    padding: 0px 5px;
    cursor: pointer;
    font: inherit;
    font-weight: var(--fw-medium);
  }
  .behoerden-ref:hover { background: var(--accent-soft); }

  .quiz-card { display: flex; flex-direction: column; gap: var(--sp-4); }
  .quiz-card .quiz-question { font-size: var(--fs-lg); font-weight: var(--fw-medium); }
  .quiz-options { display: flex; flex-direction: column; gap: var(--sp-2); }
  .quiz-option {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-raised);
    cursor: pointer; text-align: left; color: var(--text-primary); font-size: var(--fs-sm);
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  }
  .quiz-option:hover { border-color: var(--border-strong); }
  .quiz-option.correct { border-color: var(--success); background: rgba(43,224,140,.16); }
  .quiz-option.wrong { border-color: var(--danger); background: rgba(255,58,92,.16); }
  .quiz-option:disabled { cursor: default; }
  .quiz-explanation { font-size: var(--fs-sm); color: var(--text-body); line-height: var(--lh-relaxed); display: none; }
  .quiz-explanation.visible { display: block; }

  .empty-state { text-align: center; padding: var(--sp-8) var(--sp-5); color: var(--text-muted); }
  .empty-state svg { margin-bottom: var(--sp-3); }

  /* ---- Glossar ---- */
  /* Einspaltige Liste statt Kachel-Grid, alphabetisch (siehe loadGlossar()) —
     zum Aufklappen wie ein klassisches FAQ/Handbuch-Inhaltsverzeichnis. */
  .glossar-list { display: flex; flex-direction: column; gap: var(--sp-3); padding-bottom: var(--sp-8); }
  .glossar-item { padding: var(--sp-4) var(--sp-5); }

  /* ---- A-Z-Schnellnavigation: springt zur jeweiligen Buchstaben-Sektion — von
     Glossar und Gesetze gemeinsam genutzt (gleiches Muster, generischer Klassenname). ---- */
  .az-nav {
    display: flex; flex-wrap: wrap; gap: var(--sp-2);
    margin-bottom: var(--sp-6); padding-bottom: var(--sp-5);
    border-bottom: 1px solid var(--border-weak);
  }
  .az-nav-btn {
    width: 32px; height: 32px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-md); border: 1px solid var(--border);
    background: var(--surface-raised); color: var(--text-secondary);
    font-size: var(--fs-sm); font-weight: var(--fw-medium); cursor: pointer;
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .az-nav-btn:hover { border-color: var(--accent-hover); color: var(--text-primary); background: var(--accent-soft); }
  .glossar-letter-heading { scroll-margin-top: 84px; margin-top: var(--sp-6); }
  .glossar-letter-heading:first-child { margin-top: 0; }
  .glossar-letter-heading h2 { font-size: var(--fs-h3); color: var(--accent-hover); }

  /* ---- Behördenregister: alphabetische Liste zum Aufklappen, gleiches Muster wie
     das Glossar (details[name] = nur ein Eintrag gleichzeitig offen). Inline-Chips im
     Fließtext (.behoerden-ref) öffnen weiterhin das Modal, siehe openBehoerdeRef. */
  .behoerden-list { display: flex; flex-direction: column; gap: var(--sp-3); padding-bottom: var(--sp-8); }
  .glossar-item .behoerde-ebene {
    font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-muted);
    text-transform: uppercase; letter-spacing: var(--ls-wide); margin-top: var(--sp-3);
  }
  .behoerde-ebene + p { margin-top: var(--sp-1); }

  /* ---- Gesetze: Rechtsgebiet-Liste (siehe .amt-row) + Gesetz-Akkordion + Paragraphen-Liste ---- */
  .gesetz-liste-head, .gesetz-lesen-head { margin-bottom: var(--sp-5); }
  .gesetz-liste-head h2, .gesetz-lesen-head h2 { font-size: var(--fs-h2); margin-top: var(--sp-2); }
  .gesetz-liste-head p, .gesetz-lesen-head p { color: var(--text-secondary); margin-top: var(--sp-2); max-width: 640px; }
  .paragraph-list { display: flex; flex-direction: column; gap: var(--sp-1); padding-bottom: var(--sp-8); }
  .paragraph-row {
    display: flex; align-items: baseline; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md); border: 1px solid var(--border-weak);
    background: var(--surface-tile); cursor: pointer; text-align: left; width: 100%;
    font: inherit; color: inherit;
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  }
  .paragraph-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
  .paragraph-row .paragraph-num { font-weight: var(--fw-semibold); color: var(--accent-hover); flex-shrink: 0; min-width: 56px; }
  .paragraph-row .paragraph-title { color: var(--text-secondary); font-size: var(--fs-sm); }

  /* ---- Gesetze-Liste: alphabetische Akkordion-Liste statt Kachel-Grid ---- */
  .accordion-list { display: flex; flex-direction: column; gap: var(--sp-1); padding-bottom: var(--sp-8); }
  .accordion-item {
    border-radius: var(--r-md); border: 1px solid var(--border-weak);
    background: var(--surface-tile); overflow: hidden;
  }
  .accordion-item.open { border-color: var(--border-strong); }
  .accordion-header { display: flex; align-items: stretch; }
  .accordion-toggle {
    flex: 1; display: flex; align-items: baseline; gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-2) var(--sp-3) var(--sp-4);
    border: none; background: none; cursor: pointer; text-align: left; font: inherit; color: inherit;
  }
  .accordion-toggle:hover { background: var(--surface-hover); }
  .accordion-chevron { flex-shrink: 0; align-self: center; color: var(--text-muted); transition: transform var(--dur) var(--ease); }
  /* Direktes Kind-Kombinator statt Nachfahren-Selektor: sonst würde ein offenes
     äußeres Akkordion (z. B. BGB) auch die Chevrons der Bücher darin (verschachteltes
     Akkordion) mitdrehen, egal ob die selbst auf- oder zugeklappt sind. */
  .accordion-item.open > .accordion-header .accordion-chevron { transform: rotate(90deg); }
  .accordion-code { font-weight: var(--fw-semibold); color: var(--accent-hover); flex-shrink: 0; min-width: 90px; }
  .accordion-title { color: var(--text-secondary); font-size: var(--fs-sm); }
  .accordion-header .fav-btn { margin: var(--sp-2) var(--sp-3) var(--sp-2) 0; flex-shrink: 0; align-self: center; }
  .accordion-body { padding: 0 var(--sp-4) var(--sp-4); }
  .accordion-body .paragraph-list { padding-bottom: 0; }

  .fav-btn.active { color: var(--accent); }
  .fav-btn.active svg { fill: currentColor; }

  /* ---- Mein Bereich ---- */
  .mein-bereich-group { margin-bottom: var(--sp-6); }
  .mein-bereich-group h3 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: var(--sp-3); }
  .mein-bereich-row .accordion-toggle { cursor: pointer; }
  .glossar-item summary { font-weight: var(--fw-medium); cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
  .glossar-item summary::-webkit-details-marker { display: none; }
  .glossar-item summary svg { color: var(--text-muted); flex-shrink: 0; transition: transform var(--dur) var(--ease); }
  .glossar-item[open] summary svg { transform: rotate(180deg); }
  .glossar-item p { font-size: var(--fs-sm); color: var(--text-body); line-height: var(--lh-relaxed); margin-top: var(--sp-3); }

  /* ---- Gesetzes-Modal ---- */
  .modal-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 100;
    background: rgba(15,15,18,.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
    padding: var(--sp-5);
  }
  .modal-overlay.visible { display: flex; }
  .modal-card {
    background: var(--surface-card);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    max-width: 960px; width: 100%; max-height: 80vh;
    overflow-y: auto;
    padding: var(--sp-6);
    transition: max-width var(--dur) var(--ease);
  }
  /* Gesetzestext-Lesemodus: feste Größe unabhängig vom Textumfang (statt sich
     an jeden Paragraphen anzupassen), Text scrollt innen, Vor/Zurück-Leiste
     bleibt immer sichtbar am unteren Rand fixiert. */
  #law-modal-overlay.modal-card--wide-active .modal-card {
    max-width: 960px; height: 78vh;
    display: flex; flex-direction: column; overflow: hidden;
  }
  #law-modal-overlay.modal-card--wide-active #law-modal-eyebrow,
  #law-modal-overlay.modal-card--wide-active #law-modal-title { flex-shrink: 0; }
  #law-modal-overlay.modal-card--wide-active #law-modal-text {
    flex: 1 1 auto; overflow-y: auto; padding-right: var(--sp-3); margin-right: calc(var(--sp-3) * -1);
  }
  .modal-card h2 { font-size: var(--fs-h3); margin-bottom: var(--sp-4); padding-right: 84px; }
  .modal-card p { font-size: var(--fs-sm); color: var(--text-body); line-height: var(--lh-relaxed); white-space: pre-wrap; }
  .modal-close { position: absolute; top: var(--sp-5); right: var(--sp-5); }
  .modal-fav { position: absolute; top: var(--sp-5); right: calc(var(--sp-5) + 44px); }
  .modal-card-wrap { position: relative; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
  .modal-nav {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
    margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid var(--border-weak);
    flex-shrink: 0;
  }
  .modal-nav button { display: inline-flex; align-items: center; gap: var(--sp-2); }
  .modal-nav button:disabled { opacity: .35; cursor: default; }
  .modal-nav .modal-position { font-size: var(--fs-sm); color: var(--text-muted); }

  .scroll-top-btn {
    position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 90;
    width: 46px; height: 46px;
    background: var(--surface-card);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-md);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), right var(--dur) var(--ease);
  }
  .scroll-top-btn[hidden] { display: flex; opacity: 0; pointer-events: none; transform: translateY(8px); }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  }
  @media (max-width: 720px) {
    .sidebar { display: none; }
    .app-body { padding-left: 0; }
    .main { padding: var(--sp-5) var(--sp-4); }
    .login-editorial { display: none; }
  }
