/* =====================================================================
   Wolf PM – Modul Einkaufscontrolling (30.11.2026)
   Nutzt ausschließlich die Tokens aus styles.css (Abschnitt 1). Diagrammfarben: validierte Referenzpalette
   (Skill dataviz), je Modus eigene Stufen. Keine Inline-Styles (CSP).
   ===================================================================== */
[data-theme="light"] {
  --ek-s1: #2a78d6; --ek-s2: #eb6834; --ek-s3: #1baf7a; --ek-s4: #eda100; --ek-s5: #e87ba4; --ek-s6: #008300; --ek-s7: #6250d6; --ek-s8: #e34948;
  --ek-saeule: #8a6a34; --ek-warm: #d9821c; --ek-kalt: #3478f6;
}
[data-theme="dark"] {
  --ek-s1: #3987e5; --ek-s2: #d95926; --ek-s3: #199e70; --ek-s4: #c98500; --ek-s5: #d55181; --ek-s6: #0ca30c; --ek-s7: #9085e9; --ek-s8: #e66767;
  --ek-saeule: #d6bc8c; --ek-warm: #f2a540; --ek-kalt: #6aa5ff;
}

/* Tableiste (iPhone/iPad) hat seit dem Einkaufsmodul 5 Bereiche – styles.css sieht 4 vor; dieses Blatt lädt danach */
.tabbar { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ---------- Unternavigation ---------- */
.ek-subnav {
  display: flex; gap: var(--a1); overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--a1) * -1) var(--a5);
  padding: var(--a1); -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.ek-subnav::-webkit-scrollbar { display: none; }
.ek-subnav a {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 36px; padding: 0 var(--a3); border-radius: var(--r-voll);
  font-size: var(--t-fuss); font-weight: 600; color: var(--text-2); background: var(--karte); box-shadow: var(--schatten-1);
  transition: background-color var(--dauer-s) var(--kurve), color var(--dauer-s) var(--kurve), transform var(--dauer-s) var(--kurve);
}
.ek-subnav a .i { color: var(--text-3); }
.ek-subnav a:hover { color: var(--text); transform: translateY(-1px); }
.ek-subnav a.aktiv { background: var(--text); color: var(--karte); }
.ek-subnav a.aktiv .i { color: var(--akzent); }
.ek-subnav .anzahl { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-voll); background: var(--orange); color: #fff; font-size: var(--t-cap2); display: inline-grid; place-items: center; }

