/* Entwurfs-Token — style.css beginnt exakt so */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --grund: #0B1220;         /* Seite */
  --flaeche: #121B2C;       /* Karten, Leisten */
  --flaeche2: #182338;      /* Hover, Vertiefungen */
  --linie: #22304A;
  --text: #E6EDF7;
  --text2: #93A4BD;
  --akzent: #22D3EE;        /* elektrisches Cyan */
  --akzent-tief: #0E7490;
  --gefahr: #F87171;
  --ok: #34D399;
  --schatten: 0 4px 24px rgba(0,0,0,.45);
  --auf-akzent: var(--auf-akzent);   /* Text auf Akzent-Flächen */
}
:root[data-theme="light"] {
  color-scheme: light;
  --grund: #F4F6FA;
  --flaeche: #FFFFFF;
  --flaeche2: #EBEFF5;
  --linie: #D9E0EB;
  --text: #16202E;
  --text2: #5A6B82;
  --akzent: #0891B2;
  --akzent-tief: #155E75;
  --gefahr: #DC2626;
  --ok: #059669;
  --schatten: 0 4px 20px rgba(22,32,46,.10);
  --auf-akzent: #FFFFFF;
  --leiste: #E4EAF3;
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--grund);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}
kbd {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: .05em .45em;
  font-size: .85em;
  color: var(--text);
}
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
}
select {
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: .5em .7em;
  color: var(--text);
}
input:not([type="checkbox"]):not([type="radio"]) {
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: .55em .75em;
  outline: none;
  transition: box-shadow .2s ease, border-color .2s ease;
}
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 30%, transparent);
}
button {
  cursor: pointer;
  background: var(--akzent);
  color: var(--auf-akzent);
  border: none;
  border-radius: 8px;
  padding: .55em 1.1em;
  font-weight: 600;
  transition: filter .15s ease, transform .1s ease;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button.knopf-still, a.knopf-still {
  display: inline-block;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: .55em 1.1em;
  font-weight: 500;
  text-decoration: none;
}
button.knopf-still:hover, a.knopf-still:hover { background: var(--flaeche2); filter: none; text-decoration: none; }
button:disabled, button[disabled] {
  cursor: not-allowed;
  opacity: .55;
  filter: none;
  transform: none;
}
button:disabled:hover, button[disabled]:hover { filter: none; background: transparent; }
label { display: block; margin-bottom: .9em; font-size: .92em; color: var(--text2); }
label input, label select { display: block; width: 100%; margin-top: .3em; color: var(--text); }
.zeile { display: flex; align-items: center; gap: .5em; }
.fehler {
  background: color-mix(in srgb, var(--gefahr) 14%, var(--flaeche));
  border: 1px solid var(--gefahr);
  color: var(--gefahr);
  border-radius: 8px;
  padding: .7em 1em;
  margin: 0 0 1em;
}
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .6em .7em; border-bottom: 1px solid var(--linie); }
th { color: var(--text2); font-weight: 600; font-size: .85em; text-transform: uppercase; letter-spacing: .04em; }
.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 12px;
  box-shadow: var(--schatten);
  padding: 1.5em;
}
.formular-karte { max-width: 420px; }
.formular-karte h1 { margin-top: 0; }

/* ---------- Anmeldeseite (eigenes, reduziertes Layout) ---------- */
body.anmeldeseite {
  display: grid;
  place-items: center;
  padding: 1.5em;
  background:
    radial-gradient(60vw 60vh at 15% -10%, color-mix(in srgb, var(--akzent) 10%, transparent), transparent),
    var(--grund);
}
.anmeldebox {
  width: 100%;
  max-width: 380px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 14px;
  box-shadow: var(--schatten);
  padding: 2.2em;
}
.anmeldebox h1 {
  margin: 0 0 1em;
  font-size: 1.3em;
  text-align: center;
}
.anmeldebox form button { width: 100%; margin-top: .4em; }

