/* Ladebilanz einer Packliste.
   Nur Struktur und Maße, damit die Bilanz lesbar ist. Farben und Feinheiten
   gehören in app.css und können hier alles überschreiben – diese Datei wird
   vor app.css geladen. */

/* ── Packtisch: Katalog links, Ladung rechts ─────────────── */

.pack-summe {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.pack-summe-kopf {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.pack-summe-kopf > strong {
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.pack-summe > small { font-size: 12px; opacity: .8; }

.ladung-balken-gross { height: 12px; border-radius: 6px; }

.pack-summe.ist-knapp  .ladung-balken > span { background: #ed6c02; }
.pack-summe.ist-zuviel .ladung-balken > span { background: #c62828; }
.pack-summe.ist-zuviel > small { color: #c62828; font-weight: 600; }

/* Solange eine Mengenänderung noch nicht gespeichert ist, gilt die Bilanz als
   nicht nachgezogen. Lieber ausgegraut als eine Zahl, die gerade nicht stimmt. */
.pack-summe.wartet { opacity: .55; }

.pack-grenzen { margin-bottom: 12px; }

.pack-grenzen > summary {
    cursor: pointer;
    padding: 4px 0;
    font-size: 13px;
    opacity: .85;
}

.pack-spalten {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.pack-spalte {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.pack-spalte-kopf {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pack-spalte-kopf > strong { font-size: 14px; }
.pack-spalte-kopf > input[type="search"] { flex: 1; min-width: 0; }
.pack-spalte-zahl { margin-left: auto; font-size: 12px; opacity: .75; }

/* Beide Spalten scrollen für sich. Sonst läuft man bei 200 Artikeln
   dauernd zwischen Katalog und Ladung hin und her. */
.pack-rollen {
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 2px;
}

/* Eine Zeile, egal ob im Katalog oder in der Ladung: Bild, Text, Bedienung. */
.pack-zeile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 8px;
}

.pack-bild {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .10);
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    color: rgba(0, 0, 0, .32);
}

.pack-bild img { max-width: 100%; max-height: 100%; object-fit: contain; }

.pack-text { flex: 1 1 auto; min-width: 0; }
.pack-text > strong { display: block; font-size: 13px; }
.pack-text > small  { display: block; font-size: 11px; opacity: .75; }

.pack-bestand {
    flex: 0 0 auto;
    text-align: right;
    font-size: 12px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.pack-bestand > b { display: block; font-size: 14px; }
.pack-bestand.ist-leer { opacity: .55; }

.pack-knoepfe {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Mengenregler: minus, Zahl, plus, entfernen. */
.pack-menge {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
}

.pack-menge button {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .16);
    border-radius: 6px;
    background: transparent;
    font: inherit;
    line-height: 1;
    cursor: pointer;
}

.pack-menge button:disabled { opacity: .4; cursor: default; }

/* Eingabefeld statt nur Anzeige: 48 Fußplatten tippt man, statt 48-mal auf
   Plus zu drücken. */
.pack-menge input {
    width: 56px;
    padding: 3px 6px;
    border: 1px solid rgba(0, 0, 0, .16);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pack-menge > small {
    min-width: 42px;
    font-size: 11px;
    opacity: .75;
}

/* Nur-Lese-Fall ohne Schreibrecht. */
.pack-menge > span {
    min-width: 44px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.pack-menge .pack-weg { border-color: transparent; opacity: .6; }
.pack-menge .pack-weg:hover { opacity: 1; color: #c62828; }

/* Überschrift je Ladeort, mit Anzahl und Gewicht. */
.pack-gruppe {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 6px;
    padding-bottom: 4px;
    border-bottom: 2px solid currentColor;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.pack-gruppe:first-child { margin-top: 0; }
.pack-gruppe > span { margin-left: auto; font-weight: 600; letter-spacing: 0; }
.pack-gruppe.ist-zuviel { color: #c62828; }

.pack-leer {
    margin: 0;
    padding: 14px 10px;
    font-size: 13px;
    opacity: .7;
}

.pack-frei > summary {
    cursor: pointer;
    padding: 6px 0;
    font-size: 12px;
    opacity: .85;
}

@media (max-width: 900px) {
    .pack-spalten { grid-template-columns: 1fr; }
    .pack-rollen  { max-height: 340px; }
}

.ladung-bilanz {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    margin: 4px 0 12px;
}

.ladung-karte {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 8px;
}

.ladung-karte > strong {
    font-size: 13px;
}

/* pre-line, weil die zweite Zeile (Leergewicht und Ladung) als Umbruch im
   Text steht und nicht als eigenes Element. */
.ladung-karte > small {
    font-size: 12px;
    line-height: 1.45;
    opacity: .85;
    white-space: pre-line;
}

/* Der Balken zeigt die Auslastung. Über 100 % wird er nicht länger – er
   wechselt die Farbe, sonst sprengt eine doppelte Beladung das Raster. */
.ladung-balken {
    position: relative;
    height: 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .10);
    overflow: hidden;
}

.ladung-balken > span {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: #2e7d32;
    transition: width .2s ease;
}

.ladung-karte.ist-knapp   .ladung-balken > span { background: #ed6c02; }
.ladung-karte.ist-zuviel  .ladung-balken > span { background: #c62828; }

.ladung-karte.ist-knapp  { border-color: #ed6c02; }
.ladung-karte.ist-zuviel { border-color: #c62828; }

/* Ohne Stammdaten wird nicht gerechnet – die Karte bleibt sichtbar, sagt aber,
   dass sie nichts aussagt. */
.ladung-karte.ist-offen        { border-style: dashed; }
.ladung-karte.ist-offen > small { opacity: .7; }

.ladung-hinweise {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.ladung-hinweise:empty { margin-bottom: 0; }

.ladung-hinweis {
    margin: 0;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid currentColor;
    font-size: 13px;
    background: rgba(0, 0, 0, .04);
}

.ladung-hinweis.warnung { color: #c62828; }
.ladung-hinweis.offen   { color: #6a6a6a; }

@media (max-width: 700px) {
    .ladung-bilanz { grid-template-columns: 1fr; }
}
