/* ============================================================
   ERP-Modul — Oberflaeche im Stil einer Warenwirtschaft
   ------------------------------------------------------------
   Aufbau je Bereich (angelehnt an Lexware):

     Kopfzeile mit Aktionen
     Registerkarten (Artikel / Material / ...)
     schmale Filterleiste
     ┌────────────────────────────────┐
     │ Stammdatentabelle, dicht,      │  oben
     │ Zeilenauswahl, eigener Scroll  │
     ├────────────────────────────────┤
     │ Detail-Registerkarten          │  unten
     │ Detailinhalt zur gewaehlten    │
     │ Zeile (Stammblatt, Stueckliste,│
     │ Historie)                      │
     └────────────────────────────────┘

   WICHTIG — zwei Fallen aus style.css:
     Zeile 407: input, button, select { width:100%; margin-bottom:15px }
       Jedes Bedienelement ist per Vorgabe volle Breite mit Abstand.
       Alles hier muss "width:auto" und "margin-bottom:0" ausdruecklich
       zuruecksetzen, sonst stapeln sich Schaltflaechen untereinander.
     Zeile 551: table { width:100%; margin-top:20px; font-size:14px }
       Deshalb setzen die Gitter-Regeln Groesse und Abstand neu.

   Praefix: erp-
   ============================================================ */

/* ---------- Kopfzeile eines ERP-Bereichs ---------- */
.erp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.erp-head h2 {
  margin: 0;
  font-size: 20px;
}

.erp-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Registerkarten ---------- */
.erp-tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  border-bottom: 2px solid #cbd5e1;
  margin: 0 0 12px;
  padding: 0;
}

.erp-tab {
  /* width/margin muessen gegen style.css:407 gesetzt werden */
  width: auto;
  margin: 0 0 -2px 0;
  padding: 8px 18px;
  appearance: none;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s, background .12s, border-color .12s;
}

.erp-tab:hover {
  color: #4f46e5;
  background: #f1f5f9;
  transform: none;
  box-shadow: none;
}

.erp-tab.active {
  color: #4f46e5;
  background: #fff;
  border-color: #cbd5e1 #cbd5e1 #4f46e5;
  border-bottom-width: 2px;
}

.erp-tab-count {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 9px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.erp-tab.active .erp-tab-count {
  background: #4f46e5;
  color: #fff;
}

/* ---------- Filterleiste ---------- */
.erp-toolbar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.erp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.erp-field--wide {
  min-width: 240px;
  flex: 1;
}

.erp-field > label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #64748b;
}

.erp-field > input,
.erp-field > select,
.erp-field > textarea {
  width: 100%;
  margin: 0;                 /* gegen style.css:407 */
  padding: 6px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  box-shadow: none;
  transition: border-color .12s;
}

.erp-field > input:focus,
.erp-field > select:focus,
.erp-field > textarea:focus {
  outline: none;
  border-color: #4f46e5;
}

.erp-field > input:disabled,
.erp-field > select:disabled,
.erp-field > textarea:disabled {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

.erp-field > input[readonly] {
  background: #f8fafc;
  color: #475569;
}

.erp-toolbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

/* ---------- Kleine Schaltflaeche im Gitter ---------- */
.erp-btn {
  width: auto;
  margin: 0;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  color: #334155;
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}

.erp-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: none;
  box-shadow: none;
}

.erp-btn--primary {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

.erp-btn--primary:hover {
  background: #4338ca;
  border-color: #4338ca;
  color: #fff;
}

.erp-btn--gefahr {
  background: #fff;
  border-color: #fca5a5;
  color: #b91c1c;
}

.erp-btn--gefahr:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.erp-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   Zweigeteilte Ansicht: Stammdaten oben, Details unten
   ============================================================ */
.erp-lex {
  display: flex;
  flex-direction: column;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.erp-lex-oben {
  max-height: 46vh;
  min-height: 180px;
  overflow: auto;
  background: #fff;
}

.erp-lex-fuss {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 12px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12px;
  color: #64748b;
}

.erp-lex-unten {
  border-top: 2px solid #cbd5e1;
  background: #f8fafc;
}

/* Registerkarten des Detailbereichs — flach, wie eine Fussleiste */
.erp-dtabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid #cbd5e1;
  background: #eef2f7;
  padding: 0 6px;
}

.erp-dtab {
  width: auto;
  margin: 0;
  padding: 7px 16px;
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
}

.erp-dtab:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: none;
  box-shadow: none;
}

