/* Moderne, variable Grotesk-Schrift (Plus Jakarta Sans) für Überschriften/Marke UND Lesetext –
   lokal mitgeliefert (assets/fonts), keine Internetverbindung nötig. Bewusst EINE klare, moderne
   Schriftfamilie für die ganze App (kein Serifen-Kontrast mehr) – Hierarchie entsteht über
   Schriftschnitt/-größe statt über eine "altmodisch" wirkende Buch-Serife. */
@font-face {
  font-family: 'Plus Jakarta Sans Variable';
  src: url('../assets/fonts/plus-jakarta-sans-variable.woff2') format('woff2-variations'), url('../assets/fonts/plus-jakarta-sans-variable.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---------- Light Mode: helles, freundliches "Feld in der Mitte" ----------
     Palette 1:1 nach Vorlage "Jade Horizon" (#B7E5BA / #5CA87C / #288760 /
     #1A5140) – der äußere Seitenhintergrund (--bg / --bg-image) und die
     "Chrome"-Elemente (Topbar, Bottom-Nav) nutzen genau diese vier Töne als
     Verlauf von hell nach dunkel. Der zentrale Inhaltsbereich (Hauptpanel +
     Karten, also z.B. "Homebase" und "Neueste Updates") bleibt hell/neutral,
     damit dichter Gesetzestext klar und kontrastreich lesbar bleibt. Dark
     Mode (s.u.) bleibt komplett unverändert dunkel. */
  --bg: #f6f3ec;
  /* ---------- Verschwommener Pastell-Verlauf ("Aurora/Mesh") ----------
     Weiche, große Farbflecken (Lindgrün, Pfirsich, Rosé, Minz) auf cremigem
     Grund, zusätzlich per filter:blur() auf body::before verwischt (siehe
     unten) – bewusst luftig/hell statt der vorherigen satten Jade-Fläche. */
  --bg-image:
    radial-gradient(ellipse 900px 760px at 8% 10%, rgba(206, 222, 140, 0.65), transparent 62%),
    radial-gradient(ellipse 820px 720px at 88% 12%, rgba(236, 202, 168, 0.32), transparent 60%),
    radial-gradient(ellipse 980px 940px at 90% 80%, rgba(232, 166, 197, 0.62), transparent 60%),
    radial-gradient(ellipse 760px 760px at 10% 90%, rgba(170, 206, 166, 0.42), transparent 62%),
    linear-gradient(180deg, #f8f5ef 0%, #f3efe7 100%);
  --paper: #fbfdf9;
  --panel: rgba(255,255,255,0.6);
  --panel-solid: #f6f9f5;
  --panel-muted: #e8f1e9;
  --border: rgba(18,36,28,0.14);
  --border-soft: rgba(18,36,28,0.08);
  --text: #12241c;
  --text-muted: #52685c;
  --text-faint: #93a599;

  /* ---------- Jade-Akzent, exakt die vier Palette-Töne (themen-abhängig, s.u. Dark Mode) ---------- */
  --accent: #5ca87c;
  --accent-dark: #288760;
  --accent-deep: #1a5140;
  --accent-light: #b7e5ba;
  --accent-wash: #eef8ef;
  --wash-rgb: 92, 168, 124;

  /* "Chrome"-Elemente (Topbar, Rundknöpfe, Formatierungsleiste, Toast) – im Light Mode jetzt
     HELLES Frostglas passend zum verschwommenen Pastell-Hintergrund (wie die Bottom-Nav/den
     KI-Button, die das schon so hatten), dunkler Text/Icons für Kontrast. Dark Mode behält das
     ursprüngliche gedämpfte dunkle Jade-Glas (s.u. Dark-Mode-Block), bleibt also unverändert. */
  --chrome-a: rgba(255,255,255,0.62);
  --chrome-b: rgba(244,240,229,0.42);
  --chrome-glow-rgb: 92, 168, 124;
  --chrome-text: #17281f;
  --chrome-border: rgba(18,36,28,0.12);
  --chrome-hover: rgba(18,36,28,0.07);
  --chrome-divider: rgba(18,36,28,0.14);
  /* Runde Topbar-Icon-Buttons (Suche, Profil, Hell/Dunkel-Schalter) – eigenes, helles Glas. */
  --topbar-btn-bg: rgba(255,255,255,0.42);
  --topbar-btn-border: rgba(18,36,28,0.16);
  --topbar-overlay: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0));
  --topbar-knob-icon: #eef8ef;

  /* Splash-Screen-Text/-Akzente – folgen jetzt dem aktuellen Theme (der Splash-Hintergrund
     selbst nutzt var(--bg-image) und ist damit hell im Light Mode, dunkel im Dark Mode). */
  --splash-text: #17281f;
  --splash-text-muted: rgba(18,36,28,0.6);
  --splash-track: rgba(18,36,28,0.14);
  --splash-ring: rgba(40,135,96,0.45);

  --green: #288760;
  --red: #b6543f;
  --orange: #b9852f;

  --radius: 12px;
  --radius-lg: 18px;
  --blur: 22px;
  /* Überschriften/Marke: die moderne Plus-Jakarta-Sans-Variable-Schrift (siehe @font-face oben,
     hoher Schriftschnitt/kräftig für Titel & den "NOMOS LAB"-Schriftzug). */
  --display: 'Plus Jakarta Sans Variable', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Lesetext (Normtext-Paragraphen, Karteikarten, Fragen/Antworten): dieselbe moderne Schrift,
     nur im regulären Schriftschnitt – klar und zeitgemäß statt in einer Buch-Serife. */
  --serif: 'Plus Jakarta Sans Variable', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--sans);
}

/* ---------- Dark Mode: vertiefte "Nacht"-Variante – dieselben vier Jade-Töne,
   nur invertiert (helle Töne für Akzente/Text, dunkle Töne für die Fläche
   selbst), plus ein einzelner, notwendig abgeleiteter Tiefschwarzgrün-Ton
   ganz unten im Verlauf, damit der Dark Mode spürbar dunkler wirkt als der
   dunkelste Palette-Ton. Die "Chrome"-Elemente bleiben bewusst konstant
   (gleiches Glas in beiden Modi). ---------- */
:root[data-theme="dark"] {
  --bg: #142219;
  --bg-image: linear-gradient(180deg, #5ca87c 0%, #288760 35%, #1a5140 68%, #142219 100%);
  --paper: #16261d;
  --panel: rgba(8,12,9,0.5);
  --panel-solid: #17281f;
  --panel-muted: #101c16;
  --border: rgba(255,255,255,0.10);
  --border-soft: rgba(255,255,255,0.055);
  --text: #eaf6ec;
  --text-muted: #9fb8a8;
  --text-faint: #56685e;

  --accent: #5ca87c;
  --accent-dark: #b7e5ba;
  --accent-deep: #eef8ef;
  --accent-light: #1a5140;
  --accent-wash: #101c16;
  --wash-rgb: 92, 168, 124;

  --green: #5ca87c;
  --red: #d9776a;
  --orange: #d6a659;

  /* Chrome bleibt im Dark Mode wie ursprünglich: dunkles Jade-Glas, heller Text. */
  --chrome-a: rgba(40,135,96,0.82);
  --chrome-b: rgba(26,81,64,0.88);
  --chrome-glow-rgb: 26, 81, 64;
  --chrome-text: #eef8ef;
  --chrome-border: rgba(255,255,255,0.10);
  --chrome-hover: rgba(255,255,255,0.14);
  --chrome-divider: rgba(255,255,255,0.18);
  --topbar-btn-bg: rgba(0,0,0,0.25);
  --topbar-btn-border: rgba(255,255,255,0.35);
  --topbar-overlay: linear-gradient(180deg, rgba(8,8,5,0.5), rgba(8,8,5,0));
  --topbar-knob-icon: #2a3018;

  /* Splash bleibt im Dark Mode wie ursprünglich: heller Text auf dem dunklen Jade-Verlauf. */
  --splash-text: #eef8ef;
  --splash-text-muted: rgba(238,248,239,0.6);
  --splash-track: rgba(238,248,239,0.18);
  --splash-ring: rgba(183,229,186,0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
  position: relative;
  /* Erzwingt einen eigenen Stacking-Context für body, damit die z-index:-1
     Hintergrund-Ebenen unten (::before/::after) zuverlässig ÜBER der eigenen
     html/body-Hintergrundfarbe, aber UNTER dem normalen Inhalt (Topbar/Main/
     Bottomnav) liegen. Ohne das landet ein negativer z-index sonst hinter der
     Body-Hintergrundfarbe und ist unsichtbar. */
  isolation: isolate;
}
/* Hintergrund 1:1 nach der "Jade Horizon"-Farbpalette: heller Mint-Ton oben,
   der über die beiden mittleren Jade-Töne in das dunkelste Grün unten
   übergeht. Fixiert auf die Fensterhöhe, damit der Verlauf beim Scrollen
   immer gleich aussieht (reine Optik, keine Interaktion). Bewusst OHNE
   zusätzliche Abdunkelungs-Vignette (anders als frühere Versionen) – die
   Palette soll frisch und hell wirken, nicht schwer/düster. */
body::before {
  content: "";
  position: fixed;
  /* Größer als der Viewport, damit der weiche filter:blur() unten nicht an
     den Rändern "abgeschnitten" aussieht (harte Kante durch den Blur-Radius). */
  inset: -120px;
  z-index: -1;
  pointer-events: none;
  background-image: var(--bg-image);
  filter: blur(64px);
}
:root[data-theme="dark"] body::before { inset: 0; filter: none; }
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(ellipse at 50% 38%, transparent 55%, rgba(0,0,0,0.05) 100%);
}

/* ---------- Splash-Screen: kurzer Marken-Vorspann beim Start (siehe js/splash.js) – zeigt Logo
   und Schriftzug ca. 1,3s lang, blendet danach über ~0,5s sanft aus (insgesamt ~2s, wie
   angefragt). Nutzt jetzt denselben verschwommenen Pastell-Look wie der App-Hintergrund (an das
   neue Design angepasst), statt der früheren fixen dunklen Jade-Markentöne – Logo/Schriftzug in
   dunklem Text für Kontrast auf dem hellen Grund. Bewusst weiter unabhängig vom Hell/Dunkel-
   Umschalter der App selbst (wie ein App-Icon/Launch-Screen), nur eben jetzt im hellen Look. */
#splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f5ef;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}
/* Derselbe verschwommene Pastell-Verlauf wie der App-Hintergrund (var(--bg-image)), als
   eigene, überdimensionierte, geblurrte Ebene – damit der Start direkt "in" den Look der App
   überblendet, statt einer eigenen, blasseren Farbwahl. Größer als der Screen + eigener Blur,
   damit die Kanten nicht hart abgeschnitten aussehen (gleiche Technik wie body::before). */
#splash::before {
  content: "";
  position: absolute;
  inset: -140px;
  z-index: 0;
  background-image: var(--bg-image);
  filter: blur(70px) saturate(128%);
}
#splash.splash-hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
/* Weiche, leuchtende Farbflecken im Hintergrund (wie Bokeh/Aurora) – geben der reinen
   Verlaufsfläche Tiefe und Bewegung, statt flach zu wirken. Pulsieren dezent während der
   kurzen Sichtbarkeit des Splash-Screens. Farben jetzt 1:1 die Pastell-Palette des
   App-Hintergrunds (Lindgrün / Rosé / Pfirsich) statt der früheren reinen Jade-Töne. */
#splash .splash-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.65;
  animation: splashOrbPulse 2.6s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
#splash .splash-orb-a {
  width: 380px; height: 380px;
  left: -100px; top: -80px;
  background: radial-gradient(circle, rgba(206,222,140,0.65), transparent 70%);
  animation-delay: 0s;
}
#splash .splash-orb-b {
  width: 420px; height: 420px;
  right: -140px; bottom: -120px;
  background: radial-gradient(circle, rgba(232,166,197,0.55), transparent 70%);
  animation-delay: 0.4s;
}
#splash .splash-orb-c {
  width: 300px; height: 300px;
  right: 8%; top: -60px;
  background: radial-gradient(circle, rgba(236,202,168,0.4), transparent 70%);
  animation-delay: 0.8s;
}
@keyframes splashOrbPulse {
  from { transform: scale(1) translateY(0); opacity: 0.4; }
  to { transform: scale(1.18) translateY(-10px); opacity: 0.72; }
}
/* Feines Filmkorn über dem Verlauf – nimmt der Fläche das "flache" Digitale, wie bei
   hochwertigen Marken-/Launch-Screens üblich. Rein dekorativ, per SVG-Turbulenz erzeugt. */
#splash .splash-grain {
  position: absolute;
  inset: -20%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: overlay;
  pointer-events: none;
}
#splash .splash-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
/* "Siegel"-Moment: zwei ringförmige Schockwellen laufen einmal nach außen aus, während das
   Logo mit einem leichten Überschwung einschwingt – wie ein Wachssiegel/Stempel, passend zum
   Kodex-Thema, statt eines simplen Verblassens. */
#splash .splash-seal {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Weicher, farbiger Glow-Schein hinter dem Logo (Lindgrün + Rosé, wie im neu eingefärbten
   Logo-Verlauf selbst) – lässt das Siegel ins Bild "hineinblühen" statt flach aufzuliegen. */