/* ---------- Drei-Zonen-Raster ---------- */
body.gerippe {
  display: grid;
  grid-template-rows: 56px 1fr;
}
.kopfleiste {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5em;
  padding: 0 1.25em;
  background: var(--leiste);
  border-bottom: 1px solid var(--linie);
  box-shadow: var(--schatten);
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo {
  display: flex;
  align-items: center;
  gap: .5em;
  font-weight: 700;
  font-size: 1.05em;
  white-space: nowrap;
}
.logo .sechseck { color: var(--akzent); }
.menue-knopf {
  display: none;
  background: transparent;
  border: 1px solid var(--linie);
  color: var(--text);
  font-size: 1.1em;
  line-height: 1;
  padding: .4em .6em;
}
.menue-knopf:hover { background: var(--flaeche2); }

/* ---------- Sofortsuche (Etappe 3, Task 4) ---------- */
.suchfeld-bereich {
  position: relative;
  justify-self: center;
  width: 100%;
  max-width: 480px;
}
.suchfeld { position: relative; }
.suchfeld::before {
  content: "🔍";
  position: absolute;
  left: .7em;
  top: 50%;
  transform: translateY(-50%);
  font-size: .85em;
  opacity: .55;
  pointer-events: none;
}
.suchfeld input {
  width: 100%;
  padding-left: 2.1em;
}
.suchfeld input::placeholder { color: var(--text2); }

/* Grundgerüst des Dropdowns selbst — [hidden] MUSS display:none erzwingen:
   ohne diese Regel überschreibt ein eigener display-Wert (hier keiner, aber
   siehe #block-menue-Regression) sonst das hidden-Attribut, das Dropdown
   liesse sich nicht mehr schliessen. */
#such-ergebnisse[hidden] { display: none; }
#such-ergebnisse {
  position: absolute;
  top: calc(100% + .5em);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  min-width: 320px;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  background: var(--leiste);
  border: 1px solid var(--linie);
  border-radius: 10px;
  box-shadow: var(--schatten);
  padding: .4em;
  z-index: 30;
}
.such-gruppe {
  padding: .55em .6em .3em;
  font-size: .78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
}
.such-zeile {
  display: block;
  padding: .5em .7em;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
}
.such-zeile.aktiv { background: var(--flaeche2); border-left-color: var(--akzent); }
.such-titel { font-weight: 600; color: var(--text); }
.such-ausschnitt {
  margin-top: .15em;
  font-size: .88em;
  color: var(--text2);
  overflow-wrap: break-word;
}
.such-ausschnitt mark {
  background: transparent;
  color: var(--akzent);
  font-weight: 700;
}
.such-leer { padding: .8em .7em; color: var(--text2); }
.such-mehr-hinweis { padding: .4em .7em; color: var(--text2); font-style: italic; font-size: .85em; }
.such-fuss { margin-top: .3em; padding-top: .4em; border-top: 1px solid var(--linie); }
.frage-stellen-knopf {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--akzent);
  border: 1px dashed var(--akzent-tief);
  border-radius: 8px;
  padding: .5em .7em;
  font-weight: 600;
}

.kopf-rechts { display: flex; align-items: center; gap: .75em; }

#themen-umschalter {
  display: flex;
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
#themen-umschalter button {
  background: transparent;
  color: var(--text2);
  border-radius: 6px;
  padding: .35em .6em;
  font-weight: 500;
  font-size: .95em;
}
#themen-umschalter button:hover { background: var(--flaeche); filter: none; }
#themen-umschalter button.aktiv {
  background: var(--akzent);
  color: var(--auf-akzent);
}

.benutzermenue { position: relative; }
.benutzermenue summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4em;
  padding: .4em .7em;
  border: 1px solid var(--linie);
  border-radius: 8px;
  color: var(--text);
  user-select: none;
}
.benutzermenue summary::-webkit-details-marker { display: none; }
.benutzermenue summary:hover { background: var(--flaeche2); }
.benutzermenue summary::after { content: "▾"; color: var(--text2); font-size: .8em; }
.benutzermenue .anzeigename { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; }
.benutzermenue-inhalt {
  position: absolute;
  right: 0;
  top: calc(100% + .5em);
  min-width: 220px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 10px;
  box-shadow: var(--schatten);
  padding: .5em;
  z-index: 30;
}
.benutzermenue-inhalt .wer {
  padding: .4em .6em .6em;
  color: var(--text2);
  font-size: .85em;
  border-bottom: 1px solid var(--linie);
  margin-bottom: .4em;
}
.benutzermenue-inhalt a, .benutzermenue-inhalt button.verlinkt {
  display: block;
  width: 100%;
  text-align: left;
  padding: .5em .6em;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  border: none;
  font-weight: 400;
}
.benutzermenue-inhalt a:hover, .benutzermenue-inhalt button.verlinkt:hover {
  background: var(--flaeche2);
  text-decoration: none;
}
.benutzermenue-inhalt form { margin: 0; }

