:root {
  --bg: #f3f1ec;
  --bg-2: #ebe8e1;
  --card: #ffffff;
  --text: #141414;
  --muted: #64625c;
  --line: rgba(20, 20, 20, 0.1);
  --line-2: rgba(20, 20, 20, 0.18);
  --accent: #ff4b1f;
  --ok: #2f8a3a;
  --warn: #b45309;
  --danger: #c2410c;
  --radius: 16px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 12px 32px -12px rgba(20, 20, 20, 0.12);
  color-scheme: light;
  accent-color: var(--accent);
}

html[data-theme="dark"] {
  --bg: #0b0b0f;
  --bg-2: #121218;
  --card: #18181b;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.1);
  --line-2: rgba(255, 255, 255, 0.18);
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* The hidden attribute must win over component display values (.btn etc.). */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: #fff; }

.shell { min-height: 100%; display: flex; flex-direction: column; }
.top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top__brand { font-weight: 650; letter-spacing: -0.03em; text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.5rem; }
.mm-logo { flex: 0 0 auto; border-radius: 7px; }
html[data-theme="dark"] .mm-logo rect:first-child { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1; }
.top__grow { flex: 1; }
.top nav { display: flex; gap: 0.6rem; align-items: center; }
.page { width: min(1100px, calc(100% - 2rem)); margin: 1.4rem auto 3rem; }
.page--wide { width: min(1400px, calc(100% - 1.2rem)); }

h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -0.04em; margin: 0 0 0.4rem; }
.lead { color: var(--muted); margin: 0 0 1.4rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--card) 70%, transparent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
}
.btn:hover { border-color: var(--text); }
.btn--primary { background: var(--text); color: var(--card); border-color: var(--text); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme="dark"] .btn--primary { color: #111; }
html[data-theme="dark"] .btn--primary:hover { color: #fff; }
.btn--ghost { opacity: 0.92; }
.btn--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.card__actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.85rem; }
.grid { display: grid; gap: 0.8rem; }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.cat { margin: 1.6rem 0 0.7rem; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }

/* Gruppierung innerhalb eines Tabs (schema field.section) — Kachel mit
   Rahmen und zentriertem Kopf, wie die .control-card im Demo-Panel.
   Hintergrund abgesetzt von der Seite: Light = weiß, Dark = #2d2d2d
   (Nutzer 2026-10-08). */
.field-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.8rem 0.85rem 0.9rem;
  margin: 1rem 0 0.95rem;
}
html[data-theme="dark"] .field-card { background: #2d2d2d; }
.field-card__head {
  margin: 0 0 0.7rem;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-card > .field:last-child { margin-bottom: 0; }

/* Kacheln IN Repeater-Items (photo-curtain Per-Slide-Content): etwas
   dichtere Abstände als auf Top-Level, das Item selbst ist der Rahmen. */
.repeater-item .field-card { margin: 0.7rem 0; }
.repeater-item .field-card:first-of-type { margin-top: 0.9rem; }
.repeater-item .field-card:last-of-type { margin-bottom: 0.1rem; }
.repeater-item > .field:first-of-type { margin-top: 0; }

/* Toggle-Feld = eine Zeile: Label links, Switch rechts, zentriert. */
.field__row--switch { align-items: center; min-height: 1.9rem; }
.switch { position: relative; display: inline-flex; flex: 0 0 auto; cursor: pointer; }
.switch__input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch__input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch__track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-2);
  transition: background 0.15s ease;
}
.switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}
.switch__input:checked + .switch__track { background: var(--accent); }
.switch__input:checked + .switch__track .switch__knob { transform: translateX(16px); }