#splash .splash-seal::before {
  content: "";
  position: absolute;
  inset: -46px;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, rgba(207,232,110,0.55), transparent 60%),
    radial-gradient(circle at 68% 72%, rgba(239,134,174,0.5), transparent 62%);
  filter: blur(26px);
  opacity: 0;
  animation: splashGlowIn 0.7s ease 0.15s forwards;
}
@keyframes splashGlowIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}
#splash .splash-ring {
  position: absolute;
  inset: 0;
  border-radius: 26%;
  border: 1.5px solid var(--splash-ring);
  opacity: 0;
  animation: splashRing 1.1s cubic-bezier(.22,1,.36,1) forwards;
}
#splash .splash-ring-1 { animation-delay: 0.05s; }
#splash .splash-ring-2 { animation-delay: 0.28s; }
@keyframes splashRing {
  from { transform: scale(0.7); opacity: 0.75; }
  to { transform: scale(2.1); opacity: 0; }
}
#splash .splash-logo {
  position: relative;
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 16px 22px rgba(20,36,28,0.30)) drop-shadow(0 0 18px rgba(92,168,124,0.35));
  animation: splashLogoIn 0.6s cubic-bezier(.34,1.56,.64,1) backwards;
}
@keyframes splashLogoIn {
  from { opacity: 0; transform: scale(0.55) rotate(-8deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}
/* Schriftzug: jeder Buchstabe fliegt einzeln, zeitversetzt ein – deutlich hochwertiger als ein
   einmaliges Einblenden des ganzen Worts. */
#splash .splash-word {
  display: flex;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--splash-text);
}
#splash .splash-word span {
  display: inline-block;
  opacity: 0;
  animation: splashLetterIn 0.5s cubic-bezier(.22,1,.36,1) forwards;
}
#splash .splash-word .splash-gap { width: 0.45em; }
#splash .splash-word span:nth-child(1) { animation-delay: 0.30s; }
#splash .splash-word span:nth-child(2) { animation-delay: 0.35s; }
#splash .splash-word span:nth-child(3) { animation-delay: 0.40s; }
#splash .splash-word span:nth-child(4) { animation-delay: 0.45s; }
#splash .splash-word span:nth-child(5) { animation-delay: 0.50s; }
#splash .splash-word span:nth-child(7) { animation-delay: 0.58s; }
#splash .splash-word span:nth-child(8) { animation-delay: 0.63s; }
#splash .splash-word span:nth-child(9) { animation-delay: 0.68s; }
@keyframes splashLetterIn {
  from { opacity: 0; transform: translateY(16px) scale(0.85); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
#splash .splash-tagline {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--splash-text-muted);
  opacity: 0;
  animation: splashPopIn 0.6s cubic-bezier(.22,1,.36,1) 0.85s forwards;
}
/* Dünner, sich füllender Fortschrittsbalken – rein dekorativ, gibt dem kurzen Moment aber ein
   bewusstes "die App bereitet sich vor"-Gefühl statt eines reinen Marken-Blitzes. */
#splash .splash-progress {
  width: 130px;
  height: 3px;
  border-radius: 999px;
  background: var(--splash-track);
  overflow: hidden;
  margin-top: 4px;
  opacity: 0;
  animation: splashPopIn 0.4s ease 0.85s forwards;
}
#splash .splash-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  animation: splashProgress 1.5s cubic-bezier(.22,1,.36,1) 0.2s forwards;
}
@keyframes splashProgress {
  from { width: 0%; }
  to { width: 100%; }
}
@keyframes splashPopIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ---------- Profil-Umschalter (Account-Icon oben rechts) ---------- */
.profile-trigger {
  margin-left: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--topbar-btn-border);
  background: var(--topbar-btn-bg);
  color: var(--chrome-text);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
  transition: filter 0.15s ease;
}
.profile-trigger:hover { filter: brightness(1.12); }
.profile-trigger svg { width: 19px; height: 19px; }
.profile-panel {
  position: absolute;
  top: 62px;
  right: 32px;
  width: 300px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 34px rgba(0,0,0,0.28);
  padding: 14px;
  z-index: 60;
}
.profile-panel-header { font-family: var(--display); font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.profile-panel-hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; margin: 0 0 10px; }
.profile-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.profile-row {
  display: flex; align-items: center; gap: 8px;
  border-radius: 10px;
  padding: 6px 6px;
  border: 1px solid transparent;
  background: none;
}
.profile-row.is-active { background: var(--accent-wash); border-color: var(--accent-light); }
.profile-row > button.profile-row-main, button.profile-row {
  display: flex; align-items: center; gap: 8px; flex: 1;
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  color: var(--text);
  font-size: 13px;
}
.profile-row-action {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto; font-size: 13px;
}
.profile-row-action:hover { background: rgba(0,0,0,0.08); color: var(--text); }
.profile-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; font-family: var(--display);
}


.search-panel {
  position: absolute;
  top: 62px;
  right: 32px;
  width: 420px;
  max-width: calc(100vw - 64px);
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 34px rgba(0,0,0,0.28);
  padding: 12px;
  z-index: 65;
}
.search-panel input {
  width: 100%;
  margin: 0 0 10px;
}
.search-panel-results { max-height: 420px; overflow-y: auto; }
.search-panel-hint { font-size: 12px; color: var(--text-muted); padding: 6px 4px; line-height: 1.4; }
.search-panel-group { margin-bottom: 8px; }
.search-panel-group-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 4px 6px 2px;
}
.search-result {
  display: flex; align-items: flex-start; gap: 8px; width: 100%;
  background: none; border: none; border-radius: 10px; padding: 7px 6px; cursor: pointer;
  text-align: left; font-family: var(--sans); color: var(--text);
  transition: background 0.12s ease;
}
.search-result:hover { background: var(--accent-wash); }
.search-result-icon { flex: 0 0 auto; width: 18px; text-align: center; color: var(--accent-dark); font-size: 13px; margin-top: 1px; }
.search-result-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.search-result-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-meta { font-size: 11px; color: var(--accent-dark); margin-top: 1px; }
.search-result-snippet { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Kurzes Aufleuchten, wenn die globale Suche zu einem konkreten Eintrag springt – macht
   sichtbar, welcher Karte/Zeile/Paragraph gemeint ist. */
.search-highlight { animation: searchHighlightPulse 2.2s ease; }
@keyframes searchHighlightPulse {
  0% { box-shadow: 0 0 0 3px rgba(var(--wash-rgb), 0.9); }
  70% { box-shadow: 0 0 0 3px rgba(var(--wash-rgb), 0.9); }
  100% { box-shadow: 0 0 0 0 rgba(var(--wash-rgb), 0); }
}

/* Ansicht-Wechsel: sanftes Einblenden + leichtes Hochgleiten des neuen Seiteninhalts, statt eines
   harten Umschaltens – die Klasse wird bei jeder Navigation (siehe app.js) neu angestoßen. */
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
#main.view-anim {
  animation: viewFadeIn 0.32s cubic-bezier(.22,1,.36,1);
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 22px;
  padding-bottom: 14px;
  /* Trennlinie als weicher Verlauf statt hartem Strich */
  background: linear-gradient(90deg, transparent, var(--border) 18%, var(--border) 82%, transparent) bottom / 100% 1px no-repeat;
}
.view-header h2 {
  margin: 0;
  font-size: 25px;
}
.view-header .flex { align-items: center; }
.view-heading { display: flex; flex-direction: column; gap: 3px; }
.view-eyebrow {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-weight: 700;
}

/* ---------- Cards (Glas) ---------- */
.card {
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 10px 30px -12px rgba(0,0,0,0.16);
  transition: box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.card > strong {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.01em;
}

/* ---------- Buttons: "Liquid Glass"-Pillen – 1:1 im Stil der Referenzbilder (Continue/Cancel):
   runde, durchscheinende Glaskapseln mit Blur, feinem Rand und diagonalem Lichtreflex, statt
   flacher Farbflächen. Textfarbe bewusst fix/dunkel (nicht theme-abhängig), da die Glaskapsel
   selbst in Light- wie Dark-Mode hell bleibt – analog zur Bottom-Nav. ---------- */
.btn {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(var(--wash-rgb),0.6), rgba(var(--wash-rgb),0.3) 55%, rgba(var(--wash-rgb),0.42));
  color: #14261d;
  border: 1px solid rgba(255,255,255,0.6);
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: var(--sans);
  backdrop-filter: blur(14px) saturate(200%);
  -webkit-backdrop-filter: blur(14px) saturate(200%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.65) inset,
    0 -8px 12px -8px rgba(255,255,255,0.55) inset,
    0 4px 12px -4px rgba(20,25,15,0.28),
    0 0 0 1px rgba(var(--wash-rgb), 0.28);
  transition: filter 0.15s, transform 0.08s, box-shadow 0.15s, background 0.2s;
}
/* Diagonaler Glas-Lichtreflex quer über die Pille, wie bei den Referenzbildern. */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.6) 46%, transparent 62%);
  mix-blend-mode: overlay;
  pointer-events: none;
}
.btn:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 -8px 12px -8px rgba(255,255,255,0.6) inset,
    0 8px 18px -6px rgba(20,25,15,0.32),
    0 0 0 1px rgba(var(--wash-rgb), 0.34);
}
.btn:active { transform: translateY(1px); filter: brightness(0.98); }
.btn.secondary {
  background: linear-gradient(160deg, rgba(255,255,255,0.6), rgba(255,255,255,0.2) 55%, rgba(255,255,255,0.34));
  color: #14261d;
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 3px 10px -6px rgba(20,25,15,0.2);
}
.btn.secondary:hover {
  background: linear-gradient(160deg, rgba(255,255,255,0.72), rgba(255,255,255,0.28) 55%, rgba(255,255,255,0.44));
  border-color: rgba(255,255,255,0.75);
  transform: translateY(-1px);
}
.btn.danger {
  background: linear-gradient(160deg, rgba(182,84,63,0.4), rgba(182,84,63,0.16) 55%, rgba(182,84,63,0.26));
  color: #7a3326;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 1px 0 rgba(255,255,255,0.45) inset, 0 3px 10px -6px rgba(20,25,15,0.2);
}
.btn.danger:hover {
  background: linear-gradient(160deg, rgba(182,84,63,0.5), rgba(182,84,63,0.22) 55%, rgba(182,84,63,0.32));
  transform: translateY(-1px);
}
.btn.small { padding: 5px 14px; font-size: 11.5px; }

/* ---------- Forms ---------- */
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
textarea { resize: vertical; }

/* Eigener "Glas"-Pfeil statt des groben Browser-Standardpfeils, passend zum Rest der App. */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2352685c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select::-ms-expand { display: none; }
select:hover { border-color: var(--accent); }
select optgroup { font-style: normal; font-weight: 700; color: var(--accent-dark); background: var(--paper); }
select option { font-weight: 400; color: var(--text); background: var(--paper); }

:root[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%239fb8a8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}
label { font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-muted); display: block; margin-bottom: 4px; margin-top: 10px; }

.share-toggle-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  padding: 8px 10px;
  background: var(--panel-muted);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12.5px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
}
.share-toggle-row input { margin: 0; flex: 0 0 auto; }

/* Rich-Text-Felder (contenteditable, ersetzen <textarea> überall dort, wo die Formatierungsleiste sitzt) */
.rich-editable {
  display: block;
  width: 100%;
  min-height: 90px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--text);
  overflow-y: auto;
  cursor: text;
}
.rich-editable:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.rich-editable[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
}
.rich-editable div:last-child { margin-bottom: 0; }

/* Von Utils.miniMarkdown()/renderRich() erzeugte Absätze/Listen – einheitlicher, knapper Abstand,
   egal ob in einem Rich-Text-Feld, einer Karte oder einer Tabellenzelle angezeigt. */