.erp-dtab.active {
  background: #fff;
  color: #4f46e5;
  border-color: #cbd5e1;
  box-shadow: inset 0 2px 0 #4f46e5;
}

.erp-dbody {
  background: #fff;
  padding: 14px 16px;
  max-height: 42vh;
  overflow: auto;
}

/* Tabelle ohne Detailbereich darunter (Artikel & Material: Details im Fenster) */
.erp-lex--ohne-detail .erp-lex-oben {
  max-height: calc(100vh - 300px);
  min-height: 240px;
}

/* Detailfenster: Registerkarten bleiben oben stehen, nur der Inhalt scrollt */
.erp-modal.erp-detail-fenster {
  width: min(1100px, 96vw);
  max-width: 1100px;
  height: 86vh;
}
.erp-detail-fenster .modal-content {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.erp-detail-fenster .erp-dtabs { flex: none; }
.erp-detail-fenster .erp-dbody {
  flex: 1;
  min-height: 0;
  max-height: none;
}

/* ============================================================
   Datengitter — dicht, mit Zeilenauswahl
   ============================================================ */
.erp-grid {
  width: 100%;
  margin: 0;                 /* gegen style.css:551 */
  border-collapse: collapse;
  font-size: 12.5px;
  background: #fff;
}

.erp-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 7px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #f1f5f9;
  background: #334155;
  border-right: 1px solid #475569;
  white-space: nowrap;
}

.erp-grid thead th:last-child {
  border-right: none;
}

.erp-grid tbody td {
  padding: 4px 10px;
  border-bottom: 1px solid #eef2f7;
  border-right: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
  white-space: nowrap;
}

.erp-grid tbody td:last-child {
  border-right: none;
}

.erp-grid tbody tr:nth-child(even) {
  background: #fafbfd;
}

.erp-grid tbody tr:hover {
  background: #eef2ff;
}

.erp-grid tbody tr.erp-sel,
.erp-grid tbody tr.erp-sel:hover {
  background: #4f46e5;
}

.erp-grid tbody tr.erp-sel td {
  color: #fff;
  border-right-color: rgba(255, 255, 255, .2);
  border-bottom-color: rgba(255, 255, 255, .2);
}

.erp-grid tbody tr.erp-sel .erp-hint,
.erp-grid tbody tr.erp-sel .erp-strong {
  color: #e0e7ff;
}

.erp-grid tbody tr.erp-sel .erp-badge {
  background: rgba(255, 255, 255, .18);
  color: #fff;
  border-color: rgba(255, 255, 255, .3);
}

.erp-grid--klick tbody tr {
  cursor: pointer;
}

.erp-grid tbody tr.erp-row-inaktiv td {
  color: #94a3b8;
  font-style: italic;
}

.erp-grid tbody tr.erp-row-warn td {
  background: #fffbeb;
}

/* Zellen-Hilfsklassen */
.erp-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.erp-strong {
  font-weight: 700;
  color: #0f172a;
}

.erp-mono {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12px;
}

/* ============================================================
   Detailbereich: Stammblatt
   ============================================================ */
.erp-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px 16px;
}

.erp-form-grid .erp-field--full {
  grid-column: 1 / -1;
}

.erp-fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px 14px;
  margin: 0 0 12px;
}

.erp-fieldset > legend {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #4f46e5;
  padding: 0 6px;
}

.erp-detail-kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.erp-detail-kopf h3 {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
}

