/* ==========================================================================
   Murmelkiste-Portal — Frontend-Styles
   Akzent: Murmelkiste-Türkis #79C8D0. Systemfonts (kein CDN).
   ========================================================================== */

:root {
  --tuerkis: #79c8d0;
  --tuerkis-dunkel: #4f9ea6;
  --tuerkis-hell: #e4f5f6;
  --tinte: #1c2b2d;
  --text: #263336;
  --text-schwach: #647579;
  --rand: #dde6e7;
  --flaeche: #ffffff;
  --flaeche-2: #f5f9fa;
  --hintergrund: #eef3f4;
  --gefahr: #d9534f;
  --gefahr-hell: #fbeceb;
  --warnung: #e2a63b;
  --warnung-hell: #fbf3e2;
  --erfolg: #4a9d6e;
  --erfolg-hell: #eaf6ef;
  --schatten: 0 1px 2px rgba(28, 43, 45, 0.06), 0 4px 16px rgba(28, 43, 45, 0.06);
  --radius: 10px;
  --schrift: Rubik, Ubuntu, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dunkles Farbschema: automatisch (Systemeinstellung) — es sei denn, der
   Nutzer hat explizit "hell" gewählt (data-theme="light"). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tuerkis: #79c8d0;
    --tuerkis-dunkel: #9adde3;
    --tuerkis-hell: #17393d;
    --tinte: #eef6f7;
    --text: #d9e4e5;
    --text-schwach: #90a3a6;
    --rand: #2c3e40;
    --flaeche: #162224;
    --flaeche-2: #1c2c2e;
    --hintergrund: #101a1b;
    --gefahr: #e2807c;
    --gefahr-hell: #3a2222;
    --warnung: #e7bc70;
    --warnung-hell: #3a3120;
    --erfolg: #7fc79c;
    --erfolg-hell: #1f3329;
    --schatten: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}

/* Explizit gewählt: dunkel (Schalter in der Topbar / auf dem Login-Screen) */
:root[data-theme="dark"] {
  --tuerkis: #79c8d0;
  --tuerkis-dunkel: #9adde3;
  --tuerkis-hell: #17393d;
  --tinte: #eef6f7;
  --text: #d9e4e5;
  --text-schwach: #90a3a6;
  --rand: #2c3e40;
  --flaeche: #162224;
  --flaeche-2: #1c2c2e;
  --hintergrund: #101a1b;
  --gefahr: #e2807c;
  --gefahr-hell: #3a2222;
  --warnung: #e7bc70;
  --warnung-hell: #3a3120;
  --erfolg: #7fc79c;
  --erfolg-hell: #1f3329;
  --schatten: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* WICHTIG: das hidden-Attribut muss IMMER gewinnen — sonst überschreiben
   display:flex-Regeln (.login-screen/.app-shell) das Verstecken und Login
   und Dashboard sind gleichzeitig sichtbar (Scroll-Bug). */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--schrift);
  background: var(--hintergrund);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3, h4 { color: var(--tinte); margin: 0 0 .3em; font-weight: 600; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .6em; }
a { color: var(--tuerkis-dunkel); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 1px solid transparent; border-radius: 8px; padding: .55em 1.1em;
  cursor: pointer; font-weight: 500; transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--tuerkis-dunkel); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--tinte); }
.btn-ghost { background: transparent; border-color: var(--rand); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--flaeche-2); }
.btn-gefahr { background: var(--gefahr); color: #fff; }
.btn-gefahr:hover:not(:disabled) { opacity: .85; }
.btn-sm { padding: .4em .8em; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: .3em; margin-bottom: 1em; font-size: .9rem; color: var(--text-schwach); }
.field input { padding: .6em .7em; border: 1px solid var(--rand); border-radius: 8px; background: var(--flaeche); color: var(--text); }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=email], select, textarea {
  padding: .5em .65em; border: 1px solid var(--rand); border-radius: 7px; background: var(--flaeche); color: var(--text);
}
textarea { resize: vertical; font-family: inherit; width: 100%; }
.checkbox-feld { display: inline-flex; align-items: center; gap: .4em; font-size: .9rem; }

/* ---------- Login ---------- */
.login-screen {
  position: relative;
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--tuerkis-hell), var(--hintergrund) 60%);
  padding: 1.5rem;
}
.login-theme-schalter { position: absolute; top: 1rem; right: 1rem; }

