/* vapeapp-mobile - gemeinsames mobile-first Stylesheet (lokal, KEIN CDN).
   SUPERSET: Block 1 (Zeilen bis ~72) = Auth/Start/Login (unveraendert
   uebernommen, damit login.html/start.html unveraendert funktionieren).
   Block 2 = Ebene B: WE-/Inventur-Erfassung + Barcode-Scanner. Klassennamen
   sind kollisionsfrei zu Block 1 gewaehlt (Action-Buttons = .abtn, NICHT .btn). */

/* ==== Block 1: Auth / Start / Login (Bestand) ==== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  -webkit-text-size-adjust: 100%;
}
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}
h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; color: #94a3b8; font-weight: 600; }
.muted { color: #94a3b8; font-size: 0.9rem; }
.brand { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: #64748b; }

label { display: block; margin: 14px 0 6px; font-size: 0.95rem; color: #cbd5e1; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  font-size: 1.05rem;
  padding: 14px 12px;
  border: 1px solid #334155;
  border-radius: 12px;
  background: #1e293b;
  color: #f1f5f9;
}
input:focus, select:focus { outline: 2px solid #38bdf8; border-color: #38bdf8; }

.btn {
  display: block; width: 100%;
  font-size: 1.1rem; font-weight: 600;
  padding: 16px; margin-top: 18px;
  border: 0; border-radius: 12px;
  background: #2563eb; color: #fff;
  text-align: center; text-decoration: none;
  cursor: pointer;
}
.btn:active { background: #1d4ed8; }
.btn.secondary { background: #334155; }
.btn.ghost { background: transparent; border: 1px solid #334155; color: #cbd5e1; }

.kachel {
  display: block; text-decoration: none;
  padding: 30px 20px; margin-top: 16px;
  border-radius: 16px;
  background: #1e293b; border: 1px solid #334155;
  color: #f1f5f9;
}
.kachel .icon { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.kachel .titel { font-size: 1.25rem; font-weight: 700; }
.kachel .sub { color: #94a3b8; font-size: 0.9rem; margin-top: 4px; }
.kachel:active { background: #273449; }

.fehler {
  background: #7f1d1d; color: #fecaca;
  padding: 12px 14px; border-radius: 10px; margin: 14px 0;
  font-size: 0.95rem;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.topbar .filiale { font-weight: 700; color: #38bdf8; }
.topbar a.logout { color: #94a3b8; font-size: 0.85rem; text-decoration: none; }

/* ====================================================================
   Block 2: EBENE B - WE-/Inventur-Erfassung + Barcode-Scanner
   ==================================================================== */

