/* Stammdatenautomatisierung — Mockup v02
   Layout: dunkle Seitenleiste links, heller Inhaltsbereich, Karten,
   Pipeline-Kacheln, Ampeln, Fortschrittsbalken. Keine externen Abhängigkeiten,
   System-Schriften, CSP-konform (keine Inline-Styles nötig). */

:root {
  --bg: #eef1f6;
  --flaeche: #ffffff;
  --flaeche-2: #f7f9fc;
  --text: #1d2733;
  --text-2: #5b6b7c;
  --linie: #dfe5ee;
  --akzent: #2f5fd0;
  --akzent-dunkel: #234aa5;
  --akzent-hell: #e7eefc;
  --leiste-bg: #16212e;
  --leiste-bg-2: #0f1822;
  --leiste-text: #c6d2e0;
  --leiste-aktiv: #223349;
  --gruen: #1e9e57;
  --gelb: #d99a06;
  --rot: #d23b3b;
  --gruen-hell: #e2f5ea;
  --gelb-hell: #fdf3d9;
  --rot-hell: #fbe5e5;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(16, 30, 54, 0.06), 0 4px 14px rgba(16, 30, 54, 0.06);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

/* ---------- Grundgerüst: Seitenleiste + Hauptbereich ---------- */

.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.hauptbereich { min-width: 0; }

main {
  padding: 22px 28px 48px;
  max-width: 1240px;
  width: 100%;
}

/* ---------- Seitenleiste ---------- */

.seitenleiste {
  background: linear-gradient(180deg, var(--leiste-bg) 0%, var(--leiste-bg-2) 100%);
  color: var(--leiste-text);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 4px;
}

.leiste-marke {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  line-height: 1.3;
  padding: 4px 10px 0;
}

.leiste-firma {
  color: #7e8fa3;
  font-size: 12.5px;
  padding: 0 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

.leiste-trenner {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 10px 4px;
  width: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--leiste-text);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14.5px;
}

.nav-link .nav-symbol { width: 22px; text-align: center; flex: none; }

.nav-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.nav-link[aria-current="page"] {
  background: var(--leiste-aktiv);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--akzent);
}

.leiste-fuss {
  margin-top: auto;
  padding: 10px;
  font-size: 12px;
  color: #66788c;
}

/* ---------- Kopfleiste ---------- */

.kopfleiste {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 28px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 0;
  z-index: 30;
}

.hinweis-chip {
  background: #fff7e6;
  color: #8a6510;
  border: 1px solid #f0dfae;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kopf-rechts {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.kopf-rechts a { color: var(--akzent); text-decoration: none; font-weight: 600; }
.kopf-rechts a:hover { text-decoration: underline; }
.kopf-rechts .kopf-trenner { color: var(--linie); }

.leiste-umschalter {
  display: none;
  background: none;
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}

/* ---------- Seitenkopf im Inhalt ---------- */

.seitenkopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 18px;
}

.seitenkopf h1 { font-size: 22px; margin: 0; letter-spacing: 0.01em; }

.seitenkopf .untertitel {
  flex-basis: 100%;
  color: var(--text-2);
  font-size: 13.5px;
  margin-top: -6px;
}

.brotkrumen { font-size: 13.5px; color: var(--text-2); margin: 0 0 14px; }
.brotkrumen a { color: var(--akzent); text-decoration: none; }
.brotkrumen a:hover { text-decoration: underline; }

/* ---------- Karten ---------- */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.karte > h2, .karte > h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.karten-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.karten-kopf h2, .karten-kopf h3 { margin: 0; font-size: 16px; }

a.karte-link { text-decoration: none; color: inherit; display: block; }
a.karte-link .karte:hover { border-color: var(--akzent); }

/* ---------- Pipeline (Flow-Kacheln) ---------- */

.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  margin: 8px 0 12px;
}

.stufe {
  flex: 1 1 120px;
  min-width: 116px;
  background: var(--flaeche-2);
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: 8px 10px;
  position: relative;
}