.rt-p { margin: 0 0 8px; }
.rt-p:last-child { margin-bottom: 0; }
.rt-ul { margin: 4px 0 8px 18px; padding: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-faint); font-weight: 600; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; }
tr:hover td { background: var(--accent-wash); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.badge.deadline { background: rgba(182,84,63,0.14); color: var(--red); }
.badge.session { background: var(--accent-light); color: var(--accent-deep); }
.badge.exam { background: rgba(185,133,47,0.16); color: var(--orange); }

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill {
  padding: 5px 13px; border-radius: 20px; font-size: 11.5px; cursor: pointer;
  background: rgba(255,255,255,0.1); color: var(--text-muted); border: 1px solid var(--border);
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
}
.pill:hover { border-color: var(--accent); color: var(--accent-deep); }
.pill.active { background: var(--accent-deep); color: var(--paper); border-color: var(--accent-deep); }

.empty-state { color: var(--text-faint); font-size: 13px; padding: 26px; text-align: center; font-style: italic; }

.tc-ins { color: var(--green); text-decoration: underline; background: rgba(95,143,90,0.14); }
.tc-del { color: var(--red); text-decoration: line-through; background: rgba(182,84,63,0.10); }

.progress-bar { background: var(--border-soft); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar > div { background: var(--accent); height: 100%; }

.flex { display: flex; gap: 10px; align-items: center; }
.flex.between { justify-content: space-between; }
.muted { color: var(--text-muted); font-size: 12px; }

/* Modal-Ein-/Ausblenden: Hintergrund faded sanft, das Fenster selbst gleitet leicht nach oben
   und skaliert dabei minimal hoch – wirkt bewusst "weicher"/hochwertiger als ein hartes Erscheinen. */
@keyframes modalBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalPopIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6,8,4,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  animation: modalBackdropIn 0.22s ease;
}
.modal-backdrop.closing {
  opacity: 0;
  transition: opacity 0.18s ease;
}
.modal-backdrop.closing .modal {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.modal {
  background: var(--panel-solid);
  background: color-mix(in srgb, var(--panel-solid) 78%, transparent);
  backdrop-filter: blur(calc(var(--blur) + 8px)) saturate(160%);
  -webkit-backdrop-filter: blur(calc(var(--blur) + 8px)) saturate(160%);
  border-radius: var(--radius-lg); padding: 26px 26px 24px;
  width: 480px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 30px 70px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.16);
  border-top: 3px solid var(--accent);
  animation: modalPopIn 0.26s cubic-bezier(.22,1,.36,1);
}
.modal h3 { margin-top: 0; font-size: 18px; }

.timer-display {
  font-size: 44px; font-weight: 700; text-align: center; color: var(--accent-deep);
  font-family: var(--display);
}

.file-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.file-row:last-child { border-bottom: none; }
.dropzone {
  border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 24px;
  text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 14px;
  background: var(--accent-wash);
  backdrop-filter: blur(10px);
}
.dropzone.drag { border-color: var(--accent); }

/* ---------- Month grid ---------- */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  overflow: hidden;
}
.month-weekday {
  background: var(--accent-wash);
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-deep);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 0;
}
.month-cell {
  background: var(--panel-solid);
  min-height: 92px;
  min-width: 0; /* Grid-Items schrumpfen sonst nicht unter ihren Inhalt (Default min-width:auto) –
                   ohne das würde ein langer Termin-Titel die ganze Spalte aufsprengen. */
  padding: 6px 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.month-cell:hover { background: var(--accent-wash); }
.month-cell.muted-cell { background: var(--panel-muted); }
.month-cell.muted-cell .month-daynum { color: var(--text-faint); }
.month-daynum { font-size: 12px; color: var(--text-muted); font-weight: 600; font-family: var(--serif); }
.month-daynum.today-num {
  background: var(--accent-deep); color: var(--paper); border-radius: 50%;
  width: 21px; height: 21px; display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.month-cell.is-today { background: var(--accent-wash); }
.month-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; min-width: 0; }
.month-pill {
  font-size: 10px; padding: 1.5px 5px; border-radius: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-weight: 700;
  min-width: 0; /* dito: erst dadurch greift text-overflow:ellipsis statt die Zelle zu sprengen */
  max-width: 100%;
  box-sizing: border-box;
}
.month-pill.deadline { background: var(--red); color: #fff; }
.month-pill.session { background: var(--accent-deep); color: var(--paper); }
.month-pill.exam { background: var(--orange); color: #2a1a00; }
.month-more { font-size: 10px; color: var(--text-faint); padding-left: 3px; }
.month-pill-time { opacity: 0.85; font-weight: 800; }

@media (max-width: 700px) {
  .month-cell { min-height: 60px; }
}

/* ---------- Week grid (Wochenansicht) ---------- */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  overflow: hidden;
}
.week-col {
  background: var(--panel-solid);
  min-height: 220px;
  min-width: 0; /* siehe .month-cell – ohne das sprengt ein langer Titel die Spaltenbreite */
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.week-col:hover { background: var(--accent-wash); }
.week-col.is-today { background: var(--accent-wash); }
.week-colhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}
.week-weekday {
  font-size: 10px; font-weight: 700; color: var(--accent-deep);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.week-daynum { font-size: 13px; font-weight: 600; color: var(--text-muted); font-family: var(--serif); }
.week-colhead.today-num .week-daynum {
  background: var(--accent-deep); color: var(--paper); border-radius: 50%;
  width: 21px; height: 21px; display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.week-events { display: flex; flex-direction: column; gap: 3px; overflow: hidden; min-width: 0; }
.week-empty { font-size: 11px; color: var(--text-faint); text-align: center; padding-top: 10px; }

@media (max-width: 700px) {
  .week-col { min-height: 140px; padding: 6px 4px; }
  .week-weekday { font-size: 9px; }
}

/* ---------- Tagesansicht (Kalender) ---------- */
.day-agenda-row { cursor: pointer; }
.day-agenda-row:hover { background: var(--accent-wash); }

/* ---------- Überschneidungs-Markierung (Monat/Woche/Tag/Liste/Planung) ---------- */
.month-pill.conflict { outline: 2px dashed var(--red); outline-offset: -1px; }
.conflict-flag {
  display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--red);
  margin-left: 6px;
}

/* ---------- Kursplanung (Vergleichs-Zeitraster) ---------- */
.planner-wrap { display: flex; gap: 6px; }
.planner-timecol { flex-shrink: 0; width: 46px; }
.planner-timecol-head { height: 29px; }
.planner-hourlabel {
  font-size: 10px; color: var(--text-faint); text-align: right; padding-right: 6px;
  transform: translateY(-6px);
}
.planner-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  overflow: hidden;
}
.planner-dayhead {
  background: var(--accent-wash);
  text-align: center;
  font-size: 10px; font-weight: 700; color: var(--accent-deep);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 7px 0;
}
.planner-day { position: relative; background: var(--panel-solid); }
.planner-hourline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border-soft); }
.planner-slot {
  position: absolute; left: 3px; right: 3px;
  border-radius: 6px; padding: 3px 5px; font-size: 10.5px; line-height: 1.25;
  overflow: hidden; color: #fff;
}
.planner-slot.fixed { background: var(--text-faint); opacity: 0.55; cursor: default; }
.planner-slot.fixed.session { background: var(--accent-deep); opacity: 0.45; }
.planner-slot.fixed.exam { background: var(--orange); color: #2a1a00; opacity: 0.6; }
.planner-slot.planning { background: var(--accent); cursor: pointer; }
.planner-slot.conflict { outline: 2px dashed var(--red); outline-offset: -1px; }

@media (max-width: 700px) {
  .planner-timecol { width: 34px; }
  .planner-hourlabel { font-size: 8.5px; }
  .planner-slot { font-size: 9px; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast {
  position: fixed; bottom: 112px; right: 24px;
  background: linear-gradient(135deg, var(--chrome-a), var(--chrome-b));
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  color: var(--chrome-text);
  border: 1px solid var(--chrome-border);
  padding: 12px 18px; border-radius: 10px; font-size: 13px; z-index: 100; max-width: 320px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  animation: toastIn 0.3s cubic-bezier(.22,1,.36,1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.toast-hide {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
}

/* ---------- Kodizes: Gesetzes-Leser ---------- */
.law-card { border-left: 3px solid var(--accent); }
.law-card .law-heading { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.law-card .law-abbr { font-family: var(--display); font-size: 19px; font-weight: 800; color: var(--accent-deep); }
.law-card .law-title { font-size: 13px; color: var(--text-muted); }
.law-card .law-description { font-size: 13px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.provision {
  border-top: 1px solid var(--border-soft);
  padding: 12px 2px;
}
.provision .provision-label { font-family: var(--serif); font-weight: 700; color: var(--accent-deep); font-size: 13.5px; }
.provision .provision-heading { color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.provision .provision-text {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin-top: 6px;
}
.provision .provision-empty {
  font-size: 12.5px; color: var(--text-faint); font-style: italic; margin-top: 5px;
}

/* Kodizes: einzelnes Gesetz wie ein Buch, das man erst aufschlagen muss, um die Paragraphen zu sehen. */
.law-book { margin-top: 14px; }
.law-book-summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--accent-light);
}
.law-book-summary::-webkit-details-marker { display: none; }
.law-book-summary::before {
  content: '▸'; color: var(--accent-dark); font-size: 13px; transition: transform 0.15s ease;
}
.law-book[open] .law-book-summary::before { transform: rotate(90deg); }
.law-book-title { font-weight: 700; color: var(--accent-deep); font-size: 13px; }
.law-book-inner { padding: 4px 4px 0; }

/* Lernwall: Prüfskizzen (Prüfungsschemata) wie im Kodizes-Leser auf-/zuklappbar. */
.schema-book {
  margin-top: 14px;
  border: 1px solid var(--accent-light);
  border-radius: 10px;
  background: var(--accent-wash);
  overflow: hidden;
}
.schema-book-summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
}
.schema-book-summary::-webkit-details-marker { display: none; }
.schema-book-summary::before {
  content: '▸'; color: var(--accent-dark); font-size: 13px; transition: transform 0.15s ease;
}
.schema-book[open] .schema-book-summary::before { transform: rotate(90deg); }
.schema-book-title { font-weight: 700; color: var(--accent-deep); font-family: var(--display); }
.schema-book-inner { padding: 2px 14px 14px 26px; }

/* Lernwall: Zusammenfassungen – sobald mehr als eine hochgeladen ist, genauso auf-/zuklappbar
   wie die Prüfskizzen oben, damit die Liste bei mehreren (teils langen, mit PDF-Vorschau)
   Zusammenfassungen nicht endlos lang wird. Bei genau einer Zusammenfassung bleibt die Karte
   wie bisher immer offen (kein Klapp-Pfeil nötig). */
.summary-book {
  margin-top: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--panel-solid);
  overflow: hidden;
}
.summary-book-summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
}
.summary-book-summary::-webkit-details-marker { display: none; }
.summary-book-summary::before {
  content: '▸'; color: var(--accent-dark); font-size: 13px; transition: transform 0.15s ease; flex: 0 0 auto;
}
.summary-book[open] .summary-book-summary::before { transform: rotate(90deg); }
.summary-book-title { font-weight: 700; color: var(--text); }
.summary-book-inner { padding: 0 16px 16px; }

.feed-tag {
  display: inline-block;
  min-width: 66px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-weight: 700;
  margin-right: 10px;
}

.section-label {
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint);
  margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-soft);
}

/* ---------- Kodex-Schnellzugriff: kleiner Rundknopf + Nachschlage-Fenster ---------- */
.codex-fab {
  position: fixed; right: 18px; bottom: 118px; z-index: 45;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--chrome-border);
  background: linear-gradient(180deg, var(--chrome-a), var(--chrome-b));
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  color: var(--chrome-text); font-family: var(--serif); font-size: 21px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 12px 26px -6px rgba(0,0,0,0.4);
  transition: box-shadow 0.15s ease;
  user-select: none;
}
.codex-fab:hover { box-shadow: 0 16px 32px -6px rgba(0,0,0,0.5); }

/* Frei verschiebbares Schwebe-Fenster (kein Modal!) – bewusst ohne abgedunkelten Hintergrund,
   damit man Folien &amp; Notizen aus "Skizzen" währenddessen weiter im Hintergrund sehen kann. */
.codex-window {
  position: fixed;
  z-index: 52; /* über dem Modal-Hintergrund (50), damit ein Klick auf einen §-Verweis auch aus Fenstern heraus sichtbar ist */
  min-width: 300px;
  max-width: 90vw;
  background: var(--panel-solid);
  background: color-mix(in srgb, var(--panel-solid) 90%, transparent);
  backdrop-filter: blur(calc(var(--blur) + 8px)) saturate(160%);
  -webkit-backdrop-filter: blur(calc(var(--blur) + 8px)) saturate(160%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.16);
  border-top: 3px solid var(--accent);
  box-shadow: 0 30px 70px rgba(0,0,0,0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.codex-window-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 10px 12px 16px;
  cursor: grab;
  touch-action: none; user-select: none;
  border-bottom: 1px solid var(--border-soft);
  flex: 0 0 auto;
}
.codex-window-header:active { cursor: grabbing; }
.codex-window-title { font-family: var(--display); font-weight: 700; font-size: 14px; }
.codex-window-close {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  width: 26px; height: 26px; border-radius: 6px; font-size: 13px; flex: 0 0 auto;
}
.codex-window-close:hover { background: rgba(0,0,0,0.08); color: var(--text); }
.codex-window-body { padding: 14px 16px 16px; overflow-y: auto; flex: 1 1 auto; }
.codex-lookup-controls { display: flex; gap: 10px; margin: 4px 0 14px; }
.codex-lookup-controls select { flex: 0 0 130px; }
.codex-lookup-controls input { flex: 1; }
.codex-list { overflow-y: auto; }

/* ---------- KI-Assistent: schwebender Chat-Button + Panel (app-weit, nicht Teil des lokalen
   Datenmodells – Anfragen gehen an die Anthropic-Claude-API). Optisch an .codex-fab/.codex-window
   angelehnt, aber eine eigene, höher gestapelte Position, damit beide nebeneinander Platz haben. ---------- */
.ai-fab {
  position: fixed; right: 18px; bottom: 176px; z-index: 45;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.6);
  background: linear-gradient(160deg, rgba(var(--wash-rgb),0.62), rgba(var(--wash-rgb),0.32) 55%, rgba(var(--wash-rgb),0.44));
  backdrop-filter: blur(14px) saturate(200%);
  -webkit-backdrop-filter: blur(14px) saturate(200%);
  color: #14261d;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.65) inset,
    0 -8px 12px -8px rgba(255,255,255,0.55) inset,
    0 12px 26px -6px rgba(0,0,0,0.32),
    0 0 0 1px rgba(var(--wash-rgb), 0.28);
  transition: box-shadow 0.15s ease, transform 0.08s ease;
  user-select: none;
}
.ai-fab svg { width: 22px; height: 22px; }
.ai-fab:hover { box-shadow: 0 16px 32px -6px rgba(0,0,0,0.4), 0 0 0 1px rgba(var(--wash-rgb), 0.34); transform: translateY(-1px); }
.ai-fab:active { transform: translateY(1px); }