/* ---------- Hell/Dunkel-Schalter (Icon-Wechsel steuert app.js) ---------- */
.theme-schalter { padding: .35em .55em; line-height: 1; }
.theme-schalter svg { width: 17px; height: 17px; }
.login-card {
  background: var(--flaeche); border-radius: 16px; box-shadow: var(--schatten);
  padding: 2rem; width: 100%; max-width: 380px;
}
.login-brand { display: flex; align-items: center; gap: .8em; margin-bottom: 1.4em; }
.login-brand h1 { font-size: 1.15rem; margin: 0; }
.login-brand p { margin: 0; font-size: .82rem; color: var(--text-schwach); }
.login-brand-mark, .brand-mark {
  width: 42px; height: 42px; border-radius: 11px; background: var(--tuerkis);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.2rem; flex-shrink: 0;
}
.login-fehler { color: var(--gefahr); background: var(--gefahr-hell); border-radius: 8px; padding: .6em .8em; font-size: .88rem; margin-top: .8em; }

/* ---------- App-Grundgerüst ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: .8em; padding: .6em 1em;
  background: var(--flaeche); border-bottom: 1px solid var(--rand); position: sticky; top: 0; z-index: 20;
}
.topbar-brand { display: flex; align-items: center; gap: .6em; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; font-size: .95rem; }
.brand-name { font-weight: 700; color: var(--tinte); }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: .6em; font-size: .88rem; }
.user-name { font-weight: 600; }
.user-rolle {
  background: var(--tuerkis-hell); color: var(--tuerkis-dunkel); padding: .15em .6em;
  border-radius: 999px; font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
}
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 4px; width: 34px; height: 34px; background: none; border: none; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; width: 100%; background: var(--tinte); border-radius: 2px; }

.layout { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--flaeche); border-right: 1px solid var(--rand);
  display: flex; flex-direction: column; padding: .8em .6em; gap: .2em;
}
.nav-item {
  display: flex; align-items: center; gap: .7em; padding: .65em .7em; border-radius: 9px;
  border: none; background: none; color: var(--text); text-align: left; cursor: pointer; position: relative;
}
.nav-item:hover { background: var(--flaeche-2); }
.nav-item.nav-aktiv { background: var(--tuerkis-hell); color: var(--tuerkis-dunkel); font-weight: 600; }
.nav-badge {
  margin-left: auto; background: var(--gefahr); color: #fff; border-radius: 999px;
  font-size: .72rem; padding: .1em .5em; font-weight: 700;
}
.sidebar-fuss { margin-top: auto; padding: .8em .7em 0; font-size: .78rem; }
.sidebar-fuss a { color: var(--text-schwach); }
.nav-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 15; }

.content { flex: 1; min-width: 0; padding: 1.2em 1.4em 3em; overflow-x: hidden; }
.tab-panel { display: none; }
.tab-panel.tab-aktiv { display: block; }
.panel-kopf { display: flex; align-items: center; justify-content: space-between; gap: 1em; margin-bottom: .9em; flex-wrap: wrap; }
.abschnitt-titel { margin: 1.6em 0 .6em; color: var(--text-schwach); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.hinweis { color: var(--text-schwach); font-size: .85rem; }
.banner-hinweis {
  background: var(--tuerkis-hell); color: var(--tuerkis-dunkel); padding: .7em 1em; border-radius: 9px; font-size: .88rem;
}

/* ---------- Kacheln ---------- */
.kachel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8em; }
.kachel {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 1em 1.1em; box-shadow: var(--schatten);
}
.kachel-label { font-size: .78rem; color: var(--text-schwach); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .3em; }
.kachel-wert { font-size: 1.6rem; font-weight: 700; color: var(--tinte); }
.kachel-wert small { font-size: .95rem; font-weight: 500; color: var(--text-schwach); }
.kachel-fuss { font-size: .8rem; margin-top: .3em; }
.kachel-fuss.delta-hoch { color: var(--erfolg); }
.kachel-fuss.delta-niedrig { color: var(--gefahr); }
.kachel.kachel-warnung { border-color: var(--warnung); background: var(--warnung-hell); }
.kachel.kachel-gefahr { border-color: var(--gefahr); background: var(--gefahr-hell); }
.kachel.kachel-ok { border-color: var(--erfolg); background: var(--erfolg-hell); }
.kachel.kachel-neutral { opacity: .8; }
.kachel-titelzeile { display: flex; align-items: center; justify-content: space-between; gap: .5em; margin-bottom: .4em; }

