/* ============================================================================
   base.css — Lead-Portal: Tokens, Rahmen, alle Bausteine
   Reihenfolge: 1 Tokens · 2 Grund · 3 Rahmen · 4 Bausteine · 5 Ebenen (Dialog,
   Menü, Toast, Hover) · 6 Ziehen · 7 Suche, 404, Feedback · 8 Breiten
   Umbrüche: 600 / 960 / 1280. Bewegung: Feder (--feder), nie linear.
   ========================================================================== */

/* ───────────────────────────────── 1 Tokens ──────────────────────────────── */
:root {
  --grund: #F6F5F1;
  --flaeche: #FFFFFF;
  --mulde: #EEECE6;
  --schwebe: #FAF9F6;
  --linie: #E3E0D8;
  --linie-stark: #CBC7BD;
  --tinte: #1A1916;
  --tinte-2: #38362F;
  --tinte-3: #5C594F;
  --tinte-4: #878378;
  --blass: #A8A498;
  --akzent: #F2542D;                 /* kommt zur Laufzeit aus der Agentur (White-Label) */
  --akzent-tinte: #FFFFFF;
  --akzent-weich: color-mix(in srgb, var(--akzent) 10%, white);
  --gut: #1E9A61;
  --warn: #DB8400;
  --fehler: #E0483F;
  --info: #2F7DE1;
  --radius: 12px;
  --radius-gross: 24px;                /* Dialoge */
  --schatten-1: 0 1px 2px rgba(26, 25, 22, .05);
  --schatten-2: 0 4px 10px -2px rgba(26, 25, 22, .10), 0 2px 4px -2px rgba(26, 25, 22, .05);
  --schatten-3: 0 14px 28px -6px rgba(26, 25, 22, .14), 0 4px 8px -4px rgba(26, 25, 22, .06);
  --feder: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1.004 83.8%, 1);
  --feder-ruhig: cubic-bezier(.22, 1, .36, 1);
  /* weiche Feder mit kleinem Überschwinger (~4 %): für lange Wege (Landung beim Ziehen, gleitende Linien) */
  --feder-sanft: linear(0, 0.063 2.5%, 0.218 5.4%, 0.674 12.6%, 0.862 16.6%, 0.969 20.4%, 1.018 23.4%, 1.043 27%, 1.047 31.4%, 1.034 38.2%, 1.008 50.4%, 0.998 62.6%, 1);
  --weg: cubic-bezier(.4, 0, 1, 1);  /* Austritt: zügig hinaus */

  /* Ergänzungen des Fundaments */
  --radius-klein: 8px;
  --seitenleiste: 284px;
  --rand: 32px;                      /* Seitenabstand des Inhalts */
  --schrift: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ring: 0 0 0 3px color-mix(in srgb, var(--akzent) 20%, transparent);
  --dunkel: rgba(26, 25, 22, .44);
  --gut-weich: color-mix(in srgb, var(--gut) 11%, white);
  --warn-weich: color-mix(in srgb, var(--warn) 13%, white);
  --fehler-weich: color-mix(in srgb, var(--fehler) 10%, white);
  --info-weich: color-mix(in srgb, var(--info) 10%, white);
}

/* ───────────────────────────────── 2 Grund ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  height: 100%; margin: 0; overflow: hidden;
  background: var(--grund); color: var(--tinte);
  font: 400 14px/20px var(--schrift);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; color: var(--tinte); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
button:disabled { cursor: not-allowed; }
input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
small { font-size: 12px; line-height: 18px; }
::selection { background: color-mix(in srgb, var(--akzent) 22%, white); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--akzent) 70%, white); outline-offset: 2px; }
[hidden] { display: none !important; }

/* schmale, ruhige Rollbalken */
* { scrollbar-width: thin; scrollbar-color: var(--linie-stark) transparent; }

.icon { flex: none; display: block; }
.nur-vorleser { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.zahlen { font-variant-numeric: tabular-nums; }
.gedaempft { color: var(--tinte-4); }

/* Grundtypen für Bereiche */
.abschnitt-titel { font-size: 18px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
.abschnitt-text { font-size: 14px; line-height: 20px; color: var(--tinte-3); margin-top: 2px; }
.leiste { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.leiste-luft { flex: 1; }

/* ───────────────────────────────── 3 Rahmen ──────────────────────────────── */
#app { height: 100vh; height: 100dvh; }
/* Seiten ohne Rahmen (Login): eigener Rollbereich über das ganze Fenster */
.frei { height: 100vh; height: 100dvh; overflow: auto; }
.rahmen { display: grid; grid-template-columns: var(--seitenleiste) minmax(0, 1fr); height: 100vh; height: 100dvh; }

/* Seitenleiste */
.seitenleiste {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--flaeche); border-right: 1px solid var(--linie); padding: 18px 16px 12px;
}
.wortmarke { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; min-width: 0; }
.wortmarke-zeichen {
  flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--akzent); color: var(--akzent-tinte); font-weight: 600; font-size: 16px; letter-spacing: -.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--schatten-1);
}
.wortmarke--logo { flex: 1 1 auto; padding: 10px 12px 22px; }
/* Agentur-Logo: immer ganz, im eigenen Seitenverhältnis, nie gestreckt */
.wortmarke-logo { display: block; flex: none; width: auto; max-width: 100%; height: auto; max-height: 52px; object-fit: contain; object-position: left center; }
.wortmarke-name { font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seitenleiste .seitenleiste-x { display: none; margin-left: auto; } /* nur in der Schublade (< 960 px) */
.nav-trenner { height: 1px; background: var(--linie); margin: 0 0 14px; }

.nav-kunde {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 18px; min-width: 0;
  background: var(--schwebe); border: 1px solid var(--linie); border-radius: var(--radius);
}
.nav-kunde-text { min-width: 0; display: grid; }
.nav-kunde-text strong { font-weight: 600; font-size: 14px; line-height: 20px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.nav-kunde-text span { font-size: 13px; line-height: 18px; color: var(--tinte-4); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }

.nav-abschnitt { font-size: 12px; line-height: 18px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--tinte-4); padding: 0 12px; margin: 4px 0 6px; }
.nav-abschnitt:not(:first-child) { margin-top: 18px; }
.nav-liste { display: grid; gap: 2px; }
.nav-punkt {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; min-width: 0; width: 100%;
  border-radius: var(--radius); font-size: 16px; line-height: 22px; font-weight: 600; color: var(--tinte-2);
  transition: background-color .15s, color .15s;
}
.nav-punkt:hover { background: var(--schwebe); }
.nav-punkt.ist-aktiv { background: var(--mulde); color: var(--tinte); }
.nav-punkt .icon { color: var(--tinte-3); }
.nav-punkt.ist-aktiv .icon { color: var(--tinte); }
.nav-punkt-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; flex: 1; min-width: 0; }

.nav-rollbereich { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.nav-kampagne { height: 36px; font-size: 14px; line-height: 20px; font-weight: 500; gap: 14px; padding-left: 18px; }
.nav-kampagne .nav-ampel { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--linie-stark); transition: background-color .2s, box-shadow .2s; }
.nav-kampagne .nav-ampel.ist-neu { background: var(--gut); }
.nav-kampagne.ist-aktiv .nav-ampel { background: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 18%, transparent); }
.nav-kampagne.ist-aktiv { font-weight: 600; }