/* ---------- Rumpf: Seitenleiste · Inhalt · Kontext ---------- */
.rumpf {
  display: grid;
  grid-template-columns: 260px minmax(0,1fr) 280px;
  min-height: calc(100vh - 56px);
}

#seitenleiste {
  background: var(--leiste);
  border-right: 1px solid var(--linie);
  padding: 1.25em .75em;
  overflow-y: auto;
}
#seitenleiste .kategorie {
  border: none;
  margin-bottom: .2em;
}
#seitenleiste summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .55em;
  padding: .55em .6em;
  border-radius: 8px;
  font-weight: 600;
  user-select: none;
}
#seitenleiste summary::-webkit-details-marker { display: none; }
#seitenleiste summary:hover { background: var(--flaeche2); }
#seitenleiste summary::after {
  content: "";
  margin-left: auto;
  width: .5em;
  height: .5em;
  border-right: 2px solid var(--text2);
  border-bottom: 2px solid var(--text2);
  transform: rotate(-45deg);
  transition: transform .15s ease;
}
#seitenleiste details[open] summary::after { transform: rotate(45deg); }
#seitenleiste .kategorie-symbol { font-size: 1.05em; }
.artikel-liste { list-style: none; margin: .15em 0 .6em; padding: 0; }
.artikel-liste li { border-left: 2px solid transparent; }
.artikel-liste a {
  display: block;
  padding: .45em .9em .45em 1.35em;
  border-radius: 0 8px 8px 0;
  color: var(--text2);
}
.artikel-liste a:hover { background: var(--flaeche2); color: var(--text); text-decoration: none; }
.artikel-liste li.aktiv { border-left-color: var(--akzent); }
.artikel-liste li.aktiv a { color: var(--text); background: var(--flaeche2); font-weight: 600; }

main {
  padding: 2em 2.5em;
  min-width: 0;
  max-width: 100%;
}
main .lesespalte { max-width: 72ch; }

#kontext {
  background: var(--leiste);
  border-left: 1px solid var(--linie);
  padding: 1.5em 1.25em;
  color: var(--text2);
  font-size: .92em;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
}
#kontext h2 { font-size: .8em; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); }

.willkommenskarte h1 { margin-top: 0; }
.willkommenskarte p { color: var(--text2); }

/* ---------- Artikelseite ---------- */
.brotkrume {
  color: var(--text2);
  font-size: .9em;
  margin-bottom: .9em;
}
.brotkrume a { color: var(--text2); }
.brotkrume a:hover { color: var(--akzent); }
.brotkrume .trenner { margin: 0 .35em; }

.artikel-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5em;
  margin-bottom: 1.4em;
}
.artikel-kopf h1 { margin: 0; }

.artikel-fluss > * + * { margin-top: 1.5em; }

