/* HK CI: Tokens aus tokens.css (HK Design Basics). Alias-Namen für Bestandsregeln. */
:root {
  --blau: var(--hk-blau);
  --blau-dunkel: var(--hk-dunkelblau);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--schrift);
  background: var(--atmo) fixed, var(--nacht);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1.4rem;
  background: var(--kopf-flaeche);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rand);
  box-shadow: var(--schatten-1);
  position: sticky; top: 0; z-index: 5;
}
.marke .logo {
  background: linear-gradient(135deg, var(--hk-blau), var(--hk-dunkelblau));
  color: #fff; font-weight: 700;
  padding: 0.15rem 0.5rem; border-radius: 6px; letter-spacing: 0.05em;
  box-shadow: var(--schatten-blau);
}
.home-link { text-decoration: none; transition: opacity var(--schnell); }
.home-link:hover { opacity: 0.85; }
.marke .produkt { color: var(--text-gedimmt); font-weight: 500; margin-left: 0.4rem; }
#benutzer-anzeige { display: flex; align-items: center; gap: 0.8rem; }
#hauptnav { display: flex; gap: 0.15rem; margin-left: 1.6rem; margin-right: auto;
  background: var(--flaeche-hell); border: 1px solid var(--rand);
  padding: 0.2rem; border-radius: 999px; }
.nav-knopf { background: none; border: none; color: var(--text-gedimmt); font-family: inherit;
  font-size: 0.9rem; font-weight: 600; padding: 0.4rem 0.95rem; border-radius: 999px; cursor: pointer; }
.nav-knopf.aktiv { background: var(--flaeche); color: var(--hk-dunkelblau);
  box-shadow: var(--schatten-1), inset 0 0 0 1px var(--rand); }
html.dunkel .nav-knopf.aktiv { color: var(--akzent-nr); }
.nav-knopf:not(.aktiv):hover { color: var(--text); }

.ampel { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; margin-right: 0.4rem; vertical-align: -1px; }
.ampel.gruen { background: var(--gruen); box-shadow: 0 0 6px rgba(46, 158, 91, 0.55); }
.ampel.gelb { background: var(--gelb); box-shadow: 0 0 6px rgba(217, 154, 0, 0.55); }
.ampel.rot { background: var(--rot); box-shadow: 0 0 6px rgba(217, 83, 79, 0.55); }
.negativ { color: var(--rot); font-weight: 600; }
.report-text { background: var(--flaeche-hell); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 0.8rem 1rem; font-family: Consolas, monospace; font-size: 0.85rem; white-space: pre-line; }

/* Dashboard-Grafiken (SVG, ohne Chart-Lib) */
.grafik { width: 100%; height: auto; display: block; }
.grafik .achse { fill: var(--text-gedimmt); font-size: 11px; font-family: inherit; }
.grafik .wertlabel { fill: var(--text-gedimmt); font-size: 9.5px; font-family: inherit; }
.grafik .wertlabel.blau { fill: var(--akzent-nr); }
.legende { display: flex; gap: 1.2rem; justify-content: center; color: var(--text-gedimmt);
  font-size: 0.78rem; margin-top: 0.3rem; flex-wrap: wrap; }
.legende i { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 3px;
  margin-right: 0.35rem; vertical-align: -1px; }
#benutzer-name { color: var(--text-gedimmt); }
#benutzer-name b { color: var(--text); }

main { max-width: 1100px; margin: 1.6rem auto; padding: 0 1rem; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: var(--titel-spationierung); margin: 0 0 0.9rem; }
h2 { font-size: 0.82rem; font-weight: 700; margin: 0 0 0.7rem; color: var(--text-gedimmt);
  text-transform: uppercase; letter-spacing: 0.09em; }

.versteckt { display: none !important; }

.karte {
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius-gross); padding: 1.5rem; margin-bottom: 1.1rem;
  box-shadow: var(--schatten-2);
  animation: hkm-auftauchen var(--sanft) both;
  transition: box-shadow var(--sanft), border-color var(--schnell), transform var(--sanft);
}
.zahnrad { background: none; border: none; color: var(--text-gedimmt); cursor: pointer;
  font-size: 0.9rem; padding: 0 0.2rem; }