.stufe .stufe-name {
  font-size: 12px;
  color: var(--text-2);
  display: block;
  min-height: 32px;
}

.stufe .stufe-zahl {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stufe-pfeil {
  align-self: center;
  color: #9aa8ba;
  font-size: 15px;
  flex: none;
}

.stufe--link { border-color: #bcd0f5; }
.stufe--link a { color: var(--akzent); font-size: 12px; text-decoration: none; display: block; }
.stufe--link a:hover { text-decoration: underline; }

/* ---------- Fortschrittsbalken ---------- */

.fortschritt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.fortschritt-balken {
  flex: 1;
  height: 9px;
  background: #e4e9f1;
  border-radius: 999px;
  overflow: hidden;
}

.fortschritt-wert {
  height: 100%;
  background: linear-gradient(90deg, var(--akzent) 0%, #4f7fe8 100%);
  border-radius: 999px;
}

.fortschritt-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  min-width: 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Quote (Prozent + Mini-Balken, ersetzt die Ampel) ---------- */

.quote {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.quote-zahl {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.quote-balken {
  display: inline-block;
  width: 72px;
  height: 7px;
  border-radius: 99px;
  background: var(--flaeche-2, #e8edf3);
  overflow: hidden;
  flex: none;
}

.quote-wert {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--akzent);
}

.quote-zelle { white-space: nowrap; }

/* ---------- ⓘ Mouse-Over-Erklärung ---------- */

.info-punkt {
  display: inline-block;
  color: var(--akzent);
  cursor: help;
  font-size: 13px;
  font-style: normal;
  vertical-align: super;
  line-height: 1;
}

/* ---------- Cockpit: Ebenen-Tabelle ---------- */

.ebenen-tabelle td:first-child { font-weight: 600; }
.ebenen-tabelle .quote-zelle { width: 160px; }

.karten-trenner {
  border: 0;
  border-top: 1px solid var(--linie);
  margin: 18px 0 12px;
}

/* ---------- Sortierbare Spaltenköpfe ---------- */

.sortier-knopf {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.sortier-knopf:hover { color: var(--akzent); }

/* ---------- Inline-Edit in Tabellen ---------- */

.inline-edit {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
  min-width: 150px;
}

.inline-edit:hover { border-color: var(--linie); background: #fff; }
.inline-edit:focus { border-color: var(--akzent); background: #fff; outline: none; }

.anrede-chip {
  display: inline-block;
  font-size: 12px;
  color: var(--text-2);
  margin-right: 4px;
}

/* ---------- E-Mail-Entwürfe ---------- */

.entwurf {
  border: 1px solid var(--linie);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0;
  background: var(--flaeche-2, #f7f9fc);
}

.entwurf textarea { min-height: 150px; }

/* ---------- KPI-Zeile ---------- */

.kpi-zeile {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  font-size: 13.5px;
  color: var(--text-2);
  margin: 4px 0 10px;
}

.kpi-zeile strong { color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- Tabellen ---------- */

.tabellen-rahmen { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--linie);
  vertical-align: middle;
}

th {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  background: var(--flaeche-2);
  white-space: nowrap;
}

td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }

tbody tr:hover { background: #f3f7ff; }

tr.zeile-klickbar { cursor: pointer; }
tr.zeile-klickbar:focus-visible { outline: 2px solid var(--akzent); outline-offset: -2px; }

tr.gruppen-zeile td {
  background: var(--flaeche-2);
  font-weight: 600;
  font-size: 13.5px;
}

tfoot td { font-weight: 700; background: var(--flaeche-2); }

/* ---------- Saisonvergleich (Übersicht) ---------- */

.vergleich-details > summary {
  cursor: pointer;
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--akzent-dunkel);
}

.vergleich-details[open] > summary { margin-bottom: 8px; }

.vergleich-tabelle th.vergleich-gruppe {
  text-align: center;
  border-left: 1px solid var(--linie);
}

.vergleich-tabelle td:nth-child(2), .vergleich-tabelle th:nth-child(2),
.vergleich-tabelle td:nth-child(5), .vergleich-tabelle th:nth-child(5) {
  border-left: 1px solid var(--linie);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge--grau { background: #edf0f5; color: #56657a; }
.badge--blau { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.badge--gruen { background: var(--gruen-hell); color: #166b3e; }
.badge--gelb { background: var(--gelb-hell); color: #8a6510; }
.badge--rot { background: var(--rot-hell); color: #a32626; }

/* ---------- Reiter (Tabs) ---------- */

.reiter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 2px solid var(--linie);
  margin-bottom: 16px;
}

.reiter button {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 8px 14px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}

.reiter button:hover { color: var(--text); }

.reiter button[aria-selected="true"] {
  color: var(--akzent-dunkel);
  border-bottom-color: var(--akzent);
}

/* Saison-Reiter als Chips */
.saison-reiter { display: flex; flex-wrap: wrap; gap: 8px; }

.saison-reiter button {
  border: 1px solid var(--linie);
  background: var(--flaeche);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--text-2);
}

.saison-reiter button[aria-pressed="true"] {
  background: var(--akzent);
  border-color: var(--akzent);
  color: #fff;
  font-weight: 600;
}

/* ---------- Buttons & Formulare ---------- */

.knopf {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--akzent);
  color: #fff;
  border: 1px solid var(--akzent);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.knopf:hover { background: var(--akzent-dunkel); }

.knopf--sekundaer {
  background: var(--flaeche);
  color: var(--akzent-dunkel);
  border-color: #b9c8e6;
}

.knopf--sekundaer:hover { background: var(--akzent-hell); }

.knopf--leise {
  background: none;
  border-color: transparent;
  color: var(--akzent);
  padding: 4px 8px;
}

.knopf--leise:hover { background: var(--akzent-hell); }

.knopf--gefahr { background: var(--flaeche); border-color: #e7b3b3; color: var(--rot); }
.knopf--gefahr:hover { background: var(--rot-hell); }

.knopf[disabled] {
  background: #eef0f4;
  border-color: var(--linie);
  color: #9aa6b5;
  cursor: not-allowed;
}

button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 1px;
}

label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], select, textarea {
  width: 100%;
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: var(--flaeche);
  color: var(--text);
}

textarea { resize: vertical; min-height: 140px; line-height: 1.55; }

select.inline-auswahl {
  width: auto;
  font-weight: 700;
  font-size: 15px;
  padding: 5px 8px;
  background: var(--akzent-hell);
  border-color: #bcd0f5;
  color: var(--akzent-dunkel);
}

.feld { margin-bottom: 14px; }
.feld-zeile { display: flex; flex-wrap: wrap; gap: 14px; }
.feld-zeile .feld { flex: 1 1 180px; margin-bottom: 0; }

.radio-zeile { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.radio-zeile label { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--text); margin: 0; }
.radio-zeile input { width: auto; }

fieldset { border: 1px solid var(--linie); border-radius: 8px; padding: 10px 14px; }
legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0 6px; }

/* Werte-Raster für Einstellungs-Dropdowns */
.werte-raster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px 22px;
}

.wert-block .wert-name { font-size: 12.5px; color: var(--text-2); }
.wert-block .wert-technisch { font-size: 11.5px; color: #93a1b3; }

/* Schalter (Agenten an/aus) */
.schalter-zeile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--linie);
  font-size: 14px;
}

.schalter-zeile:last-child { border-bottom: none; }

.schalter {
  appearance: none;
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: #cfd8e4;
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background 0.15s ease;
}

.schalter::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: left 0.15s ease;
}

.schalter:checked { background: var(--gruen); }
.schalter:checked::after { left: 19px; }

/* ---------- Hinweise / Warnungen ---------- */

.warnung {
  display: flex;
  gap: 10px;
  background: var(--gelb-hell);
  border: 1px solid #ecd9a0;
  color: #7a5a0d;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin: 10px 0;
}

.info-leiste {
  background: var(--akzent-hell);
  border: 1px solid #c8d8f6;
  color: #28477e;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin: 10px 0;
}

.fehlerbox {
  background: var(--rot-hell);
  border: 1px solid #ecbcbc;
  color: #8f2020;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
}

.dezent { color: var(--text-2); font-size: 13px; }
.klein { font-size: 12.5px; }

/* ---------- Review-Töpfe ---------- */

.topf {
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--flaeche-2);
}

.topf-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.topf-kopf code {
  background: #e8edf5;
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 13px;
}

.topf ul { margin: 6px 0; padding-left: 20px; font-size: 13.5px; }
.topf li { margin: 3px 0; }

.topf-aktionen { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------- Bildkarten (SKU-Detail) ---------- */

.bild-raster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.bild-karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  overflow: hidden;
}

.bild-karte img {
  width: 100%;
  height: 230px;
  object-fit: contain;
  background: #fff;
  border-bottom: 1px solid var(--linie);
  display: block;
}

.bild-karte .bild-inhalt { padding: 12px 14px; }
.bild-karte h3 { margin: 0 0 6px; font-size: 14px; word-break: break-all; }

.pruefliste { list-style: none; margin: 8px 0; padding: 0; font-size: 13px; }
.pruefliste li { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.pruefliste .pruef-id { font-weight: 700; min-width: 26px; }
.pruef-ok { color: var(--gruen); }
.pruef-fehler { color: var(--rot); }
.pruef-offen { color: #93a1b3; }

/* ---------- Upload-Panel ---------- */

.upload-zone {
  border: 2px dashed #b9c8e6;
  border-radius: var(--radius);
  background: var(--akzent-hell);
  padding: 20px;
  text-align: center;
  color: #28477e;
}

.upload-zone input[type="file"] { display: none; }

.upload-liste { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; text-align: left; }
.upload-liste li { padding: 3px 0; border-bottom: 1px dashed var(--linie); }

/* ---------- Dialog / Toast ---------- */

dialog {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(10, 20, 40, 0.3);
  padding: 22px 24px;
  width: min(540px, 92vw);
}

dialog::backdrop { background: rgba(15, 24, 34, 0.45); }

dialog h2 { margin: 0 0 14px; font-size: 17px; }

.dialog-fuss { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  background: #1d2733;
  color: #fff;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  max-width: min(560px, 90vw);
}

.toast.sichtbar { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Login ---------- */

.login-buehne {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1100px 500px at 10% -10%, #2a3c54 0%, transparent 60%),
    linear-gradient(160deg, var(--leiste-bg) 0%, var(--leiste-bg-2) 70%);
  padding: 24px;
}

.login-karte {
  background: var(--flaeche);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  padding: 30px 32px;
  width: min(400px, 94vw);
}

.login-karte h1 { font-size: 20px; margin: 0 0 4px; }
.login-karte .dezent { margin-bottom: 18px; }
.login-karte .knopf { width: 100%; justify-content: center; margin-top: 6px; }

.login-hinweis { margin-top: 16px; }

/* ---------- Sonstiges ---------- */

.aktionen-zelle { display: flex; gap: 6px; flex-wrap: wrap; }

.mehr-knopf-zeile { text-align: center; padding: 14px 0 2px; }

.fuss-vermerk {
  margin-top: 26px;
  color: #93a1b3;
  font-size: 12px;
}

.versteckt { display: none !important; }

/* ---------- Responsiv ---------- */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .seitenleiste {
    position: fixed;
    inset: 0 28% 0 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
  }

  body.leiste-offen .seitenleiste { transform: translateX(0); }

  .leiste-umschalter { display: inline-flex; }

  .kopfleiste { padding: 10px 14px; }
  .hinweis-chip { display: none; }
  main { padding: 16px 14px 40px; }
  .stufe { min-width: 100px; }
}