/* Schritt-Zeitleiste: nummerierte Ronden mit verbindender Linie */
.schritt {
  display: grid;
  grid-template-columns: 2.4em 1fr;
  column-gap: 1.1em;
  position: relative;
}
.schritt-ronde {
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background: var(--flaeche2);
  border: 2px solid var(--akzent);
  color: var(--akzent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  position: relative;
  z-index: 1;
}
.schritt:has(+ .schritt)::before {
  content: "";
  position: absolute;
  left: calc(1.1em - 1px);
  top: 2.2em;
  bottom: -1.5em;
  width: 2px;
  background: var(--linie);
}
.schritt-inhalt { padding-top: .25em; }
.schritt-inhalt :first-child { margin-top: 0; }

.text-block :first-child { margin-top: 0; }

h2.zwischentitel { scroll-margin-top: 5em; margin: 1.6em 0 .6em; }

.bild-karte {
  margin: 0;
  border: 1px solid var(--linie);
  border-radius: 12px;
  overflow: hidden;
  background: var(--flaeche);
}
.bild-karte img {
  display: block;
  width: 100%;
  cursor: zoom-in;
}
.bild-karte figcaption {
  padding: .7em 1em;
  color: var(--text2);
  font-size: .88em;
  border-top: 1px solid var(--linie);
}

.linkgruppe {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .8em;
}
.link-kachel {
  display: flex;
  flex-direction: column;
  gap: .2em;
  padding: .9em 1em;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: var(--flaeche);
  color: var(--text);
}
.link-kachel:hover { border-color: var(--akzent); text-decoration: none; }
.link-titel { font-weight: 600; }
.link-url { color: var(--text2); font-size: .85em; word-break: break-all; }

.datei-karte {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  padding: 1em 1.2em;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: var(--flaeche);
}
.datei-name { font-weight: 600; }
.datei-meta { color: var(--text2); font-size: .88em; margin-top: .2em; }

.artikel-fuss {
  margin-top: 2.5em;
  padding-top: 1.2em;
  border-top: 1px solid var(--linie);
  color: var(--text2);
  font-size: .88em;
}

.abschnitts-liste { list-style: none; margin: 0; padding: 0; }
.abschnitts-liste li { margin-bottom: .5em; border-left: 2px solid transparent; padding-left: .6em; }
.abschnitts-liste a { color: var(--text2); }
.abschnitts-liste a:hover { color: var(--akzent); }
.abschnitts-liste li.aktiv { border-left-color: var(--akzent); }
.abschnitts-liste li.aktiv a { color: var(--akzent); font-weight: 600; }

/* ---------- Lightbox ---------- */
dialog#lightbox {
  border: none;
  padding: 0;
  max-width: 92vw;
  max-height: 88vh;
  background: transparent;
}
dialog#lightbox::backdrop { background: rgba(0,0,0,.72); }
dialog#lightbox img {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 8px;
}
dialog#lightbox #lightbox-schliessen {
  position: fixed;
  top: 1.2em;
  right: 1.2em;
  background: var(--flaeche);
  color: var(--text);
  border: 1px solid var(--linie);
  border-radius: 50%;
  width: 2.4em;
  height: 2.4em;
  padding: 0;
  font-size: 1em;
}

/* ---------- KI-Assistent-Overlay (Etappe 3, Task 6) ---------- */
/* [hidden] MUSS display:none erzwingen — dieselbe Regression wie beim
   Such-Dropdown/Block-Menü: ohne diese Regel überschreibt das eigene
   display:flex unten das hidden-Attribut, das Overlay liesse sich nicht
   mehr schliessen. */
#assistent[hidden] { display: none; }
#assistent {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5em;
  background: rgba(0,0,0,.55);
}
.assistent-fenster {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 12px;
  box-shadow: var(--schatten);
  width: min(640px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 1.25em 1.5em 1.5em;
}
.assistent-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6em;
}
.assistent-kopf h2 { margin: 0; font-size: 1.1em; }
#assistent-schliessen {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--linie);
  border-radius: 50%;
  width: 2.1em;
  height: 2.1em;
  padding: 0;
  font-size: .95em;
}
#assistent-formular { display: flex; gap: .6em; margin-bottom: 1em; }
#assistent-formular input { flex: 1; }
.assistent-antwort {
  overflow-y: auto;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.assistent-quellen {
  margin-top: 1em;
  padding-top: .8em;
  border-top: 1px solid var(--linie);
  display: flex;
  flex-direction: column;
  gap: .35em;
}
.assistent-quellen-titel {
  font-size: .78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
}
.assistent-panel {
  margin-top: 1.5em;
  padding-top: 1.25em;
  border-top: 1px solid var(--linie);
}
.assistent-panel h2 { margin-bottom: .5em; }
#frage-zur-seite-formular { display: flex; flex-direction: column; gap: .5em; }

/* ---------- Editor (Etappe 2, Task 4) ---------- */
#editor-leiste {
  position: sticky;
  top: 56px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: .9em;
  margin: -2em -2.5em 1.4em;
  padding: .9em 2.5em;
  background: color-mix(in srgb, var(--flaeche) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--linie);
}
#editor-statusanzeige {
  color: var(--ok);
  font-size: .9em;
}
#editor-statusanzeige.editor-status-fehler { color: var(--gefahr); }

#editor-warnbanner { margin-bottom: 1.2em; }

#editor-upload-hinweis { color: var(--text2); font-size: .9em; }

/* Globale Sperre waehrend eines laufenden Uploads (Task 5, Fix-Runde):
   friert Blockcontainer + Editor-Leiste optisch/interaktiv ein — die
   eigentliche Absicherung sind die `laufendeUploads`-Wächter in editor.js,
   dies ist nur die sichtbare/Zeiger-Ebene (siehe Report). */
#editor-bloecke.upload-sperre, #editor-leiste.upload-sperre {
  opacity: .65;
  pointer-events: none;
}

