/* IBC-Wareneingang – angelehnt an iOS im Dunkelmodus: Systemschrift, schwarzer Grund, gruppierte Flächen mit
   runden Ecken, feine Trennlinien, Schalter statt Häkchen. Akzent bleibt das gebrochene Weiß von A&E Nova.
   Farbe nur dort, wo sie etwas bedeutet (Route, Warnung). Große Tippflächen für Handschuhe. */
:root {
  --grund: #000000;
  --karte: #1C1C1E;
  --platte: #2C2C2E;
  --linie: #38383A;
  --tinte: #FFFFFF;
  --leise: rgba(235, 235, 245, .6);
  --hell: #F2F1EC;
  --akzent: #F2F1EC;
  --kopf: rgba(22, 22, 24, .82);
  --waschen: #0A84FF;
  --blasentausch: #FF9F0A;
  --pruefung: #98989F;
  --entsorgung: #FF453A;
  --warn: #FFD60A;
  --warn-grund: rgba(255, 214, 10, .12);
  --fehler: #FF453A;
  --ok: #30D158;
  --rund: 12px;
  --rund-klein: 10px;
  --schrift: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, "Segoe UI", Roboto, sans-serif;
  --titel: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--grund); }
body {
  margin: 0; background: var(--grund); color: var(--tinte);
  font: 400 17px/1.4 var(--schrift); letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
img { max-width: 100%; display: block; }
a { color: var(--akzent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* ---------- Kopf (Navigationsleiste, durchscheinend) */
.kopf {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: calc(6px + env(safe-area-inset-top)) 16px 6px; background: var(--kopf); color: var(--tinte);
  border-bottom: .5px solid var(--linie);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.marke { display: flex; align-items: center; gap: 10px; color: inherit; min-height: 44px; }
.marke img { width: 52px; height: 34px; object-fit: contain; mix-blend-mode: lighten; }
.marke span { font: 600 17px/1 var(--titel); letter-spacing: -.02em; }
.status { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pille { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--platte); color: var(--leise); white-space: nowrap; }
.pille::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; background: #636366; vertical-align: 1px; }
.pille.an::before { background: var(--ok); }
.pille.sim::before { background: var(--warn); }
a.pille { color: var(--leise); }

/* ---------- Inhalt */
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 16px; overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; font-family: var(--titel); }
h1 { font-size: clamp(26px, 7.5vw, 34px); font-weight: 700; line-height: 1.12; letter-spacing: -.025em; margin-top: 4px; }
h2 { font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; margin: 28px 0 10px; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0 0 12px; max-width: 68ch; }
.leise { color: var(--leise); }
.klein { font-size: 15px; }

/* Lieferungs-Kopf */
.schild { background: var(--karte); border-radius: var(--rund); padding: 16px; }
.schild .kunde { font: 700 28px/1.12 var(--titel); letter-spacing: -.02em; margin: 2px 0 4px; }
.zaehler { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.zaehler div { background: var(--platte); border-radius: var(--rund-klein); padding: 10px; }
.zaehler b { display: block; font: 700 28px/1 var(--titel); letter-spacing: -.02em; }
.zaehler span { display: block; font-size: 13px; line-height: 1.25; color: var(--leise); hyphens: manual; margin-top: 4px; }
.zaehler .waschen b { color: var(--waschen); }
.zaehler .blasentausch b { color: var(--blasentausch); }
.zaehler .pruefung b { color: var(--pruefung); }

/* Liste der IBCs: gruppierte Liste mit Trennlinien */
.liste { list-style: none; margin: 0; padding: 0; background: var(--karte); border-radius: var(--rund); overflow: hidden; }
.liste > li + li { border-top: .5px solid var(--linie); margin-left: 16px; }
.liste > li + li > a, .liste > li + li > .zeile { margin-left: -16px; }
.liste a {
  display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 16px; color: inherit; min-height: 80px;
}
.liste a:active { background: var(--platte); }
.liste img, .liste .ohnefoto { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; background: var(--platte); }
.liste .titel { font-weight: 600; }
.liste .unter { font-size: 15px; color: var(--leise); }
.liste .rechts { text-align: right; font: 600 19px/1.1 var(--titel); }
.liste .rechts small { display: block; font: 400 13px var(--schrift); color: var(--leise); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.chip { font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--platte); color: var(--tinte); }
.chip.waschen { background: rgba(10, 132, 255, .18); color: #64B0FF; }
.chip.blasentausch { background: rgba(255, 159, 10, .18); color: #FFB340; }
.chip.pruefung { color: #C7C7CC; }
.chip.entsorgung { background: rgba(255, 69, 58, .18); color: #FF6961; }
.chip.warn { background: var(--warn-grund); color: var(--warn); }
.chip.laeuft { color: var(--leise); }

.leer { text-align: center; padding: 36px 16px; background: var(--karte); border-radius: var(--rund); color: var(--leise); }
.hinweise { background: var(--warn-grund); color: var(--warn); border-radius: var(--rund); padding: 12px 16px; margin: 12px 0; }
.hinweise ul { margin: 4px 0 0; padding-left: 18px; }
.hinweise a { color: inherit; text-decoration: underline; }
.fehlerbox { background: rgba(255, 69, 58, .14); color: #FF6961; border-radius: var(--rund); padding: 12px 16px; margin: 12px 0; }

/* ---------- Formulare */
.feld { display: grid; gap: 6px; margin-bottom: 14px; }
.feld > label, .feld > .lbl { font-size: 13px; font-weight: 400; color: var(--leise); display: flex; gap: 8px; align-items: center; padding-left: 4px; }
input[type=text], input[type=number], input[type=search], input[type=password], input:not([type]), select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; font: 400 17px var(--schrift); color: var(--tinte);
  background: var(--karte); border: 0; border-radius: var(--rund-klein); -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--leise) 50%), linear-gradient(135deg, var(--leise) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input::placeholder, textarea::placeholder { color: rgba(235, 235, 245, .3); }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 2px rgba(242, 241, 236, .5); }
textarea { min-height: 90px; }
.zwei { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.drei { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.unsicher input, .unsicher select, .unsicher .segment { box-shadow: inset 0 0 0 1.5px rgba(255, 214, 10, .7); }
.marke-unsicher { font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-grund); padding: 1px 7px; border-radius: 999px; }

/* Segmentierte Auswahl wie iOS */
.segment { display: flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--platte); }
.segment button {
  flex: 1; min-height: 44px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  font: 500 15px var(--schrift); color: var(--tinte); transition: background .15s;
}
.segment button[aria-pressed=true] { background: #636366; font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, .25); }

/* Häkchen als Schalter */
.haken {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; font-size: 17px;
  background: var(--karte); padding: 6px 16px; margin: 0;
}
.haken input {
  order: 2; flex: 0 0 auto; -webkit-appearance: none; appearance: none; width: 51px; height: 31px; margin: 0;
  border-radius: 999px; background: #39393D; position: relative; cursor: pointer; transition: background .2s;
}
.haken input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .3); transition: transform .2s;
}
.haken input:checked { background: var(--ok); }
.haken input:checked::after { transform: translateX(20px); }
.haken { border-radius: var(--rund); }
.haken + .haken { border-top: .5px solid var(--linie); border-top-left-radius: 0; border-top-right-radius: 0; }
.haken:has(+ .haken) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.dialog .haken { background: var(--platte); }
fieldset { border: 0; padding: 0; margin: 18px 0 8px; min-width: 0; }
legend { font: 400 13px var(--schrift); text-transform: uppercase; letter-spacing: .02em; color: var(--leise); margin: 22px 0 8px; padding: 0 0 0 16px; }
details { background: var(--karte); border-radius: var(--rund); padding: 0 16px; margin: 10px 0; }
details > summary { min-height: 50px; display: flex; align-items: center; font-size: 17px; cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid #5A5A5F; border-bottom: 2px solid #5A5A5F; transform: rotate(-45deg); transition: transform .2s; }
details[open] > summary::after { transform: rotate(45deg); }
details[open] > summary { border-bottom: .5px solid var(--linie); margin-bottom: 12px; }
details .feld input, details .feld textarea, details .feld select { background: var(--platte); }

/* Fotos aufnehmen */
.fotos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fotoplatz {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--rund); background: var(--karte);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px;
  cursor: pointer; overflow: hidden; padding: 8px;
}
.fotoplatz input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.fotoplatz b { font: 600 16px var(--schrift); }
.fotoplatz small { color: var(--leise); font-size: 13px; }
.fotoplatz svg { width: 28px; height: 28px; stroke: var(--akzent); }
.fotoplatz.gefuellt { padding: 0; }
.fotoplatz.gefuellt img { width: 100%; height: 100%; object-fit: cover; }
.fotoplatz.gefuellt .etikett { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; font-weight: 500; padding: 3px 9px; border-radius: 999px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.fotostreifen { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; margin-top: 12px; }
.fotostreifen a { flex: 0 0 auto; scroll-snap-align: start; }
.fotostreifen img { height: 150px; width: auto; border-radius: var(--rund-klein); }

.route-gross { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--rund); margin: 14px 0; font: 700 24px var(--titel); letter-spacing: -.02em; background: var(--karte); }
.route-gross::before { content: ""; flex: 0 0 12px; height: 12px; border-radius: 50%; background: currentColor; }
.route-gross small { display: block; font: 400 15px var(--schrift); letter-spacing: 0; color: var(--leise); }
.route-gross.waschen { color: var(--waschen); }
.route-gross.blasentausch { color: var(--blasentausch); }
.route-gross.pruefung { color: var(--pruefung); }
.route-gross.entsorgung { color: var(--entsorgung); }
.gewicht { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 6px; }
.gewicht .rest { background: var(--hell); color: #000; border-radius: var(--rund-klein); padding: 8px 12px; }
.gewicht .rest b { display: block; font: 700 26px var(--titel); letter-spacing: -.02em; }

.codes { font-size: 14px; color: var(--leise); word-break: break-all; }
.codes li { margin-bottom: 4px; }

/* ---------- Knöpfe und Aktionsleiste */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border-radius: var(--rund); border: 0; background: var(--platte); color: var(--tinte);
  font: 600 17px var(--schrift); letter-spacing: -.01em; cursor: pointer; width: 100%; white-space: nowrap;
  transition: opacity .15s, transform .1s;
}
.knopf:active { opacity: .7; }
.knopf.haupt { background: var(--hell); color: #000; }
.knopf.gefahr { background: rgba(255, 69, 58, .16); color: #FF6961; }
.knopf.flach { background: transparent; color: var(--akzent); font-weight: 400; min-height: 44px; white-space: normal; text-align: center; }
.knopf[disabled] { opacity: .35; cursor: not-allowed; }
.knopf svg { width: 21px; height: 21px; stroke: currentColor; }
.knoepfe { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 16px; }
.knoepfe .knopf { white-space: normal; text-align: center; line-height: 1.15; padding-top: 8px; padding-bottom: 8px; }

.aktionsleiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--kopf);
  border-top: .5px solid var(--linie);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.aktionsleiste:empty { display: none; }
.aktionsleiste > * { max-width: 728px; }
.aktionsleiste > .knopf { flex: 1 1 0; min-width: 0; padding: 0 12px; }
@media (min-width: 792px) { .aktionsleiste { justify-content: center; } .aktionsleiste > * { flex: 0 1 360px; } }

.meldung {
  position: fixed; left: 16px; right: 16px; top: calc(64px + env(safe-area-inset-top)); bottom: auto; z-index: 20; margin: 0 auto; max-width: 560px;
  background: rgba(44, 44, 46, .92); color: var(--tinte); padding: 13px 18px; border-radius: 16px; font-size: 15px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.meldung.fehler { background: rgba(120, 30, 26, .95); }

.lade { display: inline-block; width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: drehen .8s linear infinite; vertical-align: -3px; }
@keyframes drehen { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lade { animation-duration: 2.4s; } * { transition: none !important; } }

.balken { height: 4px; background: var(--platte); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.balken div { height: 100%; background: var(--hell); width: 0; transition: width .2s; }

.zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.zeile > .leise { white-space: nowrap; }
.verlauf a { grid-template-columns: minmax(0, 1fr) auto; min-height: 60px; }
.liste.verlauf > li > .zeile { padding: 10px 16px; min-height: 60px; }
.liste.verlauf > li > .zeile[style] { background: none !important; border: 0 !important; border-radius: 0 !important; }

@media (max-width: 380px) {
  .zaehler { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gewicht { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .gewicht .rest { grid-column: 1 / -1; }
  .drei { grid-template-columns: 1fr 1fr; }
  .marke span { font-size: 16px; }
  .marke img { width: 44px; height: 30px; }
  .pille { font-size: 11.5px; padding: 3px 8px; }
  h1 { font-size: 30px; }
}

/* Hinweis-Dialog (Datenschutz) als Blatt von unten */
.dialog-hinter { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; padding: 8px; }
.dialog { background: var(--karte); border-radius: 14px 14px 14px 14px; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); }
.dialog .knopf:not(.haupt):not(.flach) { background: var(--platte); }
.dialog-liste { padding-left: 18px; margin: 0 0 12px; font-size: 15px; }
.dialog-liste li { margin-bottom: 8px; }
@media (min-width: 600px) { .dialog-hinter { align-items: center; } }

/* Erkennung verbessern */
.lernbox { background: var(--karte); border-radius: var(--rund); padding: 16px; margin: 16px 0 0; }
.lernbox h3 { margin-bottom: 6px; }
.lernbox.offen { box-shadow: inset 0 0 0 1.5px var(--ok); }
.lernbox textarea { background: var(--platte); }
.lernbox .knopf { white-space: normal; }

/* Alle abgelesenen Daten: gruppierte Listen wie in den iOS-Einstellungen */
.abgelesen { margin: 18px 0; }
.abgelesen h2 { margin-top: 8px; }
.etikett-block { margin-bottom: 14px; }
.etikett-block h3 { font: 400 13px var(--schrift); text-transform: uppercase; letter-spacing: .02em; color: var(--leise); margin: 0 0 6px 16px; }
.etikett-block dl { margin: 0; background: var(--karte); border-radius: var(--rund); padding: 0 16px; display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); }
.etikett-block dt, .etikett-block dd { padding: 11px 0; border-top: .5px solid var(--linie); }
.etikett-block dt:first-of-type, .etikett-block dd:first-of-type { border-top: 0; }
.etikett-block dt { color: var(--leise); font-size: 15px; padding-right: 12px; }
.etikett-block dd { margin: 0; font-size: 15px; text-align: right; }