.erp-detail-aktionen {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Eingaben direkt im Gitter (Stuecklistenpositionen) */
.erp-grid input,
.erp-grid select {
  width: 100%;
  min-width: 70px;
  margin: 0;
  padding: 3px 6px;
  font-size: 12.5px;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  box-shadow: none;
}

.erp-grid input:focus,
.erp-grid select:focus {
  outline: none;
  border-color: #4f46e5;
}

.erp-grid td.erp-zelle-material { min-width: 260px; }
.erp-grid td.erp-zelle-zahl     { width: 110px; }
.erp-grid td.erp-zelle-einheit  { width: 110px; }
.erp-grid td.erp-zelle-knopf    { width: 44px; text-align: center; }

/* ---------- Statusanzeige ---------- */
.erp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.erp-badge--gruen { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.erp-badge--gelb  { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.erp-badge--rot   { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.erp-badge--blau  { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.erp-badge--grau  { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

.erp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* ---------- Hinweise und Leerzustaende ---------- */
/* Gedaempfte Zelle, z. B. "ohne Charge" im Bestand */
.erp-dim {
  color: #94a3b8;
  font-weight: 500;
}

.erp-hint {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.erp-note {
  border-left: 3px solid #4f46e5;
  background: #f8fafc;
  border-radius: 0 6px 6px 0;
  padding: 9px 13px;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.55;
  margin: 0 0 12px;
}

.erp-note--warn {
  border-left-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

.erp-note strong { color: #0f172a; }
.erp-note--warn strong { color: #78350f; }

.erp-empty {
  text-align: center;
  padding: 34px 20px;
  color: #94a3b8;
  font-size: 13px;
}

.erp-empty-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
  opacity: .5;
}

/* ---------- Eigenes Fenster (Vergleich, Auswahl) ----------
   Bewusst NICHT die Klasse .modal: closeAllModals() in js/modals.js
   setzt auf jedes .modal ein inline display:none. Das schlaegt die
   Klasse .active, wodurch sich das Fenster nach der ersten
   Bestaetigungsabfrage nicht mehr oeffnen liesse.
   Die z-index-Werte liegen unter denen von .modal (9998/9999), damit
   Bestaetigungsabfragen weiterhin oben liegen. */
.erp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 9000;
}

.erp-modal-backdrop[hidden] { display: none; }

.erp-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 9001;
  max-width: 1000px;
  width: 94%;
  max-height: 88vh;
  overflow-y: auto;
  display: none;
}

.erp-modal.active { display: block; }

/* ---------- Status des Moduls (Etappen-Uebersicht) ---------- */
.erp-status-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.erp-status-list li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 12.5px;
  color: #475569;
  padding: 7px 11px;
  border-radius: 6px;
  background: #f8fafc;
}

.erp-status-list li > span:first-child {
  flex: none;
  width: 20px;
  text-align: center;
}

/* ---------- Schmale Fenster ---------- */
@media (max-width: 900px) {
  .erp-lex-oben { max-height: 40vh; }
  .erp-dbody { max-height: none; }
  .erp-toolbar-actions { margin-left: 0; width: 100%; }
}

/* ============================================================
   Bedienkomfort: Splitter, bewegliche Fenster, Mehrfachauswahl
   ============================================================ */

/* ---------- Ziehbare Trennlinie zwischen oben und unten ---------- */
.erp-splitter {
  height: 9px;
  background: #eef2f7;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  cursor: row-resize;
  position: relative;
  flex: none;
  user-select: none;
  transition: background .12s;
}

.erp-splitter:hover,
.erp-splitter.erp-zieht {
  background: #c7d2fe;
}

/* Griffpunkte in der Mitte, damit man sieht, dass man ziehen kann */
.erp-splitter::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 3px;
  border-radius: 2px;
  background: #94a3b8;
}

/* Waehrend des Ziehens darf nichts markiert werden */
body.erp-zieht-gerade,
body.erp-zieht-gerade * {
  user-select: none !important;
  cursor: row-resize !important;
}

body.erp-schiebt-gerade,
body.erp-schiebt-gerade * {
  user-select: none !important;
}

/* Die feste Hoehe weicht dem eingestellten Wert */
.erp-lex-oben {
  resize: none;
}

/* ---------- Bewegliches, groessenveraenderbares Fenster ---------- */
.erp-modal {
  display: none;
  min-width: 380px;
  min-height: 220px;
  /* Gescrollt wird innen im Inhalt, nicht am ganzen Fenster —
     sonst wandert die Titelleiste beim Blaettern aus dem Bild. */
  overflow: hidden;
}

.erp-modal.active {
  display: flex;
  flex-direction: column;
}

/* Sobald das Fenster verschoben wurde, uebernimmt die Position aus dem
   Skript — transform wird dann zurueckgesetzt. */
.erp-modal.erp-frei {
  transform: none;
  resize: both;
  overflow: auto;
}

.erp-modal .modal-content {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

/* Titelleiste zum Anfassen */
.erp-fenster-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  border-radius: 10px 10px 0 0;
  cursor: move;
  flex: none;
  user-select: none;
}

.erp-fenster-kopf h3 {
  margin: 0;
  font-size: 14px;
  color: #0f172a;
}

.erp-fenster-kopf .erp-detail-aktionen {
  cursor: default;
}

.erp-fenster-griff {
  color: #94a3b8;
  font-size: 13px;
  letter-spacing: 2px;
  flex: none;
}

/* Anfasser unten rechts zum Vergroessern */
.erp-fenster-groesse {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 45%, #94a3b8 45%, #94a3b8 55%, transparent 55%),
    linear-gradient(135deg, transparent 70%, #94a3b8 70%, #94a3b8 80%, transparent 80%);
  z-index: 2;
}

/* ---------- Mehrfachauswahl im Gitter ---------- */
.erp-grid th.erp-spalte-wahl,
.erp-grid td.erp-spalte-wahl {
  width: 34px;
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}

.erp-grid input[type="checkbox"] {
  width: auto;
  min-width: 0;
  margin: 0;
  cursor: pointer;
  accent-color: #4f46e5;
}

.erp-grid tbody tr.erp-markiert td {
  background: #eef2ff;
}

.erp-grid tbody tr.erp-markiert.erp-sel td {
  background: #4338ca;
}

/* ---------- Gruppenzeile ---------- */
.erp-grid tbody tr.erp-gruppe td {
  background: #e2e8f0;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  border-top: 2px solid #cbd5e1;
  padding-top: 6px;
  padding-bottom: 6px;
}

.erp-grid tbody tr.erp-gruppe:hover td {
  background: #cbd5e1;
}

.erp-gruppe-pfeil {
  display: inline-block;
  width: 14px;
  color: #475569;
  transition: transform .12s;
}

.erp-gruppe.erp-zu .erp-gruppe-pfeil {
  transform: rotate(-90deg);
}

.erp-gruppe-zahl {
  font-weight: 400;
  color: #475569;
  font-size: 11.5px;
}

/* ---------- Leiste fuer Sammelaktionen ---------- */
.erp-sammelleiste {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: #4f46e5;
  color: #fff;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}

.erp-sammelleiste .erp-btn {
  background: rgba(255, 255, 255, .15);
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}

.erp-sammelleiste .erp-btn:hover {
  background: rgba(255, 255, 255, .28);
  border-color: #fff;
  color: #fff;
}

.erp-sammelleiste-rest {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ---------- Fortschritt bei Sammelaktionen ---------- */
.erp-fortschritt {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .25);
  overflow: hidden;
  width: 160px;
}

.erp-fortschritt-balken {
  height: 100%;
  background: #fff;
  width: 0;
  transition: width .15s;
}

/* ---------- Tastaturhinweis ---------- */
.erp-tasten {
  font-size: 11px;
  color: #94a3b8;
}

.erp-tasten kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #f8fafc;
  font-family: inherit;
  font-size: 10.5px;
  color: #475569;
}

/* ================================================================
   Lagerjournal in der Historie (erp-journal.js)
   ================================================================ */
.erp-journal-kopf {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 13px;
  color: #334155;
}

.erp-journal td { vertical-align: top; }

.erp-journal-minus { color: #b91c1c; }
.erp-journal-plus  { color: #15803d; }

/* Buchung ohne Charge (Fehlbestand): veraendert den Bestand nicht */
.erp-journal-unwirksam td { color: #94a3b8; }
.erp-journal-unwirksam td.erp-journal-minus { color: #ef4444; }

.erp-hist-protokoll {
  margin-top: 18px;
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}

.erp-hist-protokoll > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  padding: 4px 0;
  user-select: none;
}

.erp-hist-protokoll[open] > summary { margin-bottom: 8px; }

/* 📄 hinter der Bezeichnung: zum Artikel liegen Dokumente (SPI) */
.erp-dok-marke {
  font-size: 12px;
  opacity: 0.75;
  cursor: help;
}

/* ================================================================
   Artikel-Schnellansicht (erp-artikel-popup.js) und klickbare Nummern
   ================================================================ */
.erp-artikel-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed #94a3b8;
  cursor: pointer;
}

.erp-artikel-link:hover {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

#erpArtikelPopupFenster { max-width: 760px; }

.erp-popup { padding: 4px 2px; }

.erp-popup-kopf {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.erp-popup-titel {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

.erp-popup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px 18px;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.erp-popup-feld { display: flex; flex-direction: column; gap: 2px; }

.erp-popup-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.erp-popup-wert { font-size: 14px; color: #1e293b; font-weight: 600; }

.erp-popup-h4 {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin: 14px 0 6px;
}

.erp-popup-dokumente { display: grid; gap: 6px; }

.erp-popup-dokument {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
}

.erp-popup-dokument .erp-btn { margin: 0; }

/* Wareneingang: Lieferschein einlesen (KI-Vorschlag) */
.erp-we-import { background: #f8fafc; border-color: #c7d2fe; }
.erp-we-import .erp-grid input, .erp-we-import .erp-grid select { font-size: 12.5px; padding: 3px 6px; }
.erp-we-import .erp-grid td { vertical-align: middle; }

/* ================================================================
   Spalteneinstellung je Tabelle (erp-spalten.js)
   ================================================================ */
.erp-spalten-panel {
  position: fixed;
  z-index: 9500;                 /* über Tabelle und Splitter, unter Modals */
  width: 290px;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  padding: 10px 12px 12px;
  font-size: 13px;
}

.erp-spalten-kopf {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 6px;
}

.erp-spalten-liste { display: grid; gap: 1px; }

.erp-spalten-zeile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 4px 2px;
  border-radius: 6px;
}

.erp-spalten-zeile:hover { background: #f1f5f9; }
.erp-spalten-zeile--aus .erp-spalten-name span { color: #94a3b8; }

.erp-spalten-name {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  color: #1e293b;
}

/* style.css zwingt jedes input auf 100 % Breite und 15 px Rand */
.erp-spalten-name input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #4f46e5;
}

.erp-spalten-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-spalten-pfeile { display: flex; gap: 2px; flex: 0 0 auto; }

.erp-spalten-pfeile button {
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  font-size: 10px;
  line-height: 1;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  box-shadow: none;
  cursor: pointer;
}

.erp-spalten-pfeile button:hover:not(:disabled) {
  background: #eef2ff;
  border-color: #4f46e5;
  color: #4f46e5;
  transform: none;
}

.erp-spalten-pfeile button:disabled { opacity: 0.35; cursor: default; }

.erp-spalten-fuss {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #e2e8f0;
}

/* ================================================================
   Lager → 📅 Rampenplan (erp-rampenplan.js)
   ================================================================ */
.erp-rp-leiste { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.erp-rp-leiste strong { font-size: 15px; }
.erp-rp-leiste .erp-btn { width: auto; }
.erp-rp-oben { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.erp-rp-oben .erp-rp-spalte { flex: 1 1 260px; }
.erp-rp-reihe { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.erp-rp-raster { display: grid; gap: 8px; overflow-x: auto; }
.erp-rp-spalte { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px; min-height: 140px;
  position: relative; display: flex; flex-direction: column; gap: 6px; }
.erp-rp-spalte.heute { border: 2px solid #4f46e5; background: #eef2ff; }
.erp-rp-spalte.vergangen { opacity: .7; }
.erp-rp-spalte.rot { border-color: #fca5a5; background: #fef2f2; min-height: 0; }
.erp-rp-spalte.offen { border-style: dashed; min-height: 0; }
.erp-rp-tag { font-size: 12px; font-weight: 700; color: #334155; padding: 2px 4px; }
.erp-rp-karte { background: #fff; border: 1px solid #dbeafe; border-left: 4px solid #3b82f6; border-radius: 6px;
  padding: 6px 8px; font-size: 12px; cursor: pointer; }
.erp-rp-karte:hover { box-shadow: 0 2px 8px rgba(15,23,42,.12); }
.erp-rp-karte.abholung { border-color: #fed7aa; border-left-color: #f97316; }
.erp-rp-karte.kontrolliert, .erp-rp-karte.erledigt { border-left-color: #16a34a; background: #f0fdf4; }
.erp-rp-karte.verspaetet { border-left-color: #dc2626; }
.erp-rp-karte .kopf { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.erp-rp-karte .zeit { font-weight: 800; color: #3730a3; }
.erp-rp-karte .titel { font-weight: 700; font-size: 13px; margin-top: 2px; }
.erp-rp-karte .info, .erp-rp-karte .quelle { color: #64748b; font-size: 11px; }
.erp-rp-karte .notiz { font-style: italic; font-size: 11px; margin-top: 2px; }
.erp-rp-plus { margin-top: auto; width: 100%; border: 1px dashed #cbd5e1; background: transparent; color: #64748b;
  border-radius: 6px; cursor: pointer; font-size: 14px; padding: 2px; box-shadow: none; margin-bottom: 0; }
.erp-rp-plus:hover { background: #fff; color: #4f46e5; }

/* Rampenplan: Drag & Drop */
.erp-rp-bausteine { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px;
  padding: 8px 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; }
.erp-rp-bausteine-titel { font-size: 12px; font-weight: 700; color: #334155; margin-right: 4px; }
.erp-rp-bausteine-trenner { font-size: 11px; color: #64748b; margin: 0 2px 0 8px; }
.erp-rp-baustein { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; cursor: grab; user-select: none; border: 1px solid #bfdbfe;
  background: #eff6ff; color: #1d4ed8; }
.erp-rp-baustein.abholung { border-color: #fed7aa; background: #fff7ed; color: #c2410c; }
.erp-rp-baustein.vorlage { font-weight: 600; }
.erp-rp-baustein:hover { box-shadow: 0 2px 6px rgba(15,23,42,.15); }
.erp-rp-karte.ziehbar { cursor: grab; }
.erp-rp-karte.zieht, .erp-rp-baustein.zieht { opacity: .45; }
.erp-rp-zieht [data-drop] { outline: 2px dashed #a5b4fc; outline-offset: -2px; }
.erp-rp-zieht [data-drop].ueber { outline: 2px solid #4f46e5; background: #e0e7ff; }
.erp-rp-spalte.offen { min-height: 70px; }

/* ---------- Einkauf (erp-einkauf*.js) ---------- */
.erp-ek-schritte { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 6px; }
.erp-ek-schritt {
  display: flex; align-items: center; gap: 6px; flex: 1 1 120px;
  padding: 6px 9px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; color: #64748b; font-size: 12.5px;
}
.erp-ek-schritt small { display: block; font-size: 11px; color: #64748b; }
.erp-ek-schritt-text { display: flex; flex-direction: column; line-height: 1.25; }
.erp-ek-punkt {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #cbd5e1; background: #fff; font-size: 11px; font-weight: 700;
}
.erp-ek-schritt--ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.erp-ek-schritt--ok .erp-ek-punkt { background: #16a34a; border-color: #16a34a; color: #fff; }
.erp-ek-schritt--teil { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.erp-ek-schritt--teil .erp-ek-punkt { border-color: #f59e0b; color: #b45309; }
.erp-ek-h { margin: 14px 0 6px; font-size: 13px; color: #334155; }
.erp-ek-tab td { padding: 3px 4px; vertical-align: top; }
.erp-ek-tab input:not([type=checkbox]), .erp-ek-tab select {
  width: 100%; margin: 0; padding: 4px 6px; font-size: 12.5px; border: 1px solid #cbd5e1; border-radius: 4px;
  background: #fff; box-shadow: none; min-width: 0;
}
.erp-ek-vorschlag { background: #fef9c3 !important; }
.erp-ek-warn { color: #b45309; font-weight: 600; }
.erp-ek-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.erp-ek-liste { margin: 4px 0 8px; padding-left: 18px; font-size: 12.5px; }
.erp-ek-schalter--an { border-color: #16a34a; background: #f0fdf4; }
.erp-ek-schalter textarea, .erp-fieldset textarea { font-family: inherit; }
/* ---------- Inventur (erp-inventur.js) ---------- */
.erp-inv-tabelle { overflow-x: auto; }
.erp-inv-tabelle .erp-inv-zahl {
  width: 120px; margin: 0; padding: 3px 6px; font-size: 12.5px; text-align: right;
  border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; box-shadow: none;
}
.erp-inv-tabelle .erp-inv-zahl:focus { border-color: #4f46e5; outline: 2px solid #c7d2fe; }
.erp-inv-tabelle .erp-inv-zahl.erp-inv-falsch { border-color: #dc2626; background: #fef2f2; }
.erp-grid tbody tr.erp-inv-gezaehlt td { background: #f8fafc; }
.erp-inv-plus { color: #15803d; font-weight: 600; }
.erp-inv-minus { color: #b91c1c; font-weight: 600; }
.erp-inv-null { color: #94a3b8; }
.erp-inv-leiste {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  padding: 8px 12px; margin: 0 0 10px; border: 1px solid #e2e8f0; border-radius: 8px;
  background: #f8fafc; font-size: 12.5px; color: #334155;
}
.erp-inv-leiste .erp-btn { margin-left: auto; }
.erp-inv-arten { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.erp-inv-vorschau { margin-top: 10px; font-size: 13px; color: #334155; }
.erp-modal.erp-bestand-fenster { width: min(680px, 96vw); max-width: 680px; }
.erp-inv-material { font-weight: 600; color: #0f172a; margin: 0 0 8px; }
.erp-bestand-fenster .modal-content { padding: 14px 16px; overflow-y: auto; }
.erp-bestand-knoepfe { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; }
@media (max-width: 760px) {
  .erp-inv-leiste .erp-btn { margin-left: 0; width: 100%; }
}