input#editor-titel {
  display: block;
  width: 100%;
  margin-bottom: 1.4em;
  font-size: 1.6em;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: .3em .5em;
}

#editor-bloecke.bearbeitbar [contenteditable] {
  outline: none;
  border-radius: 8px;
  padding: .2em .4em;
  margin: -.2em -.4em;
  transition: box-shadow .15s ease;
}
#editor-bloecke.bearbeitbar [contenteditable]:hover { box-shadow: 0 0 0 1px var(--linie); }
#editor-bloecke.bearbeitbar [contenteditable]:focus {
  box-shadow: 0 0 0 2px var(--akzent);
}

.zwischentitel-editor { margin: 1.6em 0 .6em; }
.zwischentitel-eingabe {
  width: 100%;
  font-size: 1.3em;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: .3em .5em;
}

#mini-leiste {
  position: absolute;
  display: flex;
  gap: 2px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 8px;
  box-shadow: var(--schatten);
  padding: 3px;
  z-index: 40;
}
#mini-leiste button {
  background: transparent;
  color: var(--text);
  padding: .35em .6em;
  border-radius: 6px;
  font-weight: 500;
}
#mini-leiste button:hover { background: var(--flaeche2); filter: none; }

/* ---------- Editor (Etappe 2, Task 5): Blockoperationen & Medien ---------- */

/* Eigenes Abstandsmodell für den Blockcontainer: Blöcke UND ＋-Linien sind
   abwechselnde direkte Kinder — die generische `.artikel-fluss > * + *`-Regel
   würde beiden dieselbe grosse Lücke geben, hier stattdessen gezielt je Typ. */
#editor-bloecke.bearbeitbar > * + * { margin-top: 0; }

.block-wrapper {
  position: relative;
  padding: .2em 2.6em .2em 0;
}
.block-griffe {
  position: absolute;
  top: -.1em;
  right: 0;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .15s ease;
}
.block-wrapper:hover .block-griffe,
.block-wrapper:focus-within .block-griffe {
  opacity: 1;
}
.block-griffe button {
  background: var(--flaeche);
  color: var(--text2);
  border: 1px solid var(--linie);
  border-radius: 6px;
  padding: .25em .45em;
  font-size: .85em;
  line-height: 1;
}
.block-griffe button:hover { background: var(--flaeche2); filter: none; color: var(--text); }
.block-griffe .griff-loeschen:hover { color: var(--gefahr); border-color: var(--gefahr); }
.block-griffe .griff-ziehen { cursor: grab; }
.block-griffe .griff-ziehen:active { cursor: grabbing; }

/* Drag&Drop-Indikator beim Verschieben eines Blocks (funktioniert in beiden
   Farbmodi, da ausschliesslich über das Token `--akzent`). */
.block-wrapper.zieht-ueber-oben::before,
.block-wrapper.zieht-ueber-unten::after {
  content: "";
  position: absolute;
  left: 0;
  right: 2.6em;
  height: 3px;
  border-radius: 2px;
  background: var(--akzent);
}
.block-wrapper.zieht-ueber-oben::before { top: -.5em; }
.block-wrapper.zieht-ueber-unten::after { bottom: -.5em; }

/* ＋-Linie zwischen Blöcken (und am Ende) */
.block-einfuege-linie {
  position: relative;
  height: 1.4em;
  display: flex;
  align-items: center;
}
.block-einfuege-linie::before {
  content: "";
  position: absolute;
  left: 0;
  right: 2.6em;
  top: 50%;
  height: 1px;
  background: var(--akzent);
  opacity: 0;
  transition: opacity .15s ease;
}
.block-einfuege-linie:hover::before { opacity: .5; }
.block-einfuege-linie--ende::before { opacity: .25; }
.block-einfuege-linie--ende:hover::before { opacity: .6; }
.block-einfuege-knopf {
  position: relative;
  z-index: 1;
  margin-left: 1.2em;
  width: 1.6em;
  height: 1.6em;
  padding: 0;
  border-radius: 50%;
  background: var(--flaeche);
  color: var(--akzent);
  border: 1px solid var(--akzent);
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s ease, transform .1s ease;
}
.block-einfuege-linie:hover .block-einfuege-knopf,
.block-einfuege-linie--ende .block-einfuege-knopf {
  opacity: 1;
}
.block-einfuege-knopf:hover { transform: scale(1.1); filter: none; background: var(--flaeche2); }

