/* Packen auf dem Hof.
   Große Flächen, wenig Text – bedient wird das im Stehen, oft mit Handschuhen
   und auf einem Handy. Nur Struktur und Maße; Farben stehen in app.css und
   dürfen hier alles überschreiben, weil diese Datei vorher geladen wird. */

/* ── Übersicht: eine Karte je Packliste ──────────────────── */

.packen-karten {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.packen-karte {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.packen-karte > strong { font-size: 15px; }

.packen-karte-zeile {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    opacity: .8;
}

.packen-karte .ladung-balken { height: 8px; }
.packen-karte.ist-fertig .ladung-balken > span { background: #2e7d32; }

/* ── Eine Liste abarbeiten ───────────────────────────────── */

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

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

.packen-fortschritt-kopf > strong {
    font-size: 19px;
    font-variant-numeric: tabular-nums;
}

.packen-fortschritt > small { font-size: 12px; opacity: .8; }

.packen-schnell { margin-bottom: 12px; }

.packen-positionen {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.packen-gruppe {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid currentColor;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.packen-gruppe:first-child { margin-top: 0; }
.packen-gruppe > span { margin-left: auto; font-weight: 600; letter-spacing: 0; }

/* Die ganze Zeile ist die Schaltfläche. Ein kleines Kästchen zu treffen ist
   mit Arbeitshandschuhen nichts. */
.packen-zeile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.packen-haken {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 2px solid currentColor;
    border-radius: 8px;
    font-size: 17px;
    line-height: 1;
    opacity: .45;
}

.packen-zeile.ist-gepackt .packen-haken {
    opacity: 1;
    color: #2e7d32;
    border-color: #2e7d32;
}

.packen-zeile.ist-gepackt .packen-text > strong {
    text-decoration: line-through;
    opacity: .6;
}

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

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

.packen-text { flex: 1 1 auto; min-width: 0; }
.packen-text > strong { display: block; font-size: 15px; }
.packen-text > small  { display: block; font-size: 12px; opacity: .75; margin-top: 2px; }

.packen-menge {
    flex: 0 0 auto;
    font-size: 17px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ── Abschluss ───────────────────────────────────────────── */

.packen-abschluss {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, .14);
}

.packen-abschluss > h3 { margin: 0 0 4px; font-size: 15px; }

.packen-hinweis {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.5;
    opacity: .8;
    max-width: 62ch;
}

.packen-foto {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.packen-foto-feld {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 160px;
    height: 120px;
    border: 1px dashed rgba(0, 0, 0, .28);
    border-radius: 10px;
    overflow: hidden;
    font-size: 12px;
    opacity: .7;
    text-align: center;
    padding: 6px;
}

.packen-foto-feld img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.packen-leer {
    margin: 0;
    padding: 18px 4px;
    font-size: 14px;
    opacity: .75;
}

/* ── Abholen: zählen, was zurückkommt ────────────────────── */

.abhol-zeile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 10px;
}

.abhol-kopf {
    display: flex;
    align-items: center;
    gap: 12px;
}

.abhol-soll {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 12px;
    opacity: .75;
    white-space: nowrap;
}

.abhol-mengen {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.abhol-mengen label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
}

.abhol-mengen input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.abhol-mengen .ist-schaden input  { border-color: #ed6c02; }
.abhol-mengen .ist-verlust input  { border-color: #c62828; }

.abhol-notiz {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid rgba(0, 0, 0, .16);
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
}

.abhol-warnung {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #c62828;
}

.abhol-zeile.ist-erfasst { border-color: #2e7d32; }

/* ── Belege ──────────────────────────────────────────────── */

.beleg-liste {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.beleg-liste:empty { margin-bottom: 0; }

.beleg-eintrag {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 8px;
}

.beleg-bild {
    flex: 0 0 auto;
    width: 56px;
    height: 42px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: .8;
}

.beleg-bild img { width: 100%; height: 100%; object-fit: cover; }

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

.beleg-marke {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.beleg-marke.ist-schaden { color: #ed6c02; }
.beleg-marke.ist-verlust { color: #c62828; }

.beleg-foto {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

/* ── Rücklauf: das Lager entscheidet ─────────────────────── */

.ruecklauf-liste {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ruecklauf-fall {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 10px;
}

.ruecklauf-fall.ist-erledigt { opacity: .72; }
.ruecklauf-fall.ist-offen    { border-left: 3px solid #ed6c02; }

.ruecklauf-kopf {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ruecklauf-kopf > .packen-text { flex: 1 1 220px; }

.ruecklauf-zahlen {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ruecklauf-zahl {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ruecklauf-zahl.ist-schaden { color: #ed6c02; }
.ruecklauf-zahl.ist-verlust { color: #c62828; }
.ruecklauf-zahl.ist-bestand { opacity: .75; }

.ruecklauf-entscheidung {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ruecklauf-status {
    font-size: 12px;
    font-weight: 600;
}

.ruecklauf-status.ist-reparatur  { color: #ed6c02; }
.ruecklauf-status.ist-ausgebucht { color: #c62828; }

.ruecklauf-berechnen {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-left: auto;
}

.ruecklauf-notiz {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid rgba(0, 0, 0, .16);
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
}

/* Der Vermerk für die Disposition – der Grund, warum das Lager überhaupt
   etwas einträgt. */
.marke-berechnen {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #c62828;
    color: #c62828;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .ruecklauf-berechnen { margin-left: 0; }
}

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

@media (max-width: 700px) {
    .packen-karten   { grid-template-columns: 1fr; }
    .packen-zeile    { padding: 14px 12px; }
    .packen-text > strong { font-size: 16px; }
    .packen-foto-feld { width: 100%; height: 160px; }
}

/* ── Kontrollfahrt nach RSA 21 ───────────────────────────── */

.kontrolle-kopfzeile {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    align-items: end;
    margin-bottom: 16px;
}

.kontrolle-schnell { align-self: end; }

.kontrolle-punkte {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.kontrolle-gruppe > h4 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding-bottom: 4px;
    border-bottom: 2px solid currentColor;
}

.kontrolle-punkt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 10px;
    flex-wrap: wrap;
}

.kontrolle-punkt + .kontrolle-punkt { margin-top: 6px; }

.kontrolle-punkt > span { flex: 1 1 220px; min-width: 0; font-size: 14px; }

/* Drei große Flächen statt eines Auswahlmenüs: das wird mit Handschuhen
   bedient, im Stehen. */
.kontrolle-wahl {
    display: flex;
    gap: 4px;
    flex: 0 0 auto;
}

.kontrolle-wahl button {
    padding: 7px 12px;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.kontrolle-wahl button[aria-pressed="true"] { font-weight: 700; }
.kontrolle-wahl button[data-wert="ok"][aria-pressed="true"]        { border-color: #2e7d32; color: #2e7d32; }
.kontrolle-wahl button[data-wert="mangel"][aria-pressed="true"]    { border-color: #c62828; color: #c62828; }
.kontrolle-wahl button[data-wert="entfaellt"][aria-pressed="true"] { opacity: .7; }

.kontrolle-punkt.ist-mangel { border-color: #c62828; }

.kontrolle-punkt input[type="text"] {
    flex: 1 1 100%;
    padding: 7px 10px;
    border: 1px solid rgba(0, 0, 0, .16);
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
}

/* ── Kontrollbuch ────────────────────────────────────────── */

.kontrolle-buch {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, .14);
}

.kontrolle-buch > h3 { margin: 0 0 10px; font-size: 15px; }

.kontrolle-eintrag {
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 10px;
}

.kontrolle-eintrag + .kontrolle-eintrag { margin-top: 8px; }
.kontrolle-eintrag.ist-mangel { border-left: 3px solid #c62828; }

.kontrolle-eintrag-kopf {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.kontrolle-eintrag-kopf > strong { font-size: 14px; }
.kontrolle-eintrag-kopf > small  { opacity: .75; font-size: 12px; }
.kontrolle-eintrag-kopf > .marke { margin-left: auto; }

.kontrolle-mangelliste {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 13px;
}

/* Mangelzeile: Text links, die beiden Fotoknoepfe rechts daneben. */
.kontrolle-mangelliste > li {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.kontrolle-mangelliste > li + li { margin-top: 6px; }
.kontrolle-mangelliste > li > span:first-child { flex: 1 1 200px; min-width: 0; }

.kontrolle-mangel-knoepfe {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Standortnachweis ────────────────────────────────────── */

.kontrolle-standort {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.kontrolle-standort-stand {
    flex: 1 1 260px;
    margin: 0;
    font-size: 13px;
}

.kontrolle-standort-stand.ist-gut  { color: #2e7d32; }
.kontrolle-standort-stand.ist-ohne { opacity: .8; }

/* Das Grundfeld nimmt eine eigene Zeile - es erscheint nur, wenn die Ortung
   nichts geliefert hat, und soll dann nicht zwischen die Knoepfe rutschen. */
.kontrolle-standort > [data-standort-grund] { flex: 1 1 100%; }

.kontrolle-standort-zeile {
    margin: 6px 0 0;
    font-size: 12px;
    opacity: .8;
}

.kontrolle-standort-zeile.ist-ohne { font-style: italic; }
.kontrolle-standort-zeile.ist-weit { color: #c62828; opacity: 1; }

/* ── Nachweisfotos ───────────────────────────────────────── */

.kontrolle-fotos {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0;
}

.kontrolle-foto {
    position: relative;
    width: 92px;
    margin: 0;
}

.kontrolle-fotos img {
    width: 92px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
}

.kontrolle-foto.ist-behoben img { outline: 2px solid #2e7d32; outline-offset: -2px; }

.kontrolle-foto > figcaption {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.25;
    opacity: .8;
    overflow-wrap: anywhere;
}

.kontrolle-foto-weg {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 700px) {
    .kontrolle-punkt      { flex-direction: column; align-items: stretch; }
    .kontrolle-wahl       { display: grid; grid-template-columns: repeat(3, 1fr); }
    .kontrolle-wahl button { padding: 12px 6px; }

    /* Auf dem Handy gehoert der Loeschknopf an den Rand des Daumens, nicht
       in die Bildmitte - und er darf nicht kleiner sein als eine Fingerkuppe. */
    .kontrolle-foto-weg { width: 26px; height: 26px; }
}

/* ── Nachweis als PDF ────────────────────────────────────── */

/* Ueberschrift links, Zeitraum und Knopf rechts - auf dem Handy untereinander. */
.kontrolle-buch-kopf {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.kontrolle-buch-kopf > h3 { margin: 0; }

.kontrolle-nachweis {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.kontrolle-nachweis label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}

.kontrolle-nachweis input { min-width: 130px; }

.kontrolle-eintrag-knoepfe { margin-top: 10px; }

@media (max-width: 700px) {
    .kontrolle-nachweis { width: 100%; }
    .kontrolle-nachweis label { flex: 1 1 45%; }
    .kontrolle-nachweis .knopf { width: 100%; }
}

/* ── Sofort behobene Maengel ─────────────────────────────── */

/* Der Haken erscheint nur an einer Mangelzeile, unter dem Notizfeld. */
.kontrolle-behoben {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 13px;
    cursor: pointer;
}

.kontrolle-behoben input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

/* Behoben heisst: war ein Mangel, ist aber erledigt. Deshalb bleibt die Zeile
   sichtbar markiert, nur nicht mehr in Warnfarbe. */
.kontrolle-punkt.ist-mangel.ist-behoben { border-color: #2e7d32; }

.kontrolle-mangelliste > li.ist-behoben { opacity: .75; }

/* Wann und durch wen ein Mangel abgestellt wurde - steht unter der Zeile,
   damit Text und Knoepfe darueber in einer Reihe bleiben. */
.kontrolle-erledigt {
    flex: 1 1 100%;
    margin-top: 2px;
    font-size: 11px;
    opacity: .8;
}

/* ── Strecke abfahren ────────────────────────────────────── */

.kontrolle-strecke {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 10px;
}

.kontrolle-strecke-kopf {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.kontrolle-strecke-liste {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Eine Zeile je Punkt: Name und Entfernung links, Knopf rechts. */
.strecke-punkt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 8px;
}

.strecke-punkt-text { flex: 1 1 auto; min-width: 0; }
.strecke-punkt-text > span  { display: block; font-size: 14px; }
.strecke-punkt-text > small { display: block; font-size: 11px; opacity: .75; margin-top: 2px; }

.strecke-punkt.ist-erreicht { border-color: #2e7d32; }
.strecke-punkt.ist-erreicht .strecke-punkt-text > span:before {
    content: "\2713\00a0";
    color: #2e7d32;
    font-weight: 700;
}

/* Fehlende Streckenpunkte nachtragen - Knoepfe umbrechen bei langen Namen. */
.kontrolle-nachtragen {
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Knoepfe zum Setzen der Punkte - stehen unter der Liste, nicht darueber:
   auf der Fahrt wird abgehakt, gesetzt wird seltener. */
.kontrolle-strecke-pflege {
    margin-top: 10px;
    flex-wrap: wrap;
}

/* ── Aufstell- und Halteverbotsprotokoll ─────────────────── */

.protokoll-material,
.protokoll-fahrzeuge {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

/* Eine Zeile je Material oder Fahrzeug: schmale Felder vorn, Loeschknopf
   hinten. Auf dem Handy bricht sie um, statt sich zusammenzuquetschen. */
.protokoll-zeile {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.protokoll-zeile > input {
    flex: 1 1 140px;
    min-width: 0;
}

.protokoll-menge       { flex: 0 0 68px; text-align: right; }
.protokoll-zeichen     { flex: 0 0 90px; }
.protokoll-kennzeichen { flex: 0 0 130px; text-transform: uppercase; }

@media (max-width: 700px) {
    .protokoll-menge       { flex: 0 0 60px; }
    .protokoll-zeichen     { flex: 0 0 80px; }
    .protokoll-kennzeichen { flex: 1 1 100%; }
}

/* ── Unterschrift ────────────────────────────────────────── */

.protokoll-unterschrift,
.protokoll-fotos {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

/* Weisses Feld mit gestricheltem Rand: es soll aussehen wie die Zeile auf
   einem Formular, auf der man unterschreibt. Die Hoehe ist fest, damit auf
   dem Handy genug Platz zum Ziehen bleibt.
   touch-action: none - sonst scrollt die Seite, statt zu zeichnen. */
.unterschrift-feld {
    width: 100%;
    height: 150px;
    border: 1px dashed rgba(0, 0, 0, .35);
    border-radius: 10px;
    background: #fff;
    touch-action: none;
    cursor: crosshair;
}

/* Im Protokollbuch: die abgelegte Unterschrift, klein und auf weissem Grund. */
.unterschrift-bild {
    display: block;
    max-width: 260px;
    margin: 6px 0;
    padding: 4px;
    border-radius: 6px;
    background: #fff;
}

/* Material ist freiwillig - zugeklappt, aber auffindbar. */
details.protokoll-material > summary {
    padding: 8px 0;
    font-size: 13px;
    cursor: pointer;
}

@media (max-width: 700px) {
    .unterschrift-feld { height: 130px; }
}