.zahnrad:hover { color: var(--hk-blau); }
.aktiv-zoom { border-color: var(--blau) !important; color: var(--akzent-nr) !important; }
.login-karte { max-width: 400px; margin: 10vh auto; padding: 2rem;
  animation: hkm-aufziehen var(--sanft) both; }
.login-karte h1 { font-size: 1.35rem; }
.login-karte form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.8rem; }
.hinweis { color: var(--text-gedimmt); font-size: 0.85rem; }

.kuerzel-reihe { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.kuerzel-reihe button {
  background: var(--flaeche-hell); color: var(--text); border: 1px solid var(--rand);
  border-radius: 8px; padding: 0.45rem 0.8rem; cursor: pointer; font-family: inherit; font-weight: 600;
}
.kuerzel-reihe button:hover { border-color: var(--hk-blau); color: var(--hk-dunkelblau);
  box-shadow: var(--schatten-1); transform: translateY(-1px); }
html.dunkel .kuerzel-reihe button:hover { color: var(--akzent-nr); }

input, select, textarea {
  background: var(--flaeche); color: var(--text);
  border: 1px solid var(--rand-stark); border-radius: 8px;
  padding: 0.55rem 0.7rem; font-family: inherit; font-size: 0.95rem;
  transition: border-color var(--schnell), box-shadow var(--schnell);
}
input:hover, select:hover { border-color: var(--hk-grau); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--hk-blau);
  box-shadow: 0 0 0 3px rgba(18, 117, 187, 0.15); }