.nutzer-bereich { border-top: 1px solid var(--linie); margin-top: 12px; padding-top: 12px; }
.nutzer-kachel {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 8px 8px 10px; min-width: 0;
  border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche);
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.nutzer-kachel:hover, .nutzer-kachel[data-offen] { background: var(--schwebe); border-color: var(--linie-stark); }
.nutzer-kachel-text { display: grid; min-width: 0; flex: 1; text-align: left; }
.nutzer-kachel-text strong { font-size: 14px; line-height: 20px; font-weight: 600; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
/* E-Mail in einer Zeile (bricht sonst mitten im Wort); ist sie länger, kürzt sie mit title */
.nutzer-kachel-text span { font-size: 12px; line-height: 18px; color: var(--tinte-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nutzer-kachel > .icon { color: var(--tinte-4); }

/* Hauptspalte */
.haupt { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; height: 100dvh; }
.mobil-leiste { display: none; }
.schublade-dunkel { display: none; }

.kopf { flex: none; padding: 22px var(--rand) 0; }
.kopf-zeile { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.seitentitel {
  position: relative; flex: 1; min-width: 0; font-size: 30px; line-height: 38px; font-weight: 600; letter-spacing: -.025em;
}
.seitentitel span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.seitentitel .titel-neu { animation: titel-ein .42s var(--feder-ruhig) backwards; }
.seitentitel .titel-alt { position: absolute; inset: 0; animation: titel-aus .24s ease both; pointer-events: none; }
@keyframes titel-ein { from { opacity: 0; transform: translateY(6px); } }
@keyframes titel-aus { to { opacity: 0; transform: translateY(-4px); } }
.kopf-werkzeug { display: flex; align-items: center; gap: 4px; flex: none; }
.kopf-aktionen { display: flex; align-items: center; gap: 8px; flex: none; margin-left: 8px; }
.kopf-aktionen:empty { display: none; }
.kopf-reiter { margin-top: 10px; border-bottom: 1px solid var(--linie); }
.kopf-reiter .reiter-eintrag { font-size: 15px; }
.kopf-unterreiter { margin-top: 14px; }
.kopf-untertitel { margin: 4px 0 8px; }

.inhalt { flex: 1; min-height: 0; overflow: auto; padding: 24px var(--rand) 48px; scrollbar-gutter: stable; }
/* nur Deckkraft: ein transform am Scrollbereich würde fest positionierte Leisten der Bereiche verschieben */
.inhalt-ein { animation: inhalt-ein .32s ease-out backwards; }
@keyframes inhalt-ein { from { opacity: 0; } }

/* ──────────────────────────────── 4 Bausteine ────────────────────────────── */

/* Knopf */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  height: 40px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent;
  font: 600 14px/20px var(--schrift); white-space: nowrap; user-select: none; cursor: pointer;
  transition: transform .45s var(--feder), background-color .15s, border-color .15s, box-shadow .15s, filter .15s, color .15s;
}
.knopf:active:not(:disabled) { transform: scale(.97); transition-duration: .11s, .15s, .15s, .15s, .15s, .15s; }
.knopf:disabled { opacity: .45; box-shadow: none; }
.knopf--haupt { background: var(--akzent); color: var(--akzent-tinte); box-shadow: var(--schatten-1), inset 0 1px 0 rgba(255, 255, 255, .2); }
.knopf--haupt:hover:not(:disabled) { filter: brightness(1.08); }
.knopf--umriss { background: var(--flaeche); border-color: var(--linie-stark); color: var(--tinte-2); box-shadow: var(--schatten-1); }
.knopf--umriss:hover:not(:disabled) { background: var(--schwebe); border-color: var(--tinte-4); }
.knopf--leise { color: var(--tinte-2); }
.knopf--leise:hover:not(:disabled) { background: var(--mulde); }
.knopf--gefahr { background: var(--fehler); color: #fff; box-shadow: var(--schatten-1), inset 0 1px 0 rgba(255, 255, 255, .18); }
.knopf--gefahr:hover:not(:disabled) { filter: brightness(1.07); }
.knopf--gefahr-umriss, .knopf.knopf--gefahr-umriss { background: var(--flaeche); border-color: color-mix(in srgb, var(--fehler) 45%, white); color: var(--fehler); box-shadow: var(--schatten-1); }
.knopf.knopf--gefahr-umriss:hover:not(:disabled) { background: var(--fehler-weich); border-color: var(--fehler); filter: none; }
.knopf.knopf--akzent-umriss { background: var(--flaeche); border-color: color-mix(in srgb, var(--akzent) 45%, white); color: var(--akzent); }
.knopf.knopf--akzent-umriss:hover:not(:disabled) { background: var(--akzent-weich); border-color: var(--akzent); }
/* Drücken: kurz und weich hinein (kein Feder-Sprung), Loslassen federt zurück */
.knopf:active:not(:disabled), .icon-knopf:active:not(:disabled), button.chip:active, .haken:active:not(:disabled), .umschalter-teil:active, .pille--knopf:active { transition-timing-function: var(--feder-ruhig); }
.knopf--klein { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; gap: 6px; }
.knopf--voll { width: 100%; }
.knopf { max-width: 100%; }   /* nie breiter als die Umgebung; erst dann kürzt der Text (mit title) */
.knopf-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.dreher { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: drehen .7s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }

/* Icon-Knopf */
.icon-knopf {
  position: relative; display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--radius);
  color: var(--tinte-3); border: 1px solid transparent;
  transition: transform .45s var(--feder), background-color .15s, color .15s, border-color .15s;
}
.icon-knopf:hover:not(:disabled), .icon-knopf[data-offen] { background: var(--mulde); color: var(--tinte); }
.icon-knopf:active:not(:disabled) { transform: scale(.92); transition-duration: .11s, .15s, .15s, .15s; }
.icon-knopf:disabled { opacity: .4; }
.icon-knopf.ist-aktiv { background: var(--mulde); color: var(--tinte); }
.icon-knopf--umriss { background: var(--flaeche); border-color: var(--linie-stark); box-shadow: var(--schatten-1); }
.icon-knopf--umriss:hover:not(:disabled) { background: var(--schwebe); border-color: var(--tinte-4); }
.icon-knopf--gefahr { color: var(--fehler); }
.icon-knopf--gefahr:hover:not(:disabled) { background: var(--fehler-weich); color: var(--fehler); }
.icon-knopf--klein { width: 32px; height: 32px; border-radius: 10px; }
.icon-knopf--gross { width: 48px; height: 48px; }
.icon-knopf-zahl {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--akzent); color: var(--akzent-tinte); font-size: 11px; line-height: 18px; font-weight: 600; text-align: center;
}

/* Felder */
/* --platz setzt Feld(): so breit wie der Platzhalter. Nie breiter als die Umgebung (kein Überlaufen). */
.feld-gruppe { display: grid; gap: 6px; min-width: min(100%, var(--platz, 0px)); }
.feld-etikett { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--tinte-2); }
.feld-pflicht { color: var(--fehler); }
.feld-beschreibung { font-size: 13px; line-height: 18px; color: var(--tinte-4); margin-top: -2px; }
.feld-fehler { font-size: 13px; line-height: 18px; color: var(--fehler); }
.feld {
  display: flex; align-items: center; gap: 8px; min-height: 40px; min-width: 0; padding: 0 12px;
  background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: var(--radius); box-shadow: var(--schatten-1);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.feld:hover { border-color: var(--tinte-4); }
.feld:focus-within, .feld.auswahl:focus-visible, .feld.auswahl[data-offen] { border-color: var(--akzent); box-shadow: 0 0 0 1px var(--akzent), var(--ring); outline: none; }
.feld--fehler, .feld--fehler:hover { border-color: var(--fehler); }
.feld--fehler:focus-within { border-color: var(--fehler); box-shadow: 0 0 0 1px var(--fehler), 0 0 0 3px color-mix(in srgb, var(--fehler) 18%, transparent); }
.feld--aus { background: var(--schwebe); color: var(--tinte-4); box-shadow: none; pointer-events: none; }
.feld--klein { min-height: 32px; border-radius: 10px; padding: 0 10px; }
.feld-icon { color: var(--tinte-4); }
.feld-eingabe {
  flex: 1; min-width: 0; width: 100%; height: 38px; padding: 0; border: 0; outline: 0; background: transparent;
  font: 400 16px/24px var(--schrift); color: var(--tinte);
}
.feld--klein .feld-eingabe { height: 30px; font-size: 14px; }
.feld-eingabe::placeholder { color: var(--blass); opacity: 1; text-overflow: ellipsis; }
.feld-eingabe:placeholder-shown { text-overflow: ellipsis; }
.feld--text { padding: 8px 12px; align-items: stretch; }
.feld--text .feld-eingabe { height: auto; min-height: 72px; resize: vertical; }
.feld-leeren { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--tinte-4); flex: none; }
.feld-leeren:hover { background: var(--mulde); color: var(--tinte); }

/* Auswahl */
.auswahl { cursor: pointer; user-select: none; }
.auswahl-wert, .auswahl-platzhalter, .auswahl-chips { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 24px; }
.feld--klein .auswahl-wert, .feld--klein .auswahl-platzhalter { font-size: 14px; }
.auswahl-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auswahl-platzhalter { display: block; color: var(--blass); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auswahl-chips { flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.auswahl-pfeil { color: var(--tinte-4); transition: transform .35s var(--feder); }
.auswahl[data-offen] .auswahl-pfeil { transform: rotate(180deg); }

/* Sortierwahl: Richtungs-Knopf + Auswahl in einem Feld */
.sortierwahl { display: inline-flex; align-items: stretch; min-width: 0; }
.sortierwahl-richtung {
  display: grid; place-items: center; flex: none; width: 40px; border: 1px solid var(--linie-stark); border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius); background: var(--flaeche); color: var(--tinte-3); box-shadow: var(--schatten-1);
  transition: background-color .15s, color .15s;
}
.sortierwahl-richtung:hover { background: var(--schwebe); color: var(--tinte); }
.sortierwahl-richtung .icon { transition: transform .5s var(--feder); }
.sortierwahl-richtung.ist-ab .icon { transform: scaleY(-1); }
.sortierwahl .feld-gruppe { min-width: 0; }
.sortierwahl-feld { border-radius: 0 var(--radius) var(--radius) 0; min-width: 190px; }

/* Punkt, Pille, Marke, Zahl, Chip */
.punkt { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--f, var(--tinte-4)); }
.pille {
  --f: var(--tinte-4);
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px; max-width: 100%;
  background: color-mix(in srgb, var(--f) 9%, white); border: 1px solid color-mix(in srgb, var(--f) 26%, white);
  color: color-mix(in srgb, var(--f) 76%, black); font-size: 13px; line-height: 18px; font-weight: 500; white-space: nowrap;
}
.pille-punkt { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--f); }
.pille-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pille--klein { height: 22px; padding: 0 8px; font-size: 12px; gap: 6px; }
.pille--knopf { height: 40px; padding: 0 12px 0 14px; border-radius: var(--radius); font-size: 14px; font-weight: 600; gap: 8px; transition: filter .15s, transform .45s var(--feder); }
.pille--knopf:hover { filter: brightness(.97); }
.pille--knopf:active { transform: scale(.97); }