/* Sticky Kopfzeile der Erfassungsseiten */
.appbar {
  position: sticky; top: 0; z-index: 5;
  background: #111827; border-bottom: 1px solid #334155;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px;
}
.appbar a.back { color: #94a3b8; text-decoration: none; font-size: 1.25rem; line-height: 1; }
.appbar a.back:active { color: #e2e8f0; }
.appbar .head { min-width: 0; }
.appbar .ttl { font-size: 1.05rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .sub { font-size: 0.8rem; color: #94a3b8; margin-top: 2px; }
.appbar .fil { margin-left: auto; font-size: 0.85rem; color: #94a3b8; white-space: nowrap; }

/* Inhaltsbreite der Erfassungsseiten etwas breiter + Platz fuer Bottom-Bar */
.page { max-width: 640px; margin: 0 auto; padding: 12px 10px 130px; }

.note { font-size: 0.82rem; color: #f59e0b; padding: 6px 4px; }
.empty { color: #94a3b8; text-align: center; margin-top: 60px; }

/* --- WE: Lieferungs-Liste --- */
a.lscard {
  display: block; text-decoration: none; color: inherit;
  background: #1e293b; border: 1px solid #334155;
  border-radius: 14px; padding: 14px 16px; margin-bottom: 12px;
}
a.lscard:active { background: #243247; }
.lscard .ls { font-size: 1.1rem; font-weight: 700; letter-spacing: .3px; }
.lscard .row { display: flex; gap: 8px; margin-top: 6px; font-size: .85rem; color: #94a3b8; flex-wrap: wrap; }
.badge { background: #0b3d2e; color: #22c55e; border-radius: 999px; padding: 2px 10px; font-weight: 600; }

/* --- WE: Positions-Checkliste --- */
.pos {
  background: #1e293b; border: 1px solid #334155;
  border-radius: 12px; padding: 10px 12px; margin-bottom: 9px;
}
.pos.hit { outline: 2px solid #22c55e; }
.pos .a { font-size: .95rem; font-weight: 600; line-height: 1.25; word-break: break-word; }
.pos .e { font-size: .78rem; color: #94a3b8; font-variant-numeric: tabular-nums; margin-top: 2px; }
.pos .ctl { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.soll { font-size: .8rem; color: #94a3b8; }

/* Stepper (WE) - grosse Touch-Ziele */
.stepper { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 48px; height: 48px; border-radius: 10px;
  border: 1px solid #334155; background: #0b1220; color: #f1f5f9;
  font-size: 1.5rem; line-height: 1; cursor: pointer; touch-action: manipulation;
}
.stepper button:active { background: #243247; }
.stepper input.ist {
  width: 70px; height: 48px; text-align: center; font-size: 1.2rem; font-weight: 700;
  border-radius: 10px; border: 1px solid #334155; background: #0b1220; color: #f1f5f9;
  padding: 0; -moz-appearance: textfield;
}
.stepper input.ist::-webkit-outer-spin-button,
.stepper input.ist::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* --- Inventur: freie Erfassung --- */
.entry { background: #1e293b; border: 1px solid #334155; border-radius: 14px; padding: 12px; }
.entry label { font-size: .78rem; color: #94a3b8; display: block; margin: 6px 2px 3px; }
.entry input {
  width: 100%; height: 52px; border-radius: 10px; border: 1px solid #334155;
  background: #0b1220; color: #f1f5f9; font-size: 1.1rem; padding: 0 12px;
}
.lk { font-size: .82rem; color: #94a3b8; min-height: 18px; margin: 6px 2px; }
.lk b { color: #a855f7; }
.lk .miss { color: #f59e0b; }
.rowb { display: flex; gap: 10px; margin-top: 10px; }
.rowb .abtn { flex: 1; }
.listhead { margin: 18px 4px 8px; font-size: .9rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; }
.item {
  display: flex; align-items: center; gap: 10px;
  background: #1e293b; border: 1px solid #334155;
  border-radius: 10px; padding: 9px 12px; margin-bottom: 7px;
}
.item .a { flex: 1; min-width: 0; }
.item .a .n { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .a .e { font-size: .75rem; color: #94a3b8; }
.item .q { font-size: 1.15rem; font-weight: 800; color: #a855f7; }

/* --- Bottom-Aktionsleiste (WE + Inventur) --- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; gap: 10px;
  max-width: 640px; margin: 0 auto;
  background: #111827; border-top: 1px solid #334155;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.abtn {
  flex: 1; border: none; border-radius: 12px;
  padding: 15px 12px; font-size: 1rem; font-weight: 700;
  cursor: pointer; color: #04140b; touch-action: manipulation;
}
.abtn.scan { background: #38bdf8; color: #03202e; }
.abtn.save { background: #64748b; color: #0b1220; }
.abtn.fin  { background: #22c55e; color: #04140b; }
.abtn.add  { background: #a855f7; color: #150421; }
.abtn:active { filter: brightness(.9); }

/* --- Kamera-Overlay --- */
.cam {
  position: fixed; inset: 0; background: #000; z-index: 20;
  display: none; flex-direction: column;
}
.cam video { flex: 1; object-fit: cover; width: 100%; }
.cam .reticle {
  position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%);
  width: 76%; max-width: 320px; aspect-ratio: 3 / 2;
  border: 3px solid rgba(255,255,255,.9); border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); pointer-events: none;
}
.cam .scan-status {
  position: absolute; left: 0; right: 0; bottom: 88px; text-align: center;
  color: #fff; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.8); padding: 0 16px;
}
.cam .cx { padding: 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: #111827; text-align: center; }
.cam .cx button { background: #ef4444; color: #fff; border: none; border-radius: 10px; padding: 12px 20px; font-weight: 700; cursor: pointer; }

/* --- Toast --- */
#toast, .toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: #0b3d2e; color: #22c55e;
  padding: 10px 16px; border-radius: 999px; font-weight: 600;
  max-width: 90%; text-align: center;
  opacity: 0; transition: opacity .2s; z-index: 30; pointer-events: none;
}
#toast.show, .toast.show { opacity: 1; }
.toast.warn { background: #422006; color: #fbbf24; }
.toast.err  { background: #7f1d1d; color: #fecaca; }

/* --- Abschluss-Dialog --- */
dialog {
  border: none; border-radius: 16px; background: #1e293b; color: #e2e8f0;
  max-width: 420px; width: 92%; padding: 0;
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog .h { padding: 16px; border-bottom: 1px solid #334155; font-weight: 700; }
dialog .b { padding: 16px; font-size: .95rem; line-height: 1.5; }
dialog .b .kw { display: block; margin-top: 8px; font-size: 1.3rem; font-weight: 800; color: #22c55e; letter-spacing: .5px; }
dialog .f { padding: 14px 16px; display: flex; gap: 10px; }
dialog .f a, dialog .f button {
  flex: 1; text-align: center; text-decoration: none; border: none;
  border-radius: 10px; padding: 12px; font-weight: 700; cursor: pointer;
}
dialog .f .dl { background: #22c55e; color: #04140b; }
dialog .f .ok { background: #334155; color: #e2e8f0; }

/* ====================================================================
   Block 3: EBENE 2 - Heute-Startseite (Sendungsspiegel + Zaehler-Kacheln)
   ==================================================================== */
.sendspiegel {
  background: #1e293b; border: 1px solid #334155;
  border-radius: 14px; padding: 12px 14px; margin-top: 8px;
}
.sendspiegel .sline { display: flex; align-items: center; gap: 8px; font-size: .95rem; font-weight: 600; margin: 6px 0; }
.sendspiegel .scount { min-width: 30px; text-align: center; border-radius: 999px; padding: 2px 8px; font-weight: 800; background: #0c4a6e; color: #38bdf8; }
.sendspiegel .scount.ok { background: #0b3d2e; color: #22c55e; }
.sendspiegel .srow { border-left: 2px solid #334155; margin: 4px 0 8px 14px; padding: 2px 0 2px 10px; }
.sendspiegel .sls { font-size: .9rem; font-weight: 600; }
.sendspiegel .slief { color: #94a3b8; font-weight: 400; margin-left: 8px; }
.sendspiegel .strk { font-size: .78rem; color: #94a3b8; font-variant-numeric: tabular-nums; word-break: break-all; }
.sendspiegel .sempty { color: #94a3b8; font-size: .9rem; padding: 4px 0; }
.kachel .kcount { float: right; background: #0c4a6e; color: #38bdf8; border-radius: 999px; padding: 3px 13px; font-size: 1rem; font-weight: 800; }
.kachel .kcount.zero { background: #1f2937; color: #64748b; }
#notif-btn { margin-top: 22px; }