/* ---------- Ampeln ---------- */
.ampel-punkt { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ampel-rot { background: var(--gefahr); }
.ampel-gelb { background: var(--warnung); }
.ampel-gruen { background: var(--erfolg); }
.ampel-grau { background: var(--rand); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3em; padding: .18em .6em; border-radius: 999px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.badge-hoch { background: var(--gefahr-hell); color: var(--gefahr); }
.badge-mittel { background: var(--warnung-hell); color: var(--warnung); }
.badge-niedrig { background: var(--erfolg-hell); color: var(--erfolg); }
.badge-status { background: var(--flaeche-2); color: var(--text-schwach); border: 1px solid var(--rand); }
.badge-status-neu { background: var(--tuerkis-hell); color: var(--tuerkis-dunkel); border-color: transparent; }
.badge-status-freigegeben, .badge-status-gesendet { background: var(--erfolg-hell); color: var(--erfolg); border-color: transparent; }

/* ---------- Tabellen ---------- */
.tabelle-wrap { overflow-x: auto; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; white-space: nowrap; }
th, td { text-align: left; padding: .6em .8em; border-bottom: 1px solid var(--rand); }
th { color: var(--text-schwach); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--flaeche-2); }
.tabelle-leer { padding: 1.4em; text-align: center; color: var(--text-schwach); }

/* ---------- Kundenservice ---------- */
.filter-leiste { display: flex; flex-wrap: wrap; gap: .5em; margin-bottom: .8em; }
.filter-leiste select, .filter-leiste input { flex: 1 1 130px; min-width: 110px; }
.ks-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1em; align-items: start; }
.mail-liste { display: flex; flex-direction: column; gap: .5em; max-height: 70vh; overflow-y: auto; padding-right: 2px; }
.mail-karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px; padding: .8em .9em;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.mail-karte:hover { border-color: var(--tuerkis); }
.mail-karte.mail-aktiv { border-color: var(--tuerkis-dunkel); box-shadow: 0 0 0 2px var(--tuerkis-hell); }
.mail-karte-kopf { display: flex; justify-content: space-between; gap: .5em; align-items: center; margin-bottom: .3em; }
.mail-karte-shop { font-size: .72rem; font-weight: 700; color: var(--tuerkis-dunkel); text-transform: uppercase; }
.mail-karte-betreff { font-weight: 600; margin-bottom: .15em; }
.mail-karte-meta { font-size: .78rem; color: var(--text-schwach); display: flex; gap: .5em; flex-wrap: wrap; }
.pager { display: flex; justify-content: center; gap: .6em; margin-top: .7em; align-items: center; font-size: .85rem; color: var(--text-schwach); }