.knopf {
  border: none; border-radius: 9px; padding: 0.55rem 1.05rem;
  font-family: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer;
}
.knopf.primaer { background: linear-gradient(180deg, var(--hk-blau-hell), var(--hk-blau));
  color: #fff; box-shadow: var(--schatten-blau), inset 0 1px 0 rgba(255,255,255,0.22); }
.knopf.primaer:hover { filter: brightness(1.07); transform: translateY(-1px);
  box-shadow: 0 6px 18px -3px rgba(18, 117, 187, 0.55), inset 0 1px 0 rgba(255,255,255,0.22); }
.knopf.primaer:active { transform: translateY(0) scale(0.98); filter: none; }
.knopf.sekundaer { background: var(--flaeche); color: var(--text); border: 1px solid var(--rand-stark);
  box-shadow: var(--schatten-1); }
.knopf.sekundaer:hover { border-color: var(--hk-blau); color: var(--hk-dunkelblau); transform: translateY(-1px); }
html.dunkel .knopf.sekundaer { background: var(--flaeche-hell); }
html.dunkel .knopf.sekundaer:hover { color: var(--akzent-nr); }
.knopf.klein { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.knopf:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }
tr.klickbar td { transition: background var(--schnell); }

/* KI-Import-Dropzone: Bestellung fallen lassen -> Formular vorbefüllt (Mensch prüft) */
.ki-dropzone { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  border: 2px dashed var(--rand-stark); border-radius: var(--radius);
  padding: 0.8rem 1rem; margin-bottom: 1rem; font-size: 0.88rem; color: var(--text-gedimmt);
  transition: border-color var(--schnell), background var(--schnell); cursor: pointer; }
.ki-dropzone b { color: var(--text); }
.ki-dropzone .dz-symbol { font-size: 1.5rem; }
.ki-dropzone.aktiv, .ki-dropzone:hover { border-color: var(--hk-blau); background: rgba(18, 117, 187, 0.06); }
.ki-dropzone.laedt { border-color: var(--hk-blau); animation: gate-puls 1.4s ease-in-out infinite; }
.dz-link { color: var(--hk-blau); text-decoration: underline; cursor: pointer; }

.pe-befunde { background: var(--flaeche-hell); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 0.7rem 0.9rem; margin: 0.4rem 0 0.8rem; font-size: 0.85rem; }
.pe-befunde.ok { border-left: 4px solid var(--gruen); }
.pe-befunde.warnung { border-left: 4px solid var(--gelb); }
.pe-befunde.fehler { border-left: 4px solid var(--rot); }
.pe-befunde .befund { margin-top: 0.3rem; }

.zeile-kopf { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.formzeile { display: flex; gap: 0.6rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.formzeile input, .formzeile select { flex: 1; min-width: 180px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--rand); font-size: 0.9rem; }
th { color: var(--text-gedimmt); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  border-bottom: 1px solid var(--rand-stark); }
tr.klickbar { cursor: pointer; }
tr.klickbar:hover td { background: var(--flaeche-hell); }
tr.klickbar:hover td:first-child { box-shadow: inset 3px 0 0 var(--hk-blau); }

.status-badge {
  display: inline-block; padding: 0.18rem 0.65rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.02em;
  background: var(--badge-bg); color: var(--badge-text);
  white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(0, 78, 112, 0.12);
}
.status-badge.final { background: var(--gruen-flaeche); color: #1b6b3c; box-shadow: inset 0 0 0 1px rgba(46,158,91,0.3); }
html.dunkel .status-badge.final { color: #7fdca6; }
.status-badge.storniert { background: var(--rot-flaeche); color: #a33531; box-shadow: inset 0 0 0 1px rgba(217,83,79,0.3); }
html.dunkel .status-badge.storniert { color: #f3a19e; }

.gate-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.55rem; height: 1.55rem; border-radius: 50%;
  font-size: 0.72rem; font-weight: 700; margin-right: 0.25rem;
  background: var(--flaeche-hell); color: var(--text-gedimmt); border: 1px solid var(--rand);
  transition: transform var(--schnell);
}
.gate-chip.offen-jetzt { border-color: var(--gelb); color: var(--gelb);
  background: var(--gelb-flaeche); animation: gate-puls 2.2s ease-in-out infinite; }
@keyframes gate-puls { 50% { box-shadow: 0 0 0 4px rgba(217, 154, 0, 0.15); } }
.gate-chip.frei { background: var(--gruen); color: #fff; border-color: var(--gruen); }

.aktion-leiste { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0.8rem 0; }
.rollen-hinweis { color: var(--text-gedimmt); font-size: 0.82rem; }

.kennzahl-reihe { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.kennzahl {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px;
  padding: 0.75rem 1.1rem; min-width: 140px; box-shadow: var(--schatten-1);
  position: relative; overflow: hidden;
}
.kennzahl::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--hk-blau); border-radius: 3px 0 0 3px; opacity: 0.75; }
.kennzahl .wert { font-size: 1.65rem; font-weight: 700; letter-spacing: var(--titel-spationierung); line-height: 1.2; }
.kennzahl .label { color: var(--text-gedimmt); font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em; }
.kennzahl.gut .wert { color: var(--gruen); }
.kennzahl.gut::before { background: var(--gruen); }
.kennzahl.schlecht .wert { color: var(--rot); }
.kennzahl.schlecht::before { background: var(--rot); }

fieldset { border: 1px dashed var(--rand-stark); border-radius: var(--radius); margin: 0 0 0.6rem; padding: 0.6rem; }
legend { padding: 0 0.4rem; color: var(--text-gedimmt); font-size: 0.85rem; }
.datum-feld { display: flex; align-items: center; gap: 0.5rem; color: var(--text-gedimmt); font-size: 0.85rem; }

.positions-editor input { width: 100%; padding: 0.35rem 0.5rem; font-size: 0.88rem; }
.positions-editor td { padding: 0.25rem 0.3rem; border-bottom: none; }
.positions-editor .schmal { width: 5.5rem; }
.pos-entfernen { background: none; border: none; color: var(--rot); cursor: pointer; font-size: 1rem; border-radius: 6px; }
.pos-entfernen:hover { background: var(--rot-flaeche); }

.fortschritt { color: var(--text-gedimmt); font-size: 0.8rem; white-space: nowrap; }
.fortschritt b { color: var(--text); }
.fortschritt.komplett b { color: var(--gruen); }

.inline-edit { display: flex; gap: 0.3rem; align-items: center; }
.inline-edit input { width: 5.5rem; padding: 0.3rem 0.4rem; font-size: 0.85rem; }

.beleg-zeile { display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.5rem 0.2rem;
  border-bottom: 1px solid var(--rand); font-size: 0.88rem; flex-wrap: wrap;
  border-radius: 6px; transition: background var(--schnell); }
.beleg-zeile:hover { background: var(--flaeche-hell); }
.beleg-zeile:last-child { border-bottom: none; }
.beleg-nr { font-weight: 700; color: var(--akzent-nr); }

dialog#modal {
  background: var(--flaeche); color: var(--text);
  border: 1px solid var(--rand); border-radius: var(--radius-gross);
  padding: 1.5rem; min-width: 420px; max-width: 640px;
  box-shadow: var(--schatten-3);
}
dialog#modal[open] { animation: hkm-aufziehen 220ms cubic-bezier(0.25, 0.9, 0.3, 1.1) both; }
dialog#modal::backdrop { background: rgba(9, 22, 30, 0.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-form h2 { color: var(--text); font-size: 1.12rem; text-transform: none; letter-spacing: 0; font-weight: 700; }
.modal-form .formzeile.ende { justify-content: flex-end; margin-top: 1rem; margin-bottom: 0; }
.modal-form table { margin: 0.5rem 0; }
.modal-form label.feld { display: block; margin-bottom: 0.65rem; color: var(--text-gedimmt);
  font-size: 0.8rem; font-weight: 600; }
.modal-form label.feld input, .modal-form label.feld select { width: 100%; margin-top: 0.28rem; font-weight: 400; }
.summen-zeile { text-align: right; font-weight: 700; padding-top: 0.6rem; }

/* ---------- CRM-Pipeline + Cockpit ---------- */
.crm-spalten { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 860px) { .crm-spalten { grid-template-columns: 1fr; } }
.crm-spalte { background: var(--flaeche-hell); border: 1px solid var(--rand); border-radius: var(--radius-gross);
  padding: 0.8rem; display: flex; flex-direction: column; gap: 0.6rem; min-height: 160px; }
.crm-spalte.gewonnen { background: var(--gruen-flaeche); border-color: var(--gruen); }
.crm-karte { display: flex; flex-direction: column; gap: 0.15rem; text-align: left; font-family: inherit;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px; padding: 0.7rem 0.85rem;
  cursor: pointer; color: var(--text); font-size: 0.88rem; box-shadow: var(--schatten-1);
  transition: transform var(--schnell), box-shadow var(--sanft), border-color var(--schnell); }
.crm-karte:hover { border-color: var(--hk-blau); transform: translateY(-2px); box-shadow: var(--schatten-2); }
.crm-karte.still { cursor: default; }
.crm-karte.still:hover { border-color: var(--rand); transform: none; box-shadow: var(--schatten-1); }
.crm-karte.faellig { border-color: var(--gelb); box-shadow: 0 0 0 1px var(--gelb); }
.crm-meta { color: var(--text-gedimmt); font-size: 0.78rem; }
.kennzahl.gross { min-width: 175px; }
.kennzahl.gross .wert { font-size: 1.45rem; }
.cockpit-grafiken { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 860px) { .cockpit-grafiken { grid-template-columns: 1fr; } }

/* ---------- Plantafel (Gantt: Maschinen × Wochen) ---------- */
.wochen-nav { display: flex; align-items: center; gap: 0.6rem; }
#woche-anzeige { font-weight: 700; min-width: 8.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.plantafel { overflow-x: auto; padding-bottom: 1rem; }
.pt-balken { height: 5px; border-radius: 3px; background: var(--flaeche-hell); margin-top: 0.3rem; overflow: hidden; }
.pt-balken > div { height: 100%; border-radius: 3px; transition: width var(--sanft); }

.gantt { display: flex; flex-direction: column; min-width: 900px; border: 1px solid var(--rand);
  border-radius: var(--radius); overflow: hidden; background: var(--flaeche); box-shadow: var(--schatten-1); }
.gantt-zeile { display: grid; grid-template-columns: 150px repeat(8, minmax(95px, 1fr));
  border-bottom: 1px solid var(--rand); }
.gantt-zeile:last-child { border-bottom: none; }
.gantt-maschine { padding: 0.6rem 0.8rem; border-right: 1px solid var(--rand-stark);
  display: flex; flex-direction: column; justify-content: center; gap: 0.1rem;
  position: sticky; left: 0; background: var(--flaeche); z-index: 2; }
.gantt-kopf .gantt-zelle { text-align: center; font-weight: 700; font-size: 0.76rem;
  letter-spacing: 0.05em; color: var(--text-gedimmt);
  padding: 0.45rem 0.2rem; background: var(--flaeche-hell); }
.gantt-zelle { position: relative; min-height: 46px; padding: 0.35rem;
  border-right: 1px solid var(--rand); display: flex; gap: 2px; align-items: center;
  transition: background var(--schnell); }
.gantt-zelle:last-child { border-right: none; }
.gantt-zelle.heute { background: rgba(18, 117, 187, 0.07);
  box-shadow: inset 0 2px 0 var(--hk-blau); }
.gantt-zelle.ueberlast { box-shadow: inset 0 0 0 2px var(--rot); background: var(--rot-flaeche); }
.gantt-zelle.drag-ueber, .gantt-ablage.drag-ueber { background: rgba(18, 117, 187, 0.18);
  box-shadow: inset 0 0 0 2px var(--hk-blau); }
.gantt-last { position: absolute; right: 3px; bottom: 1px; font-size: 0.62rem; color: var(--text-gedimmt); }
.gantt-last.rot { color: var(--rot); font-weight: 700; }
.gantt-personal { font-size: 0.66rem; font-weight: 600; color: var(--text-gedimmt); }
.gantt-personal.rot { color: var(--rot); font-weight: 700; }

.gantt-balken { height: 42px; border-radius: 7px; min-width: 34px; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 1px; padding: 0 0.45rem; cursor: grab;
  font-size: 0.68rem; font-weight: 700; color: #fff; white-space: nowrap;
  box-shadow: var(--schatten-1), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: filter var(--schnell), transform var(--schnell), box-shadow var(--schnell); }
.gantt-balken .b-z1, .gantt-balken .b-z2 { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.gantt-balken .b-z2 { font-size: 0.6rem; font-weight: 600; opacity: 0.85; }
.gantt-balken:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: var(--schatten-2); }
.gantt-balken:active { cursor: grabbing; }
.gantt-balken.gezogen { opacity: 0.4; }
.gantt-balken.gruen { background: linear-gradient(180deg, #3cb371, var(--gruen)); color: #06220f; }
.gantt-balken.gelb { background: linear-gradient(180deg, #eab308, var(--gelb)); color: #201700; }
.gantt-balken.rot { background: linear-gradient(180deg, #e4645f, var(--rot)); }
.gantt-balken.blau { background: linear-gradient(180deg, var(--hk-blau-hell), var(--hk-blau)); }

.pep-leiste { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 0.5rem 0.8rem; margin-bottom: 0.8rem; font-size: 0.78rem; box-shadow: var(--schatten-1); }
.pep-woche { background: var(--flaeche-hell); border: 1px solid var(--rand); border-radius: 999px;
  padding: 0.15rem 0.6rem; color: var(--text-gedimmt); font-weight: 600; white-space: nowrap; }
.pep-woche.gruen { border-color: var(--gruen); color: var(--gruen); background: var(--gruen-flaeche); }
.pep-woche.rot { border-color: var(--rot); color: var(--rot); background: var(--rot-flaeche); }

.gantt-ablage { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  background: var(--flaeche); border: 1.5px dashed var(--rand-stark); border-radius: var(--radius);
  padding: 0.6rem 0.8rem; margin-bottom: 0.8rem; font-size: 0.85rem;
  transition: background var(--schnell), box-shadow var(--schnell); }
.gantt-ablage .gantt-balken { flex: 0 0 auto; padding: 0 0.6rem; }
.balken-legende { font-size: 0.75rem; margin-top: 0.3rem; }
.komplett { color: var(--gruen); font-weight: 600; }

/* Leerer Zustand — freundlich statt leerer Tabelle */
.leer-hinweis { text-align: center; color: var(--text-gedimmt); padding: 2.2rem 1rem; font-size: 0.9rem; }
.leer-hinweis::before { content: "✓"; display: block; font-size: 1.8rem; margin-bottom: 0.4rem;
  color: var(--gruen); opacity: 0.7; }

/* ---------- Mobile (< 720px): Tabellen werden Karten, Nav wird Daumenleiste ---------- */
/* Schwebender Heim-Knopf — immer sichtbar, unten links (Gegenstück zu Hermann unten rechts).
   Grund: Am Handy verdeckt die Daumen-Nav den Kopf, am Desktop scrollt das Logo weg. */
#home-schwebt {
  display: flex; align-items: center; justify-content: center; padding: 0;
  position: fixed; left: 1.2rem; bottom: 1.2rem; z-index: 20;
  width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 1px solid var(--rand);
  background: var(--flaeche); box-shadow: var(--schatten-3);
  transition: transform var(--schnell), border-color var(--schnell);
}
#home-schwebt img { width: 2.1rem; height: auto; display: block; }
#home-schwebt:hover { transform: scale(1.07); border-color: var(--hk-blau); }
#home-schwebt:active { transform: scale(0.94); }
@media (max-width: 720px) {
  /* Mobil sitzt der Knopf IN der Daumenleiste (links, fest) — die Tabs scrollen rechts
     daneben frei. Vorher lag er über der Leiste und blockierte das Wischen. */
  #home-schwebt {
    left: 0.45rem; bottom: calc(0.45rem + env(safe-area-inset-bottom));
    width: 2.7rem; height: 2.7rem; z-index: 7; box-shadow: var(--schatten-2);
  }
  #home-schwebt img { width: 1.6rem; }
}

@media (max-width: 720px) {
  /* WICHTIG: kein backdrop-filter im mobilen Header! Ein Filter macht den Header zum
     Containing Block, dadurch klebte die fixierte Daumen-Nav oben AM HEADER und verdeckte
     das Home-Logo (Nutzermeldung 25.07.2026). Ohne Filter greift wieder der Viewport. */
  header { flex-wrap: nowrap; padding: 0.5rem 0.8rem; gap: 0.5rem;
    backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--flaeche); }
  .marke { display: flex; align-items: center; flex-shrink: 0; }
  .marke .produkt { display: none; }       /* macht Platz: Home-Logo bleibt immer sichtbar */
  #benutzer-name { font-size: 0.8rem; white-space: nowrap; }
  #hauptnav {
    position: fixed; bottom: 0; left: 0; right: 0; margin: 0; z-index: 6;
    display: flex; justify-content: flex-start;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    background: var(--kopf-flaeche); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: none; border-top: 1px solid var(--rand); border-radius: 0;
    box-shadow: 0 -4px 20px rgba(13, 40, 60, 0.08);
    /* links Platz für den festen Home-Knopf, damit die Tabs frei wischbar bleiben */
    padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom)) 3.5rem;
  }
  #hauptnav::-webkit-scrollbar { display: none; }
  /* 9 Tabs: seitlich wischbar statt gequetscht — jeder Knopf bleibt voll antippbar */
  .nav-knopf { min-height: var(--touch); flex: 0 0 auto; font-size: 0.85rem;
    padding: 0.4rem 0.85rem; white-space: nowrap; }
  .nav-knopf.aktiv { background: var(--hk-blau); color: #fff; box-shadow: var(--schatten-blau); }
  main { margin: 0.8rem auto 5.5rem; }
  h1 { font-size: 1.2rem; }

  .karte { padding: 0.9rem; }
  .zeile-kopf { flex-wrap: wrap; gap: 0.5rem; }
  .formzeile { flex-direction: column; }
  .formzeile input, .formzeile select { min-width: 0; width: 100%; }
  .knopf { min-height: var(--touch); }
  .kennzahl { flex: 1 1 40%; min-width: 0; }

  /* Tabellen -> gestapelte Karten (Label aus data-label) */
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr {
    background: var(--flaeche-hell); border: 1px solid var(--rand); border-radius: var(--radius);
    margin: 0.55rem 0; padding: 0.45rem 0.7rem;
  }
  td { display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem;
       border-bottom: none; padding: 0.28rem 0; text-align: right; }
  td::before { content: attr(data-label); color: var(--text-gedimmt); font-size: 0.76rem;
               text-transform: uppercase; letter-spacing: 0.04em; text-align: left; flex-shrink: 0; }
  td:not([data-label]) { justify-content: flex-start; text-align: left; }
  td:not([data-label])::before { content: none; }
  tr.klickbar:hover td:first-child { box-shadow: none; }

  /* Positions-Editor bleibt tabellarisch unpraktisch -> stapeln ohne Labels */
  .positions-editor td { justify-content: stretch; }
  .positions-editor td::before { align-self: center; }

  dialog#modal { min-width: 0; width: calc(100vw - 1.6rem); max-width: none; padding: 1rem; }
  .beleg-zeile { flex-direction: column; gap: 0.3rem; }
}

/* ---------- Hermann (KI-Assistent) ---------- */
#ki-knopf {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 8;
  width: 3.6rem; height: 3.6rem; border-radius: 50%; border: none; cursor: pointer;
  background: none; padding: 0;
  filter: drop-shadow(0 6px 18px rgba(18, 117, 187, 0.45));
  transition: transform var(--sanft), filter var(--sanft);
}
#ki-knopf img { width: 100%; height: 100%; display: block; }
#ki-knopf:hover { transform: scale(1.08) rotate(-4deg);
  filter: drop-shadow(0 10px 26px rgba(18, 117, 187, 0.6)); }
.hermann-titel { display: flex; align-items: center; gap: 0.5rem; }
.hermann-titel img { width: 1.6rem; height: 1.6rem; }
.ki-kopf .hinweis { color: rgba(255, 255, 255, 0.75); }
.ki-kopf b { color: #fff; }
#ki-panel {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 9;
  width: min(420px, calc(100vw - 2rem)); height: min(560px, calc(100vh - 6rem));
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius-gross);
  box-shadow: var(--schatten-3); display: flex; flex-direction: column; overflow: hidden;
  animation: hkm-aufziehen var(--sanft) both;
}
.ki-kopf { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: linear-gradient(120deg, var(--hk-dunkelblau), #0a6391); }
#ki-verlauf { flex: 1; overflow-y: auto; padding: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
.ki-nachricht { max-width: 88%; padding: 0.55rem 0.8rem; border-radius: 14px; font-size: 0.9rem;
  line-height: 1.45; white-space: pre-wrap; word-break: break-word;
  animation: hkm-auftauchen 180ms ease-out both; }
.ki-nachricht.nutzer { align-self: flex-end; color: #fff; border-bottom-right-radius: 4px;
  background: linear-gradient(180deg, var(--hk-blau-hell), var(--hk-blau)); }
.ki-nachricht.assistent { align-self: flex-start; background: var(--flaeche-hell); border: 1px solid var(--rand);
  border-bottom-left-radius: 4px; }
.ki-nachricht.denkt { color: var(--text-gedimmt); font-style: italic; }
.ki-nachricht.denkt::after { content: "…"; animation: denkt-punkte 1.2s steps(4) infinite; }
@keyframes denkt-punkte { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "…"; } }
.ki-aktionen { align-self: flex-start; font-size: 0.72rem; color: var(--text-gedimmt); }
#ki-form { display: flex; gap: 0.5rem; padding: 0.7rem; border-top: 1px solid var(--rand);
  background: var(--flaeche); }
#ki-form input { flex: 1; }
@media (max-width: 720px) {
  #ki-knopf { bottom: 5.2rem; }
  #ki-panel { bottom: 4.6rem; right: 0.6rem; height: min(520px, calc(100vh - 9rem)); }
}

#toast-bereich { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 10; }

@media (max-width: 720px) {
  #toast-bereich { left: 1rem; right: 1rem; bottom: 5.2rem; }
  .toast { max-width: none; }
}
.toast {
  background: var(--flaeche); border: 1px solid var(--rand); border-left: 4px solid var(--blau);
  border-radius: 10px; padding: 0.7rem 1rem; max-width: 380px;
  box-shadow: var(--schatten-3); font-size: 0.88rem;
  animation: toast-rein 260ms cubic-bezier(0.25, 0.9, 0.3, 1.1);
}
.toast.fehler { border-left-color: var(--rot); }
.toast.ok { border-left-color: var(--gruen); }
@keyframes toast-rein { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; } }
