/* App-spezifische Ergänzungen zum Design-System (v2 — nur var(--*)-Tokens, keine harten Werte).
   Layout-Utilities und Buttons liegen in components.css; hier nur, was wirklich App-spezifisch ist. */

:root {
  --color-danger-bg: #fee2e2;
  --color-success-bg: #eef0f4; /* v2: Erfolg = neutrale Fläche, kein Grün */
}

/* Navigation: schlanke Trennung Geräte | Teile */
.nav-gruppe { display: flex; align-items: center; gap: var(--space-4); }
/* Trennstrich zwischen Nav-Gruppen: als Rahmen der Gruppe statt eigenem 1-px-Element — läuft über die
   volle Gruppenhöhe (auch bei zweizeiligen Beschriftungen) und kann weder wegfallen noch alleine stehen. */
.nav-gruppe + .nav-gruppe { border-left: 1px solid rgba(255, 255, 255, 0.35); padding-left: var(--space-6); }

/* Leitstand/Cockpit: KPI-Boxen — Zahl gross, Rot nur wenn kritisch */
.kpi-zeile { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.kpi-zeile.kpi-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.finanz-filterzeile, .finanz-filterformular, .finanz-filterformular label { display: flex; align-items: center; gap: var(--space-4); }
.finanz-filterzeile { flex-wrap: wrap; }
.finanz-filterzeile h2 { margin: 0; }
.finanz-filterformular label { margin: 0; white-space: nowrap; }
.kpi-zeile.kpi-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-zeile.kpi-2 { grid-template-columns: repeat(2, 1fr); }
.kpi b { display: block; font-size: 30px; line-height: 1.1; }
.kpi span { color: var(--color-ink-muted); font-size: 13px; }
.kpi-rot b { color: var(--color-danger); }
.tag-amber { background: #eef0f4; color: var(--color-ink); } /* v2: neutral — Ampel ist neutral/rot */

/* KPI-Kacheln als Filter: klickbar, aktive Kachel markiert — ersetzt die separate Filterknopf-Zeile */
a.kpi { text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--color-blue-500); }
a.kpi.aktiv { border-color: var(--color-navy); box-shadow: inset 0 0 0 1.5px var(--color-navy); }
a.kpi .kpi-zusatz { font-size: 12px; color: var(--color-blue-600); font-weight: 600; }

/* Frist in der Tabelle: ruhiger Text statt Pille pro Zeile; rot nur wenn überfällig */
.frist { font-size: 13px; color: var(--color-ink-muted); white-space: nowrap; }
.frist-rot { color: var(--color-danger); font-weight: 600; }

/* CSV-Import eingeklappt — Arbeitsfläche gehört dem Scannen */
details.einklapp-karte > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: var(--space-3); }
details.einklapp-karte > summary::-webkit-details-marker { display: none; }
details.einklapp-karte > summary .aufklapp-hinweis { margin-left: auto; font-size: 13px; color: var(--color-blue-600); font-weight: 600; white-space: nowrap; }
details.einklapp-karte[open] > summary { margin-bottom: var(--space-2); }

/* Cockpit: Pipeline-Zeile + kopierbarer Meldetext */
.pipeline { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-4); margin-top: var(--space-3); }
.pipeline-stufe { display: flex; align-items: baseline; gap: var(--space-2); color: inherit; text-decoration: none; }
.pipeline-stufe b { font-size: 22px; }
.pipeline-stufe span { color: var(--color-ink-muted); font-size: 13px; }
.pipeline-pfeil { color: var(--color-ink-muted); }
.pipeline-pfeil::before {
  content: ''; display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  background: currentColor;
  -webkit-mask: var(--ikon-chev-r) center / contain no-repeat; mask: var(--ikon-chev-r) center / contain no-repeat;
}
.meldetext {
  font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; line-height: 1.5;
  background: #f6f7f9; border: 1px solid var(--color-card-border); border-radius: var(--radius-sm);
  padding: var(--space-3); white-space: pre-wrap; max-height: 320px; overflow-y: auto;
}