.ai-panel {
  position: fixed;
  right: 18px;
  bottom: 234px;
  z-index: 48;
  width: 340px;
  max-width: calc(100vw - 36px);
  max-height: 60vh;
  background: var(--panel-solid);
  background: color-mix(in srgb, var(--panel-solid) 90%, transparent);
  backdrop-filter: blur(calc(var(--blur) + 8px)) saturate(160%);
  -webkit-backdrop-filter: blur(calc(var(--blur) + 8px)) saturate(160%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.16);
  border-top: 3px solid var(--accent);
  box-shadow: 0 30px 70px rgba(0,0,0,0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ai-panel[hidden] { display: none; }
.ai-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 10px 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  flex: 0 0 auto;
}
.ai-panel-title { font-family: var(--display); font-weight: 700; font-size: 14px; }
.ai-panel-close {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  width: 26px; height: 26px; border-radius: 6px; font-size: 15px; flex: 0 0 auto;
}
.ai-panel-close:hover { background: rgba(0,0,0,0.08); color: var(--text); }
.ai-panel-body { padding: 14px 16px 16px; overflow-y: auto; }
.ai-panel-messages {
  padding: 12px 14px 4px;
  overflow-y: auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}
.ai-msg {
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.45;
  word-wrap: break-word;
}
.ai-msg-user {
  align-self: flex-end;
  background: linear-gradient(160deg, rgba(var(--wash-rgb),0.55), rgba(var(--wash-rgb),0.28) 55%, rgba(var(--wash-rgb),0.4));
  color: #14261d;
  border: 1px solid rgba(255,255,255,0.5);
  border-bottom-right-radius: 4px;
}
.ai-msg-assistant {
  align-self: flex-start;
  background: color-mix(in srgb, var(--panel-solid) 60%, transparent);
  border: 1px solid var(--border-soft);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.ai-msg-error {
  align-self: flex-start;
  background: rgba(182,84,63,0.16);
  border: 1px solid rgba(182,84,63,0.35);
  color: #7a3326;
  border-bottom-left-radius: 4px;
}
.ai-msg-loading { font-weight: 700; letter-spacing: 0.12em; }
.ai-panel-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
  flex: 0 0 auto;
}
.ai-panel-input-row textarea {
  flex: 1;
  resize: none;
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 12px;
  max-height: 90px;
}
.ai-panel-hint { font-size: 10.5px; padding: 0 14px 12px; line-height: 1.4; }
.ai-panel-messages .ai-panel-hint { padding: 8px 2px; }

/* Erscheint neben markiertem Normtext im Nachschlage-Fenster, um die Auswahl wie mit einem Textmarker dauerhaft zu markieren. */
.codex-ref-btn {
  position: fixed;
  z-index: 60;
  background: var(--accent-deep);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 22px -6px rgba(0,0,0,0.45);
  white-space: nowrap;
}
.codex-ref-btn:hover { filter: brightness(1.1); }
.codex-item {
  border-top: 1px solid var(--border-soft); padding: 10px 2px;
}
.codex-item:first-child { border-top: none; }
.codex-item summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px;
}
.codex-item summary::-webkit-details-marker { display: none; }
.codex-item summary::before { content: '›'; margin-right: 8px; color: var(--accent); font-weight: 700; }
.codex-item[open] summary::before { content: '⌄'; }
.codex-item .provision-text { margin-left: 18px; }

/* Persönliche Textmarker-Markierungen im Normtext (wie im Papierkodex) – Klick entfernt sie wieder. */
.provision-text mark.user-highlight { cursor: pointer; }
.provision-text mark.user-highlight:hover { filter: brightness(0.94); }

/* Verweise wie „→ § 4 AVG" unterhalb eines Paragraphen – frei eintippbar, wie handschriftliche Randnotizen im Kodex. */
.provision-refs {
  margin: 8px 0 2px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.provision-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-wash);
  color: var(--accent-deep);
  border-radius: 999px;
  padding: 3px 6px 3px 10px;
  font-size: 12px;
  font-weight: 600;
}
.provision-ref-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent-deep);
  opacity: 0.65;
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
}
.provision-ref-remove:hover { opacity: 1; }
.provision-ref-add {
  background: none;
  border: 1px dashed var(--border-soft);
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
}
.provision-ref-add:hover { color: var(--accent-deep); border-color: var(--accent); }
.provision-ref-input {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  min-width: 160px;
}

/* ---------- Kursskizzen: Notizblock + Folien als aufgeschlagenes Spread ---------- */
.notebook-spread {
  display: grid;
  /* minmax(0, 1fr): beide Seiten bleiben gleich breit – auch wenn viele/lange PDF-Tabs rechts dazukommen
     (sonst würde die Folien-Seite breiter und das Schreibfenster links schmäler) */
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  min-height: 560px;
}
.notebook-page {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.notebook-page-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.notebook-divider {
  width: 1px;
  position: relative;
  background: linear-gradient(to bottom, transparent, var(--border) 8%, var(--border) 92%, transparent);
}
.notebook-divider::before, .notebook-divider::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--panel-muted);
  border: 1px solid var(--border);
}
.notebook-divider::before { top: 16%; }
.notebook-divider::after { top: 80%; }
.notes-textarea {
  flex: 1;
  min-height: 480px;
  /* Eigener Scrollbalken statt die ganze Seite wachsen zu lassen – so bleiben die Folien
     rechts daneben immer sichtbar, egal wie lang der Notiztext wird. */
  max-height: 560px;
  overflow-y: auto;
  resize: none;
  font-family: "Calibri", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  padding: 34px 38px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background-color: var(--paper);
  background-image: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 10px 26px -16px rgba(0,0,0,0.2);
}
.notes-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash), 0 10px 26px -16px rgba(0,0,0,0.2);
}

/* ---------- Markierfunktion für Folien (Textmarker-Overlay über der Folienvorschau) ---------- */
.annot-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.annot-color-row { display: flex; align-items: center; gap: 5px; margin: 0 2px; }
.annot-color-swatch {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; padding: 0; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.annot-color-swatch:hover { transform: scale(1.1); }
.annot-color-swatch.annot-color-active { border-color: var(--text); transform: scale(1.12); }

/* Folien-Spalte bleibt beim Scrollen der Notizen sichtbar – samt Markierleiste (sonst scrollt sie aus dem Bild) */
.slides-page { position: sticky; top: 6px; align-self: start; min-width: 0; }
.slide-tabs { max-width: 100%; }
@media (max-width: 860px) {
  .notebook-spread { grid-template-columns: 1fr; }
  .notebook-divider { display: none; }
  .slides-page { position: static; }
  .notes-page { border-bottom: 1px solid var(--border-soft); }
}

/* ---------- Formatierungsleiste (über allen Textfeldern) – gedämpfte Glas-Pille mit Icon-Buttons ---------- */
.fmt-toolbar {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  gap: 1px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding: 5px 8px;
  background: linear-gradient(135deg, var(--chrome-a), var(--chrome-b));
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-radius: 999px;
  border: 1px solid var(--chrome-border);
  box-shadow: 0 6px 18px -4px rgba(0,0,0,0.35);
  /* Angepinnt: bleibt beim Scrollen sichtbar, statt nach oben aus dem Blick zu verschwinden.
     top-Offset ist so gewählt, dass die Leiste unterhalb der fixen #topbar (~78px hoch,
     z-index 30) andockt, ohne sie zu verdecken; innerhalb von Modalen (kein sichtbarer
     Topbar-Konflikt) rutscht sie einfach an den oberen Rand des Modal-Scrollbereichs. */
  position: sticky;
  top: 6px;
  z-index: 25;
}
.fmt-divider { width: 1px; height: 18px; background: var(--chrome-divider); margin: 0 5px; flex: 0 0 auto; }
.fmt-btn {
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--chrome-text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.fmt-btn:hover { background: var(--chrome-hover); }
.fmt-btn:active { background: var(--chrome-hover); filter: brightness(0.94); }
.fmt-btn b, .fmt-btn i, .fmt-btn u, .fmt-btn s { font-family: var(--sans); font-size: 13px; }
.fmt-btn svg { width: 15px; height: 15px; }
.fmt-btn.fmt-heading { font-size: 11px; font-weight: 700; width: auto; padding: 0 6px; border-radius: 6px; }
mark { background: var(--accent-light); color: var(--accent-deep); padding: 0 2px; border-radius: 2px; }

/* Überschriften innerhalb von Rich-Text-Feldern/-Anzeigen – deutlich kleiner als echte Seitenüberschriften */
.rich-editable h1, .rich-editable h2, .rich-editable h3,
.provision-text h1, .provision-text h2, .provision-text h3,
.law-description h1, .law-description h2, .law-description h3,
.question-text h1, .question-text h2, .question-text h3,
.answer-text h1, .answer-text h2, .answer-text h3 {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--accent-deep);
  margin: 10px 0 6px;
  line-height: 1.25;
}
.rich-editable h1, .provision-text h1, .law-description h1, .question-text h1, .answer-text h1 { font-size: 20px; }
.rich-editable h2, .provision-text h2, .law-description h2, .question-text h2, .answer-text h2 { font-size: 17px; }
.rich-editable h3, .provision-text h3, .law-description h3, .question-text h3, .answer-text h3 { font-size: 15px; }

/* ---------- Homebase: Allgemeine Fragen ---------- */
.question-card { border-left: 3px solid var(--accent); }
.question-card .question-text { font-family: var(--serif); font-size: 14.5px; line-height: 1.5; }
.question-card .answer-text { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-soft); font-size: 13.5px; line-height: 1.6; }
.question-card .answer-empty { margin-top: 8px; color: var(--text-faint); font-size: 12.5px; font-style: italic; }

/* ---------- Lernwall: Karteikarten (Flip-Karte zum Durchgehen) ---------- */
.flashcard-stage {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
  perspective: 1600px;
}
.flashcard {
  width: 100%;
  max-width: 560px;
  height: 320px;
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.flashcard.is-flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--panel-solid);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 20px 50px -20px rgba(0,0,0,0.3);
  padding: 30px 34px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.flashcard-back {
  transform: rotateY(180deg);
  background: var(--accent-wash);
  border-color: var(--accent-light);
}
.flashcard-face-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-weight: 700;
  margin-bottom: 14px;
  flex: 0 0 auto;
}
.flashcard-face-content {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  margin: auto 0;
}
.flashcard-front .flashcard-face-content { text-align: center; font-weight: 700; font-size: 20px; }

/* ---------- Klausurportal: Filter ---------- */
.filter-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filter-row select { max-width: 200px; }

/* ---------- Uni-Konto: Anmeldefenster (Design-Vorschau, 1:1 nach Vorlage) ----------
   Bewusst eigenständig gestylt (nicht die normale .modal-Klasse) – gedämpftes,
   kinoreifes Foto-artiges Hintergrund-Bokeh + eine schwebende Frosted-Glass-Karte,
   helle Schrift auf dunklem Grund, unterstrichene Eingabefelder statt Boxen. */
.uni-login-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(92,168,124,0.35), transparent 46%),
    radial-gradient(circle at 88% 0%, rgba(183,229,186,0.28), transparent 42%),
    radial-gradient(circle at 50% 100%, rgba(26,81,64,0.55), transparent 55%),
    linear-gradient(160deg, #14231b, #0a120d 70%);
}
.uni-login-card {
  position: relative;
  width: 100%; max-width: 380px;
  background: rgba(255,255,255,0.13);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 28px;
  padding: 42px 32px 32px;
  box-shadow: 0 40px 90px -20px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.2);
  color: #f4f6ee;
}
.uni-login-close {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.14); border: none; color: #f4f6ee;
  font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.uni-login-close:hover { background: rgba(255,255,255,0.24); }
.uni-login-card h2 {
  font-family: var(--display);
  font-size: 25px; font-weight: 800; line-height: 1.25;
  color: #fff; margin: 0 0 26px;
}
.uni-field { margin-bottom: 20px; }
.uni-field-row { display: flex; justify-content: space-between; align-items: baseline; }
.uni-field label {
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(244,246,238,0.6); margin: 0;
}
.uni-field a.uni-link {
  font-size: 11.5px; color: rgba(244,246,238,0.75);
}
.uni-field a.uni-link:hover { color: #fff; }
.uni-field input {
  width: 100%; background: transparent; border: none;
  border-bottom: 1px solid rgba(244,246,238,0.32);
  border-radius: 0; padding: 9px 2px 8px; margin-top: 4px;
  color: #fff; font-size: 15px;
}
.uni-field input::placeholder { color: rgba(244,246,238,0.4); }
.uni-field input:focus { outline: none; border-bottom-color: var(--accent); box-shadow: none; }
.uni-remember { display: flex; align-items: center; gap: 8px; margin: 4px 0 26px; }
.uni-remember input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
.uni-remember label { font-size: 12.5px; color: rgba(244,246,238,0.75); margin: 0; }
.uni-btn-primary {
  width: 100%; padding: 13px; border-radius: 999px; border: none;
  background: #171a12; color: #f4f6ee; font-weight: 700; font-size: 14px;
  cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.uni-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,0.4); }