.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; }
.field--action .field-action { width: 100%; }
.field label { font-size: 0.78rem; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.field textarea { min-height: 72px; resize: vertical; }
.field input[type="color"] { padding: 0.15rem; height: 2.2rem; }
.range-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.range-field input[type="range"] { flex: 1; margin: 0; }
.range-field__value {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.78rem;
  min-width: 2.8rem;
  text-align: right;
  font-weight: 500;
}

.image-field {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.image-field__thumb {
  width: 52px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg-2);
  flex-shrink: 0;
}
.image-field__inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.color-field {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.4rem 0.55rem;
  align-items: center;
}
.color-field__pick {
  position: relative;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, #c8c4bb 25%, transparent 25%),
    linear-gradient(-45deg, #c8c4bb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c8c4bb 75%),
    linear-gradient(-45deg, transparent 75%, #c8c4bb 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}
.color-field__preview {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.color-field__swatch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 !important;
  opacity: 0;
  cursor: pointer;
  min-height: 0;
  border: 0;
}
.color-field__value { min-width: 0; font-variant-numeric: tabular-nums; }
.color-field > .field__help { grid-column: 1 / -1; }
.color-field__op-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.55rem; }
.color-field__alpha { flex: 1; }
.color-field__alpha-lab,
.color-field__op-row .meta { font-size: 0.75rem; color: var(--muted); min-width: 2.6rem; }
.bg-field { display: flex; flex-direction: column; gap: 0.4rem; }
.field.is-overridden { outline: 1px solid var(--warn); outline-offset: 3px; border-radius: 10px; padding: 0.45rem; }
.field__row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.msg { font-size: 0.85rem; color: var(--muted); }
.msg--err { color: var(--danger); }
.auth { width: min(26rem, calc(100% - 2rem)); margin: 4rem auto; }

.theme-pick { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.theme-pick label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.theme-pick input { accent-color: var(--accent); }

.bps { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.bps button[aria-pressed="true"],
.groups button[aria-pressed="true"] {
  background: var(--text);
  color: var(--card);
  border-color: var(--text);
}
html[data-theme="dark"] .bps button[aria-pressed="true"],
html[data-theme="dark"] .groups button[aria-pressed="true"] {
  color: #111;
}

.editor {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 0;
  min-height: calc(100dvh - 58px);
}
.editor__form {
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 1rem;
  max-height: calc(100dvh - 58px);
  background: var(--bg);
}
.editor__preview {
  /* Kein Scrollbalken: fitFrame passt den Frame contain-faehig ein
     (editor.js); Ueberlauf, z.B. durch Rundung, wird abgeschnitten. */
  overflow: hidden;
  background: var(--bg-2);
  position: relative;
  min-height: calc(100dvh - 58px);
}
.editor__fit {
  /* Horizontal UND vertikal mittig im Paneel (Nutzer 2026-10-08): kleine
     Module (Buttons/Cards) stehen nicht mehr oben geklebt. */
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
}
.editor__frame {
  display: block;
  background: transparent;
  border: 0;
  border-radius: 0;
  /* Kein Frame-Schatten: der Schatten liegt jetzt IN der Preview direkt um
     das Modul (preview.html ?chrome=1) — der Frame hat transparente Hover-
     Luft oben/unten, ein Rahmen-Schatten wuerde im Leeren schweben. */
}
/* Tab-Leiste (Nutzer 2026-10-09): kompakter (schmaleres Padding, Schrift
   2 px kleiner — bei 3-4 Tabs passen alle nebeneinander) und sticky im
   Form-Scroll-Container, damit die Settings beim Scrollen sofort erreichbar
   sind. Negative margins spannen die Leiste ueber den Container-Padding-
   Rand voll auf, padding gleicht die Startposition aus. */
.groups {
  display: flex; gap: 0.35rem; flex-wrap: wrap;
  position: sticky; top: -1rem; z-index: 5; /* -1rem = Margin-Box-Ausgleich: der Balken pinnt sonst 1rem unter dem Scroll-Top (Lücke, Nutzer 2026-10-09) */
  margin: -1rem -1rem 0.45rem; padding: 0.6rem 1rem 0.55rem;
  background: var(--bg);
}
.groups .btn {
  min-height: 28px;
  padding: 0.28rem 0.62rem;
  font-size: 0.75rem; /* war 0.88rem (~14px) → 12px */
}

.repeater-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem;
  margin-bottom: 0.6rem;
  background: var(--card);
}
.repeater-item summary { cursor: pointer; font-weight: 600; }
.repeater-item__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.55rem; }

/* reorderInline (bounce-cards): Drag-Handle (nur ↑/↓-Icon) rechts in der
   GESCHLOSSENEN Summary-Zeile — das Item an eine Position der Wahl ziehen.
   Die Ablagestelle zeigt sich als gestrichelte Kachel; das gezogene Item
   dimmt. Im offenen Zustand ausgeblendet — die Actions-Zeile behaelt die
   ↑/↓-Pfeile (Tastatur-Fallback, keine Dopplung). */
.repeater-item__summary--inline { display: flex; align-items: center; gap: 0.4rem; }
.repeater-item__summary--inline .repeater-item__label { flex: 1 1 auto; min-width: 0; }
.repeater-item__reorder { display: inline-flex; flex: 0 0 auto; }
.repeater-item__handle {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}
.repeater-item__handle:hover { color: var(--text); border-color: var(--line-2); }
.repeater-item__handle:active { cursor: grabbing; }
.repeater-item.is-dragging { opacity: 0.45; }
.repeater-item__drop {
  height: 2.2rem;
  border: 2px dashed var(--accent);
  border-radius: 10px;
  margin: 0.3rem 0;
  pointer-events: none;
}
.repeater-item[open] .repeater-item__reorder { display: none; }

.repeater-modal {
  padding: 0.15rem 0.7rem 0.55rem;
}
.repeater-modal__summary {
  list-style: none;
  cursor: pointer;
  font-weight: 650;
  font-size: 0.82rem;
  padding: 0.55rem 0;
}
.repeater-modal__summary::-webkit-details-marker { display: none; }
.repeater-modal:not([open]) .repeater-modal__summary {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.35rem 0 0.15rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.repeater-modal:not([open]) .repeater-modal__close { display: none; }
.repeater-modal[open] .repeater-modal__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.45rem;
}
.repeater-modal__close {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: inherit;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  padding: 0.28rem 0.7rem;
  cursor: pointer;
}

.meta { color: var(--muted); font-size: 0.75rem; }

/* Export target select lives in the editor top bar (outside .field). */
.top select {
  min-height: 40px;
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--card) 70%, transparent);
  font-size: 0.85rem;
  cursor: pointer;
}
.btn[disabled] { opacity: 0.55; }
/* Add/Duplicate an der Repeater-Grenze: Not-allowed-Cursor (roter Kreis
   mit Strich), auch auf dem disabled-Button. */
.btn[disabled].is-capped, .btn.is-capped { cursor: not-allowed; }

@media (max-width: 860px) {
  .editor { grid-template-columns: minmax(220px, 42%) 1fr; }
}
@media (max-width: 640px) {
  .editor { grid-template-columns: 1fr; }
  .editor__form { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .editor__preview { min-height: 62vh; overflow: auto; } /* Single-Column: Paneel laeuft mit der Seite */
}

/* Select stepper (schema "stepper": true) — cycle options with ‹ › */
.select-stepper {
  display: flex;
  align-items: center;
  justify-content: center; /* ‹ n/N › mittig unter dem Dropdown (Nutzer 2026-10-08) */
  gap: 8px;
  margin-top: 6px;
}
.select-stepper__btn {
  appearance: none;
  border: 1px solid #dcdcde;
  background: #fff;
  color: #1d2327;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.select-stepper__btn:hover { border-color: #2271b1; background: #e7f3ff; }
html[data-theme="dark"] .select-stepper__btn {
  background: #3a3a3a;
  border-color: #555;
  color: #f0f0f0;
}
html[data-theme="dark"] .select-stepper__btn:hover { border-color: #7fb1e0; background: #454545; }
html[data-theme="dark"] .select-stepper__pos { color: #b7b7b7; }
.select-stepper__pos {
  font-size: 12px;
  color: #646970;
  min-width: 44px;
  text-align: center;
}

/* Kompakte Variante (schema "stepper": "compact", Content-Felder): das
   Dropdown schrumpft auf die Restbreite, ‹ › stehen direkt daneben —
   ohne Zaehler (Nutzer 2026-10-08). */
.select-stepper--compact {
  justify-content: flex-start;
  gap: 6px;
  margin-top: 0;
}
.select-stepper--compact select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

/* Icon field (schema type "icon") — preview + library popover */
.icon-field { position: relative; }
.icon-field__trigger {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 400px;
  background: #fff; border: 1px solid #dcdcde; border-radius: 6px;
  padding: 8px 10px; cursor: pointer; text-align: left;
}
.icon-field__trigger:hover { border-color: #2271b1; }
.icon-field__preview {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 4px; background: #f0f0f1; color: #1d2327;
}
.icon-field__preview svg { width: 18px; height: 18px; }
.icon-field__placeholder { font-size: 13px; }
.icon-field__label { flex: 1 1 auto; font-size: 13px; color: #1d2327; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-field__action { font-size: 12px; color: #2271b1; font-weight: 600; }
.icon-field__popover {
  position: absolute; z-index: 10010; top: calc(100% + 6px); left: 0;
  width: min(420px, 100%); max-height: 280px; overflow: auto;
  background: #fff; border: 1px solid #dcdcde; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 4px; padding: 8px;
}
.icon-field__opt {
  appearance: none; border: 1px solid transparent; background: #fff;
  border-radius: 6px; padding: 6px 2px 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #1d2327;
}
.icon-field__opt:hover { background: #e7f3ff; border-color: #2271b1; }
.icon-field__opt.is-current { border-color: #2271b1; background: #e7f3ff; }
.icon-field__opt svg { width: 20px; height: 20px; }
.icon-field__opt-text { font-size: 11px; }

/* Dashboard card previews: live module render in a scaled iframe */
.card-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 10px;
  background: #f2f1ee;
  margin-bottom: 12px;
  pointer-events: none;
}
.card-preview iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1200px;
  height: 800px;
  border: 0;
  transform-origin: 0 0;
  pointer-events: none;
}

/* ---------- Dashboard filter bar (library-style chips + search) ---------- */

.filters { margin: 0.9rem 0 1.1rem; display: flex; flex-direction: column; gap: 0.65rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.chip {
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  font-family: inherit;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.chip small {
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  color: var(--muted);
  background: rgba(20, 20, 20, 0.05);
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  line-height: 1.2;
}
.chip:hover { color: var(--text); border-color: var(--line-2); background: #fff; }
.chip.is-on {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
  box-shadow: 0 4px 12px rgba(20, 20, 20, 0.12);
}
.chip.is-on small { color: rgba(255, 255, 255, 0.75); background: rgba(255, 255, 255, 0.18); }

/* Dark: blasser Grautext auf Grau war unlesbar (Nutzer 2026-10-09) — hellere
   Schrift, sichtbarer Rand, Badge mit eigenem Kontrast. */
html[data-theme="dark"] .chip {
  background: #2d2d2d;
  border-color: rgba(255, 255, 255, 0.16);
  color: #e3e3e3;
}
html[data-theme="dark"] .chip small {
  color: #c9c9c9;
  background: rgba(255, 255, 255, 0.1);
}
/* Project chips: New-project-Aktion und Delete-Variante, Projekt-Select pro Karte. */
.chip--add { border-style: dashed; }
.chip--danger { color: #b3261e; border-color: rgba(179, 38, 30, 0.4); }
.chip--danger:hover { background: #b3261e; color: #fff; border-color: #b3261e; }
/* Projekt-Chips oben links auf der Karte (Zuweisungs-Anzeige): NUR im
   Select-Modus sichtbar, im normalen Durchblick stoeren sie nur. */
.card { position: relative; }
.card__projects {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: none;
  flex-wrap: wrap;
  gap: 0.3rem;
  max-width: calc(100% - 20px);
  pointer-events: none;
}
body.is-selecting .card__projects { display: flex; }
.card__projects span {
  padding: 0.26rem 0.65rem;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.85);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.4;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Mehrfach-Auswahl: Suchzeile mit Select-Button, Aktionsleiste, picked-Karte. */
.search { display: flex; gap: 0.5rem; align-items: center; }
.search .btn { flex-shrink: 0; }
/* Trenner zwischen Projekt-Chips und Kategorie-Chips. */
#projectChips:not([hidden]) + #chips {
  border-top: 1px dashed var(--line-2);
  margin-top: 0.8rem;
  padding-top: 0.8rem;
}
/* Auswahl-Leiste: klebt IM Auswahl-Modus am oberen Rand ÜBER dem sticky
   Topbar (hoeherer z-index). Sie liegt ausserhalb von #filters im DOM,
   damit der Sticky-Bereich nicht am Container-Ende endet. */
.select-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  margin-top: 0.55rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
#selProject {
  padding: 0.42rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: inherit;
}
html[data-theme="dark"] #selProject { background: #2d2d2d; border-color: rgba(255, 255, 255, 0.16); color: #e3e3e3; }
body.is-selecting .card { cursor: pointer; }
body.is-selecting .card-preview { pointer-events: none; }
.card.is-picked { outline: 2px solid #ff4b1f; outline-offset: 3px; }
/* Eigener Projekt-Dialog: showModal zentriert vertikal + horizontal,
   das Backdrop dimmt die Seite. */
.mm-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  width: min(26rem, calc(100vw - 2rem));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.mm-dialog::backdrop { background: rgba(20, 20, 20, 0.45); }
.mm-dialog h2 { margin: 0 0 0.2rem; }
.mm-dialog input {
  width: 100%;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: inherit;
  font-family: inherit;
  font-size: 0.92rem;
  box-sizing: border-box;
}
.mm-dialog input:focus { outline: none; border-color: var(--line-2); box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.06); }
.mm-dialog__actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.2rem; }
html[data-theme="dark"] .mm-dialog { background: #232323; border-color: rgba(255, 255, 255, 0.16); color: #e3e3e3; }
html[data-theme="dark"] .mm-dialog input { background: #2d2d2d; border-color: rgba(255, 255, 255, 0.16); color: #e3e3e3; }

html[data-theme="dark"] .chip:hover {
  background: #383838;
  border-color: rgba(255, 255, 255, 0.32);
  color: #fff;
}
html[data-theme="dark"] .chip.is-on {
  background: #e3e3e3;
  border-color: #e3e3e3;
  color: #161616;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .chip.is-on small {
  color: #161616;
  background: rgba(0, 0, 0, 0.1);
}

.search input {
  width: 100%;
  max-width: 420px;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search input:focus { border-color: var(--line-2); box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.06); }
.search input::placeholder { color: var(--muted); }
/* Dark Theme: Das Feld behielt sonst Weiss mit heller Schrift (--text). */
html[data-theme="dark"] .search input {
  background: #2d2d2d;
  border-color: rgba(255, 255, 255, 0.16);
  color: #e3e3e3;
}
html[data-theme="dark"] .search input:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08); }

/* Export-Dialog (Runde 26): Der Export öffnet sich als Code-Ansicht
   (Copy JSON) statt als sofortiger Download — der Datei-Download bleibt
   als Button erhalten, wie beim Freeflow-Generator. Die Code-Fläche bleibt
   in beiden Themes dunkel, damit der JSON-Block wie ein Editor aussieht. */
.xmodal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 10, 14, 0.72);
  backdrop-filter: blur(6px);
}
.xmodal[hidden] { display: none; }
.xmodal__panel {
  width: min(56rem, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.xmodal__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.xmodal__title { font-weight: 650; font-size: 0.95rem; margin: 0; }
.xmodal__hint { color: var(--muted); font-size: 0.75rem; margin: 0.15rem 0 0; }
.xmodal__close {
  margin-left: auto;
  min-height: 34px;
  min-width: 34px;
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  line-height: 1;
}
.xmodal__code {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 1rem 1.1rem;
  background: #0d0d12;
  color: #ffd7a1;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  white-space: pre;
  user-select: all;
}
.xmodal__foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--line);
}
.xmodal__status { color: var(--ok); font-size: 0.78rem; margin-right: auto; visibility: hidden; }
.xmodal__status.is-on { visibility: visible; }
