:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1c1f1d;
  --muted: #6b706c;
  --line: #e1e6ef;
  --accent: #1354e5;
  --accent-ink: #ffffff;
  --accent-soft: #e5edfd;
  --warn: #9a5b00;
  --warn-soft: #fbf0dc;
  --danger: #b3261e;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(28, 31, 29, .05), 0 6px 20px rgba(28, 31, 29, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
[hidden] { display: none !important; }
h1 { font-size: 30px; margin: 0 0 4px; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }

.wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; }
.wrap.narrow { max-width: 520px; }

.brand { text-align: center; padding: 40px 0 28px; }
.brand-logo { display: block; width: min(260px, 70vw); height: auto; margin: 0 auto 22px; }
.done-logo { display: block; width: 150px; height: auto; margin: 32px auto 0; opacity: .9; }
.brand-mark {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 32px;
}

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.label { display: block; font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.label:not(:first-child) { margin-top: 16px; }

.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px; background: #fff;
  padding: 12px 14px; font: inherit; color: inherit; outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.big { font-size: 20px; padding: 15px 16px; }

.btn {
  border: 0; border-radius: 14px; padding: 12px 18px; font: inherit; font-weight: 600;
  cursor: pointer; background: #e8ecf3; color: var(--ink); touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); padding: 10px 12px; }
.btn.light { background: rgba(255,255,255,.92); color: var(--ink); }
.btn.big { font-size: 20px; padding: 16px 22px; }
.btn.full { width: 100%; margin-top: 16px; }
.btn.round { width: 64px; height: 64px; border-radius: 50%; font-size: 30px; padding: 0; flex: none; }
.btn:disabled { opacity: .5; }

.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 4px 10px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow); width: 100%; text-align: left; border: 0; font: inherit; color: inherit;
}
button.row { cursor: pointer; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 14px; color: var(--muted); }
.row-qty { font-weight: 700; font-size: 20px; white-space: nowrap; }
.row-qty small { font-weight: 500; font-size: 14px; color: var(--muted); }
.row.pending { opacity: .75; }
.row .del { background: none; border: 0; color: var(--muted); font-size: 22px; padding: 6px 8px; cursor: pointer; }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: rgba(244, 246, 250, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 700; font-size: 20px; }
.topbar-sub { font-size: 14px; color: var(--muted); }
.sync.ok { color: var(--accent); }
.sync.pending { color: var(--warn); font-weight: 600; }

.scan-button {
  width: 100%; border: 0; border-radius: 24px; padding: 34px 20px; margin-top: 8px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 24px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; box-shadow: 0 10px 30px rgba(19, 84, 229, .25);
}
.scan-button:active { transform: scale(.99); }

.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 22px 0 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.search-row { display: flex; gap: 10px; margin-bottom: 10px; }

.article-card { padding-top: 22px; }
.art-name { font-size: 26px; line-height: 1.25; margin: 0 0 10px; letter-spacing: -.01em; }
.art-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-block; font-size: 14px; padding: 4px 10px; border-radius: 999px; background: #eaeef5; color: var(--muted); }
.tag.warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; margin-bottom: 10px; }
.notice { background: var(--warn-soft); color: #5e3a00; border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; font-size: 16px; }

.qty-row { display: flex; align-items: center; gap: 12px; }
.input.qty { text-align: center; font-size: 40px; font-weight: 700; padding: 10px; height: 76px; }
.unit-hint { text-align: center; margin-top: 12px; color: var(--muted); }
.unit-hint strong { color: var(--ink); font-size: 22px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; font: inherit; cursor: pointer; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.done-icon {
  width: 96px; height: 96px; border-radius: 50%; margin: 60px auto 20px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 52px;
}

/* Kamera */
.scanner { position: fixed; inset: 0; background: #000; z-index: 20; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; left: 50%; top: 45%; width: min(80vw, 520px); height: min(42vw, 260px); transform: translate(-50%, -50%);
  border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); border: 3px solid rgba(255, 255, 255, .9); overflow: hidden;
}
.scan-line { position: absolute; left: 8%; right: 8%; height: 2px; background: #7fb0ff; top: 50%; animation: sweep 1.8s ease-in-out infinite; }
@keyframes sweep { 0%, 100% { top: 15%; } 50% { top: 85%; } }
.scanner-hint { position: absolute; left: 0; right: 0; top: calc(45% + min(21vw, 130px) + 20px); text-align: center; color: #fff; font-weight: 600; }
.scanner-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 12px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.scanner-bar .btn { font-size: 20px; padding: 16px 28px; }

/* Dialog */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(20, 22, 21, .45); z-index: 30; display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--card); border-radius: 22px; width: min(100%, 480px); padding: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialog h3 { margin: 0 0 8px; font-size: 22px; }
.dialog p { margin: 0 0 8px; }
.dialog .confirm-qty { font-size: 44px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
.dialog .confirm-qty small { font-size: 22px; font-weight: 600; color: var(--muted); }
.dialog-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.dialog-actions .btn { font-size: 19px; padding: 15px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}
.toast.ok { background: var(--accent); }
.toast.err { background: var(--danger); }

@media (max-width: 420px) {
  .search-row .btn { padding: 15px 14px; }
  .topbar .btn.ghost { font-size: 15px; }
}

.banner {
  background: var(--warn-soft); color: #5e3a00; border-bottom: 1px solid #f0dcb5;
  padding: 12px 16px; font-size: 16px; display: flex; flex-direction: column; gap: 2px; text-align: center;
}
.btn.small { font-size: 14px; }
.banner.danger { background: #fde7e5; color: var(--danger); border-bottom-color: #f5c2bd; }
.row.failed { background: #fde7e5; }
.row.failed .row-sub strong { color: var(--danger); }

/* Als WebApp im Vollbild: Platz für Statusleiste/Kamera-Aussparung */
.topbar { padding-top: max(12px, env(safe-area-inset-top)); }