.uni-btn-secondary {
  width: 100%; padding: 13px; border-radius: 999px; margin-top: 10px;
  background: rgba(255,255,255,0.92); color: #1b1f16; font-weight: 700; font-size: 14px;
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.12s ease;
}
.uni-btn-secondary:hover { transform: translateY(-1px); }
.uni-btn-secondary svg { width: 15px; height: 15px; }
.uni-login-footnote {
  text-align: center; font-size: 11.5px; line-height: 1.5;
  color: rgba(244,246,238,0.55); margin-top: 24px;
}

/* Wer in den Systemeinstellungen reduzierte Bewegung eingestellt hat, bekommt alle Übergänge/
   Animationen praktisch verkürzt statt komplett übersprungen (so bleibt z.B. das Umschalten von
   Hell-/Dunkelmodus optisch nachvollziehbar, es "springt" aber nicht mehr sichtbar). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ====================================================================
   Kodex: Absätze (1), (2) … jeweils in eigener Zeile
   ==================================================================== */
.provision-text .abs { margin: 0 0 7px; padding-left: 2.9em; text-indent: -2.9em; }
.provision-text .abs:last-child { margin-bottom: 0; }
.provision-text .abs-no { display: inline-block; width: 2.9em; text-indent: 0; font-weight: 700; color: var(--accent-dark); }
.provision-text .abs-body { text-indent: 0; }
.provision-text .abs-plain { padding-left: 0; text-indent: 0; }
/* Ziffern (1. 2. 3.) und Buchstaben (a) b)) beginnen jeweils in einer neuen, leicht eingerückten Zeile */
.provision-text .zi-gap { display: inline-block; }
.provision-text .zi-gap.zi-l0 { width: 0.9em; }
.provision-text .zi-gap.zi-l1 { width: 2.1em; }
.provision-text .zi-br { line-height: 1.9; }
/* Verweise pro Absatz: stehen unter dem Absatz; der Knopf ist dezent und erscheint deutlich beim Darüberfahren */
.provision-text .abs-refs { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 3px; text-indent: 0; }
.provision-text .abs-ref-add {
  background: none; border: 1px dashed transparent; border-radius: 999px; cursor: pointer;
  color: var(--text-muted); font-size: 11px; font-weight: 600; padding: 1px 8px; opacity: 0.55;
}
.provision-text .abs:hover .abs-ref-add, .provision-text .abs-ref-add:focus { opacity: 1; border-color: var(--border-soft); }
.provision-text .abs-ref-add:hover { color: var(--accent-deep); border-color: var(--accent); }
@media (hover: none) { .provision-text .abs-ref-add { opacity: 1; border-color: var(--border-soft); } }
.provision-text .abs-refs .provision-ref-chip { font-size: 11px; padding: 1px 4px 1px 9px; }
.provision-text .abs-refs .provision-ref-input { font-size: 11px; padding: 2px 8px; min-width: 130px; }
.provision-ref-chip .rich-ref { cursor: pointer; }
.provision-text .abs-note { color: var(--text-muted); font-style: italic; font-size: 0.93em; padding-left: 0; text-indent: 0; }
.provision-text .abs-note .abs-body { display: inline; }
[data-theme="dark"] .provision-text .abs-no { color: var(--accent); }

/* Mehrfarbige Markierungen im Normtext */
.provision-text mark.user-highlight { color: inherit; padding: 0 1px; border-radius: 3px; cursor: pointer; }
.provision-text mark.user-highlight.hl-yellow { background: rgba(255, 217, 61, 0.5); }
.provision-text mark.user-highlight.hl-green  { background: rgba(92, 190, 130, 0.38); }
.provision-text mark.user-highlight.hl-pink   { background: rgba(255, 120, 165, 0.38); }
.provision-text mark.user-highlight.hl-blue   { background: rgba(90, 170, 255, 0.38); }
.provision-text mark.user-highlight.hl-orange { background: rgba(255, 160, 60, 0.45); }
.provision-text mark.user-highlight.hl-purple { background: rgba(165, 120, 250, 0.38); }

.codex-hl-menu {
  position: fixed; z-index: 70;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 9px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 10px 28px -6px rgba(0,0,0,0.45);
}
.codex-hl-swatch {
  width: 20px; height: 20px; padding: 0; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18);
  transition: transform 0.12s ease;
}
.codex-hl-swatch:hover { transform: scale(1.15); }
.codex-hl-swatch.active { border-color: var(--text); }
.codex-hl-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.codex-hl-remove {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 12px; font-family: var(--sans); padding: 2px 4px; border-radius: 6px;
}
.codex-hl-remove:hover { color: var(--text); background: var(--chrome-hover); }

/* ====================================================================
   Word-artige Leiste für das Notizenfeld
   ==================================================================== */
.fmt-toolbar.word-toolbar {
  flex-direction: column; align-items: stretch; gap: 3px;
  border-radius: 16px; padding: 6px 8px;
  top: 6px;
}
.word-toolbar .wt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; }
.word-toolbar .wt-group { display: flex; align-items: center; gap: 1px; padding: 0 6px; position: relative; }
.word-toolbar .wt-group + .wt-group::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 1px; background: var(--chrome-divider);
}
.word-toolbar .wt-group:first-child { padding-left: 0; }
.word-toolbar .fmt-btn { border-radius: 7px; width: 28px; height: 28px; position: relative; }
.word-toolbar .fmt-btn.active, .word-toolbar .wt-drop.active { background: var(--accent-wash); color: var(--accent-deep); box-shadow: inset 0 0 0 1px var(--accent); }
[data-theme="dark"] .word-toolbar .fmt-btn.active { color: var(--accent-dark); background: rgba(92,168,124,0.18); }
.word-toolbar .wt-glyph { font-family: var(--sans); font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; }
.word-toolbar .wt-glyph.wt-small { font-size: 11px; }
.word-toolbar .wt-glyph sub, .word-toolbar .wt-glyph sup { font-size: 8px; line-height: 0; }

.word-toolbar .wt-drop {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 4px;
  height: 28px; padding: 0 7px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--chrome-text); cursor: pointer;
  font-family: var(--sans); font-size: 12.5px;
}
.word-toolbar .wt-drop:hover { background: var(--chrome-hover); border-color: var(--chrome-border); }
.word-toolbar .wt-style { width: 104px; }
.word-toolbar .wt-font { width: 128px; }
.word-toolbar .wt-size { width: 56px; }
.word-toolbar .wt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.word-toolbar .wt-chev, .word-toolbar .wt-caret { font-size: 9px; opacity: 0.7; }

.word-toolbar .wt-split { display: inline-flex; align-items: center; border-radius: 7px; }
.word-toolbar .wt-split:hover { background: var(--chrome-hover); }
.word-toolbar .wt-split .fmt-btn { width: 26px; }
.word-toolbar .wt-split .fmt-btn:hover { background: transparent; }
.word-toolbar .wt-caret {
  width: 14px; height: 28px; padding: 0; border: none; background: transparent; cursor: pointer; color: var(--chrome-text);
}
.word-toolbar .wt-a { font-family: var(--sans); font-weight: 700; font-size: 14px; line-height: 1; margin-top: -3px; }
.word-toolbar .wt-bar {
  position: absolute; left: 6px; right: 6px; bottom: 3px; height: 3px; border-radius: 2px; background: transparent;
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.25);
}

/* Popover (hängt am <body>) */
.wt-pop {
  position: fixed; z-index: 80; min-width: 150px; max-height: min(70vh, 460px); overflow-y: auto;
  padding: 6px;
  background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px -8px rgba(0,0,0,0.45);
  font-family: var(--sans); font-size: 13px;
}
.wt-pop .wt-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 6px 10px; border: none; border-radius: 7px; background: transparent;
  color: inherit; cursor: pointer; font: inherit; box-sizing: border-box;
}
.wt-pop .wt-item:hover { background: var(--chrome-hover); }
.wt-pop .wt-item.active { background: var(--accent-wash); color: var(--accent-deep); font-weight: 600; }
[data-theme="dark"] .wt-pop .wt-item.active { color: var(--accent-dark); background: rgba(92,168,124,0.18); }
.wt-pop.wt-list { min-width: 170px; }
.wt-pop .wt-danger { color: var(--red); }
.wt-pop .wt-more { position: relative; cursor: pointer; }
.wt-pop .wt-more input[type=color] { width: 24px; height: 20px; padding: 0; border: none; background: none; margin-left: auto; cursor: pointer; }
.wt-pop .wt-swatches { display: grid; grid-template-columns: repeat(5, 24px); gap: 5px; padding: 6px 10px; }
.wt-pop .wt-swatch {
  width: 24px; height: 24px; padding: 0; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2);
}
.wt-pop .wt-swatch:hover { transform: scale(1.1); }
.wt-pop .wt-swatch.active { border-color: var(--text); }
.wt-pop.wt-border { width: 272px; }
.wt-pop .wt-sect { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 8px 10px 3px; }
.wt-pop .wt-seg { display: flex; gap: 4px; padding: 2px 10px; flex-wrap: wrap; }
.wt-pop .wt-segbtn {
  flex: 1 1 auto; padding: 4px 8px; border: 1px solid var(--border); border-radius: 7px;
  background: transparent; color: inherit; cursor: pointer; font: inherit; font-size: 12px;
}
.wt-pop .wt-segbtn:hover { background: var(--chrome-hover); }
.wt-pop .wt-segbtn.active { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-deep); font-weight: 600; }
[data-theme="dark"] .wt-pop .wt-segbtn.active { color: var(--accent-dark); background: rgba(92,168,124,0.18); }
.wt-pop .wt-poslist { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px 4px; }
.wt-pop .wt-pos { padding: 5px 8px; font-size: 12px; }
.wt-pop .wt-posicon { display: inline-flex; flex: 0 0 auto; }
.wt-pop.wt-table { padding: 10px; }
.wt-pop .wt-tgrid { display: grid; grid-template-columns: repeat(8, 18px); gap: 3px; }
.wt-pop .wt-tcell { width: 18px; height: 18px; border: 1px solid var(--border); border-radius: 3px; background: transparent; cursor: pointer; }
.wt-pop .wt-tcell.on { background: var(--accent-wash); border-color: var(--accent); }
.wt-pop .wt-tlabel { text-align: center; font-size: 12px; color: var(--text-muted); margin: 6px 0 4px; }