.marke {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; line-height: 18px; font-weight: 500; white-space: nowrap;
  background: var(--mulde); border: 1px solid var(--linie); color: var(--tinte-3);
}
.marke--info { background: var(--info-weich); border-color: color-mix(in srgb, var(--info) 26%, white); color: color-mix(in srgb, var(--info) 80%, black); }
.marke--gut { background: var(--gut-weich); border-color: color-mix(in srgb, var(--gut) 28%, white); color: color-mix(in srgb, var(--gut) 78%, black); }
.marke--warn { background: var(--warn-weich); border-color: color-mix(in srgb, var(--warn) 32%, white); color: color-mix(in srgb, var(--warn) 72%, black); }
.marke--fehler { background: var(--fehler-weich); border-color: color-mix(in srgb, var(--fehler) 28%, white); color: color-mix(in srgb, var(--fehler) 80%, black); }
.marke--akzent { background: var(--akzent-weich); border-color: color-mix(in srgb, var(--akzent) 30%, white); color: color-mix(in srgb, var(--akzent) 82%, black); }

.zahl {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
  background: var(--schwebe); border: 1px solid var(--linie); color: var(--tinte-2);
  font-size: 12px; line-height: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.zahl--info { background: var(--info-weich); border-color: color-mix(in srgb, var(--info) 26%, white); color: color-mix(in srgb, var(--info) 80%, black); }
.zahl--gut { background: var(--gut-weich); border-color: color-mix(in srgb, var(--gut) 28%, white); color: color-mix(in srgb, var(--gut) 78%, black); }
.zahl--warn { background: var(--warn-weich); border-color: color-mix(in srgb, var(--warn) 32%, white); color: color-mix(in srgb, var(--warn) 72%, black); }
.zahl--fehler { background: var(--fehler-weich); border-color: color-mix(in srgb, var(--fehler) 28%, white); color: color-mix(in srgb, var(--fehler) 80%, black); }
.zahl--akzent { background: var(--akzent-weich); border-color: color-mix(in srgb, var(--akzent) 30%, white); color: color-mix(in srgb, var(--akzent) 82%, black); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; max-width: 100%;
  background: var(--flaeche); border: 1px solid var(--linie-stark); color: var(--tinte-3);
  font-size: 13px; line-height: 18px; font-weight: 500; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .45s var(--feder);
}
button.chip:hover { border-color: var(--tinte-4); color: var(--tinte); }
button.chip:active { transform: scale(.96); transition-duration: .15s, .15s, .15s, .11s; }
.chip.ist-aktiv { background: var(--akzent-weich); border-color: color-mix(in srgb, var(--akzent) 42%, white); color: color-mix(in srgb, var(--akzent) 86%, black); }
.chip--grau.ist-aktiv { background: var(--mulde); border-color: var(--linie-stark); color: var(--tinte); }
.chip { min-width: 0; }
.chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip-zahl { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--tinte-4); }
.chip.ist-aktiv .chip-zahl { color: inherit; }
.chip-x { display: grid; place-items: center; width: 16px; height: 16px; margin-right: -4px; border-radius: 50%; color: var(--tinte-4); }
.chip-x:hover { background: var(--mulde); color: var(--tinte); }

/* Schalter */
.schalter-zeile { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.schalter-zeile.ist-aus { opacity: .5; }
.schalter {
  position: relative; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--linie-stark);
  transition: background-color .2s; margin-top: 0;
}
.schalter-knauf {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(26, 25, 22, .25); transition: transform .5s var(--feder), width .2s;
}
.schalter:active:not(:disabled) .schalter-knauf { width: 22px; }
.schalter.ist-an { background: var(--akzent); }
.schalter.ist-an .schalter-knauf { transform: translateX(16px); }
.schalter.ist-an:active:not(:disabled) .schalter-knauf { transform: translateX(12px); }
.schalter--klein { width: 32px; height: 20px; }
.schalter--klein .schalter-knauf { width: 14px; height: 14px; }
.schalter--klein.ist-an .schalter-knauf { transform: translateX(12px); }
.schalter-text { display: grid; gap: 2px; min-width: 0; padding-top: 2px; }
.schalter-titel { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--tinte-2); cursor: pointer; }
.schalter-text small { color: var(--tinte-4); }