.ek .abschnitt { margin-bottom: var(--a6); }
.ek-kennzahlen { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ek-kennzahlen.klein { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: var(--a4); }
.ek-kennzahlen.klein .kachel-wert { font-size: var(--t-titel2); }
.ek-kachel-sub { font-size: var(--t-cap); color: var(--text-3); margin-top: 2px; line-height: 1.3; }
.ek-karte { padding: var(--a4); border-radius: var(--r-l); background: var(--karte); box-shadow: var(--schatten-1); }
.ek-notiz { font-size: var(--t-cap); color: var(--text-3); margin-top: var(--a2); line-height: 1.45; }
.ek-grau { color: var(--text-3); font-weight: 400; }
.ek-unter { display: block; font-size: var(--t-cap); color: var(--text-3); font-weight: 400; line-height: 1.35; margin-top: 2px; overflow-wrap: anywhere; }
.ek-einheit { color: var(--text-3); font-size: var(--t-cap); margin-left: 1px; }
.ek-knopfreihe { display: flex; flex-wrap: wrap; gap: var(--a2); margin-bottom: var(--a4); }
.ek-oben { margin: 0 0 var(--a3); }
.ek-segment { margin-bottom: var(--a4); }

/* Veränderung */
.ek-delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: var(--t-fuss); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ek-delta.hoch { color: var(--rot); }
.ek-delta.runter { color: var(--gruen); }

/* Listenzeilen mit Sparkline */
.ek-pzeile { gap: var(--a3); }
.ek-pz-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ek-pz-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ek-pz-name span { font-size: var(--t-cap); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ek-pz-preis { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.ek-spark { width: 90px; height: 26px; flex: none; }
.ek-spark path { fill: none; stroke: var(--akzent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ek-spark circle { fill: var(--akzent); }
.ek-spark-leer { width: 90px; flex: none; font-size: var(--t-cap2); color: var(--text-3); text-align: center; }

/* ---------- Diagramme ---------- */
.ek-diagramm { width: 100%; height: auto; display: block; overflow: visible; }
.ek-raster { stroke: var(--linie); stroke-width: 1; }
.ek-basis { stroke: var(--linie-stark); stroke-width: 1; }
.ek-achse { fill: var(--text-3); font-size: 11px; font-family: var(--schrift); font-variant-numeric: tabular-nums; }
.ek-saeule { fill: var(--ek-saeule); transition: opacity var(--dauer-s) var(--kurve); }
.ek-hitflaeche { fill: transparent; }
.ek-diagramm:hover .ek-saeule { opacity: .55; }
.ek-diagramm .ek-hit.hover .ek-saeule { opacity: 1; }
.ek-hit.hover .ek-hitflaeche { fill: var(--fuellung-2); }
.ek-linie { fill: none; stroke-width: 2; stroke-linejoin: round; }
.ek-marker { stroke: var(--karte); stroke-width: 2; }
.ek-hitkreis { fill: transparent; }
.ek-hit.hover .ek-marker { r: 6; }
.ek-hit { cursor: default; }
.ek-linie.s1, .ek-marker.s1 { stroke: var(--ek-s1); } .ek-marker.s1, .ek-punkt.s1 { fill: var(--ek-s1); background: var(--ek-s1); }
.ek-linie.s2 { stroke: var(--ek-s2); } .ek-marker.s2, .ek-punkt.s2 { fill: var(--ek-s2); background: var(--ek-s2); }
.ek-linie.s3 { stroke: var(--ek-s3); } .ek-marker.s3, .ek-punkt.s3 { fill: var(--ek-s3); background: var(--ek-s3); }
.ek-linie.s4 { stroke: var(--ek-s4); } .ek-marker.s4, .ek-punkt.s4 { fill: var(--ek-s4); background: var(--ek-s4); }
.ek-linie.s5 { stroke: var(--ek-s5); } .ek-marker.s5, .ek-punkt.s5 { fill: var(--ek-s5); background: var(--ek-s5); }
.ek-linie.s6 { stroke: var(--ek-s6); } .ek-marker.s6, .ek-punkt.s6 { fill: var(--ek-s6); background: var(--ek-s6); }
.ek-linie.s7 { stroke: var(--ek-s7); } .ek-marker.s7, .ek-punkt.s7 { fill: var(--ek-s7); background: var(--ek-s7); }
.ek-linie.s8 { stroke: var(--ek-s8); } .ek-marker.s8, .ek-punkt.s8 { fill: var(--ek-s8); background: var(--ek-s8); }
.ek-marker.s1 { stroke: var(--karte); }
.ek-legende { display: flex; flex-wrap: wrap; gap: var(--a2) var(--a4); margin-bottom: var(--a3); font-size: var(--t-fuss); color: var(--text-2); }
.ek-legende span { display: inline-flex; align-items: center; gap: 6px; }
.ek-punkt { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ek-tip {
  position: fixed; z-index: 90; pointer-events: none; max-width: 320px; padding: 7px 10px; border-radius: var(--r-s);
  background: var(--text); color: var(--karte); font-size: var(--t-cap); line-height: 1.4; box-shadow: var(--schatten-3);
}

/* Divergierende Balken */
.ek-delta-liste { display: flex; flex-direction: column; gap: 2px; }
.ek-delta-zeile { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(80px, 1fr) 72px; align-items: center; gap: var(--a3); padding: 6px var(--a2); border-radius: var(--r-s); }
.ek-delta-zeile:hover, .ek-delta-zeile.hover { background: var(--fuellung-2); }
.ek-dz-name { font-size: var(--t-fuss); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ek-dz-balken { width: 100%; height: 14px; }
.ek-dz-wert { font-size: var(--t-fuss); font-weight: 600; text-align: right; }
.ek-warm { fill: var(--ek-warm); } .ek-kalt { fill: var(--ek-kalt); }

/* ---------- Tabellen ---------- */
.ek-werkzeugleiste { display: flex; flex-wrap: wrap; align-items: center; gap: var(--a2); margin-bottom: var(--a3); }
.ek-suche { flex: 1 1 220px; margin: 0; }
.ek-wahl select, .ek-inline, .ek .feld select {
  min-height: 36px; padding: 0 28px 0 var(--a3); border-radius: var(--r-s); border: 0; background: var(--fuellung-2); color: var(--text);
  font: inherit; font-size: var(--t-fuss); appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.ek-wl-rechts { display: flex; gap: var(--a2); margin-left: auto; align-items: center; }
.ek-spaltenwahl { position: relative; }
.ek-spaltenwahl summary { list-style: none; cursor: pointer; }
.ek-spaltenwahl summary::-webkit-details-marker { display: none; }
.ek-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; max-height: 340px; overflow: auto; padding: var(--a2);
  background: var(--karte); border-radius: var(--r-m); box-shadow: var(--schatten-3); display: flex; flex-direction: column; gap: 2px;
  animation: ek-ein var(--dauer-m) var(--kurve-feder);
}
.ek-menu label, .ek-menu button { display: flex; align-items: center; gap: var(--a2); padding: 7px var(--a2); border-radius: var(--r-s); font-size: var(--t-fuss); cursor: pointer; text-align: left; background: none; border: 0; }
.ek-menu label:hover, .ek-menu button:hover { background: var(--fuellung-2); }
.ek-tabelle-scroll { overflow-x: auto; border-radius: var(--r-l); background: var(--karte); box-shadow: var(--schatten-1); }
.ek-tabelle { width: 100%; border-collapse: collapse; font-size: var(--t-fuss); }
.ek-tabelle th {
  position: sticky; top: 0; text-align: left; font-weight: 600; font-size: var(--t-cap); color: var(--text-3); text-transform: uppercase; letter-spacing: .04em;
  padding: var(--a3) var(--a3); border-bottom: 1px solid var(--linie); background: var(--karte); white-space: nowrap; user-select: none;
}
.ek-tabelle th[data-ek-sort] { cursor: pointer; }
.ek-tabelle th[data-ek-sort]:hover { color: var(--text); }
.ek-tabelle th .i { margin-left: 4px; vertical-align: -2px; color: var(--akzent); }
.ek-tabelle td { padding: 10px var(--a3); border-bottom: 1px solid var(--linie); vertical-align: top; }
.ek-tabelle tbody tr:last-child td { border-bottom: 0; }
.ek-tabelle tbody tr { transition: background-color var(--dauer-s) var(--kurve); }
.ek-tabelle tbody tr[data-ek-link] { cursor: pointer; }
.ek-tabelle tbody tr:hover { background: var(--fuellung-2); }
.ek-tabelle .r { text-align: right; }
.ek-tabelle td.r > b, .ek-tabelle td.r > .ek-einheit { white-space: nowrap; }
.ek-tabelle td.r { min-width: 96px; }
.ek-tabelle td.r .ek-unter { text-align: right; }
.ek-tabelle .ek-archiviert td { color: var(--text-3); }
.ek-tabelle .ek-bester td { background: var(--gruen-weich); }
.ek-editierbar { cursor: text; }
.ek-editierbar:hover { box-shadow: inset 0 -2px 0 var(--akzent-weich); }
.ek-inline { width: 100%; min-width: 120px; padding-right: var(--a2); background-image: none; outline: 2px solid var(--akzent); }
select.ek-inline { padding-right: 28px; }
.ek-gruppenzeile th { background: var(--karte-2); color: var(--text); text-transform: none; letter-spacing: 0; font-size: var(--t-fuss); position: static; }
.ek-gruppenzeile .anzahl { color: var(--text-3); font-weight: 500; margin-left: 6px; }
.ek-gsumme { float: right; font-variant-numeric: tabular-nums; }
.ek-aktionen { text-align: right; white-space: nowrap; }
.ek-aktionen .knopf-icon { width: 32px; height: 32px; }
.ek-keine { text-align: center; color: var(--text-3); padding: var(--a6) !important; }
.ek-tabellen-fuss { font-size: var(--t-cap); color: var(--text-3); margin-top: var(--a2); padding: 0 var(--a2); }

/* ---------- Prüfliste ---------- */
.ek-pruef-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--a3); }
.ek-pruef { padding: var(--a4); border-radius: var(--r-l); background: var(--karte); box-shadow: var(--schatten-1); display: flex; flex-direction: column; gap: var(--a2); }
.ek-pruef-kopf { display: flex; gap: var(--a3); align-items: flex-start; }
.ek-pruef-werte { display: flex; flex-wrap: wrap; gap: var(--a2) var(--a4); font-size: var(--t-fuss); font-variant-numeric: tabular-nums; color: var(--text-2); }
.ek-pruef-grund { display: flex; gap: 6px; align-items: flex-start; font-size: var(--t-fuss); color: var(--orange); background: var(--orange-weich); padding: var(--a2) var(--a3); border-radius: var(--r-s); }
.ek-pruef-vorschlag { font-size: var(--t-fuss); color: var(--text-2); }
.ek-pruef .ek-knopfreihe { margin: var(--a1) 0 0; }

/* ---------- Upload / Formulare ---------- */
.ek-upload { display: flex; flex-direction: column; gap: var(--a3); }
.ek-dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--a6) var(--a4); border-radius: var(--r-l);
  border: 1.5px dashed var(--linie-stark); background: var(--karte-2); color: var(--text-2); text-align: center; cursor: pointer;
  transition: border-color var(--dauer-s) var(--kurve), background-color var(--dauer-s) var(--kurve);
}
.ek-dropzone:hover, .ek-dropzone:focus-within { border-color: var(--akzent); background: var(--akzent-weich); }
.ek-dropzone .i { width: 26px; height: 26px; color: var(--akzent); }
.ek-dropzone span { font-size: var(--t-cap); color: var(--text-3); }
.ek-dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ek-check { flex-direction: row !important; align-items: flex-start; gap: var(--a2); }
.ek-check input, .feld.ek-check input { margin-top: 3px; width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--akzent); flex: none; box-shadow: none; appearance: auto; -webkit-appearance: checkbox; }
.ek-check > span { font-size: var(--t-fuss); color: var(--text); font-weight: 400; }
.ek-wahlgruppe { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; }
.ek-wahlgruppe legend { font-size: var(--t-cap); color: var(--text-3); font-weight: 600; padding: var(--a3) var(--a4) var(--a1); }
.ek-wahlgruppe > label:not(.feld) { display: flex; align-items: center; gap: var(--a2); padding: var(--a3) var(--a4) var(--a1); font-weight: 600; }
.ek-wahlgruppe > label:not(.feld) input { accent-color: var(--akzent); width: 18px; height: 18px; }
.ek-anfrage { margin-bottom: var(--a4); }
.ek-anfrage h3 { font-size: var(--t-callout); }
.ek-anfrage textarea { width: 100%; font: inherit; font-size: var(--t-fuss); padding: var(--a3); border-radius: var(--r-m); border: 0; background: var(--fuellung-2); color: var(--text); resize: vertical; }

/* ---------- Assistent ---------- */
.ek-assistent { display: flex; flex-direction: column; gap: var(--a4); }
.ek-frageform { display: flex; gap: var(--a2); align-items: center; }
.ek-frage { flex: 1; margin: 0; }
.ek-fragechips { margin-top: var(--a3); flex-wrap: wrap; }
.ek-fragechips .chip { text-align: left; }
.ek-antwortblock { margin-bottom: var(--a3); }
.ek-fazit { margin-bottom: var(--a3); }

/* ---------- Bewegung ---------- */
@keyframes ek-ein { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.ek .kachel { transition: transform var(--dauer-s) var(--kurve), box-shadow var(--dauer-s) var(--kurve); }
.ek .kachel:hover { transform: translateY(-2px); box-shadow: var(--schatten-2); }
@media (prefers-reduced-motion: reduce) { .ek-subnav a, .ek .kachel, .ek-menu { transition: none; animation: none; } .ek .kachel:hover { transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .ek-kennzahlen.klein { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .ek-kennzahlen { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .ek-wl-rechts { margin-left: 0; width: 100%; justify-content: flex-end; }
  .ek-frageform { flex-direction: column; align-items: stretch; }
  .ek-pruef-liste { grid-template-columns: 1fr; }
  .ek-delta-zeile { grid-template-columns: minmax(0, 1fr) 90px 64px; }
  /* Tabellen als Karten */
  .ek-tabelle-scroll { background: none; box-shadow: none; overflow: visible; }
  .ek-tabelle thead { display: none; }
  .ek-tabelle, .ek-tabelle tbody, .ek-tabelle tr, .ek-tabelle td { display: block; width: 100%; }
  .ek-tabelle tbody tr { background: var(--karte); border-radius: var(--r-l); box-shadow: var(--schatten-1); margin-bottom: var(--a2); padding: var(--a2) 0; }
  .ek-tabelle td { border: 0; padding: 4px var(--a4); display: flex; justify-content: space-between; gap: var(--a3); text-align: right; }
  .ek-tabelle td::before { content: attr(data-label); color: var(--text-3); font-size: var(--t-cap); text-align: left; flex: none; max-width: 45%; }
  .ek-tabelle td:first-child { font-size: var(--t-sub); text-align: left; }
  .ek-tabelle td:first-child::before { display: none; }
  .ek-tabelle td.r .ek-unter, .ek-tabelle td .ek-unter { text-align: right; }
  .ek-tabelle td:first-child .ek-unter { text-align: left; }
  .ek-tabelle .ek-aktionen { justify-content: flex-end; }
  .ek-tabelle .ek-aktionen::before { display: none; }
  .ek-tabelle .ek-gruppenzeile { background: none; box-shadow: none; padding: var(--a3) 0 var(--a1); }
  .ek-tabelle .ek-gruppenzeile th { display: block; background: none; padding: 0 var(--a2); }
}