/* Inhalte im Word-Editor */
.word-editor { font-size: 15px; }
.word-editor p, .word-editor div { margin: 0 0 0.45em; }
.word-editor table { border-collapse: collapse; margin: 8px 0; max-width: 100%; }
.word-editor td, .word-editor th { border: 1px solid var(--border); padding: 5px 8px; min-width: 48px; vertical-align: top; }
.word-editor th { background: var(--panel-muted); font-weight: 700; }
.word-editor hr { border: none; border-top: 2px solid var(--border); margin: 12px 0; }
.word-editor blockquote { margin: 6px 0; padding-left: 12px; border-left: 3px solid var(--accent); color: var(--text-muted); }
.word-editor ul, .word-editor ol { margin: 4px 0; padding-left: 26px; }
.wt-pop.wt-border .wt-swatches { grid-template-columns: repeat(6, 24px); }
.codex-item .provision-text { font-family: var(--serif); font-size: 13.5px; line-height: 1.65; }
.wt-pop .wt-more { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Word-Leiste in Dialogen: etwas breiter, damit die Leiste nicht in vier Zeilen umbricht */
.modal:has(.word-toolbar) { width: min(720px, 94vw); }
.modal .fmt-toolbar.word-toolbar { top: 0; }

/* ====================================================================
   Hover-Beschriftung für Symbole (siehe js/tooltip.js)
   ==================================================================== */
.nomos-tip {
  position: fixed; z-index: 200; pointer-events: none;
  max-width: 240px; padding: 5px 10px;
  background: var(--text); color: var(--paper);
  border-radius: 8px; font-family: var(--sans); font-size: 12px; font-weight: 600; line-height: 1.3;
  box-shadow: 0 8px 20px -6px rgba(0,0,0,0.45);
  opacity: 0; transform: translateY(2px); visibility: hidden;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
}
.nomos-tip.show { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }

/* „Allgemein für alle sichtbar“-Schalter: Text nie abschneiden, sondern umbrechen */
.share-toggle-row { align-items: flex-start; line-height: 1.4; }
.share-toggle-row input { width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 2px 0 0; flex: 0 0 16px; }
.share-toggle-row span { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; }

/* ====================================================================
   Info-Guide auf der Homebase
   ==================================================================== */
.guide-card { padding: 0; overflow: hidden; border-color: var(--accent-light); }
.guide-summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px;
}
.guide-summary::-webkit-details-marker { display: none; }
.guide-title { font-weight: 700; display: inline-flex; align-items: center; gap: 10px; }
.guide-badge {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 13px;
}
.guide-hint { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.guide-hint::after { content: ' ›'; }
.guide-card[open] .guide-hint::after { content: ' ⌃'; }
.guide-body { padding: 0 20px 18px; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.guide-tile {
  display: flex; flex-direction: column; gap: 4px; padding: 11px 13px; border-radius: 12px;
  background: var(--panel-muted); border: 1px solid var(--border-soft); color: var(--text); text-decoration: none;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.guide-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.guide-tile strong { font-size: 13px; color: var(--accent-deep); }
[data-theme="dark"] .guide-tile strong { color: var(--accent-dark); }
.guide-tile span { font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.guide-tips { margin-top: 14px; font-size: 12.5px; }
.guide-tips ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-muted); line-height: 1.5; }
.guide-tips li { margin-bottom: 3px; }

/* Info-Guide: Schritt für Schritt mit Vorschaubildern (js/guide.js) */
.guide-intro { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.guide-intro p { flex: 1 1 320px; }
.guide-progress { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 13px; margin: 4px 0 8px; color: var(--accent-deep); }
[data-theme="dark"] .guide-progress { color: var(--accent-dark); }
.guide-progress .muted { font-weight: 500; font-size: 12px; }
.guide-h { margin: 18px 0 8px; font-size: 13px; color: var(--accent-deep); }
[data-theme="dark"] .guide-h { color: var(--accent-dark); }
.guide-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.guide-step { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 270px); gap: 18px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--panel-muted); border: 1px solid var(--border-soft); }
.guide-step.is-done { opacity: 0.72; }
.gs-head { display: flex; align-items: center; gap: 10px; }
.gs-head h4 { margin: 0; font-size: 14.5px; }
.gs-num { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-dark); color: #fff; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
[data-theme="dark"] .gs-num { background: var(--accent); color: #0d1a13; }
.guide-step.is-done .gs-num { background: var(--accent); }
.gs-lead { margin: 6px 0 6px 34px; font-size: 12.5px; color: var(--text-muted); }
.gs-list { margin: 0 0 8px 34px; padding-left: 18px; font-size: 12.5px; line-height: 1.55; }
.gs-list li { margin-bottom: 2px; }
.gs-foot { margin-left: 34px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.gs-done { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.gs-ill { min-width: 0; }
@media (max-width: 760px) {
  .guide-step { grid-template-columns: 1fr; }
  .gs-ill { order: -1; max-width: 340px; }
  .gs-lead, .gs-list, .gs-foot { margin-left: 0; }
}

/* Mini-Vorschaubilder (SVG) – übernehmen die Farben der App */
.gi { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--panel-muted); border: 1px solid var(--border-soft); font-family: inherit; }
.guide-step .gi { background: var(--panel-solid); }
.gi .p { fill: var(--paper); stroke: var(--border); stroke-width: 1; }
.gi .sl { fill: #fff; }
.gi .cf { fill: var(--paper); stroke: var(--border); stroke-width: 1; }
[data-theme="dark"] .gi .sl { fill: #e9f1ec; }
.gi .a { fill: var(--accent); }
.gi .al { fill: var(--accent-light); }
[data-theme="dark"] .gi .al { fill: #2a4a3a; }
.gi .m { fill: var(--text-muted); opacity: 0.4; }
.gi .pill { fill: var(--panel-muted); stroke: var(--border); stroke-width: 1; }
.gi .field { fill: var(--field-bg, #fff); stroke: var(--border); stroke-width: 1; }
.gi .sep { fill: var(--border); }
.gi .tabc { fill: var(--accent-light); }
[data-theme="dark"] .gi .tabc { fill: #2a4a3a; }
.gi .tabi { fill: var(--panel-muted); stroke: var(--border); stroke-width: 1; }
.gi .t, .gi .tb { fill: var(--text); }
.gi .tb { font-weight: 700; }
.gi .tm { fill: var(--text-muted); }
.gi .ta { fill: var(--accent-dark); font-weight: 700; }
[data-theme="dark"] .gi .ta { fill: var(--accent); }
.gi .tw { fill: #fff; font-weight: 700; }
.gi .tg { fill: var(--accent-deep); font-weight: 700; }
[data-theme="dark"] .gi .tg { fill: #eef8ef; }
.gi .arrow { fill: none; stroke: var(--accent-dark); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gi .hl { fill: none; stroke: var(--accent-dark); stroke-width: 1.6; stroke-dasharray: 4 3; animation: giDash 1.4s linear infinite; }
@keyframes giDash { to { stroke-dashoffset: -14; } }
@media (prefers-reduced-motion: reduce) { .gi .hl { animation: none; } #nomosTour .tour-spot, #nomosTour .tour-card { transition: none !important; } }

/* Geführte Tour (js/guide.js) */
#nomosTour { position: fixed; inset: 0; z-index: 99000; }
#nomosTour .tour-block { position: absolute; inset: 0; background: transparent; }
#nomosTour .tour-spot {
  position: absolute; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10, 24, 18, 0.64), 0 0 0 2px var(--accent), 0 0 24px 4px rgba(92, 168, 124, 0.45);
  transition: left 0.28s ease, top 0.28s ease, width 0.28s ease, height 0.28s ease;
}
#nomosTour .tour-card {
  position: absolute; background: var(--paper); color: var(--text); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px 16px; box-shadow: 0 24px 60px -16px rgba(10, 24, 18, 0.55); transition: left 0.28s ease, top 0.28s ease;
}
#nomosTour .tour-count { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--accent-dark); margin-bottom: 4px; }
[data-theme="dark"] #nomosTour .tour-count { color: var(--accent); }
#nomosTour .tour-card h3 { margin: 0 0 6px; font-size: 17px; }
#nomosTour .tour-card p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; color: var(--text-muted); }
#nomosTour .tour-dots { display: flex; gap: 5px; margin-bottom: 12px; }
#nomosTour .tour-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
#nomosTour .tour-dots span.on { width: 18px; border-radius: 3px; background: var(--accent-dark); }
#nomosTour .tour-actions { display: flex; align-items: center; gap: 8px; }
#nomosTour .tour-spacer { flex: 1; }
#nomosTour .tour-skip { background: none; border: 0; color: var(--text-muted); font: inherit; font-size: 12.5px; cursor: pointer; padding: 6px 4px; }
#nomosTour .tour-skip:hover { color: var(--text); text-decoration: underline; }

/* ====================================================================
   Entwurfs-Schutz (js/draftguard.js)
   ==================================================================== */
.draft-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.4;
  background: var(--accent-wash); border: 1px solid var(--accent-light); color: var(--text);
}
.draft-bar.draft-warn { background: rgba(182, 84, 63, 0.12); border-color: rgba(182, 84, 63, 0.45); }
.draft-bar-actions { display: inline-flex; gap: 6px; }
.draft-bar-btn {
  border: 1px solid var(--border); background: var(--panel-solid); color: var(--text); cursor: pointer;
  border-radius: 8px; padding: 4px 10px; font: inherit; font-size: 12px; font-weight: 600;
}
.draft-bar-btn:hover { border-color: var(--accent); }
.draft-bar-btn.danger { color: var(--red); border-color: rgba(182, 84, 63, 0.5); }


/* ---------- Automatisch erkannte §-Verweise (reflinks.js) ---------- */
:root { --ref-color: #1f6b4a; }
:root[data-theme="dark"] { --ref-color: #8fd6a8; }
::highlight(nomos-ref) {
  color: var(--ref-color);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}
.ref-hover { cursor: pointer; }
.codex-item.codex-flash { animation: codexFlash 2.2s ease-out; }
@keyframes codexFlash {
  0%, 35% { background: color-mix(in srgb, var(--accent) 30%, transparent); box-shadow: 0 0 0 2px var(--accent); }
  100% { background: transparent; box-shadow: 0 0 0 0 transparent; }
}

/* Hinweis statt weißem Feld, wenn eine Datei nicht direkt angezeigt werden kann */
.preview-fallback { display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; width: 100%; height: 100%; min-height: 160px; box-sizing: border-box; color: var(--muted, #667); font-size: 13px; line-height: 1.5; background: var(--paper); }

/* ---------- Notenrechner (gradecalc.js) ---------- */
.modal:has(.gc-rows) { max-width: 640px; width: min(640px, 94vw); }
.gc-group { margin-bottom: 12px; }
.gc-group-title { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #667); margin: 0 0 6px; }
.gc-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 10px 84px 30px; gap: 6px; align-items: center; margin-bottom: 6px; }
.gc-row input { margin: 0; min-width: 0; }
.gc-row .gc-pts { text-align: right; }
.gc-of { text-align: center; opacity: .6; }
.gc-x { border: none; background: transparent; color: var(--danger, #b3402f); font-size: 18px; line-height: 1; cursor: pointer; border-radius: 8px; padding: 4px; }
.gc-x:hover { background: rgba(179, 64, 47, .12); }
.gc-add { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.gc-result { border: 1px solid var(--border-soft, rgba(0,0,0,.12)); border-radius: 14px; padding: 14px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.gc-big { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 8px; }
.gc-big > div { display: flex; flex-direction: column; gap: 2px; }
.gc-big strong { font-size: 24px; line-height: 1.15; }
.gc-grade { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; border-radius: 9px; font-weight: 700; background: var(--accent-wash, #eef8ef); color: var(--accent-deep, #1a5140); }
.gc-big .gc-grade { width: 44px; height: 44px; font-size: 24px; }
.gc-grade.g5 { background: rgba(179, 64, 47, .15); color: var(--danger, #b3402f); }
.gc-line { font-size: 13px; line-height: 1.5; margin: 6px 0 10px; }
.gc-needs { display: grid; gap: 6px; }
.gc-need { display: grid; grid-template-columns: 36px 70px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.gc-need.ok { opacity: .75; }
.gc-need.no { opacity: .5; text-decoration: line-through; }
.gc-th { margin-top: 12px; font-size: 13px; }
.gc-th summary { cursor: pointer; color: var(--accent-dark); }
.gc-th-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 10px 0; }
.gc-th-grid label { display: flex; align-items: center; gap: 6px; margin: 0; }
.gc-th-grid input { width: 70px; margin: 0; text-align: right; }
[data-theme="dark"] .gc-grade { color: var(--accent-dark); background: rgba(92,168,124,.2); }
[data-theme="dark"] .gc-grade.g5 { background: rgba(230, 120, 100, .2); color: #f0a090; }
@media (max-width: 520px) { .gc-row { grid-template-columns: minmax(0, 1fr) 64px 8px 64px 28px; } }

/* ---------- Passwortschutz der Profile (auth.js) ---------- */
.auth-overlay { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(10, 24, 18, .55); backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%); }
.auth-card { width: min(400px, 100%); background: var(--panel-solid); color: var(--text); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 22px; padding: 26px 24px 20px; box-shadow: 0 30px 80px rgba(0,0,0,.35); text-align: center; max-height: 92vh; overflow: auto; }
.auth-card h2 { margin: 10px 0 4px; font-size: 20px; }
.auth-sub { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.auth-avatar { width: 54px; height: 54px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 19px; font-family: var(--display); }
.auth-field { position: relative; margin-bottom: 10px; }
.auth-field input { width: 100%; box-sizing: border-box; margin: 0; padding-right: 40px; text-align: left; }
.auth-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 15px; opacity: .6; padding: 4px 6px; }
.auth-eye:hover { opacity: 1; }
.auth-check { display: flex; gap: 8px; align-items: flex-start; text-align: left; font-size: 12.5px; line-height: 1.45; margin: 10px 0; color: var(--text); }
.auth-check input { margin-top: 3px; width: auto; }
.auth-msg { min-height: 18px; color: var(--danger, #b3402f); font-size: 12.5px; margin: 2px 0 8px; }
.auth-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.auth-link { background: none; border: none; color: var(--accent-dark); cursor: pointer; font-size: 12.5px; margin-top: 12px; text-decoration: underline; }
.auth-code { font-family: ui-monospace, Menlo, monospace; font-size: 20px; letter-spacing: .08em; padding: 14px 8px; margin: 6px 0 10px; border-radius: 12px; border: 1px dashed var(--accent); background: var(--accent-wash); user-select: all; }
.profile-row-lock { font-size: 11px; margin-left: auto; opacity: .75; }

.auth-logo { display: block; width: 72px; height: 72px; margin: 0 auto 10px; object-fit: contain; filter: drop-shadow(0 8px 12px rgba(20,60,45,0.28)); }
.auth-brand { font-family: var(--display); letter-spacing: .22em; text-transform: uppercase; font-size: 12px; font-weight: 700; color: var(--accent-dark); margin-bottom: 10px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; }
.auth-more { text-align: left; font-size: 12.5px; margin: 4px 0 10px; }
.auth-more summary { cursor: pointer; color: var(--accent-dark); }
.auth-field input[type="email"], .auth-field input[type="text"] { padding-right: 12px; }
.auth-check, .auth-check span { text-transform: none; letter-spacing: normal; }
.auth-actions + .auth-sub { margin-top: 8px; }


/* ---------- Hinweis-Text ---------- */
.auth-note { margin: 4px 0 8px; font-size: 11.5px; line-height: 1.4; color: var(--muted, #6b7a72); text-align: left; }

.auth-spinner { width: 34px; height: 34px; margin: 18px auto 0; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: auSpin .9s linear infinite; }
@keyframes auSpin { to { transform: rotate(360deg); } }

/* ---------- Folien (PDF) seitenweise mit seitengebundenen Markierungen ---------- */
.slide-pdf-scroll { position: absolute; inset: 0; overflow: auto; background: var(--bg-soft, #e9ece9); -webkit-overflow-scrolling: touch; }
.slide-pdf-pages { padding: 12px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: min-content; }
.slide-pg { position: relative; flex: 0 0 auto; margin: 0 auto; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18); isolation: isolate; }
.slide-pg canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
/* Multiply: die Markierung färbt nur das Weiß der Folie – schwarzer Text bleibt voll lesbar */
.slide-pg .slide-pg-ann { mix-blend-mode: multiply; pointer-events: none; touch-action: auto; }
.slide-pdf-pages.annot-on .slide-pg-ann { pointer-events: auto; touch-action: none; cursor: crosshair; }
.slide-pg-no { position: absolute; right: 6px; bottom: 4px; font-size: 10px; color: #888; background: rgba(255, 255, 255, 0.8); padding: 0 5px; border-radius: 6px; pointer-events: none; }
.annot-zoom { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: 12px; }
.annot-zoom #slideZoomLbl { min-width: 42px; text-align: center; color: var(--text-muted); }

/* ---------- Studienplan-Import, Wahl-Kennzeichen, "Allgemein"-Kennzeichen ---------- */
.plan-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-solid, #fff); }
.plan-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plan-info .muted { font-size: 12px; }
.optional-tag { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; color: var(--accent-dark, #2f5d4a); background: var(--accent-wash); vertical-align: 1px; }
.shared-badge { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; vertical-align: 1px; white-space: nowrap; }
.shared-badge.mine { color: #2f6a8a; background: rgba(47, 106, 138, .12); }
.shared-badge.foreign { color: #8a5a2f; background: rgba(138, 90, 47, .13); }

/* ====================================================================
   NEUES LAYOUT (nach Entwurf): abgerundetes Fenster auf dem verschwommenen
   Pastell-Hintergrund – Kopfleiste mit Logo, mittiger Suche und Aktionen,
   links die Seitenleiste (Navigation / Fächer / Tools), rechts der Inhalt.
   ==================================================================== */
:root {
  --win-bg: rgba(255,255,255,0.93);
  --win-line: rgba(30,40,34,0.09);
  --side-hover: rgba(30,40,34,0.05);
  --side-active: #dff0e4;
  --side-active-text: #17402f;
  --field-bg: #ffffff;
  --field-border: rgba(30,40,34,0.12);
  --pill-bg: #e9f3ec;
  --pill-text: #1d5a42;
  --logo-bg: #3f7d61;
}
:root[data-theme="dark"] {
  --win-bg: rgba(20,34,25,0.94);
  --win-line: rgba(255,255,255,0.08);
  --side-hover: rgba(255,255,255,0.06);
  --side-active: rgba(92,168,124,0.22);
  --side-active-text: #dff3e5;
  --field-bg: rgba(255,255,255,0.06);
  --field-border: rgba(255,255,255,0.12);
  --pill-bg: rgba(92,168,124,0.2);
  --pill-text: #cdeed6;
  --logo-bg: #3f7d61;
}

body { display: block; min-height: 100vh; overflow: hidden; }

#appwin {
  position: fixed;
  inset: 22px;
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  grid-template-rows: 76px minmax(0, 1fr);
  background: var(--win-bg);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 2px 4px rgba(20,30,25,0.04), 0 30px 80px -20px rgba(40,30,30,0.28);
  overflow: hidden;
}
:root[data-theme="dark"] #appwin { border-color: rgba(255,255,255,0.08); box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6); }

/* ---------- Kopfleiste ---------- */
#topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px 0 26px;
  position: relative;
  z-index: 60;
  border-bottom: 1px solid var(--win-line);
}
.tb-menu { display: none; }
.brand-link { display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--text); flex: 0 0 auto; width: 192px; }
.brand-logo {
  width: 40px; height: 40px; object-fit: contain; display: block;
  filter: drop-shadow(0 3px 5px rgba(20,60,45,0.30));
  flex: 0 0 auto;
}
.brand { font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: 0.2em; color: var(--text); white-space: nowrap; }

.topbar-center { flex: 1 1 auto; display: flex; justify-content: center; position: relative; min-width: 0; }
.topsearch {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 715px; height: 42px; padding: 0 16px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(30,40,34,0.04);
  color: var(--text-muted);
  margin: 0;
  text-transform: none; letter-spacing: 0; font-size: 14px;
  cursor: text;
}
.topsearch:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--wash-rgb), 0.22); }
.topsearch svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--text); }
.topsearch input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent; box-shadow: none;
  font: inherit; font-size: 13.5px; color: var(--text); padding: 0; margin: 0; height: 100%;
}
.topsearch input::placeholder { color: var(--text-muted); opacity: 0.85; }
.topsearch kbd { font-family: inherit; font-size: 12px; color: var(--text-faint); letter-spacing: 0.08em; flex: 0 0 auto; }

.topbar-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.tb-pill {
  display: inline-flex; align-items: center; gap: 9px;
  height: 40px; padding: 0 18px;
  border-radius: 11px; border: none;
  background: var(--pill-bg); color: var(--pill-text);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: filter 0.15s ease, transform 0.08s ease;
}
.tb-pill svg { width: 17px; height: 17px; }
.tb-pill:hover { filter: brightness(0.96); }
.tb-pill:active { transform: translateY(1px); }
.tb-bell {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--text); background: transparent; margin-left: 6px;
}
.tb-bell:hover { background: var(--side-hover); }
.tb-bell svg { width: 21px; height: 21px; }
.profile-trigger {
  margin-left: 6px; width: 38px; height: 38px; border: none;
  background: #5f8f77; color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: none;
}
.profile-trigger:hover { filter: brightness(1.08); }
.profile-panel { top: 70px; right: 20px; }
.search-panel {
  top: calc(100% + 8px); left: 50%; right: auto; width: 100%; max-width: 715px;
  transform: translateX(-50%);
  max-width: min(715px, 100%);
}

/* ---------- Seitenleiste ---------- */
#sidebar {
  grid-row: 2; grid-column: 1;
  overflow-y: auto; overflow-x: hidden;
  padding: 14px 12px 18px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--win-line) transparent;
}
.sb-nav { display: flex; flex-direction: column; gap: 1px; }
.sb-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; height: 36px; padding: 0 12px;
  border: none; background: transparent; border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 500; color: var(--text);
  text-decoration: none; text-align: left; cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.sb-item:hover { background: var(--side-hover); }
.sb-item.active { background: var(--side-active); color: var(--side-active-text); font-weight: 600; }
.sb-icon { width: 20px; height: 20px; flex: 0 0 auto; display: flex; }
.sb-icon svg { width: 100%; height: 100%; }
.sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-item.soon { opacity: 0.5; }
.sb-item.soon:hover { opacity: 0.7; }
.sb-soon { font-size: 8.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); border: 1px solid var(--win-line); border-radius: 999px; padding: 1px 5px; flex: 0 0 auto; }
.sb-divider { height: 1px; background: var(--win-line); margin: 12px 4px 10px; }
.sb-section-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: none; padding: 4px 12px 8px; cursor: pointer;
  font-family: inherit; font-size: 12px; letter-spacing: 0.09em; font-weight: 500; color: var(--text-muted);
}
.sb-chev { width: 16px; height: 16px; display: flex; transition: transform 0.18s ease; }
.sb-chev svg { width: 100%; height: 100%; }
.sb-section.closed .sb-chev { transform: rotate(-90deg); }
.sb-section.closed .sb-section-body { display: none; }
.sb-section-body { display: flex; flex-direction: column; gap: 1px; }
.sb-fach { height: 34px; font-size: 13.5px; gap: 12px; }
.sb-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; margin: 0 4px 0 3px; }
.sb-add { color: var(--text-muted); height: 36px; font-size: 13.5px; margin-top: 4px; }
.sb-add .sb-icon { width: 17px; height: 17px; margin: 0 5px 0 2px; }
.sb-hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; padding: 2px 12px 6px; }
.sidebar-scrim { display: none; }

/* ---------- Inhaltsbereich ---------- */
#main {
  grid-row: 2; grid-column: 2;
  overflow-y: auto; overflow-x: hidden;
  padding: 26px 34px 40px;
  background: transparent;
  border-left: 1px solid var(--win-line);
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--win-line) transparent;
}
.view-eyebrow { font-size: 11px; letter-spacing: 0.1em; }
.card { background: var(--panel); }
:root:not([data-theme="dark"]) .card { background: rgba(255,255,255,0.82); }

/* schwebende Knöpfe/Hinweise: ohne untere Navigationsleiste jetzt ganz unten */
.codex-fab { bottom: 44px; right: 44px; }
.ai-fab { display: none; }
.ai-panel { right: 44px; bottom: 44px; width: 380px; max-height: 70vh; border-top: 1px solid rgba(255,255,255,0.16); border-radius: 18px; z-index: 70; box-shadow: 0 24px 60px -12px rgba(0,0,0,0.3); }
.toast { bottom: 44px; right: 44px; }

/* ---------- Schmale Fenster: Seitenleiste wird zum ausfahrbaren Menü ---------- */
@media (max-width: 1180px) {
  .tb-pill span { display: none; }
  .tb-pill { padding: 0 12px; }
  .brand-link { width: auto; }
}
@media (max-width: 900px) {
  #appwin { inset: 0; border-radius: 0; border: none; grid-template-columns: minmax(0, 1fr); }
  #topbar { padding: 0 12px; gap: 10px; }
  .tb-menu { display: flex; width: 38px; height: 38px; border: none; background: transparent; color: var(--text); align-items: center; justify-content: center; border-radius: 10px; cursor: pointer; }
  .tb-menu svg { width: 22px; height: 22px; }
  .brand { display: none; }
  .brand-link { width: auto; }
  .tb-pill, .tb-bell { display: none; }
  #main { grid-column: 1; border-left: none; padding: 18px 14px 36px; }
  #sidebar {
    position: fixed; z-index: 90; top: 0; bottom: 0; left: 0; width: 262px;
    background: var(--panel-solid); transform: translateX(-102%); transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.25);
  }
  body.sidebar-open #sidebar { transform: none; }
  body.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(0,0,0,0.3); }
  .ai-panel { right: 12px; bottom: 12px; left: 12px; width: auto; }
}

/* "Bald verfügbar"-Knopf in der Kopfleiste */
.tb-pill.soon { opacity: 0.55; }
.tb-pill.soon:hover { opacity: 0.75; filter: none; }
.tb-soon { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid currentColor; border-radius: 999px; padding: 1px 6px; opacity: 0.8; }
@media (max-width: 1180px) { .tb-pill .tb-soon { display: none; } }

/* Karteikarten ein-/ausklappbar */
.card-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; text-transform: none; letter-spacing: 0; }
.card-toggle strong { font-size: 15px; }
.card-chev { display: inline-block; width: 16px; transition: transform 0.18s ease; color: var(--text-muted); }
.card-chev.closed { transform: rotate(-90deg); }

/* Folien: Tabs für mehrere PDFs pro Einheit */
.slide-tabs { display: flex; align-items: flex-end; gap: 4px; overflow-x: auto; margin: 0 0 10px; border-bottom: 1px solid var(--win-line); scrollbar-width: none; }
.slide-tabs::-webkit-scrollbar { display: none; }
.slide-tab { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; max-width: 230px; padding: 8px 12px; margin: 0; border: 1px solid transparent; border-bottom: none; border-radius: 10px 10px 0 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 12.5px; text-transform: none; letter-spacing: 0; cursor: pointer; }
.slide-tab:hover { background: var(--side-hover); color: var(--text); }
.slide-tab.active { background: var(--paper); color: var(--text); border-color: var(--win-line); font-weight: 600; position: relative; top: 1px; }
.slide-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-tab-x { font-size: 15px; line-height: 1; opacity: 0.55; border-radius: 50%; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.slide-tab-x:hover { opacity: 1; background: var(--side-hover); }
label.slide-tab-add { font-size: 17px; padding: 5px 13px; }

/* Karteikarten nach Themengebieten (view.learningwall.js) */
.fc-topics { display: flex; flex-direction: column; gap: 8px; }
.fc-topic { border: 1px solid var(--border-soft); border-radius: 12px; background: var(--panel-muted); overflow: hidden; }
.fc-topic-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none; }
.fc-topic-head::-webkit-details-marker { display: none; }
.fc-topic-chev { display: inline-block; transition: transform 0.15s ease; color: var(--text-muted); font-size: 12px; }
.fc-topic:not([open]) .fc-topic-chev { transform: rotate(-90deg); }
.fc-topic-name { font-weight: 700; color: var(--accent-deep); }
[data-theme="dark"] .fc-topic-name { color: var(--accent-dark); }
.fc-topic-study { margin-left: auto; }
.fc-topic > div { padding: 0 12px 8px; }
.fc-topic .file-row { background: var(--paper); }

/* RIS-Suche im Kodex */
.ris-card { padding: 12px 16px; }
.ris-summary { cursor: pointer; list-style: none; }
.ris-summary::-webkit-details-marker { display: none; }
.ris-summary::before { content: '▸'; display: inline-block; width: 16px; color: var(--accent); }
.ris-card[open] > .ris-summary::before { content: '▾'; }
.ris-hit { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; background: var(--surface, transparent); }

/* Info-Guide: große Beispielbilder mit Nummern */
.guide-step.has-wide { grid-template-columns: 1fr; align-items: stretch; }
.guide-step.has-wide .gs-ill { order: 2; max-width: 640px; }
.gi-wide { background: var(--panel-solid); }
.gs-list.gs-marked { list-style: none; padding-left: 0; margin-left: 34px; }
.gs-list.gs-marked li { position: relative; padding-left: 28px; margin-bottom: 6px; }
.gs-list .mk { position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 700px) { .gs-list.gs-marked { margin-left: 0; } }

/* Kurs-Chat (Register Freunde) */
.chat-wrap { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-solid); overflow: hidden; max-width: 820px; }
.chat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.chat-list { height: min(50vh, 480px); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--panel-muted); }
.chat-empty { margin: auto; color: var(--text-muted); font-size: 13px; text-align: center; }
.chat-msg { max-width: 78%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-meta { font-size: 11px; color: var(--text-muted); margin: 0 4px 2px; }
.chat-bubble { display: inline-block; text-align: left; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--panel-solid); border: 1px solid var(--border-soft); font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { border-radius: 14px 14px 4px 14px; background: var(--accent-light); border-color: transparent; }
[data-theme="dark"] .chat-msg.mine .chat-bubble { background: #2a4a3a; }
.chat-actions { margin: 1px 4px 0; min-height: 14px; }
.chat-link { background: none; border: none; padding: 0; font-size: 11px; color: var(--text-muted); cursor: pointer; opacity: 0; transition: opacity .15s; }
.chat-msg:hover .chat-link, .chat-link:focus { opacity: 1; }
.chat-link:hover { color: var(--accent-dark); text-decoration: underline; }
@media (hover: none) { .chat-link { opacity: 1; } }
.chat-status { padding: 6px 14px; font-size: 12px; color: #a3472f; background: rgba(216, 86, 111, .1); }
.chat-form { display: flex; gap: 10px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border-soft); }
.chat-form textarea { flex: 1; resize: none; min-height: 42px; }
.chat-quote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--panel-muted); font-size: 13px; overflow-wrap: anywhere; }

/* ---------- Thesis ---------- */
.th-tabs { margin-bottom: 16px; }
.th-welcome { max-width: 640px; }
.th-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.th-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.th-stat { margin: 0; text-align: left; }
.th-big { font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--accent-deep); line-height: 1.2; margin: 4px 0 2px; }
.th-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; font-size: 13.5px; margin-bottom: 6px; }
.th-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.th-two .card { margin-bottom: 14px; }
.th-bars { display: flex; align-items: flex-end; gap: 5px; height: 96px; margin: 14px 0 8px; }
.th-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.th-bar-fill { width: 100%; min-height: 3px; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .9; }
.th-bar span { font-size: 9.5px; color: var(--text-faint); }
.th-ms { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 13.5px; }
.th-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: 5px; flex: 0 0 auto; }
.th-dot.meet { background: var(--orange); }
.th-tips { margin: 10px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.65; color: var(--text); }
.th-tips li { margin-bottom: 4px; }
.th-text { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 14px; align-items: start; }
.th-outline { margin: 0; position: sticky; top: 0; max-height: calc(100vh - 230px); overflow: auto; }
.th-chlist { display: flex; flex-direction: column; gap: 2px; }
.th-ch { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 7px 8px; font-size: 13px; color: var(--text); cursor: pointer; margin: 0; font-weight: 500; }
.th-ch:hover { background: var(--side-hover); }
.th-ch.active { background: var(--side-active); color: var(--side-active-text); border-color: rgba(92,168,124,0.35); }
.th-chnum { color: var(--text-muted); font-size: 12px; min-width: 22px; }
.th-chtitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-chwc { font-size: 10.5px; color: var(--text-faint); }
.th-st { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; border: 1.5px solid var(--text-faint); }
.th-st-wip { background: #e0a63c; border-color: #e0a63c; }
.th-st-draft { background: #5b84e6; border-color: #5b84e6; }
.th-st-done { background: var(--accent); border-color: var(--accent); }
.th-editor { margin: 0; }
.th-title-input { font-family: var(--display); font-size: 20px; font-weight: 700; border: none !important; background: transparent !important; box-shadow: none !important; padding: 2px 0 !important; width: 100%; }
.th-edbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 8px 0 10px; font-size: 12.5px; }
.th-edbar label { display: flex; gap: 6px; align-items: center; margin: 0; font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.th-edbar select, .th-edbar input { margin: 0; padding: 4px 8px; width: auto; }
.th-wc { margin-left: auto; }
.th-saved { min-width: 80px; text-align: right; }
.th-hint { background: var(--accent-wash); border: 1px solid var(--border-soft); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
[data-theme="dark"] .th-hint { background: rgba(92,168,124,0.12); }
.th-hint summary { cursor: pointer; font-weight: 600; color: var(--accent-deep); }
[data-theme="dark"] .th-hint summary { color: var(--accent-light); }
.th-hint div { margin-top: 6px; line-height: 1.55; color: var(--text); }
.th-progress { margin-bottom: 10px; }
.th-text-area { min-height: 380px; font-size: 15px; line-height: 1.75; }
.th-edtools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.th-src { margin-bottom: 10px; }
.th-srctype { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-dark); font-weight: 700; margin-bottom: 3px; }
.th-srclit { font-size: 14px; line-height: 1.5; }
.th-srcnote { margin-top: 5px; }
.th-ctlist { max-height: 210px; overflow: auto; border: 1px solid var(--border-soft); border-radius: 10px; margin: 8px 0; }
.th-ctitem { display: block; width: 100%; text-align: left; margin: 0; border: none; border-bottom: 1px solid var(--border-soft); border-radius: 0; background: transparent; padding: 8px 12px; font-size: 13px; line-height: 1.4; cursor: pointer; color: var(--text); font-weight: 400; }
.th-ctitem.active { background: var(--side-active); color: var(--side-active-text); }
.th-ctprev { padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px; font-size: 14px; background: var(--panel-solid); }
.th-bib { max-height: 55vh; overflow: auto; font-size: 14px; line-height: 1.5; }
.th-bib h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-dark); }
.th-bib p { margin: 0 0 8px; padding-left: 18px; text-indent: -18px; }
.th-track-card { padding-bottom: 12px; }
.th-track { position: relative; height: 10px; background: var(--border-soft); border-radius: 6px; margin: 28px 6px 12px; }
.th-track-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-light); border-radius: 6px; }
.th-track-dot { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--accent-dark); }
.th-track-dot.done { background: var(--accent); }
.th-track-now { position: absolute; top: -8px; bottom: -8px; width: 2px; background: var(--red); }
.th-track-now span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: var(--red); }
.th-mrow { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.th-mrow.done .th-mt { text-decoration: line-through; color: var(--text-faint); }
.th-mt { font-weight: 600; }
.th-check input, .th-chk input { width: 18px; height: 18px; margin: 0; }
.th-chk { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0 0; margin: 0; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 14px; cursor: pointer; }
.th-mtblock { margin-top: 10px; }
.th-pre { white-space: pre-wrap; font-size: 14px; line-height: 1.55; }
@media (max-width: 900px) {
  .th-stats, .th-facts { grid-template-columns: 1fr 1fr; }
  .th-two, .th-grid2 { grid-template-columns: 1fr; }
  .th-text { grid-template-columns: 1fr; }
  .th-outline { position: static; max-height: 260px; }
}

/* ---------- Pomodoro ---------- */
.pm-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.pm-layout > div > .card { margin-bottom: 14px; }
.pm-card { text-align: center; }
.pm-modes { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.pm-ring { position: relative; width: 224px; height: 224px; margin: 6px auto 10px; }
.pm-ring svg { width: 100%; height: 100%; display: block; }
.pm-track { fill: none; stroke: var(--border); stroke-width: 9; }
.pm-prog { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .9s linear, stroke .3s; }
.pm-prog[data-mode="short"], .pm-prog[data-mode="long"] { stroke: var(--accent-dark); }
.pm-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.pm-time { font-family: var(--display); font-size: 46px; font-weight: 700; color: var(--accent-deep); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pm-label { font-size: 12.5px; color: var(--text-muted); }
.pm-dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 14px; min-height: 10px; }
.pm-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--text-faint); }
.pm-dot.on { background: var(--accent); border-color: var(--accent); }
.pm-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pm-go { min-width: 120px; }
.pm-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; text-align: left; margin-top: 16px; }
.pm-today h3, .pm-card h3 { margin-top: 0; }
.pm-list { display: flex; flex-direction: column; gap: 2px; }
.pm-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.pm-item:last-child { border-bottom: 0; }
.pm-item > div:first-child { flex: 1; min-width: 0; }
.pm-item-r { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 600; }
.sb-timer { margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-deep); background: var(--accent-wash); border-radius: 999px; padding: 1px 7px; }