/* Haken */
.haken {
  display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 6px;
  background: var(--flaeche); border: 1.5px solid var(--linie-stark); color: #fff;
  transition: background-color .15s, border-color .15s, transform .45s var(--feder);
}
.haken:hover:not(:disabled) { border-color: var(--akzent); }
.haken:active:not(:disabled) { transform: scale(.88); transition-duration: .15s, .15s, .11s; }
.haken.ist-an { background: var(--akzent); border-color: var(--akzent); }
.haken .icon { animation: haken-ein .4s var(--feder) backwards; }
@keyframes haken-ein { from { transform: scale(.4); opacity: 0; } }
.haken:disabled { opacity: .45; }
.haken-zeile { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.haken-zeile.ist-aus { opacity: .5; }
.haken-text { font-size: 14px; line-height: 20px; color: var(--tinte-2); cursor: pointer; }

/* Reiter */
.reiter { position: relative; display: flex; gap: 24px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.reiter::-webkit-scrollbar { display: none; }
.reiter-eintrag {
  position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 10px 2px 11px;
  font-size: 14px; line-height: 20px; font-weight: 600; color: var(--tinte-4); white-space: nowrap; transition: color .15s;
}
.reiter-eintrag:hover { color: var(--tinte-2); }
.reiter-eintrag::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--akzent);
  transform: scaleX(0); transition: transform .45s var(--feder);
}
.reiter-eintrag.ist-aktiv { color: var(--akzent); }
.reiter-eintrag.ist-aktiv::after { transform: scaleX(1); }
/* Sobald ui.js die Lage gemessen hat ([data-strich]), übernimmt EINE Linie, die zum aktiven Reiter gleitet. */
.reiter-strich {
  position: absolute; left: 0; bottom: 0; width: 100px; height: 2px; border-radius: 1px; background: var(--akzent); pointer-events: none;
  transform-origin: 0 50%; transform: translateX(var(--rx, 0px)) scaleX(var(--rb, 0)); opacity: 0;
}
.reiter[data-strich] > .reiter-strich { opacity: 1; transition: transform .55s var(--feder-sanft); }
.reiter[data-strich] > .reiter-eintrag::after { display: none; }
.reiter-eintrag:focus-visible { outline-offset: -2px; border-radius: 6px; }
.reiter-eintrag:disabled { opacity: .45; }
.reiter-zahl { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--mulde); color: var(--tinte-3); font-size: 12px; line-height: 20px; text-align: center; }

/* Umschalter (graue Schale) */
.umschalter { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--mulde); flex: none; }
.umschalter-teil {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--tinte-4); transition: background-color .15s, color .15s, box-shadow .15s, transform .45s var(--feder);
}
.umschalter-teil.nur-icon { width: 34px; padding: 0; }
.umschalter-teil:hover { color: var(--tinte-2); }
.umschalter-teil:active { transform: scale(.94); transition-duration: .15s, .15s, .15s, .11s; }
.umschalter-teil.ist-aktiv { background: var(--flaeche); color: var(--tinte); box-shadow: var(--schatten-1), 0 0 0 1px var(--linie); }
.umschalter--klein .umschalter-teil { height: 28px; font-size: 13px; padding: 0 10px; }

/* Karte */
.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten-1);
  transition: box-shadow .25s, border-color .25s, transform .5s var(--feder);
}
a.karte:hover, button.karte:hover, .karte.ist-klickbar:hover { box-shadow: var(--schatten-2); border-color: var(--linie-stark); transform: translateY(-2px); }
a.karte:active, button.karte:active, .karte.ist-klickbar:active { transform: scale(.992); transition-duration: .25s, .25s, .12s; }

/* Avatar */
.avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden;
  background: var(--mulde); color: var(--tinte-2); border: 1px solid var(--linie);
  font-weight: 600; letter-spacing: -.01em; line-height: 1; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--akzent { background: var(--akzent); color: var(--akzent-tinte); border-color: transparent; }
.avatar--gruen { background: var(--gut-weich); border-color: color-mix(in srgb, var(--gut) 40%, white); color: color-mix(in srgb, var(--gut) 80%, black); }
.avatar--orange { background: var(--warn-weich); border-color: color-mix(in srgb, var(--warn) 45%, white); color: color-mix(in srgb, var(--warn) 74%, black); }
.avatar--rot { background: var(--fehler-weich); border-color: color-mix(in srgb, var(--fehler) 40%, white); color: color-mix(in srgb, var(--fehler) 82%, black); }
.avatar--grau { background: var(--schwebe); border-color: var(--linie-stark); color: var(--tinte-3); }
.avatar-stapel { display: inline-flex; align-items: center; }
.avatar-stapel .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--flaeche); transition: transform .45s var(--feder); cursor: default; }
.avatar-stapel .avatar:first-child { margin-left: 0; }
.avatar-stapel .avatar:hover, .avatar-stapel .avatar:focus-visible { transform: translateY(-2px) scale(1.06); z-index: 1; }
.avatar--mehr { background: var(--flaeche); border-color: var(--linie-stark); color: var(--tinte-3); font-size: 11px; }

/* Ampel-Punkt */
.ampel { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--blass); }
.ampel--gruen { background: var(--gut); }
.ampel--orange { background: var(--warn); }
.ampel--rot { background: var(--fehler); }
.ampel--grau { background: var(--blass); }

/* Icon-Kachel */
.icon-kachel {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--flaeche); border: 1px solid var(--linie); color: var(--tinte-2); box-shadow: var(--schatten-1);
}
.icon-kachel--klein { width: 36px; height: 36px; border-radius: 10px; }
.icon-kachel--akzent { background: var(--akzent-weich); border-color: color-mix(in srgb, var(--akzent) 28%, white); color: var(--akzent); }

/* Leerzustand */
.leer { display: grid; justify-items: center; gap: 6px; padding: 56px 24px; text-align: center; }
.leer .icon-kachel { margin-bottom: 10px; }
.leer h3 { font-size: 16px; line-height: 24px; }
.leer p { max-width: 380px; color: var(--tinte-3); }
.leer-aktion { margin-top: 14px; }
.leer--klein { padding: 28px 16px; }

