/* Mobil-Erfassung: große Bedienflächen, gut lesbar mit Handschuhen und bei schlechtem Licht. */
html, body { font-size: 16px; overscroll-behavior: none; }
body { padding-bottom: env(safe-area-inset-bottom); }
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bar); color: var(--bar-text); padding: 6px 10px; padding-top: calc(6px + env(safe-area-inset-top)); min-height: 48px; }
.bar-l { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.bar-l strong { font-size: 15px; }
.ctx { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-r { display: flex; align-items: center; gap: 8px; }
.bar .langsw { color: var(--bar-text); }
.iconbtn { background: transparent; border: 0; color: inherit; min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); }
.iconbtn.sq { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); min-width: 52px; }
.sync { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid rgba(255,255,255,.3); color: inherit; border-radius: var(--radius); padding: 3px 8px; min-height: 32px; font-size: 13px; }
.sync i { width: 10px; height: 10px; border-radius: 50%; background: #6fbf73; display: inline-block; }
.sync.pending i { background: var(--mark); }
.sync.offline i { background: #9aa0a6; }
.sync.error i { background: #e5534b; }

.scr { padding: 12px; max-width: 720px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.narrow { max-width: 420px; margin: 16px auto; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 6px; font-weight: 600; }
.small { font-size: 13px; }
.err { color: var(--err); font-weight: 500; }
.btn.big { min-height: 52px; font-size: 16px; padding: 8px 16px; }
.btn.wide { width: 100%; }
.langbig { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; margin-bottom: 14px; }
.langbig button { min-height: 46px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius); font-weight: 500; }
.langbig button[aria-pressed="true"] { background: var(--mark); border-color: var(--mark); color: #1b1d1f; }
#loginForm .btn.primary { width: 100%; margin-top: 6px; }
#loginForm input { min-height: 46px; font-size: 17px; }

.choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.choice { text-align: left; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius); padding: 12px 14px; }
.choice b { display: block; font-size: 16px; }
.choice span { font-size: 13px; color: var(--muted); }

.locbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%;
  background: var(--mark); color: #1b1d1f; border: 0; border-radius: var(--radius); padding: 10px 14px; text-align: left; min-height: 58px; }
.locbar .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.locbar .code { font-size: 24px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.locbar .chg { font-size: 13px; text-decoration: underline; }
.locbar.none { background: var(--err-soft); color: var(--err); }
.banner { margin-top: 8px; padding: 8px 12px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 14px; }

.scanrow { display: flex; gap: 8px; margin-top: 12px; }
.scaninput { flex: 1; min-height: 56px; font-size: 20px; border: 2px solid var(--accent); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

.item { margin-top: 12px; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 12px; }
.item-h { display: flex; justify-content: space-between; gap: 8px; }
.art { font-size: 20px; font-weight: 700; word-break: break-all; }
.name { font-size: 15px; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.qtyrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 8px; }
.qbtn { min-height: 60px; font-size: 26px; padding: 0; }
.qty { min-height: 60px; font-size: 30px; text-align: center; font-weight: 700; }
.qty.check { border: 3px solid var(--mark); background: var(--warn-soft); }
.unit { font-size: 15px; color: var(--muted); min-width: 30px; }
.qhint { margin: 6px 0 0; font-size: 14px; color: var(--warn); font-weight: 500; }
.row2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.codeinfo { font-size: 13px; }

.hist ul { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.hist li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.hist li:first-child { border-top: 0; }
.hist li .a { font-weight: 600; font-family: var(--mono); font-size: 14px; }
.hist li .q { font-weight: 700; text-align: right; font-size: 16px; }
.hist li .m { font-size: 12px; color: var(--muted); grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.hist li.cancelled { opacity: .5; } .hist li.cancelled .q { text-decoration: line-through; }
.hist li.empty { cursor: default; color: var(--muted); }

.cam { position: fixed; inset: 0; z-index: 100; background: #000; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame { position: absolute; border: 3px solid var(--mark); box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); border-radius: 4px; transition: all .15s; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px; padding-top: calc(10px + env(safe-area-inset-top)); }
.cam-mode { color: #fff; font-weight: 600; background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: var(--radius); }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); color: #fff; text-align: center; }
.cam-bottom p { background: rgba(0,0,0,.55); padding: 8px 10px; border-radius: var(--radius); margin: 0 0 10px; }
#camQtyBtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.bigcode { font-size: 34px; font-weight: 700; text-align: center; padding: 14px; background: var(--mark); color: #1b1d1f; border-radius: var(--radius); }
.ocrimg { width: 100%; max-height: 120px; object-fit: contain; background: #fff; border: 1px solid var(--border); }
.picklist { list-style: none; margin: 8px 0 0; padding: 0; max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.picklist li { padding: 10px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.picklist li:first-child { border-top: 0; }
.picklist li b { font-family: var(--mono); display: block; }
.picklist li:active, .picklist li:hover { background: var(--accent-soft); }
.editinfo { background: var(--surface-2); border: 1px solid var(--border); padding: 8px 10px; margin-bottom: 10px; font-size: 14px; border-radius: var(--radius); }
#editNote { margin-top: 4px; }
.df .sp { flex: 1; }
.menu { display: flex; flex-direction: column; gap: 8px; }
dialog .db .scaninput { width: 100%; margin-bottom: 8px; }
#camCodeBtns { display: grid; }
.picklist li .small { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }

/* Tastenfeld: große Tasten, auch mit Handschuh */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.keypad .key { min-height: 58px; font-size: 26px; font-weight: 600; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); border-radius: var(--radius); font-family: var(--mono); touch-action: manipulation; }
.keypad .key:active { background: var(--accent-soft); }
.keypad .key.del { font-size: 22px; }
.keypad .key.blank { visibility: hidden; }
dialog.full { max-width: min(520px, calc(100vw - 12px)); }
dialog.full .db { padding: 10px 12px; }
.tabsh { display: flex; padding: 0 !important; }
.tabb { flex: 1; min-height: 48px; border: 0; background: var(--surface-2); font-weight: 600; font-size: 16px; border-bottom: 3px solid transparent; }
.tabb.on { background: var(--surface); border-bottom-color: var(--accent); }
.pfx { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 6px; }
.pfx button { min-height: 54px; font-size: 20px; font-weight: 700; font-family: var(--mono); border: 2px solid var(--border-strong); background: var(--surface); border-radius: var(--radius); }
.pfx button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.numrow { display: flex; align-items: center; gap: 6px; margin-top: 10px; border: 2px solid var(--accent); border-radius: var(--radius); padding: 0 10px; background: var(--surface); }
.numpfx { font-size: 30px; font-weight: 700; color: var(--accent); }
.numdisp { border: 0 !important; font-size: 30px; font-weight: 700; letter-spacing: .12em; min-height: 56px; padding: 0; background: transparent; outline: none; }
.numhit { min-height: 44px; margin: 8px 0 0; font-size: 15px; display: flex; align-items: center; }
.numhit.ok { color: var(--ok); font-weight: 600; } .numhit.err { color: var(--err); }
#editPad .key { min-height: 50px; }

/* Alles ohne Scrollen auf dem Bildschirm: Größen richten sich nach der sichtbaren Höhe (dvh) */
dialog.full { max-height: 100dvh; height: auto; margin: auto; overflow: hidden; }
dialog.full[open] { display: flex; flex-direction: column; }
dialog.full .db { overflow: auto; }
#paneNum { display: flex; flex-direction: column; gap: 0; }
.tabx { min-width: 52px; border: 0; background: var(--surface-2); font-size: 20px; color: var(--muted); }
.pfx button { min-height: clamp(40px, 7dvh, 54px); font-size: clamp(17px, 2.6dvh, 20px); }
.numrow { margin-top: clamp(6px, 1.2dvh, 10px); }
.numpfx, .numdisp { font-size: clamp(24px, 4dvh, 30px); }
.numdisp { min-height: clamp(42px, 7dvh, 56px); }
.numhit { min-height: clamp(30px, 5dvh, 44px); margin: 4px 0 0; font-size: 14px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.keypad { gap: clamp(4px, .8dvh, 6px); margin-top: clamp(4px, 1dvh, 8px); }
.keypad .key { min-height: clamp(40px, 7.2dvh, 58px); font-size: clamp(20px, 3.2dvh, 26px); }
#numOk { margin-top: clamp(6px, 1.2dvh, 10px); min-height: clamp(44px, 7dvh, 52px); }
/* Während eine Position offen ist: nur das Nötige zeigen */
body.editing .actions, body.editing .hist, body.editing .banner, body.editing .scanrow { display: none; }
body.editing .scanrow { margin-top: 6px; }
body.editing .scaninput { min-height: 44px; font-size: 16px; }
body.editing .locbar { min-height: 44px; padding: 6px 12px; }
body.editing .locbar .code { font-size: 20px; }
.item { padding: 10px; }
.qty { min-height: clamp(46px, 7.5dvh, 60px); font-size: clamp(24px, 4dvh, 30px); }
.row2 { margin: clamp(4px, 1dvh, 10px) 0; }
#ocrBtn { min-height: 40px; }
#saveBtn { min-height: clamp(46px, 7dvh, 52px); }
body.editing .item { margin-top: 6px; }
.item .art { font-size: clamp(17px, 2.8dvh, 20px); }
.item .name { font-size: 14px; line-height: 1.25; max-height: 2.5em; overflow: hidden; }
.item .tags:empty { display: none; }
.qhint { margin-top: 4px; font-size: 13px; }
.pfx button { padding: 0; min-width: 0; }

/* Ziffernblock mit hoher OK-Taste rechts */
.keypad { grid-template-columns: repeat(4, 1fr); grid-auto-rows: clamp(42px, 7.4dvh, 60px); }
.keypad .key { min-height: 0; }
.keypad .key.enter { background: var(--accent); border-color: var(--accent); color: var(--accent-text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-family: var(--font); padding: 4px 2px; }
.keypad .key.enter .ok { font-size: clamp(24px, 4dvh, 32px); line-height: 1; }
.keypad .key.enter .lbl { font-size: 12px; font-weight: 600; line-height: 1.15; hyphens: none; overflow-wrap: anywhere; }
.keypad .key.enter:disabled { opacity: .35; }
#saveBtn, #numOk { display: none; }
#editPad { margin-bottom: 6px; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Nummernfeld: nur ein Rahmen (außen), keine zweite Fokus-Linie innen */
.numrow .numdisp:focus, .numrow .numdisp:focus-visible { outline: none; box-shadow: none; }
.numrow:focus-within { box-shadow: 0 0 0 2px var(--accent); }

/* Korrektur kompakt: Menge + Lagerplatz nebeneinander, OK im Tastenfeld */
.edh { display: flex; align-items: center; gap: 8px; padding: 0 0 0 12px !important; min-height: 46px; }
.edh > span { flex: 1; font-size: 15px; }
.btn.sm { min-height: 34px; padding: 4px 10px; font-size: 14px; }
#dlgEdit .db { padding: 8px 10px; }
.editinfo { padding: 6px 8px; margin-bottom: 6px; font-size: 13px; line-height: 1.3; }
.edrow { display: grid; grid-template-columns: 1.2fr 1fr; gap: 6px; }
.edrow label span { display: block; font-size: 12px; color: var(--muted); }
.edrow input { min-height: 44px; }
#editQty { font-size: 22px; min-height: 44px; }
#editReason { margin-top: 6px; min-height: 42px; }
#editNote { margin-top: 6px; }
#editErr { margin: 4px 0 0; font-size: 13px; }
/* Mengenfeld mit Kamera-Taste daneben */
.qtyrow { grid-template-columns: 1fr auto auto; }
.camq { min-width: 50px; min-height: clamp(46px, 7.5dvh, 60px); }
.codeinfo:empty { display: none; }
.codeinfo { margin-top: 4px; }
/* Sehr kleine Displays (4-Zoll-MDE) */
@media (max-height: 560px) {
  .bar { min-height: 42px; padding-top: 4px; padding-bottom: 4px; }
  .narrow { margin: 6px auto; }
  .card { padding: 12px; }
  h1 { font-size: 17px; margin-bottom: 8px; }
  .langbig { margin-bottom: 8px; } .langbig button { min-height: 40px; }
  #loginForm input { min-height: 40px; }
  label.f { margin-bottom: 6px; }
  .locbar { min-height: 46px; padding: 6px 12px; } .locbar .code { font-size: 20px; }
}
/* OK-Taste: Wort nie trennen, Schrift passt sich der Breite an */
.keypad .key.enter .lbl { font-size: clamp(10px, 3.3vw, 13px); white-space: nowrap; overflow-wrap: normal; max-width: 100%; overflow: hidden; }
/* Meldungen oben statt unten – das Tastenfeld bleibt frei */
#toast { top: calc(50px + env(safe-area-inset-top)); bottom: auto; }
#toast div { box-shadow: 0 2px 8px rgba(0,0,0,.35); }