/* Lucide triangle-alert für Warnungen */
.warn::before, .hinweis-fehler::before {
  content: ''; width: 14px; height: 14px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>") center / contain no-repeat;
}

/* Meldungen — Fehler rot, Erfolg neutral mit Häkchen (v2: kein Grün) */
.hinweis-fehler {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--color-danger-bg); color: var(--color-danger); font-size: 14px; font-weight: 500;
}
.hinweis-ok {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--color-success-bg); color: var(--color-ink); font-size: 14px; font-weight: 500;
  border: 1px solid var(--color-divider);
}
.hinweis-ok::before {
  content: ''; width: 14px; height: 14px; flex: none; background: currentColor;
  -webkit-mask: var(--ikon-check) center / contain no-repeat; mask: var(--ikon-check) center / contain no-repeat;
}

/* Vertikal zentrierte Inhaltsfläche (Login) */
.page-main.mittig { justify-content: center; align-items: center; }

/* Upload-Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-2); padding: var(--space-8) var(--space-4);
  border: 2px dashed var(--color-divider); border-radius: var(--radius-md);
  color: var(--color-ink-muted); font-size: 14px; cursor: pointer; text-align: center;
}
.dropzone:hover, .dropzone.aktiv { border-color: var(--color-blue-500); background: var(--color-blue-100); color: var(--color-blue-700); }

/* Modal */
dialog.modal {
  width: min(980px, 94vw); max-height: 88vh; overflow: auto;
  border: none; border-radius: var(--radius-lg); padding: 0;
  box-shadow: var(--shadow-lg); background: var(--color-bg);
}
dialog.modal::backdrop { background: rgba(11, 16, 32, 0.45); }
.modal-kopf {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface); border-bottom: 1px solid var(--color-divider);
}
.modal-kopf .card-title { margin-right: auto; }
.modal-inhalt { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }

/* Auftragsetiketten-Modal (Check-in): iframe lädt die eigenständige Druckseite
   (eigenes @page 89x36mm) — Druck geht über iframe.contentWindow.print(), NICHT
   über den Fenster-Druckdialog der App-Seite. */
.etiketten-frame { width: 100%; height: 60vh; border: 0; background: #fff; }

/* Einlagerung: Scanfeld + Status (Punkt kommt aus CSS, nicht aus dem Markup) */
.scan-input { font-size: 20px; min-height: 52px; font-variant-numeric: tabular-nums; }
.scan-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--color-navy); }
.scan-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.scan-status.pausiert { color: var(--color-ink-muted); }
.scan-echo { display: flex; flex-direction: column; gap: var(--space-1); }