/* Skelett */
.skelett { display: grid; gap: 12px; }
.skelett i {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--mulde) 25%, var(--schwebe) 37%, var(--mulde) 63%); background-size: 400% 100%;
  animation: schimmer 1.4s ease infinite;
}
@keyframes schimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
.skelett-zeile { display: flex; align-items: center; gap: 24px; height: 56px; padding: 0 16px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.skelett--karten { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.skelett-karte { display: grid; gap: 14px; padding: 22px 20px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.skelett-karte i:first-child { height: 16px; }

/* Hinweis-Icon („?") */
.hinweis-icon { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; color: var(--tinte-4); cursor: help; }
.hinweis-icon:hover, .hinweis-icon:focus-visible { color: var(--tinte); }

/* Statusbalken */
.statusbalken { display: flex; gap: 3px; height: 6px; min-width: 0; }
.statusbalken.ist-leer { background: var(--mulde); border-radius: 3px; }
.statusbalken-teil { flex: 1 1 0; min-width: 6px; height: 100%; border-radius: 3px; background: var(--f, var(--tinte-4)); transition: transform .35s var(--feder), flex-grow .5s var(--feder-ruhig); transform-origin: center bottom; }
.statusbalken-teil:hover { transform: scaleY(1.8); }

/* Tabelle */
.tabelle-rahmen { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten-1); overflow: auto; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.tabelle th {
  position: sticky; top: 0; z-index: 1; padding: 12px 16px; text-align: left; white-space: nowrap;
  font-size: 12px; line-height: 18px; font-weight: 500; color: var(--tinte-3); background: var(--schwebe); border-bottom: 1px solid var(--linie);
}
.tabelle td { padding: 14px 16px; border-bottom: 1px solid var(--linie); color: var(--tinte-2); vertical-align: middle; }
.tabelle tbody tr:last-child td { border-bottom: 0; }
.tabelle tbody tr { transition: background-color .12s; }
.tabelle tbody tr.ist-klickbar { cursor: pointer; }
.tabelle tbody tr.ist-klickbar:hover, .tabelle tbody tr.ist-gewaehlt { background: var(--schwebe); }
.tabelle tbody tr:focus-visible { outline-offset: -2px; }
.tabelle .ist-rechts { text-align: right; }
.tabelle .ist-mitte { text-align: center; }
.tabelle th.ist-sortiert { color: var(--tinte); font-weight: 600; }
.tabelle-sort { display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; }
.tabelle-sort:hover { color: var(--tinte); }
.tabelle--kompakt td { padding: 10px 16px; }

/* Seitenwahl (Tabellenfuß) */
.seitenwahl { display: flex; align-items: center; gap: 8px; padding: 10px 4px 0; color: var(--tinte-3); font-size: 13px; }
.seitenwahl-luft { flex: 1; }
.seitenwahl-groesse { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border: 1px solid var(--linie-stark); border-radius: 10px; background: var(--flaeche); font-weight: 600; color: var(--tinte-2); }
.seitenwahl-groesse:hover, .seitenwahl-groesse[data-offen] { border-color: var(--tinte-4); }

/* Einstellungs-Zeile */
.einstellung { display: grid; grid-template-columns: minmax(200px, 320px) minmax(0, 560px); gap: 12px 40px; padding: 22px 0; border-bottom: 1px solid var(--linie); }
.einstellung:last-child { border-bottom: 0; }
.einstellung-links h4 { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 20px; font-weight: 600; }
.einstellung-links p { margin-top: 4px; font-size: 14px; line-height: 20px; color: var(--tinte-3); }
.einstellung-rechts { display: grid; gap: 12px; align-content: start; min-width: 0; }

/* Ablage (Upload) */
.ablage {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 24px 16px; text-align: center; cursor: pointer;
  background: var(--flaeche); border: 1.5px dashed var(--linie-stark); border-radius: var(--radius);
  transition: border-color .2s, background-color .2s, transform .45s var(--feder);
}
.ablage:hover, .ablage:focus-within { border-color: var(--akzent); }
.ablage[data-ueber] { border-color: var(--akzent); background: var(--akzent-weich); transform: scale(1.01); }
.ablage.ist-aus { opacity: .5; pointer-events: none; }
.ablage-eingabe { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ablage-text { font-weight: 600; color: var(--tinte-2); }
.ablage-hilfe { font-size: 13px; color: var(--tinte-4); }
.ablage--klein { grid-template-columns: auto minmax(0, 1fr); justify-items: start; align-items: center; gap: 0 12px; padding: 12px 14px; text-align: left; }
.ablage--klein .icon-kachel { grid-row: 1 / span 2; }
.ablage--klein .ablage-text, .ablage--klein .ablage-hilfe { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* Editor */
.editor { background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: var(--radius); box-shadow: var(--schatten-1); transition: border-color .15s, box-shadow .15s; }
.editor:focus-within { border-color: var(--akzent); box-shadow: 0 0 0 1px var(--akzent), var(--ring); }
.editor-text { padding: 12px 14px; outline: none; font-size: 14px; line-height: 22px; color: var(--tinte); overflow-wrap: anywhere; max-height: 50vh; overflow-y: auto; }
.editor-text:empty::before { content: attr(data-platzhalter); color: var(--blass); pointer-events: none; }
.editor-text a, .formatiert a { color: var(--akzent); text-decoration: underline; }
.editor-text ul, .editor-text ol, .formatiert ul, .formatiert ol { margin: 4px 0; padding-left: 22px; }
.editor-text p, .formatiert p { margin: 0 0 6px; }
.editor-text p:last-child, .formatiert p:last-child { margin-bottom: 0; }
.formatiert { font-size: 14px; line-height: 22px; overflow-wrap: anywhere; }
.editor-leiste { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-top: 1px solid var(--linie); }
.editor-luft { flex: 1; }
.editor-groesse { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 8px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--tinte-3); }
.editor-groesse:hover, .editor-groesse[data-offen] { background: var(--mulde); color: var(--tinte); }

/* ───────────────────── 5 Ebenen: Dialog, Menü, Toast, Hover ──────────────── */
.ebenen { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.ebenen > * { pointer-events: auto; }

.dialog-huelle {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow: hidden;
  background: var(--dunkel); animation: dunkel-ein .3s cubic-bezier(.25, .8, .5, 1) backwards;
}
.dialog-huelle:not([data-ebene="1"]) { background: rgba(26, 25, 22, .3); }
.dialog {
  display: flex; flex-direction: column; width: min(var(--breite, 560px), 100%); max-height: 100%; min-height: 0; overflow: hidden; outline: none;
  background: var(--flaeche); border-radius: var(--radius-gross);
  box-shadow: var(--schatten-3), 0 32px 80px -24px rgba(26, 25, 22, .4);
  animation: dialog-ein .55s var(--feder) backwards; transform-origin: 50% 46%;
}
.dialog--voll { width: min(1400px, 100%); height: 100%; }
.dialog--hoch { height: 100%; }
@keyframes dunkel-ein { from { opacity: 0; } }
@keyframes dialog-ein { from { opacity: 0; transform: scale(.92); } }
.dialog-huelle.geht { animation: dunkel-aus .2s var(--weg) both; pointer-events: none; }
.dialog-huelle.geht .dialog { animation: dialog-aus .2s var(--weg) both; }
@keyframes dunkel-aus { to { opacity: 0; } }
@keyframes dialog-aus { to { opacity: 0; transform: scale(.96); } }

.dialog-kopf { display: flex; align-items: center; gap: 16px; flex: none; padding: 20px 20px 20px 24px; border-bottom: 1px solid var(--linie); }
.dialog-titel { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dialog-titel h2 { font-size: 18px; line-height: 28px; letter-spacing: -.01em; }
.dialog-titel p { font-size: 14px; line-height: 20px; color: var(--tinte-3); }
.dialog-kopf-rechts { display: flex; align-items: center; gap: 8px; flex: none; }
.dialog-inhalt { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 24px; display: grid; gap: 18px; align-content: start; grid-auto-rows: max-content; }
.dialog-inhalt:empty { display: none; }
.dialog-inhalt--ohne-rand { padding: 0; gap: 0; }
.dialog-text { color: var(--tinte-3); font-size: 14px; line-height: 22px; }
.dialog-fuss { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex: none; padding: 16px 24px; border-top: 1px solid var(--linie); background: var(--schwebe); }
.dialog--frage .dialog-kopf { border-bottom: 0; padding-bottom: 8px; }
.dialog--frage .dialog-inhalt { padding-top: 0; }
.dialog--gefahr .icon-kachel { background: var(--fehler-weich); border-color: color-mix(in srgb, var(--fehler) 28%, white); color: var(--fehler); }
/* Bausteine für Dialog-Inhalte */
.dialog-abschnitt { display: grid; gap: 4px; }
.dialog-abschnitt h3 { font-size: 16px; line-height: 24px; }
.dialog-abschnitt p { color: var(--tinte-3); }
.schalter-liste { display: grid; gap: 18px; padding: 6px 4px; }

/* Menü */
.menue {
  position: fixed; display: flex; flex-direction: column; min-width: 200px; max-width: min(440px, calc(100vw - 16px)); overflow: hidden; outline: none;
  padding: 6px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten-3);
  animation: menue-ein .36s var(--feder-ruhig) backwards;
}
.menue[data-seite="oben"] { animation-name: menue-ein-oben; }
@keyframes menue-ein { from { opacity: 0; transform: translateY(-6px); } }
@keyframes menue-ein-oben { from { opacity: 0; transform: translateY(6px); } }
.menue.geht { animation: menue-aus .14s var(--weg) both; pointer-events: none; }
.menue.geht[data-seite="oben"] { animation-name: menue-aus-oben; }
@keyframes menue-aus { to { opacity: 0; transform: translateY(-4px) scale(.985); } }
@keyframes menue-aus-oben { to { opacity: 0; transform: translateY(4px) scale(.985); } }
.menue-kopf { display: flex; align-items: center; gap: 8px; flex: none; padding: 2px 4px 8px; margin-bottom: 6px; border-bottom: 1px solid var(--linie); font-weight: 600; }
.menue-zurueck { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--tinte-3); }
.menue-zurueck:hover { background: var(--mulde); color: var(--tinte); }
.menue-suche { display: flex; align-items: center; gap: 8px; flex: none; height: 36px; padding: 0 10px; margin-bottom: 6px; border-radius: 8px; background: var(--schwebe); border: 1px solid var(--linie); color: var(--tinte-4); }
.menue-suche:focus-within { border-color: var(--akzent); }
.menue-suche-eingabe { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; }
.menue-suche-eingabe::placeholder { color: var(--blass); }
.menue-liste { display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.menue-eintrag {
  display: flex; align-items: center; gap: 10px; flex: none; width: 100%; min-height: 38px; padding: 7px 10px; border-radius: var(--radius-klein);
  font-size: 14px; line-height: 20px; font-weight: 500; color: var(--tinte-2); text-align: left; outline: none; transition: background-color .1s;
}
.menue-eintrag:hover:not(:disabled), .menue-eintrag:focus-visible { background: var(--mulde); color: var(--tinte); }
.menue-eintrag.ist-aktiv { background: var(--schwebe); }
.menue-eintrag:disabled { opacity: .45; }
.menue-eintrag .icon { color: var(--tinte-4); }
.menue-eintrag.ist-gefahr, .menue-eintrag.ist-gefahr .icon { color: var(--fehler); }
.menue-eintrag.ist-gefahr:hover:not(:disabled), .menue-eintrag.ist-gefahr:focus-visible { background: var(--fehler-weich); color: var(--fehler); }
.menue-text { flex: 1; min-width: 0; display: grid; }
.menue-text span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.menue-text small { color: var(--tinte-4); font-weight: 400; white-space: normal; }
.menue-zahl { color: var(--tinte-4); font-variant-numeric: tabular-nums; }
.menue-eintrag .menue-haken { color: var(--akzent); }
.menue-trenner { height: 1px; flex: none; margin: 5px 4px; background: var(--linie); }
.menue-gruppe { padding: 8px 10px 4px; font-size: 12px; line-height: 18px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--tinte-4); }
.menue-leer { padding: 14px 10px; color: var(--tinte-4); text-align: center; }
.menue-frei { min-height: 0; overflow-y: auto; padding: 10px; display: grid; gap: 12px; }
.menue-frei-zeile { padding: 4px 6px; }
.menue-fuss { flex: none; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--linie); }

/* Toast: unten rechts, neue stapeln sich nach oben. --toast-hub (setzt ui.js) hebt den Stapel über einen
   Fuß, der dort liegt (Dialog-Fuß, Knopf-Leiste am Handy, [data-toast-fuss]). */
.toasts {
  position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 2000; display: flex; flex-direction: column-reverse; gap: 8px;
  width: min(380px, calc(100vw - 32px)); pointer-events: none;
  transform: translateY(calc(-1 * var(--toast-hub, 0px))); transition: transform .5s var(--feder-ruhig);
}
.toast {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 10px 12px 14px; pointer-events: auto;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten-3);
  animation: toast-ein .5s var(--feder) backwards; transition: transform .45s var(--feder-sanft);
}
@keyframes toast-ein { from { opacity: 0; transform: translateX(32px); } }
.toast.erneut { animation: toast-erneut .45s var(--feder) backwards; }
@keyframes toast-erneut { from { transform: scale(.96); } }
.toast.geht { animation: toast-aus .22s var(--weg) both; pointer-events: none; }
@keyframes toast-aus { to { opacity: 0; transform: translateX(24px); } }
.toast-icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--gut-weich); color: var(--gut); }
.toast--fehler .toast-icon { background: var(--fehler-weich); color: var(--fehler); }
.toast--info .toast-icon { background: var(--info-weich); color: var(--info); }
.toast--warn .toast-icon { background: var(--warn-weich); color: var(--warn); }
.toast--fehler { border-color: color-mix(in srgb, var(--fehler) 35%, white); }
.toast-text { flex: 1; min-width: 0; display: grid; gap: 1px; padding-top: 4px; }
.toast-text strong { font-size: 14px; line-height: 20px; font-weight: 600; overflow-wrap: anywhere; }
.toast-text span { font-size: 13px; line-height: 18px; color: var(--tinte-3); overflow-wrap: anywhere; }
.toast-aktion { flex: none; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--akzent); }
.toast-aktion:hover { background: var(--akzent-weich); }
.toast-x { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; color: var(--tinte-4); }
.toast-x:hover { background: var(--mulde); color: var(--tinte); }

