/**
 * inventur.css — Verbrauchsmaterial-Inventur (schlanke Liste, kein Bild).
 *
 * Generische Listen-Patterns kommen aus dem Shared-Set
 * (_shared/functions/list-view/grid-css/idf-list-grid.css) + Inline-Edit
 * (_shared/functions/inline-editing/idf-inline-edit.css). Hier bleiben nur
 * Inventur-Spezifika:
 *  - Grid-Spaltenbreiten (.inv-grid): Name · Menge · EK-Preis · Wert ·
 *    Standort · Lagerort · Regal-Nr.
 *  - Summen-Leisten (.inv-summary) oben + unten (sticky-fähig).
 *  - Unterbestand-Highlight (bestand < mindestbestand).
 *  - Numerische Spalten rechtsbündig (Menge / Preis / Wert).
 */

/* ================================================================ */
/* Grid: Spaltenbreiten — bewusst schlank, kein Bild.               */
/* ================================================================ */
.inv-grid {
  display: grid;
  /* Breiten aus der CSS-Variable (col-resize-Baustein); Fallback = Defaults. */
  grid-template-columns: var(--inv-cols,
    minmax(200px, 1fr)  /* Name — wächst */
    210px               /* Artikelnummer (lange Nummern wie PO-751C-80R126-50) */
    160px               /* A-Lieferant (Unternehmen, Anzeige-only) */
    110px               /* Menge (bestand + Einheit) */
    110px               /* EK-Preis */
    120px               /* Wert (Menge × EK) */
    120px               /* Standort (Enum-Label aus lagerort.standort) */
    140px               /* Lagerort */
    100px               /* Regal-Nr */
  );
  align-items: stretch;
  gap: 0;
}

/* Pen + Inhalt mit einheitlichem Abstand. */
.idf-list-rows .idf-list-row .inv-grid .idf-inline-edit-host { gap: 8px; }

/* Editierende Cell darf aufmachen, damit Comboboxen nicht clippen. */
.idf-list-rows .idf-list-row .inv-grid .idf-inline-edit-host.is-editing { overflow: visible; }

/* Numerische Spalten rechtsbündig — Menge / EK-Preis / Wert. Greift in
   Kopf UND Zellen. */
.inv-grid > .inv-cell-menge,
.inv-grid > .inv-cell-preis,
.inv-grid > .inv-cell-wert,
.inv-grid > .inv-head-menge,
.inv-grid > .inv-head-preis,
.inv-grid > .inv-head-wert {
  justify-content: flex-end;
  text-align: right;
}
/* Bei editierbaren (Menge/Preis) bleibt der Pen rechts, der Wert links
   davon — Inhalt also nach rechts, aber Pen am Rand. */
.inv-grid > .inv-cell-menge.idf-inline-edit-host,
.inv-grid > .inv-cell-preis.idf-inline-edit-host {
  justify-content: flex-end;
}

/* Wert-Spalte leicht hervorgehoben (read-only, das Ergebnis je Zeile). */
.inv-cell-wert { font-weight: 600; color: var(--ink); }

/* Unterbestand: bestand < mindestbestand → Menge-Zelle rot. */
.inv-cell-menge.is-unterbestand .idf-list-cell-text {
  color: var(--primary);
  font-weight: 700;
}

/* Fehlender EK-Preis → Wert-/Preis-Zelle dezent als Lücke markieren. */
.inv-cell-preis.is-missing .idf-list-cell-text,
.inv-cell-wert.is-missing { color: var(--mid); }

/* ================================================================ */
/* Summen-Leisten oben + unten                                      */
/* ================================================================ */
.inv-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3, 12px);
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 10px;
}
.inv-summary.is-bottom { margin: 10px 0 0; }

.inv-summary-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.inv-summary-label {
  font-size: var(--font-sm, 0.8125rem);
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.inv-summary-value {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
/* Gesamtwert hervorheben (Kern-Kennzahl der Inventur). */
.inv-summary-item.is-total .inv-summary-value {
  font-size: 1.25rem;
  color: var(--primary);
}
.inv-summary-spacer { flex: 1 1 auto; }
/* Hinweis-Chip (z.B. „ohne EK-Preis: 3") — nur sichtbar wenn > 0. */
.inv-summary-hint {
  font-size: var(--font-sm, 0.8125rem);
  color: var(--orange, #e8710a);
}
.inv-summary-hint.is-hidden { display: none; }

/* ================================================================ */
/* Schnell-Anlegen unter der Liste                                  */
/* ================================================================ */
.inv-inline-add {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 8px 0 0;
  background: var(--white);
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.inv-inline-add-icon { color: var(--mid); flex-shrink: 0; }
.inv-inline-add-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
}
.inv-inline-add-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #167ea0) 15%, transparent);
}
.inv-inline-add-input:disabled { opacity: 0.6; }

/* ================================================================ */
/* Responsive — Standort/Regal zuerst ausblenden auf schmal.        */
/* ================================================================ */
@media (max-width: 1280px) {
  /* Standort + A-Lieferant zuerst raus (Zusatzkontext). */
  .inv-grid { grid-template-columns: minmax(180px,1fr) 190px 100px 100px 110px 130px 90px; }
  .inv-grid > .inv-cell-standort,
  .inv-grid > .inv-head-standort,
  .inv-grid > .inv-cell-lieferant,
  .inv-grid > .inv-head-lieferant { display: none; }
  /* col-resize im Schmal-Layout inaktiv (Modul-Grid gewinnt hier): Griffe weg,
     Scroll-Modus neutralisieren, damit nichts verrutscht/ueberlaeuft. */
  .idf-colresize-layer { display: none; }
  .idf-colresize-scroll .idf-list-thead,
  .idf-colresize-scroll .idf-list-rows { width: auto; min-width: 0; }
}
@media (max-width: 1040px) {
  /* Lagerort + Regal-Nr raus — Kern bleibt: Name/Artikelnr/Menge/Preis/Wert. */
  .inv-grid { grid-template-columns: minmax(160px,1fr) 180px 100px 100px 110px; }
  .inv-grid > .inv-cell-lagerort,
  .inv-grid > .inv-head-lagerort,
  .inv-grid > .inv-cell-regal-nr,
  .inv-grid > .inv-head-regal-nr { display: none; }
}
@media (max-width: 820px) {
  /* Nur noch Kern-Kennzahlen: Name/Menge/Preis/Wert. */
  .inv-grid { grid-template-columns: minmax(140px,1fr) 90px 100px 110px; }
  .inv-grid > .inv-cell-artikelnr,
  .inv-grid > .inv-head-artikelnr { display: none; }
}