.platz-btn {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
  min-height: 52px; padding: var(--space-3) var(--space-4); text-align: left;
  font: inherit; font-size: 15px; color: var(--color-ink); cursor: pointer;
  background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.platz-btn:hover { border-color: var(--color-blue-500); background: var(--color-blue-100); }
.platz-btn:disabled { opacity: 0.45; cursor: wait; }
.platz-btn b.addr { font-size: 20px; letter-spacing: 0.02em; }
.platz-btn.empfohlen { border-color: var(--color-blue-500); box-shadow: inset 0 0 0 1px var(--color-blue-500); }
.platz-aktion { margin-left: auto; font-weight: 600; color: var(--color-blue-600); }

.stepper { display: inline-flex; align-items: center; gap: var(--space-2); }
.stepper input { width: 76px; text-align: center; font-size: 18px; font-weight: 600; }

.seg-opt { text-decoration: none; color: var(--color-ink); }
.seg-opt.aktiv {
  color: var(--color-blue-600); font-weight: 600;
  box-shadow: inset 0 0 0 1.5px var(--color-blue-500); background: var(--color-blue-100);
}

/* Geräte-Check-in: Zubehör-Checkliste (grosse Klickziele) */
.check-zeile { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; font-size: 17px; }
.zubehoer-check { width: 22px; height: 22px; }

/* Technikertisch/Teilekatalog: Filterzeile + Teilbilder in Tabellen */
.input-kategorie { width: auto; } /* select bemisst sich am längsten Kategorienamen */
.teil-bild { width: 56px; height: 56px; object-fit: contain; border-radius: var(--radius-sm); cursor: zoom-in; }
/* Teilbild-Popup (Technikertisch): Vollbild-Overlay, per hidden-Attribut geschaltet */
.bild-popup { position: fixed; inset: 0; background: rgba(11, 16, 32, 0.75); z-index: 1000; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.bild-popup img { max-width: min(90vw, 800px); max-height: 85vh; border-radius: var(--radius-lg); background: var(--color-surface); padding: var(--space-2); }
/* Popup mit Bild UND Text (Teilezeile der Logistik-Seite, Geni 10.09.) */
.bild-popup-karte { display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  max-width: min(90vw, 420px); padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface); text-align: center; cursor: auto; }
.bild-popup-karte img { max-width: min(80vw, 320px); max-height: 45vh; padding: 0; }



/* ── Prozess-Stepper: wo steht der Auftrag? (Technikertisch, Rüstschein) ── */
.prozess { display: flex; flex-direction: column; gap: 0; }
.prozess-schritt { display: flex; gap: var(--space-3); align-items: flex-start; }
.prozess-punkt { display: flex; flex-direction: column; align-items: center; flex: none; width: 18px; }
.prozess-punkt i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--color-divider); background: var(--color-surface); flex: none; margin-top: 3px; }
.prozess-punkt span { width: 2px; flex: 1; min-height: 18px; background: var(--color-divider); }
.prozess-schritt:last-child .prozess-punkt span { display: none; }
.prozess-text { padding-bottom: var(--space-3); font-size: 13px; color: var(--color-ink-muted); }
.prozess-text b { display: block; font-size: 14px; font-weight: 600; color: var(--color-ink-muted); }
.prozess-schritt.fertig .prozess-punkt i { background: var(--color-navy); border-color: var(--color-navy); }
.prozess-schritt.fertig .prozess-punkt span { background: var(--color-navy); }
.prozess-schritt.fertig .prozess-text b { color: var(--color-ink); }
.prozess-schritt.aktiv .prozess-punkt i { border-color: var(--color-navy); box-shadow: 0 0 0 3px var(--color-blue-200); }
.prozess-schritt.aktiv .prozess-text b { color: var(--color-ink); }

/* ── Zweispaltige Arbeitsfläche: Arbeit links, Prozess-Spalte rechts (sticky) ── */
.layout-arbeit { display: grid; grid-template-columns: 1fr 340px; gap: var(--space-6); align-items: start; }
.spalte-prozess { position: sticky; top: calc(var(--nav-height) + var(--space-4)); display: flex; flex-direction: column; gap: var(--space-4); }
@media (max-width: 980px) { .layout-arbeit { grid-template-columns: 1fr; } .spalte-prozess { position: static; } }

/* Auftragskopf: Kontext kompakt im Seitenkopf statt eigener Karten */
.auftrag-meta { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-2); font-size: 14px; color: var(--color-ink-muted); }
.auftrag-meta b { color: var(--color-ink); }