/* Hover-Kärtchen */
.schwebe {
  position: fixed; left: 0; top: 0; z-index: 2100; pointer-events: none; opacity: 0; visibility: hidden; max-width: 280px;
  padding: 6px 10px; border-radius: var(--radius-klein); background: var(--tinte); color: #fff; box-shadow: var(--schatten-2);
  font-size: 12px; line-height: 18px; font-weight: 500; transform: translateY(4px) scale(.98);
  transition: opacity .12s, transform .32s var(--feder-ruhig), visibility 0s .12s;
}
.schwebe[data-seite="unten"] { transform: translateY(-4px) scale(.98); }
.schwebe.ist-da { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.schwebe--karte { max-width: 360px; padding: 12px 14px; background: var(--flaeche); color: var(--tinte); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten-3); font-size: 13px; font-weight: 400; }
.schwebe-titel { font-weight: 600; font-size: 13px; line-height: 18px; }
.schwebe-zeile { display: flex; align-items: center; gap: 6px; color: var(--tinte-3); }

/* ───────────────────────────────── 6 Ziehen ──────────────────────────────── */
[data-zieh] { -webkit-touch-callout: none; touch-action: manipulation; }
[data-zieh-griff] { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.zieh-griff { display: inline-grid; place-items: center; width: 24px; height: 32px; border-radius: 6px; color: var(--tinte-4); flex: none; transition: color .16s ease, background-color .16s ease; }
.zieh-griff:hover, .zieh-griff:focus-visible { color: var(--tinte-2); background: var(--mulde); }
[data-zieht]:not(html) { opacity: .32; }
html[data-zieht], html[data-zieht] * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
.zieh-geist {
  z-index: 3000; pointer-events: none; will-change: transform; opacity: .98; border-radius: var(--radius); box-shadow: var(--schatten-2);
  transition: scale .4s var(--feder), rotate .4s var(--feder), box-shadow .2s, opacity .16s;
}
.zieh-geist.ist-oben { scale: 1.03; rotate: 1.2deg; box-shadow: var(--schatten-3), 0 26px 50px -14px rgba(26, 25, 22, .28); }
.zieh-geist.kehrt-zurueck { transition: transform .5s var(--feder-sanft), scale .3s var(--feder-ruhig), rotate .3s var(--feder-ruhig), box-shadow .3s; }
/* Landung: federt auf den Platz der echten Karte; die wartet unsichtbar ([data-zieh-landet]) und übernimmt dann */
.zieh-geist.landet { opacity: 1; box-shadow: var(--schatten-1); transition: transform .46s var(--feder-sanft), scale .36s var(--feder-ruhig), rotate .36s var(--feder-ruhig), box-shadow .36s; }
.zieh-geist.loest-auf { opacity: 0; scale: .96; transition: opacity .18s var(--weg), scale .18s var(--weg), rotate .18s; }
/* ohne eigene Verschiebung (z. B. Hover-Hub), damit die Übergabe auf den Pixel stimmt */
[data-zieh-landet] { opacity: 0 !important; transform: none !important; transition: none !important; }
.zieh-marke { position: fixed; z-index: 2900; pointer-events: none; border-radius: 2px; background: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 18%, transparent); }
[data-zieh-ziel] { outline: 2px dashed color-mix(in srgb, var(--akzent) 55%, white); outline-offset: -2px; background-color: var(--akzent-weich); transition: background-color .22s var(--feder-ruhig), box-shadow .22s var(--feder-ruhig); }

