@font-face { font-family: Inter; src: url(fonts/inter-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/inter-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
:root {
  --bg: #f3f4f1; --karte: #ffffff; --karte2: #eceee9; --linie: rgba(23, 32, 26, .12); --text: #17201a; --leise: #5b645d;
  --akzent: #0f5e66; --akzent-hell: #e0eeee; --gut: #1d7a46; --schlecht: #b8322a; --warn: #a86400; --r: 14px; --nav: 64px;
  --oben: env(safe-area-inset-top, 0px); --unten: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 400 16px/1.4 Inter, system-ui, sans-serif; overscroll-behavior: none; }
body { position: fixed; inset: 0; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
a { color: var(--akzent); }
#app { height: 100%; display: flex; flex-direction: column; }
.zahl, .wert, .zahlen b, .kacheln b, .stepper input { font-variant-numeric: tabular-nums; }

/* Kopf + Navigation */
.kopf { display: flex; align-items: center; gap: 10px; padding: calc(var(--oben) + 8px) 16px 8px; flex: none; background: var(--karte); border-bottom: 1px solid var(--linie); min-height: 56px; }
.kopf .marke { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.kopf .marke small { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--leise); white-space: nowrap; }
.kopf h1 { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.netz { font-size: 13px; color: var(--leise); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.netz i { width: 8px; height: 8px; border-radius: 50%; background: var(--gut); }
.netz.aus i { background: var(--warn); }
.zurueck { width: 44px; height: 44px; margin: -8px 0 -8px -12px; font-size: 22px; color: var(--akzent); }
.inhalt { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.platz { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 12px; width: 100%; }
nav.tabs { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--karte); border-top: 1px solid var(--linie); padding-bottom: var(--unten); }
nav.tabs button { height: var(--nav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; color: var(--leise); }
nav.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs button[aria-current="page"] { color: var(--akzent); font-weight: 600; }
nav.tabs button.scan-taste { position: relative; color: #fff; }
nav.tabs button.scan-taste::before { content: ''; position: absolute; top: -14px; left: 50%; width: 64px; height: 64px; margin-left: -32px; border-radius: 50%; background: var(--akzent); box-shadow: 0 6px 16px rgba(15, 94, 102, .35); border: 4px solid var(--bg); }
nav.tabs button.scan-taste svg, nav.tabs button.scan-taste span { position: relative; }
nav.tabs button.scan-taste svg { width: 28px; height: 28px; margin-top: -14px; }
nav.tabs button.scan-taste span { color: var(--akzent); font-weight: 600; margin-top: 6px; }

/* Kamera */
.cam { position: relative; flex: none; height: 38dvh; min-height: 220px; background: #000; overflow: hidden; color: #fff; }
.cam.klein { height: 26dvh; min-height: 170px; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam.pausiert video { opacity: .35; }
.ziel { position: absolute; border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.42); border: 2px solid rgba(255,255,255,.8); pointer-events: none; }
.ziel i { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #5fd3c8; box-shadow: 0 0 10px #5fd3c8; }
.ziel.treffer { animation: treffer .45s ease-out; }
@keyframes treffer { 0% { border-color: #6fe39a; box-shadow: 0 0 0 100vmax rgba(0,0,0,.42), inset 0 0 0 100px rgba(111,227,154,.35); } 100% { box-shadow: 0 0 0 100vmax rgba(0,0,0,.42), inset 0 0 0 100px rgba(111,227,154,0); } }
.cam-werkzeug { position: absolute; right: 10px; top: 10px; display: flex; gap: 8px; }
.cam-btn { min-width: 48px; height: 44px; padding: 0 12px; border-radius: 22px; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; font-weight: 600; }
.cam-btn.an { background: #fff; color: #111; }
.cam-status { position: absolute; left: 12px; right: 12px; bottom: 10px; text-align: center; font-size: 14px; }
.cam-status.leer { display: none; }
.cam-status.fehler { background: rgba(0,0,0,.8); color: #fff; padding: 10px 12px; border-radius: 10px; }

/* Bausteine */
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.leise { color: var(--leise); }
.klein { font-size: 14px; }
.btn { min-height: 52px; padding: 0 16px; border-radius: 12px; background: var(--karte); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--linie); text-decoration: none; color: inherit; text-align: center; }
.btn.haupt { background: var(--akzent); color: #fff; border-color: transparent; }
.btn.gefahr { background: transparent; color: var(--schlecht); border-color: rgba(184,50,42,.45); }
.btn.voll { width: 100%; }
.btn:disabled { opacity: .5; }
.btn.klein { min-height: 44px; font-size: 14px; padding: 0 12px; }
.feld { width: 100%; height: 52px; padding: 0 14px; border-radius: 12px; background: var(--karte); border: 1px solid var(--linie); outline: none; }
select.feld { appearance: auto; }
.feld:focus, .stepper input:focus { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-hell); }
label.beschr { display: block; font-size: 13px; color: var(--leise); margin-bottom: 4px; }
.zeile2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.zeile3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 44px; padding: 0 16px; border-radius: 22px; background: var(--karte); border: 1px solid var(--linie); font-size: 14px; }
.chips.voll { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.chips.voll .chip { padding: 0 4px; min-width: 0; }
.chip[aria-pressed="true"] { background: var(--akzent); color: #fff; border-color: transparent; font-weight: 600; }
.leer { padding: 28px 12px; text-align: center; color: var(--leise); }
.schild { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--karte2); white-space: nowrap; }
.schild.gut { color: var(--gut); background: #e3f2e8; } .schild.schlecht { color: var(--schlecht); background: #f8e5e3; } .schild.warn { color: var(--warn); background: #fbefd9; }
.hinweis { background: var(--akzent-hell); border-radius: 12px; padding: 10px 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.hinweis .mitte { flex: 1; min-width: 0; }
.formular { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 10px; }
.formular .breit { grid-column: 1 / -1; }

/* Artikel */
.artikel h2 { font-size: 18px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.artikel .meta { font-size: 14px; color: var(--leise); margin-top: 4px; overflow-wrap: anywhere; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.code { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--karte2); font-variant-numeric: tabular-nums; }
.code.fehlt { background: #fbefd9; color: var(--warn); font-weight: 600; }
.zahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
.zahlen > div { background: var(--karte2); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.zahlen b { display: block; font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zahlen .gross b { font-size: 26px; color: var(--akzent); }
.zahlen .gross.minus b { color: var(--schlecht); }
.zahlen .gross.knapp b { color: var(--warn); }
.zahlen span { font-size: 12px; color: var(--leise); }
.aktionen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.aktionen .btn { padding: 0 2px; font-size: 13px; min-height: 58px; flex-direction: column; gap: 0; }
.aktionen .btn b { font-size: 20px; line-height: 1.1; }
.fehlkarte { border-color: rgba(184,50,42,.45); }
.fehlkarte h2 { color: var(--schlecht); font-size: 17px; }
.liste { display: flex; flex-direction: column; }
.liste > button, .liste > div.z { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 2px; border-bottom: 1px solid var(--linie); text-align: left; min-height: 60px; }
.liste > button:active { background: var(--karte2); }
.liste .mitte { flex: 1; min-width: 0; }
.liste .titel { font-weight: 600; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.liste .unter { font-size: 13px; color: var(--leise); display: block; overflow-wrap: anywhere; }
.liste .wert { font-size: 17px; font-weight: 600; white-space: nowrap; text-align: right; }
.liste .wert small { display: block; font-size: 12px; font-weight: 400; color: var(--leise); }
.wert.minus, .liste .wert.minus { color: var(--schlecht); } .wert.plus, .liste .wert.plus { color: var(--gut); } .wert.knapp { color: var(--warn); }
.liste .aktion { flex: none; display: flex; gap: 6px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.kacheln div { background: var(--karte); border: 1px solid var(--linie); border-radius: 12px; padding: 10px; min-width: 0; }
.kacheln b { display: block; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.kacheln span { font-size: 12px; color: var(--leise); }
.banner { background: var(--akzent-hell); padding: 10px 16px; display: flex; align-items: center; gap: 10px; flex: none; }
.banner .mitte { flex: 1; min-width: 0; }
.banner .titel { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; padding: 6px 0; }
.check input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--akzent); }
.verlauf .z { min-height: 0; }
.mehr-laden { margin-top: 8px; }

/* Blatt von unten */
#blatt { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: rgba(10,16,12,.45); }
.blatt { width: 100%; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 20px 20px 0 0; padding: 18px 16px calc(16px + var(--unten)); display: flex; flex-direction: column; gap: 14px; }
.blatt h2 { font-size: 18px; font-weight: 600; line-height: 1.25; }
.stepper { display: grid; grid-template-columns: 72px 1fr 72px; gap: 10px; }
.stepper button { height: 72px; border-radius: 14px; background: var(--karte); font-size: 30px; font-weight: 600; border: 1px solid var(--linie); }
.stepper input { height: 72px; text-align: center; font-size: 30px; font-weight: 600; background: var(--karte); border: 1px solid var(--linie); border-radius: 14px; width: 100%; min-width: 0; outline: none; }
.vorschau { text-align: center; color: var(--leise); font-size: 15px; min-height: 21px; }
.vorschau b { color: var(--text); }
.gross-code { font-size: 24px; font-weight: 600; letter-spacing: .04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav) + var(--unten) + 18px); z-index: 30; display: flex; flex-direction: column; gap: 8px; pointer-events: none; align-items: center; }
#toast div { background: #1d2620; color: #fff; padding: 12px 14px; border-radius: 12px; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 520px; width: 100%; }
#toast div.gut { border-left: 5px solid #6fe39a; } #toast div.schlecht { border-left: 5px solid #ff8a7d; }

.anmelden { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 24px; max-width: 420px; width: 100%; margin: 0 auto; }
.anmelden .logo { width: 72px; height: 72px; margin: 0 auto 6px; border-radius: 18px; }
.anmelden h1 { font-size: 22px; font-weight: 600; text-align: center; }
.anmelden p.unter { text-align: center; color: var(--leise); margin-top: -6px; margin-bottom: 8px; }
.fehltext { color: var(--schlecht); font-size: 14px; min-height: 20px; text-align: center; }

/* Großer Bildschirm: Navigation links, Inhalt mittig, Blätter als Dialog */
@media (min-width: 1000px) {
  #app { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: auto 1fr; }
  .kopf { grid-column: 2; grid-row: 1; padding-left: 32px; padding-right: 32px; }
  .inhalt { grid-column: 2; grid-row: 2; }
  .inhalt > .platz, .inhalt > .banner { max-width: 980px; margin: 0 auto; }
  .inhalt > .cam { width: min(980px, 100% - 64px); margin: 16px auto 0; border-radius: 16px; height: 300px; flex: none; }
  nav.tabs { grid-column: 1; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; border-top: 0; border-right: 1px solid var(--linie); }
  nav.tabs::before { content: 'Nahkauf Leineberg'; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--leise); padding: 4px 12px 14px; }
  nav.tabs button { flex-direction: row; justify-content: flex-start; height: 48px; padding: 0 12px; gap: 12px; font-size: 15px; border-radius: 10px; order: 2; }
  nav.tabs button[aria-current="page"] { background: var(--akzent-hell); }
  nav.tabs button.scan-taste { order: 1; background: var(--akzent); color: #fff; margin-bottom: 10px; }
  nav.tabs button.scan-taste::before { display: none; }
  nav.tabs button.scan-taste svg { width: 24px; height: 24px; margin: 0; }
  nav.tabs button.scan-taste span { color: #fff; margin: 0; }
  .liste.raster { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
  #blatt { align-items: center; justify-content: center; }
  .blatt { max-width: 600px; border-radius: 20px; max-height: 86vh; }
  #toast { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { .ziel.treffer { animation: none; } }
.mittig { text-align: center; }
.check.karte { flex-direction: row; }