.ks-detail-spalte { min-width: 0; }
.leerzustand { background: var(--flaeche); border: 1px dashed var(--rand); border-radius: var(--radius); padding: 2.4em 1.4em; text-align: center; color: var(--text-schwach); }
.mail-detail-karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 1.1em 1.2em; box-shadow: var(--schatten); }
.mail-detail-kopf { display: flex; justify-content: space-between; gap: 1em; align-items: flex-start; flex-wrap: wrap; margin-bottom: .8em; }
.mail-detail-badges { display: flex; gap: .4em; flex-wrap: wrap; margin-top: .3em; }
.zweispalte { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; margin: 1em 0; }
.textblock-titel { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--text-schwach); margin-bottom: .3em; }
.textblock {
  background: var(--flaeche-2); border: 1px solid var(--rand); border-radius: 8px; padding: .8em .9em;
  min-height: 6em; white-space: pre-wrap; font-size: .9rem;
}
.aktionsreihe { display: flex; gap: .5em; flex-wrap: wrap; margin: .8em 0; }
.antwort-karte { border: 1px solid var(--rand); border-radius: 9px; padding: .9em 1em; margin-top: .9em; background: var(--flaeche-2); }
.antwort-kopf { display: flex; justify-content: space-between; align-items: center; gap: .6em; margin-bottom: .6em; }
.modus-schalter { display: flex; gap: .3em; margin-bottom: .7em; }
.modus-btn { padding: .35em .8em; border-radius: 7px; border: 1px solid var(--rand); background: var(--flaeche); cursor: pointer; font-size: .82rem; }
.modus-btn.modus-aktiv { background: var(--tuerkis-dunkel); color: #fff; border-color: var(--tuerkis-dunkel); }
.antwort-feld { margin-bottom: .6em; }
.antwort-feld label { display: block; font-size: .78rem; color: var(--text-schwach); margin-bottom: .25em; font-weight: 600; }
.antwort-feld textarea, .antwort-feld input { width: 100%; }
.tonalitaet-hinweis { font-size: .82rem; color: var(--tuerkis-dunkel); background: var(--tuerkis-hell); padding: .4em .7em; border-radius: 7px; margin-top: .4em; }

/* ---------- Shop-Performance ---------- */
.zeitraum-auswahl { display: flex; align-items: center; gap: .5em; }
.zeitraum-auswahl label { font-size: .88rem; color: var(--text-schwach); font-weight: 600; }
.zeitraum-auswahl select { font-size: .9rem; font-weight: 600; min-width: 150px; }
.perf-shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1em; margin-top: .8em; }
.perf-shop-karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 1em 1.1em; box-shadow: var(--schatten); }
.perf-shop-karte h4 { margin-bottom: .5em; }
.perf-metrik-grid { grid-template-columns: repeat(2, 1fr); gap: .6em; }
.perf-metrik-kachel { padding: .7em .8em; }
.perf-metrik-kachel .kachel-wert { font-size: 1.15rem; }
.perf-top-liste { list-style: none; margin: .4em 0 0; padding: 0; font-size: .85rem; }
.perf-top-liste li { display: flex; justify-content: space-between; align-items: center; padding: .25em 0; border-bottom: 1px dashed var(--rand); gap: .6em; }
.perf-top-liste li:last-child { border-bottom: none; }
.perf-top-liste .produkt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perf-top-liste .produkt-kennzahlen { display: flex; gap: .7em; flex-shrink: 0; }
.perf-top-liste .produkt-menge { color: var(--text-schwach); }
.perf-top-liste .produkt-umsatz { color: var(--text); font-weight: 600; min-width: 68px; text-align: right; }
/* Betrag in der zweiten Zeile (Goran-Vorgabe 28.07.): Name oben, Menge links /
   Betrag rechts darunter — jede Zeile exakt 2 Zeilen hoch, damit alle Karten buendig sind. */
.perf-top-liste li.produkt-zeile { flex-direction: column; align-items: stretch; gap: .05em; }
.perf-top-liste li.produkt-zeile .produkt-kennzahlen { justify-content: space-between; }
.perf-top-liste li.produkt-zeile .produkt-menge,
.perf-top-liste li.produkt-zeile .produkt-umsatz { white-space: nowrap; }
.perf-alle-produkte { margin-top: .3em; }
.perf-alle-produkte summary { cursor: pointer; font-size: .85rem; color: var(--tuerkis-dunkel); font-weight: 600; padding: .35em 0; list-style: none; }
.perf-alle-produkte summary::-webkit-details-marker { display: none; }
.perf-alle-produkte[open] summary { margin-bottom: .1em; }

/* ---------- Vergleichs-Badges (Vorperiode/Vorjahr) ---------- */
.vgl-zeile { display: flex; flex-direction: column; gap: .3em; margin-top: .5em; }
.vgl-badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: .2em .6em; border-radius: 999px; white-space: normal; line-height: 1.3; cursor: help; }
.vgl-badge.vgl-gruen { background: var(--erfolg-hell); color: var(--erfolg); }
.vgl-badge.vgl-rot { background: var(--gefahr-hell); color: var(--gefahr); }
.vgl-badge.vgl-neutral { background: var(--flaeche-2); color: var(--text-schwach); }