/* ───────────────────────── 7 Suche, 404, Feedback ────────────────────────── */
.dialog--suche { align-self: start; margin-top: min(12vh, 110px); max-height: calc(100% - min(12vh, 110px)); }
.suche-kopf { display: flex; align-items: center; gap: 16px; flex: none; padding: 20px 20px 20px 24px; border-bottom: 1px solid var(--linie); }
.suche-eingabe { flex: 1; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; font-size: 18px; line-height: 28px; border-bottom: 2px solid var(--akzent); }
.suche-eingabe::placeholder { color: var(--blass); }
.suche-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.suche-koerper { display: grid; gap: 16px; min-height: 180px; align-content: start; }
.suche-gruppe { display: grid; gap: 4px; }
.suche-gruppe h3 { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--tinte-3); padding: 0 8px 2px; }
.treffer { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: var(--radius); text-align: left; transition: background-color .1s; outline: none; }
.treffer:hover, .treffer.ist-markiert, .treffer:focus-visible { background: var(--mulde); }
.treffer-text { flex: 1; min-width: 0; display: grid; }
.treffer-text strong { font-size: 14px; line-height: 20px; font-weight: 600; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.treffer-text span { font-size: 13px; line-height: 18px; color: var(--tinte-3); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.treffer-zeit { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 12px; color: var(--tinte-4); }
.suche-leer { display: grid; justify-items: center; gap: 18px; padding: 22px 0 14px; color: var(--tinte-3); text-align: center; }
.tasten-hinweis { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--linie); border-radius: var(--radius); color: var(--tinte-2); }
kbd, .taste { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 6px; background: var(--schwebe); border: 1px solid var(--linie); font: 500 12px/1 var(--schrift); color: var(--tinte-2); }

.nicht-gefunden { height: 100vh; height: 100dvh; display: grid; align-content: center; justify-items: start; gap: 14px; padding: 48px max(24px, 9vw); }
.nicht-gefunden small { font-size: 14px; font-weight: 600; color: var(--akzent); letter-spacing: .02em; }
.nicht-gefunden h1 { font-size: clamp(34px, 5.4vw, 60px); line-height: 1.08; letter-spacing: -.035em; max-width: 16ch; }
.nicht-gefunden p { font-size: 18px; line-height: 28px; color: var(--tinte-3); max-width: 46ch; }
.nicht-gefunden .leiste { margin-top: 18px; }
/* Ruhige Seiten im Supabase-Modus (kein Zugang, Kundenansicht, keine Antwort): Zeilen kommen nacheinander von unten, mit Feder */
.ruhig > * { animation: ruhig-ein .7s var(--feder-sanft) backwards; }
.ruhig > :nth-child(2) { animation-delay: .05s; }
.ruhig > :nth-child(3) { animation-delay: .1s; }
.ruhig > :nth-child(4) { animation-delay: .16s; }
@keyframes ruhig-ein { from { opacity: 0; transform: translateY(16px); } }

.feedback { display: grid; gap: 16px; width: 100%; padding: 6px; }
.feedback-teil { display: grid; gap: 6px; min-width: 0; }
.feedback h3 { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--tinte-2); }
.feedback .umschalter { width: 100%; }
.feedback .umschalter-teil { flex: 1 1 0; min-width: 0; padding: 0 8px; }
.feedback .umschalter-teil .icon { flex: none; width: 16px; height: 16px; }
.feedback-optional { font-weight: 400; color: var(--tinte-4); }
.feedback .ablage { padding: 16px 12px; gap: 4px; }
.feedback .ablage .icon-kachel { margin-bottom: 4px; }
.feedback-datei {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 8px 10px 12px;
  background: var(--schwebe); border: 1px solid var(--linie); border-radius: var(--radius);
  animation: feedback-datei .5s var(--feder) backwards;
}
@keyframes feedback-datei { from { opacity: 0; transform: scale(.96); } }
.feedback-datei-text { flex: 1; min-width: 0; display: grid; }
.feedback-datei-text strong { font-size: 14px; line-height: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feedback-datei-text span { font-size: 12px; line-height: 18px; color: var(--tinte-4); }
.feedback-achtung .icon { flex: none; margin-top: 1px; }
.feedback-achtung { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--warn-weich); border: 1px solid color-mix(in srgb, var(--warn) 30%, white); color: color-mix(in srgb, var(--warn) 62%, black); font-size: 13px; line-height: 18px; }
.feedback-fuss { font-size: 12px; line-height: 18px; color: var(--tinte-4); text-align: center; }

.fehler-kasten { display: grid; gap: 8px; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--fehler) 30%, white); background: var(--fehler-weich); border-radius: var(--radius); color: color-mix(in srgb, var(--fehler) 70%, black); }
.fehler-kasten code { font: 12px/18px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--tinte-2); }

/* ─────────────────── 7b Rollband, gestaffeltes Erscheinen ─────────────────── */
/* Rollband: Leisten, die quer rollen (Reiter, Chip-Bänder), blenden an der Seite aus, an der es weitergeht.
   Rein in CSS über den Roll-Stand; passt alles hinein, bleibt die Leiste unverändert. Views: Klasse „rollband". */