/* Technikertisch: Explosionszeichnungs-Viewer (fast Vollbild, Canvas + Pan/Zoom) */
dialog.zeichnung-modal {
  width: 96vw; height: 94vh; max-width: 96vw; max-height: 94vh;
  border: none; border-radius: var(--radius-lg); padding: 0;
  box-shadow: var(--shadow-lg); background: var(--color-bg); overflow: hidden;
}
dialog.zeichnung-modal::backdrop { background: rgba(11, 16, 32, 0.6); }
.zeichnung-kopf {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface); border-bottom: 1px solid var(--color-divider);
}
.zeichnung-kopf .card-title { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeichnung-flaeche {
  width: 100%; height: calc(94vh - 54px); overflow: auto;
  background: var(--color-bg); cursor: grab; touch-action: none;
}
.zeichnung-flaeche.greift { cursor: grabbing; }
.zeichnung-flaeche canvas { display: block; margin: 8px auto; background: #fff; box-shadow: var(--shadow-lg); }

/* Druck: nur Inhalt */
@media print {
  .nav, .page-footer, .kein-druck { display: none !important; }
  body { background: #fff; }
  .page-main, .page-header { max-width: none; padding: 0; }
  .card { border: none; box-shadow: none; padding: 0; }
}


/* Seitenkopf-Beschreibung (Handoff v2 7, block beschreibung in base.html): EIN Satz unter dem Titel */
.page-header p { font-size: 14px; color: var(--color-ink-muted); margin: var(--space-2) 0 0; max-width: 78ch; }

/* ── Geräte-Avis (Fix-Runde 2, Paket E — Zielbild handoff-v2-7/rendered/20_geraete_avis.html) ── */
/* Zwei Karten nebeneinander: CSV-Dropzone links, «Gerät ohne CSV erfassen» rechts; schmal untereinander */
.avis-aktionen { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); align-items: stretch; }
.avis-aktionen .stapel-2 { flex: 1; justify-content: center; }
@media (max-width: 980px) { .avis-aktionen { grid-template-columns: 1fr; } }
/* Zwei gleich breite Knöpfe (Walk-in / Ohne Avis) — statt Inline-Breite des Zielbilds */
.btn-breit-190 { width: 190px; }
/* Pipeline-Tabelle: Zahlen als Pill-Chips, grösste Stufe der Zeile betont, Nullen als gedämpfter Strich */
.pipeline-kopf th { font-size: 10px; }
.pipeline-null { color: var(--color-divider); }
.pipeline-zahl {
  display: inline-flex; min-width: 26px; height: 26px; align-items: center; justify-content: center;
  padding: 0 7px; border-radius: var(--radius-pill); background: var(--color-blue-100); font-weight: 600;
  color: var(--color-ink); text-decoration: none;
}
a.pipeline-zahl:hover { background: var(--color-blue-200); text-decoration: none; }
.pipeline-zahl.stark { background: var(--color-blue-200); color: var(--color-navy); }
.aktualisiert { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; font-size: 12px; color: var(--color-ink-muted); }

/* ── Geräte-Check-in v2 (Fix-Runde 2, Paket L — Zielbild handoff-v2-8/rendered/21_geraet_checkin_v2.html) ── */
/* Arbeitsschritte links, sticky Entscheid-Spalte rechts (340px); schmal untereinander */
.checkin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-6); align-items: start; }
@media (max-width: 980px) { .checkin-grid { grid-template-columns: 1fr; } .checkin-grid .spalte-prozess { position: static; } }
/* Kennwerte als Definitionsliste (Gerät/Kunde): Beschriftung gedämpft in fester Spalte, Trennlinien */
.info-liste { display: flex; flex-direction: column; margin: 0; }
.info-liste > div { display: flex; gap: var(--space-3); padding: 7px 0; border-bottom: 1px solid var(--color-divider); font-size: 14px; }
.info-liste > div:last-child { border-bottom: none; }
.info-liste dt { width: 170px; flex: none; color: var(--color-ink-muted); }
.info-liste dd { margin: 0; }
/* Radio-Zeilen (Kaufbeleg, Abweichungsart, SN-Wahl): grosses Klickziel, Marke in Navy */
.radio-zeile { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; font-size: 15px; cursor: pointer; }
.radio-zeile input { width: 18px; height: 18px; accent-color: var(--color-navy); }
/* Feld unter einem Radio bündig zum Beschriftungstext (statt Inline-padding-left des Zielbilds) */
.radio-einzug { padding-left: calc(18px + var(--space-2)); }
/* Entscheid-Karte: Knopf volle Breite, Erklärtext darunter */
.entscheid { display: flex; flex-direction: column; gap: var(--space-2); }
.entscheid .btn { justify-content: center; }

.info-liste dd { min-width: 0; overflow-wrap: anywhere; }
.check-zeile input { flex-shrink: 0; }

/* Bei umbrechender Navigation keine überlagernde Prozess-Spalte. */
@media (max-width: 1100px) { .spalte-prozess { position: static; } }
