:root {
  --blue: #0b5394;
  --blue-d: #073763;
  --bg: #f3f5f7;
  --card: #ffffff;
  --ink: #1a2430;
  --muted: #6b7785;
  --line: #dfe4ea;
  --ok: #1e8e3e;
  --warn: #b9770e;
  --err: #c0392b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 17px;
}
#topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--blue); color: #fff; padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
}
#topbar .brand { font-weight: 700; }
#topbar .right { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.net { color: #7CFC9B; font-size: 12px; }
.net.off { color: #ffd24d; }

main { padding: 16px; max-width: 760px; margin: 0 auto; }
.view { display: flex; flex-direction: column; gap: 14px; }
.view.center { min-height: 70vh; justify-content: center; }
h1, h2 { margin: 0 0 4px; }

.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-size: 14px; color: var(--muted); }
input, select, textarea {
  font-size: 18px; padding: 14px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink); width: 100%;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

/* Geführte Schritte + Ja/Nein-Schalter */
.step { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.step .q { font-weight: 700; font-size: 16px; }
.step table.pos { border: none; }
.seg { display: flex; gap: 10px; }
.seg button { flex: 1; padding: 16px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 700; font-size: 18px; }
.seg button.active[data-v="ja"]   { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg button.active[data-v="nein"] { background: #8b95a1; border-color: #8b95a1; color: #fff; }
#retoureSub { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
#retoureSub[hidden] { display: none; }
.subq { font-weight: 600; font-size: 14px; }
.req { color: var(--err); font-weight: 700; }
.opt { color: var(--muted); font-weight: 400; font-size: 14px; }
.savehint { background: #fdecea; color: var(--err); border: 1px solid #f5c6c0; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
/* PIN maskieren ohne type=password → kein Passwortmanager-Autofill */
.pinmask { -webkit-text-security: disc; text-security: disc; letter-spacing: .3em; }

button { font-size: 17px; border: none; border-radius: 12px; padding: 14px 16px; cursor: pointer; }
button.primary { background: var(--blue); color: #fff; font-weight: 600; }
button.primary:disabled { background: #9bb4ce; }
button.ghost { background: #fff; color: var(--blue); border: 1px solid var(--line); }
button.link { background: transparent; color: var(--blue); }
button.big { padding: 18px; font-size: 19px; }
button.block { width: 100%; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card .row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; }
.card .row.big strong { font-size: 28px; color: var(--blue); }
.summary .row span { color: var(--muted); }

.card.head .kunde { font-weight: 700; font-size: 19px; }
.card.head .ls { color: var(--muted); font-size: 14px; margin-top: 4px; }
.warn { color: var(--warn); margin-top: 8px; font-size: 14px; }

table.pos { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
table.pos th, table.pos td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
table.pos th.num, table.pos td.num { text-align: right; width: 70px; }
table.pos .artbez { font-weight: 600; }
table.pos .artnr { color: var(--muted); font-size: 12px; }
table.pos input.qty { width: 72px; text-align: right; padding: 10px; font-size: 18px; }
table.pos tr.dev input.qty { border-color: var(--err); }
table.pos tr.dev .artbez::after { content: " ⚠"; color: var(--err); }
.soll { color: var(--muted); }

.check { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.check.big { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.check input { width: 26px; height: 26px; }

.signlabel { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
canvas.sign { width: 100%; height: 180px; background: #fff; border: 1px dashed var(--blue); border-radius: 12px; touch-action: none; }
.signrow { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

.hint { color: var(--muted); font-size: 14px; }
.hint code { background: #e7edf3; padding: 2px 6px; border-radius: 6px; }
.err { color: var(--err); min-height: 20px; }

.scanwrap { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 3/4; }
.scanwrap video { width: 100%; height: 100%; object-fit: cover; }
.scanframe { position: absolute; inset: 18% 14%; border: 3px solid #fff; border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }

/* Tour-Liste */
.card.tour { padding: 12px; }
.tourhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.stop { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.stop:first-of-type { border-top: none; }
.stop .ord { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex: 0 0 auto; }
.stop.done .ord { background: var(--ok); }
.stop.done { opacity: .65; }
.stop .info { flex: 1; min-width: 0; }
.stop .info .k { font-weight: 600; }
.stop .info .m { color: var(--muted); font-size: 13px; }
.stop .chev { color: var(--muted); font-size: 22px; }

.item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.item .ik { font-weight: 600; display: flex; justify-content: space-between; }
.item .im { color: var(--muted); font-size: 13px; margin-top: 4px; }
.item .badge { font-size: 12px; padding: 2px 8px; border-radius: 20px; }
.badge.ok { background: #e6f4ea; color: var(--ok); }
.badge.local { background: #fff3e0; color: var(--warn); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 30px;
  font-size: 15px; z-index: 50; max-width: 90%;
}