@property --blende-l { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --blende-r { syntax: '<length>'; inherits: false; initial-value: 0px; }
@supports (animation-timeline: scroll()) {
  .reiter, .rollband {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--blende-l), #000 calc(100% - var(--blende-r)), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 var(--blende-l), #000 calc(100% - var(--blende-r)), transparent);
    animation: rollband-blende 1s linear both; animation-timeline: scroll(self inline);
  }
  @keyframes rollband-blende {
    from { --blende-l: 0px; --blende-r: 36px; }
    8%, 92% { --blende-l: 36px; --blende-r: 36px; }
    to { --blende-l: 36px; --blende-r: 0px; }
  }
}

/* Gestaffeltes Erscheinen: Kinder einer Liste kommen kurz nacheinander (nur beim ersten Einhängen).
   Tabellenzeilen tun das von selbst; für Karten-Raster und Listen die Klasse „gestaffelt" setzen. */
.gestaffelt > *, .tabelle tbody tr { animation: reihe-ein .46s var(--feder-ruhig) backwards; }
@keyframes reihe-ein { from { opacity: 0; transform: translateY(8px); } }
.gestaffelt > :nth-child(2), .tabelle tbody tr:nth-child(2) { animation-delay: 22ms; }
.gestaffelt > :nth-child(3), .tabelle tbody tr:nth-child(3) { animation-delay: 44ms; }
.gestaffelt > :nth-child(4), .tabelle tbody tr:nth-child(4) { animation-delay: 66ms; }
.gestaffelt > :nth-child(5), .tabelle tbody tr:nth-child(5) { animation-delay: 88ms; }
.gestaffelt > :nth-child(6), .tabelle tbody tr:nth-child(6) { animation-delay: 110ms; }
.gestaffelt > :nth-child(7), .tabelle tbody tr:nth-child(7) { animation-delay: 132ms; }
.gestaffelt > :nth-child(8), .tabelle tbody tr:nth-child(8) { animation-delay: 154ms; }
.gestaffelt > :nth-child(9), .tabelle tbody tr:nth-child(9) { animation-delay: 176ms; }
.gestaffelt > :nth-child(n+10), .tabelle tbody tr:nth-child(n+10) { animation-delay: 198ms; }

/* ───────────────────────────────── 8 Breiten ─────────────────────────────── */
/* < 960 px: Seitenleiste wird zur Schublade, oben eine Leiste mit Menü-Knopf */
@media (max-width: 959.98px) {
  :root { --rand: 24px; }
  .rahmen { grid-template-columns: minmax(0, 1fr); }
  .seitenleiste {
    position: fixed; inset: 0 auto 0 0; z-index: 70; width: var(--seitenleiste); max-width: 86vw; border-right: 1px solid var(--linie);
    transform: translateX(-102%); visibility: hidden; box-shadow: none;
    transition: transform .2s cubic-bezier(.4, 0, .2, 1), visibility 0s .2s, box-shadow .2s;
  }
  .rahmen--schublade .seitenleiste { transform: none; visibility: visible; box-shadow: var(--schatten-3), 30px 0 80px -30px rgba(26, 25, 22, .35); transition: transform .5s var(--feder-ruhig), visibility 0s, box-shadow .3s; }
  .seitenleiste .seitenleiste-x { display: inline-grid; }
  .schublade-dunkel { display: block; position: fixed; inset: 0; z-index: 65; background: var(--dunkel); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .rahmen--schublade .schublade-dunkel { opacity: 1; pointer-events: auto; }
  .mobil-leiste { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; height: 56px; padding: 0 12px; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
  .mobil-leiste .wortmarke { padding: 0; }
  .mobil-leiste .wortmarke-logo { max-height: 30px; max-width: 46vw; object-position: center; }
  .mobil-leiste .wortmarke-zeichen { width: 30px; height: 30px; font-size: 14px; }
  .kopf { padding-top: 18px; }
  .kopf-werkzeug { display: none; }
  .tabelle th, .tabelle td { padding-left: 12px; padding-right: 12px; }   /* schmaler Schirm: Spalten rücken zusammen */
  .einstellung { grid-template-columns: minmax(0, 1fr); }
}

/* ≤ 600 px: Handy-Fassung */
@media (max-width: 600px) {
  :root { --rand: 16px; }
  .seitentitel { font-size: 24px; line-height: 32px; }
  .kopf-reiter .reiter-eintrag { font-size: 15px; }
  .inhalt { padding-top: 16px; }
  /* Kopf-Aktionen (z. B. „Lead erstellen") als Knopf über die volle Breite unten */
  .kopf-aktionen { position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40; margin: 0; }
  .kopf-aktionen .knopf { flex: 1; height: 48px; font-size: 15px; box-shadow: var(--schatten-3); }
  /* Gesperrter Knopf bleibt deckend, damit kein Inhalt durchscheint. */
  .kopf-aktionen .knopf:disabled { opacity: 1; background: color-mix(in srgb, var(--akzent) 42%, var(--flaeche)); color: var(--akzent-tinte); }
  .rahmen--mit-aktionen .inhalt { padding-bottom: 104px; }
  /* Dialoge füllen den Bildschirm */
  .dialog-huelle { padding: 0; }
  /* Vollbild: ohne Überschwinger hereinfahren (sonst blitzt unten kurz die Seite durch) */
  .dialog, .dialog--voll, .dialog--suche { width: 100%; height: 100%; max-height: none; margin: 0; border-radius: 0; box-shadow: none; animation: dialog-ein-handy .42s var(--feder-ruhig) backwards; }
  @keyframes dialog-ein-handy { from { opacity: 0; transform: translateY(24px); } }
  .dialog-kopf, .suche-kopf { padding: 14px 12px 14px 16px; gap: 12px; }
  .dialog-inhalt { padding: 16px; }
  .dialog-inhalt--ohne-rand { padding: 0; }
  .dialog-fuss { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  .dialog-fuss .knopf { flex: 1; }
  .dialog-huelle.geht .dialog { animation-name: dialog-aus-handy; }
  @keyframes dialog-aus-handy { to { opacity: 0; transform: translateY(20px); } }
  /* Toasts über die volle Breite; über die Knopf-Leiste hebt sie --toast-hub (ui.js misst .kopf-aktionen) */
  .toasts { left: 16px; width: auto; }
  .toast { animation-name: toast-ein-handy; }
  .toast.geht { animation-name: toast-aus-handy; }
  @keyframes toast-ein-handy { from { opacity: 0; transform: translateY(20px); } }
  @keyframes toast-aus-handy { to { opacity: 0; transform: translateY(14px); } }
  .menue { max-width: calc(100vw - 16px); }
  .nicht-gefunden { padding: 32px 20px; }
  .nicht-gefunden .leiste .knopf { flex: 1; }
}

/* ─────────────────────────── 9 Ruhige Bewegung ───────────────────────────── */
/* Wer im System „Bewegung reduzieren" gesetzt hat, bekommt dieselben Abläufe stark verkürzt (nicht abgeschaltet:
   Zustände bleiben nachvollziehbar). Dauerläufer (Lade-Kreis, Schimmer) behalten ihr Tempo bzw. stehen still. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .12s !important; animation-delay: 0s !important; transition-duration: .1s !important; scroll-behavior: auto !important; }
  .dreher { animation-duration: .7s !important; }
  .skelett i { animation: none !important; }
  .reiter, .rollband { animation-duration: auto !important; }
}