/* ---------- SEO-Tab ---------- */
.seo-shop-karte { padding: 1em 1.1em; }
/* Host-URL in eigener Zeile unter dem Shop-Namen; feste Zeilenhoehen, damit alle Karten buendig sind */
.seo-titel-gestapelt { flex-direction: column; align-items: flex-start; gap: .15em; }
.seo-shop-name { white-space: nowrap; line-height: 1.3; }
.seo-shop-host { font-size: .72rem; line-height: 1.3; min-height: 1.3em; display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seo-klartext { font-size: .92rem; font-weight: 600; margin: .3em 0 .7em; line-height: 1.4; }
.seo-klartext-ok { color: var(--erfolg); }
.seo-klartext-warnung { color: var(--warnung); }
.seo-zeilen-liste { list-style: none; margin: .5em 0 0; padding: 0; font-size: .85rem; }
.seo-zeilen-liste li { display: flex; align-items: center; gap: .5em; padding: .3em 0; border-bottom: 1px dashed var(--rand); }
.seo-zeilen-liste li:last-child { border-bottom: none; }
.seo-zeile-titel { flex-shrink: 0; width: 150px; font-weight: 600; color: var(--text-schwach); font-size: .78rem; cursor: help; }
.seo-zeile-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- KI-Zentrale (Mitarbeiter-Sicht) ---------- */
.ki-wahl-box { display: flex; align-items: center; gap: .7em; flex-wrap: wrap; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: .9em 1.1em; box-shadow: var(--schatten); }
.ki-wahl-box label { font-weight: 600; }
.ki-wahl-box select { min-width: 220px; font-size: .95rem; }
.ki-protokoll-liste { display: flex; flex-direction: column; gap: .4em; }
.ki-protokoll-eintrag { background: var(--flaeche); border: 1px solid var(--rand); border-left: 3px solid var(--erfolg); border-radius: 8px; padding: .6em .9em; font-size: .88rem; }
.ki-protokoll-eintrag.ki-protokoll-fehler { border-left-color: var(--gefahr); color: var(--gefahr); }

/* ---------- Administration > KI-Experteneinstellungen ---------- */
.ketten-liste { display: flex; flex-direction: column; gap: .5em; }
.ketten-zeile { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 9px; padding: .7em .9em; display: flex; align-items: center; gap: .8em; flex-wrap: wrap; }
.ketten-zeile .ketten-task { font-weight: 700; min-width: 130px; }
.ketten-kette { display: flex; gap: .3em; align-items: center; flex-wrap: wrap; }
.ketten-schritt { background: var(--tuerkis-hell); color: var(--tuerkis-dunkel); padding: .2em .6em; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.ketten-pfeil { color: var(--text-schwach); }
.ketten-dropdowns { margin-left: auto; display: flex; gap: .6em; align-items: end; flex-wrap: wrap; }
.ketten-dropdowns label { display: flex; flex-direction: column; gap: .2em; font-size: .72rem; color: var(--text-schwach); font-weight: 600; }
.ketten-dropdowns select { font-size: .85rem; min-width: 130px; }
.ki-test-form { display: flex; flex-direction: column; gap: .5em; max-width: 560px; }
.ki-test-form > div { display: flex; gap: .5em; }
.ki-test-ergebnis { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 9px; padding: .9em 1em; margin-top: .7em; white-space: pre-wrap; font-size: .9rem; }
.ki-test-ergebnis.ki-fehler { border-color: var(--gefahr); background: var(--gefahr-hell); color: var(--gefahr); }

/* ---------- Administration ---------- */
.admin-tabs { display: flex; gap: .4em; margin-bottom: 1em; flex-wrap: wrap; }
.admin-tab-btn { border: 1px solid var(--rand); background: var(--flaeche); padding: .5em 1em; border-radius: 999px; cursor: pointer; font-size: .85rem; }
.admin-tab-btn.admin-tab-aktiv { background: var(--tuerkis-dunkel); color: #fff; border-color: var(--tuerkis-dunkel); }
.admin-panel { display: none; }
.admin-panel.admin-panel-aktiv { display: block; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5em; margin-top: .8em; align-items: center; }
.inline-form input, .inline-form select { flex: 1 1 160px; }
.inline-form-breit input, .inline-form-breit select { flex: 1 1 150px; }
.hinweis-box { background: var(--tuerkis-hell); border-radius: 9px; padding: .8em 1em; margin-top: .8em; font-size: .88rem; }
.zeilen-aktion { display: flex; gap: .35em; }
.mini-select { padding: .25em .4em; font-size: .82rem; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; bottom: 1.2em; right: 1.2em; display: flex; flex-direction: column; gap: .5em; z-index: 100; max-width: 320px; }
.toast { background: var(--tinte); color: #fff; padding: .7em 1em; border-radius: 9px; box-shadow: var(--schatten); font-size: .88rem; animation: toast-ein .15s ease-out; }
.toast.toast-fehler { background: var(--gefahr); }
.toast.toast-erfolg { background: var(--erfolg); }
@keyframes toast-ein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Ladezustand ---------- */
.lade-hinweis { color: var(--text-schwach); font-size: .88rem; padding: 1em 0; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .zweispalte { grid-template-columns: 1fr; }
  .ks-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 240px; z-index: 25;
    transform: translateX(-100%); transition: transform .2s ease-out; box-shadow: var(--schatten);
  }
  .sidebar.sidebar-offen { transform: translateX(0); }
  .topbar-user .user-rolle { display: none; }
  .content { padding: 1em .8em 3em; }
  .kachel-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .lief-zeile { grid-template-columns: 1fr !important; }
  .lief-zahlen { justify-content: flex-start !important; }
}

/* ---------------------------------------------- Umsatz nach Lieferant
   (Goran-Auftrag 28.07.2026, Shop-Performance-Tab, murmelkiste.com) */
.lief-balken-liste { display: flex; flex-direction: column; gap: .15em; margin-top: .5em; }
.lief-zeile {
  display: grid; grid-template-columns: minmax(110px, 170px) 1fr minmax(230px, 280px);
  align-items: center; gap: .9em; padding: .4em 0; border-bottom: 1px dashed var(--rand);
}
.lief-zeile:last-child { border-bottom: none; }
.lief-zeile-gesamt {
  font-weight: 700; border-bottom: 2px solid var(--tuerkis); padding-bottom: .6em; margin-bottom: .25em;
}
.lief-name { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lief-balken-spur {
  position: relative; height: 14px; border-radius: 999px; background: var(--flaeche-2); overflow: hidden;
}
.lief-balken-fuellung {
  position: relative; height: 100%; border-radius: 999px; min-width: 4px; overflow: hidden;
  background: linear-gradient(90deg, var(--tuerkis-hell), var(--tuerkis));
  transition: width .3s ease-out;
}
.lief-balken-rohertrag {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px 0 0 999px;
  background: var(--erfolg); opacity: .8;
}
.lief-zahlen {
  display: flex; flex-wrap: wrap; gap: .25em .7em; align-items: baseline; justify-content: flex-end;
  font-size: .84rem; font-variant-numeric: tabular-nums;
}
.lief-netto { font-weight: 700; color: var(--tinte); min-width: 88px; text-align: right; white-space: nowrap; }
.lief-rohertrag-wert { color: var(--erfolg); min-width: 92px; text-align: right; white-space: nowrap; }
.lief-marge { font-weight: 700; min-width: 54px; text-align: right; color: var(--text-schwach); white-space: nowrap; }
.lief-marge.lief-marge-hoch { color: var(--erfolg); }
.lief-marge.lief-marge-niedrig { color: var(--gefahr); }
.lief-fuss { grid-column: 1 / -1; font-size: .72rem; margin-top: -.15em; }

/* ---------------------------------------------------------- Besucher (Web-Analytics) */
.an-zweispalte { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2em; margin-top: .6em; }
.an-dreispalte { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2em; margin-top: .6em; }
@media (max-width: 880px) {
  .an-zweispalte, .an-dreispalte { grid-template-columns: 1fr; }
}
.an-chart-wrap {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 1em 1.1em; box-shadow: var(--schatten); overflow-x: auto;
}
.an-chart-wrap svg { width: 100%; height: auto; overflow: visible; }
.an-chart-leer { color: var(--text-schwach); font-size: .88rem; padding: 1.4em 0; text-align: center; }

.an-bar-liste { display: flex; flex-direction: column; gap: .4em; background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: var(--radius); padding: .9em 1em; box-shadow: var(--schatten); }
.an-bar-zeile { display: grid; grid-template-columns: minmax(90px, 150px) 1fr minmax(70px, auto); align-items: center; gap: .7em; font-size: .85rem; }
.an-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bar-spur { position: relative; height: 12px; border-radius: 999px; background: var(--flaeche-2); overflow: hidden; }
.an-bar-fuellung { height: 100%; border-radius: 999px; min-width: 3px; background: linear-gradient(90deg, var(--tuerkis-hell), var(--tuerkis-dunkel)); transition: width .3s ease-out; }
.an-bar-wert { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-schwach); white-space: nowrap; }

.an-donut-wrap { display: flex; align-items: center; gap: 1em; background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: .9em 1em; box-shadow: var(--schatten); }
.an-donut-wrap svg { flex-shrink: 0; }
.an-donut-legende { display: flex; flex-direction: column; gap: .3em; font-size: .82rem; min-width: 0; }
.an-donut-legende li { display: flex; align-items: center; gap: .4em; list-style: none; }
.an-donut-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.an-donut-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-donut-anteil { margin-left: auto; color: var(--text-schwach); white-space: nowrap; }

.an-laender-liste { display: flex; flex-direction: column; gap: .3em; }
.an-land-zeile { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 9px; padding: .5em .8em; }
.an-land-kopf { display: flex; align-items: center; gap: .5em; cursor: pointer; }
.an-land-flagge { font-size: 1.1rem; }
.an-land-name { font-weight: 600; flex: 1; }
.an-land-zahlen { font-size: .85rem; color: var(--text-schwach); white-space: nowrap; }
.an-land-regionen { list-style: none; margin: .5em 0 0 1.8em; padding: 0; font-size: .82rem; color: var(--text-schwach); }
.an-land-regionen li { padding: .15em 0; }

.an-heatmap-grid { display: grid; grid-template-columns: 44px repeat(24, minmax(20px, 1fr)); gap: 2px; font-size: .68rem; }
.an-heatmap-label { color: var(--text-schwach); display: flex; align-items: center; }
.an-heatmap-stundenkopf { color: var(--text-schwach); text-align: center; }
.an-heatmap-zelle { aspect-ratio: 1; border-radius: 3px; background: var(--flaeche-2); cursor: help; }

.an-kpi-karte-titel { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--tuerkis-dunkel); margin-bottom: .3em; }

@media (max-width: 760px) {
  .an-heatmap-grid { grid-template-columns: 30px repeat(24, minmax(14px, 1fr)); }
}

/* ------------------------------------------ Besucherquellen (hierarchisch, Goran-Feedback 29.07.2026) */
.an-quellen-tabelle { padding: 0; font-size: .87rem; max-height: 660px; overflow-y: auto; }
.an-quellen-kopf, .an-quellen-zeile {
  display: grid; grid-template-columns: 1fr 90px 70px 100px 100px 90px;
  align-items: center; gap: .6em; padding: .55em .9em;
}
.an-quellen-kopf {
  color: var(--text-schwach); font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .02em; border-bottom: 1px solid var(--rand); background: var(--flaeche-2);
  position: sticky; top: 0; z-index: 1;
}
.an-quellen-kopf span:not(:first-child), .an-quellen-zeile span:not(.an-quellen-name) { text-align: right; font-variant-numeric: tabular-nums; }
.an-quellen-kanal > summary, .an-quellen-plattform > summary, .an-quellen-mehr > summary { cursor: pointer; list-style: none; }
.an-quellen-kanal > summary::-webkit-details-marker, .an-quellen-plattform > summary::-webkit-details-marker,
.an-quellen-mehr > summary::-webkit-details-marker { display: none; }
.an-quellen-zeile-kanal { font-weight: 700; color: var(--tinte); border-bottom: 1px solid var(--rand); background: var(--flaeche); }
.an-quellen-zeile-kanal:hover { background: var(--flaeche-2); }
.an-quellen-zeile-plattform { font-weight: 600; padding-left: 1.8em; border-bottom: 1px dashed var(--rand); background: var(--flaeche); }
.an-quellen-zeile-plattform:hover { background: var(--flaeche-2); }
.an-quellen-zeile-referrer { padding-left: 3.2em; color: var(--text-schwach); border-bottom: 1px dashed var(--rand); }
.an-quellen-zeile-referrer:last-child { border-bottom: none; }
.an-quellen-kanal:last-child > .an-quellen-zeile-kanal { border-bottom: none; }
.an-quellen-zeile-mehr { font-style: italic; opacity: .85; }
.an-quellen-zeile-mehr:hover { background: var(--flaeche-2); }
.an-quellen-zeile-hinweis { font-style: italic; color: var(--text-schwach); font-size: .85em; opacity: .75; border-bottom: 1px dashed var(--rand); }
.an-quellen-pfeil { display: inline-block; width: 1em; transition: transform .15s; color: var(--text-schwach); }
details[open] > summary .an-quellen-pfeil { transform: rotate(90deg); }
.an-quellen-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.an-quellen-einstieg { color: var(--text-schwach); font-weight: 400; font-size: .82em; }
.an-quellen-tabelle .tabelle-leer { padding: 1.2em; }
@media (max-width: 760px) {
  .an-quellen-kopf, .an-quellen-zeile { grid-template-columns: 1fr 60px 90px; }
  .an-quellen-kopf span:nth-child(4), .an-quellen-kopf span:nth-child(5),
  .an-quellen-zeile span:nth-child(4), .an-quellen-zeile span:nth-child(5) { display: none; }
}