/* ---------- Lernstatistik ---------- */
.st-h3 { font-size: 15px; margin: 0 0 8px; }
.st-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.st-two.st-cards { margin-top: 14px; }
.st-two .card { margin: 0; }
.st-of { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.st-hint { margin-bottom: 14px; }
.st-goal { width: 54px; display: inline-block; padding: 1px 4px; margin: 0; font-size: 12px; }
.st-link { display: inline-block; margin-top: 10px; font-size: 12.5px; color: var(--accent-dark); text-decoration: none; font-weight: 600; }
.st-link:hover { text-decoration: underline; }
.st-bars { display: flex; align-items: flex-end; gap: 2px; height: 150px; margin: 14px 0 6px; }
.st-bars-sm { height: 110px; }
.st-bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.st-bar-slot { flex: 1; width: 100%; display: flex; align-items: flex-end; min-height: 0; border-radius: 4px 4px 0 0; }
.st-bar:hover .st-bar-slot { background: var(--panel-muted); }
.st-bar-fill { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; }
.st-bar span { font-size: 9.5px; color: var(--text-faint); height: 12px; white-space: nowrap; overflow: visible; }
.st-stack { flex-direction: column; justify-content: flex-end; gap: 2px; align-items: stretch; }
.st-seg-kn, .st-seg-un { display: block; width: 100%; }
.st-seg-kn { background: var(--accent); border-radius: 0 0 2px 2px; }
.st-seg-un { background: var(--orange); border-radius: 4px 4px 0 0; }
.st-seg-un[style*="height:0%"] { display: none; }
.st-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text); margin-top: 6px; }
.st-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.st-sw.kn { background: var(--accent); }
.st-sw.un { background: var(--orange); }
.st-table { margin-top: 10px; font-size: 13px; }
.st-table summary { cursor: pointer; color: var(--text-muted); font-size: 12.5px; }
.st-table table { margin-top: 8px; }
.st-heat-wrap { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.st-heat-days { display: grid; grid-template-rows: repeat(7, 14px); gap: 2px; margin-top: 16px; font-size: 9.5px; color: var(--text-faint); line-height: 14px; }
.st-heat-months { display: grid; grid-template-columns: repeat(12, 14px); gap: 2px; font-size: 9.5px; color: var(--text-faint); height: 14px; }
.st-heat-months span { white-space: nowrap; }
.st-heat { display: grid; grid-template-columns: repeat(12, 14px); grid-template-rows: repeat(7, 14px); gap: 2px; }
.st-cell { display: inline-block; width: 14px; height: 14px; border-radius: 3px; background: var(--panel-muted); border: 1px solid var(--border-soft); box-sizing: border-box; }
.st-cell.fut { background: transparent; border-color: transparent; }
.st-cell.l1 { background: color-mix(in srgb, var(--accent) 35%, var(--panel-muted)); border-color: transparent; }
.st-cell.l2 { background: color-mix(in srgb, var(--accent) 68%, var(--panel-muted)); border-color: transparent; }
.st-cell.l3 { background: var(--accent-deep); border-color: transparent; }
.st-heat-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 11px; }
.st-hbars { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.st-h { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.st-h-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-h-t { background: var(--panel-muted); border-radius: 4px; height: 10px; overflow: hidden; }
.st-h-t i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.st-h-v { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.st-exam { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.st-exam:last-of-type { border-bottom: 0; }
@media (max-width: 860px) {
  .pm-layout, .st-two { grid-template-columns: 1fr; }
  .pm-fields { grid-template-columns: 1fr; }
}

/* ---------- WU-Portale (Link-Leiste unter der Überschrift) ---------- */
.wu-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 16px; }
.wu-links-t { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-right: 4px; font-weight: 600; }
.wu-links a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-muted); text-decoration: none; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: transparent; }
.wu-links a:hover { color: var(--accent-deep); border-color: var(--accent); background: var(--accent-wash); }
.wu-links a svg { opacity: .7; }


/* ---------- Schwebendes Prüfskizzen-Fenster ---------- */
.sp-panel { position: fixed; right: 22px; bottom: 22px; width: 400px; max-width: calc(100vw - 24px); max-height: calc(100vh - 90px); display: flex; flex-direction: column; z-index: 900; background: var(--paper); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 50px -12px rgba(0,0,0,.35); overflow: hidden; }
.sp-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border-soft); cursor: grab; user-select: none; background: var(--panel-muted); }
.sp-head:active { cursor: grabbing; }
.sp-head-actions { display: flex; gap: 4px; }
.sp-x { border: 0; background: transparent; color: var(--text-muted); width: 26px; height: 26px; border-radius: 8px; font-size: 18px; line-height: 1; cursor: pointer; margin: 0; padding: 0; }
.sp-x:hover { background: var(--side-hover); color: var(--text); }
.sp-body { padding: 4px 16px 16px; overflow-y: auto; }
.sp-panel.min .sp-body { display: none; }
.sp-panel.min { max-height: none; }
.sp-editor { min-height: 150px; max-height: 38vh; overflow-y: auto; border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; line-height: 1.6; background: var(--panel-solid); }
.sp-editor:focus { outline: none; border-color: var(--accent); }
.sp-list-t { margin: 16px 0 6px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }
.sp-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.sp-item.on { background: var(--accent-wash); }
.sp-item-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.secondary.active { border-color: var(--accent); color: var(--accent-deep); }
@media (max-width: 860px) { .sp-panel { right: 8px; left: 8px; bottom: 8px; width: auto; } }