/* Blocktyp-Menü (folgt demselben Popover-Muster wie #mini-leiste) */
#block-menue[hidden] { display: none; }
#block-menue {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 10px;
  box-shadow: var(--schatten);
  padding: 4px;
  z-index: 40;
  min-width: 12em;
}
#block-menue button {
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: .5em .7em;
  border-radius: 6px;
  font-weight: 500;
}
#block-menue button:hover { background: var(--flaeche2); filter: none; }

/* Link-Block: drei Eingabefelder */
.link-editor { display: flex; flex-direction: column; gap: .5em; }

/* Bild-/Datei-Block: Platzhalter, Vorschau, Ladezustand */
.bild-editor, .datei-editor { display: flex; flex-direction: column; gap: .6em; }
.bild-platzhalter, .datei-platzhalter {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 8em;
  padding: 1.5em;
  border: 2px dashed var(--linie);
  border-radius: 12px;
  color: var(--text2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.bild-platzhalter:hover, .datei-platzhalter:hover,
.bild-platzhalter:focus-visible, .datei-platzhalter:focus-visible {
  border-color: var(--akzent);
  color: var(--text);
}
.bild-platzhalter.zieht-ueber, .datei-platzhalter.zieht-ueber {
  border-color: var(--akzent);
  background: color-mix(in srgb, var(--akzent) 10%, transparent);
}
.bild-platzhalter .platzhalter-text, .datei-platzhalter .platzhalter-text { margin: 0; }

.bild-vorschau {
  margin: 0;
  border: 1px solid var(--linie);
  border-radius: 12px;
  overflow: hidden;
  background: var(--flaeche);
}
.bild-vorschau img { display: block; width: 100%; max-height: 22em; object-fit: contain; background: var(--grund); }
.bild-vorschau .bild-ersetzen-knopf { display: block; width: 100%; border-radius: 0; border-width: 0; border-top: 1px solid var(--linie); }

.datei-vorschau {
  display: flex;
  align-items: center;
  gap: .8em;
  padding: .9em 1.1em;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: var(--flaeche);
}
.datei-name-anzeige { font-weight: 600; }
.datei-groesse-hinweis { color: var(--text2); font-size: .88em; }
.datei-vorschau .datei-ersetzen-knopf { margin-left: auto; }

.lade-hinweis { color: var(--text2); font-size: .9em; margin: 0; }
.bild-editor.laedt .bild-platzhalter, .bild-editor.laedt .bild-vorschau,
.datei-editor.laedt .datei-platzhalter, .datei-editor.laedt .datei-vorschau {
  opacity: .55;
  pointer-events: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .rumpf { grid-template-columns: 260px minmax(0,1fr); }
  #kontext { display: none; }
}

@media (max-width: 800px) {
  .menue-knopf { display: inline-flex; align-items: center; }
  .suchfeld-bereich { display: none; }
  .rumpf { grid-template-columns: 1fr; }
  #seitenleiste {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 82vw;
    max-width: 320px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 25;
    box-shadow: var(--schatten);
  }
  #seitenleiste.offen { transform: translateX(0); }
  main { padding: 1.5em; }
}

/* ---------- Animationen (nur ohne Bewegungsreduktion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  main > * {
    animation: eingleiten .25s ease-out both;
    animation-delay: calc(var(--i, 0) * 30ms);
  }
  @keyframes eingleiten {
    from { opacity: 0; transform: translateY(6px); }
  }
  .suchfeld input:focus-visible {
    transition: box-shadow .2s ease;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--akzent) 20%, transparent);
  }
}

/* «＋ Neuer Artikel» — immer zuoberst in der Seitenleiste */
.artikel-neu-formular { margin: 0 0 .8em; }
.artikel-neu-knopf {
  width: 100%;
  background: transparent;
  color: var(--akzent);
  border: 1px dashed var(--akzent-tief);
  border-radius: 8px;
  padding: .5em .6em;
  font-weight: 600;
  text-align: left;
}
.artikel-neu-knopf:hover { background: var(--flaeche2); filter: none; }

/* Assistent: Lebenszeichen waehrend der Antwort-Vorbereitung */
.assistent-wartehinweis { color: var(--text2); font-style: italic; }
@media (prefers-reduced-motion: no-preference) {
  .assistent-wartehinweis { animation: warte-pulsieren 1.2s ease-in-out infinite; }
  @keyframes warte-pulsieren { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
}
