/* Abnahmeprotokoll Ausschankwagen – mobil zuerst (iPhone), Esselmann-CI:
   Perlnachtblau #002554, Hellrotorange #EF7D00, Systemschriften (keine Font-Dateien). */
:root {
  --navy: #002554; --orange: #EF7D00; --grau: #C6C6C6;
  --bg: #F3F4F6; --karte: #fff; --text: #0A1628; --leise: #5B6573; --linie: #E3E6EA;
  --ok: #1E8E4E; --ok-bg: #E6F4EC; --fehler: #D64232; --fehler-bg: #FCEBE9; --na: #7A838F; --na-bg: #EEF0F2;
  --radius: 14px; --schatten: 0 1px 2px rgba(10, 22, 40, .06), 0 4px 16px rgba(10, 22, 40, .06);
  --unten: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); }
.versteckt { display: none !important; }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 12px;
}
.kopf .logo { height: 18px; width: auto; display: block; }
.kopf .titel { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .92; }
.kopf .zurueck { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; padding: 0 6px 0 0; cursor: pointer; }
.warteschlange {
  font-size: 12px; font-weight: 600; background: var(--orange); color: #fff; border-radius: 999px;
  padding: 3px 10px; white-space: nowrap;
}
.warteschlange.fehler { background: var(--fehler); }
.kopf nav { display: none; gap: 4px; }
.kopf nav a { color: #fff; text-decoration: none; opacity: .75; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.kopf nav a.aktiv { opacity: 1; background: rgba(255, 255, 255, .14); }
.versionshinweis { background: var(--orange); color: #fff; font-size: 13px; padding: 8px 16px; text-align: center; }

/* ---------- Tab-Leiste unten (Handy) ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--linie); display: flex; padding-bottom: var(--unten);
}
.tabs a {
  flex: 1; text-align: center; text-decoration: none; color: var(--leise); font-size: 11px; font-weight: 600;
  padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a.aktiv { color: var(--orange); }
.tabs .zahl { position: relative; }
.tabs .zahl b { position: absolute; top: -4px; right: -12px; background: var(--fehler); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 5px; }

main { max-width: 860px; margin: 0 auto; padding: 16px 16px calc(96px + var(--unten)); }
@media (min-width: 900px) {
  .tabs { display: none; }
  .kopf nav { display: flex; }
  main { padding-bottom: 48px; }
}

/* ---------- Grundbausteine ---------- */
h1 { font-size: 24px; margin: 4px 0 14px; color: var(--navy); letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 22px 0 10px; color: var(--navy); }
.leise { color: var(--leise); font-size: 14px; }
.karte { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten); padding: 14px 16px; margin-bottom: 12px; }
.zeile { display: flex; align-items: center; gap: 10px; }
.zeile.umbruch { flex-wrap: wrap; }
.wachsen { flex: 1; min-width: 0; }
.btn {
  appearance: none; border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600; font-size: 16px;
  background: var(--navy); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; text-decoration: none;
}
.btn.orange { background: var(--orange); }
.btn.hell { background: #E9ECF1; color: var(--navy); }
.btn.rot { background: var(--fehler-bg); color: var(--fehler); }
.btn.klein { padding: 7px 14px; min-height: 36px; font-size: 14px; }
.btn.voll { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.feld { display: block; margin-bottom: 12px; }
.feld > span { display: block; font-size: 13px; font-weight: 600; color: var(--leise); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--linie); background: #fff; border-radius: 10px; padding: 11px 12px; font-size: 16px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239, 125, 0, .18); }
textarea { min-height: 90px; resize: vertical; }
.hinweis { background: #FFF4E6; color: #7A4300; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.leer { text-align: center; color: var(--leise); padding: 28px 12px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; background: var(--na-bg); color: var(--na); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.rot { background: var(--fehler-bg); color: var(--fehler); }
.badge.orange { background: #FFF1E0; color: #B35C00; }
.badge.blau { background: #E5ECF5; color: var(--navy); }

.segment { display: flex; background: #E4E7EC; border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.segment button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 9px 6px; font-weight: 600; font-size: 14px; color: var(--leise); cursor: pointer; }
.segment button.aktiv { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.fortschritt { height: 6px; background: #E4E7EC; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.fortschritt i { display: block; height: 100%; background: var(--orange); border-radius: 999px; transition: width .25s; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--navy); }
.login .karte { width: 100%; max-width: 380px; padding: 28px 24px; }
.login .logo { height: 26px; display: block; margin: 0 auto 18px; }
.login h1 { text-align: center; font-size: 20px; }
.login .version { text-align: center; font-size: 12px; color: var(--leise); margin-top: 14px; }

/* ---------- Übersicht ---------- */
.abnahme-karte { display: block; text-decoration: none; color: inherit; }
.abnahme-karte .kopfzeile { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.abnahme-karte b { font-size: 17px; }
.abnahme-karte .zahlen { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Checkliste ---------- */
.bereich { background: #fff; border-radius: var(--radius); box-shadow: var(--schatten); margin-bottom: 12px; overflow: hidden; }
.bereich > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--navy); }
.bereich > summary::-webkit-details-marker { display: none; }
.bereich > summary::after { content: '›'; font-size: 22px; color: var(--leise); transform: rotate(90deg); transition: transform .2s; }
.bereich:not([open]) > summary::after { transform: rotate(0deg); }
.punkt { border-top: 1px solid var(--linie); padding: 12px 16px; }
.punkt .text { margin-bottom: 10px; }
.wahl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.wahl button {
  border: 1.5px solid var(--linie); background: #fff; border-radius: 10px; min-height: 44px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--leise);
}
.wahl button.ok.aktiv { background: var(--ok); border-color: var(--ok); color: #fff; }
.wahl button.mangel.aktiv { background: var(--fehler); border-color: var(--fehler); color: #fff; }
.wahl button.na.aktiv { background: var(--na); border-color: var(--na); color: #fff; }
.wahl button:disabled { cursor: default; }
.mangel-kurz { margin-top: 10px; background: var(--fehler-bg); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.mangel-kurz .zeile { align-items: flex-start; }
.mangel-kurz .nr { font-weight: 800; color: var(--fehler); font-size: 13px; }
.mini-fotos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.mini-fotos img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; background: #ddd; }
.link-btn { background: none; border: 0; color: var(--orange); font-weight: 700; padding: 8px 0 0; cursor: pointer; font-size: 14px; }

/* ---------- Belegfotos ---------- */
.raster { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .raster { grid-template-columns: repeat(3, 1fr); } }
.kachel {
  position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: var(--schatten);
  border: 2px dashed var(--grau); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--leise); font-weight: 600; font-size: 14px; text-align: center; padding: 6px;
}
.kachel svg { width: 30px; height: 30px; margin-bottom: 4px; color: var(--orange); }
.kachel.voll { border: 0; padding: 0; }
.kachel.voll img { width: 100%; height: 100%; object-fit: cover; }
.kachel .unterschrift-label { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); color: #fff; font-size: 13px; padding: 16px 8px 6px; text-align: left; }
.kachel .wartet { position: absolute; top: 6px; right: 6px; background: var(--orange); color: #fff; font-size: 11px; border-radius: 999px; padding: 2px 7px; }

/* ---------- Sheet (Dialog von unten) ---------- */
.sheet-hg { position: fixed; inset: 0; background: rgba(10, 22, 40, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: ein .15s; }
.sheet {
  background: var(--bg); width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(18px + var(--unten)); animation: hoch .2s ease-out;
}
.sheet .griff { width: 40px; height: 5px; border-radius: 3px; background: var(--grau); margin: 0 auto 10px; }
.sheet h2 { margin-top: 4px; }
.sheet .aktionen { display: flex; gap: 10px; margin-top: 14px; }
.sheet .aktionen .btn { flex: 1; }
@media (min-width: 700px) { .sheet-hg { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes ein { from { opacity: 0; } }
@keyframes hoch { from { transform: translateY(40px); opacity: .6; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1.5px solid var(--linie); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--leise); }
.chips button.aktiv { border-color: var(--navy); background: var(--navy); color: #fff; }
.foto-leiste { display: flex; gap: 10px; flex-wrap: wrap; }
.foto-leiste .f { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; background: #ddd; }
.foto-leiste .f img { width: 100%; height: 100%; object-fit: cover; }
.foto-leiste .f button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.foto-leiste .neu { width: 92px; height: 92px; border-radius: 10px; border: 2px dashed var(--orange); background: #FFF6EC; color: var(--orange); font-weight: 700; font-size: 13px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.foto-leiste .neu svg { width: 28px; height: 28px; }

/* Großansicht */
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 60; display: flex; flex-direction: column; }
.lightbox img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.lightbox .leiste { display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--unten)); justify-content: center; }

/* Unterschrift */
.unterschrift-feld { background: #fff; border: 1.5px solid var(--linie); border-radius: 12px; touch-action: none; width: 100%; height: 170px; display: block; }

/* ---------- Mängel (Produktionsleitung) ---------- */
.filter { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
@media (min-width: 700px) { .filter { grid-template-columns: 2fr 1fr 1fr; } }
.mangel-karte .titel { font-weight: 700; }
.mangel-karte .unter { font-size: 13px; color: var(--leise); margin-top: 2px; }
.mangel-karte .auswahl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.mangel-karte select { padding: 8px 10px; font-size: 14px; }

/* ---------- Vorlage ---------- */
.vl-bereich { background: #fff; border-radius: var(--radius); box-shadow: var(--schatten); padding: 12px; margin-bottom: 12px; }
.vl-zeile { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.vl-zeile input { padding: 8px 10px; font-size: 15px; }
.vl-zeile .ico { border: 0; background: #EEF0F3; border-radius: 8px; width: 34px; height: 34px; flex: none; cursor: pointer; font-size: 15px; color: var(--leise); }
.vl-zeile .ico.rot { color: var(--fehler); }
.vl-bereich .name input { font-weight: 700; color: var(--navy); }
.speichern-leiste { position: sticky; bottom: calc(66px + var(--unten)); background: rgba(243, 244, 246, .95); padding: 10px 0; display: flex; gap: 10px; align-items: center; }
@media (min-width: 900px) { .speichern-leiste { bottom: 0; } }

/* Tabelle Benutzer */
table.liste { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--schatten); }
table.liste td, table.liste th { padding: 10px 12px; border-bottom: 1px solid var(--linie); text-align: left; font-size: 14px; }
table.liste th { font-size: 12px; text-transform: uppercase; color: var(--leise); letter-spacing: .04em; }

#toast { position: fixed; left: 50%; bottom: calc(84px + var(--unten)); transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
#toast div { background: rgba(10, 22, 40, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; animation: ein .2s; }
#toast div.fehler { background: var(--fehler); }
