/* Autoshop24 ERP Portal look (from customer screenshots) */
:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #111111;
  --muted: #8a8a8a;
  --line: #ececec;
  --line-2: #e5e5e5;
  --soft: #f7f7f7;
  --black: #111111;
  --ok-bg: #d8f5e4;
  --ok-ink: #1a7a45;
  --warn-bg: #ffe8b8;
  --warn-ink: #9a5b00;
  --bad-bg: #fde8e6;
  --bad-ink: #b42318;
  --r: 16px;
  --r-sm: 12px;
  --sh: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
  min-height: 100vh;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: #b0b0b0; opacity: 1; }

/* Top bar – white like ERP */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.appbar .brand-ic {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1.5px solid var(--ink);
  display: grid;
  place-items: center;
  font-size: 14px;
  flex: none;
}
.appbar .sep {
  width: 1px;
  height: 18px;
  background: var(--line-2);
  flex: none;
}
.appbar .t {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: transparent;
  font-size: 18px;
  flex: none;
  color: var(--ink);
}
.btn-appbar {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 8px;
  flex: none;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(36px + env(safe-area-inset-bottom));
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
  color: var(--ink);
}
.page-sub {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--sh);
  padding: 18px 16px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 10px;
}

/* Black primary button like ERP */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--black);
  color: #fff;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 15px;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.btn.block { display: flex; width: 100%; }
.btn.sec {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-2);
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  width: 100%;
  padding: 14px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 10px 14px; font-size: 14px; border-radius: 10px; }

/* Input row: field + black button */
.input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.input-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.input-row input:focus {
  outline: none;
  border-color: #ccc;
  box-shadow: 0 0 0 3px rgba(0,0,0,.04);
}
.input-row .btn { flex: none; border-radius: 12px; padding: 0 16px; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 16px;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: #ccc;
}

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash.error { background: var(--bad-bg); color: var(--bad-ink); }

/* Mode chips */
.mode-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mode-chip {
  flex: 1;
  min-width: 90px;
  text-align: center;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.mode-chip.on {
  border-color: var(--ink);
  background: var(--soft);
}
.mode-chip:active { transform: scale(.98); }

/* Ready-to-scan hero */
.scan-hero {
  text-align: center;
  padding: 28px 12px 8px;
}
.scan-hero .ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--soft);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  color: #666;
  font-size: 28px;
}
.scan-hero h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.scan-hero p {
  color: var(--muted);
  font-size: 14px;
  max-width: 280px;
  margin: 0 auto 18px;
  line-height: 1.45;
}

/* Recent scan list items */
.scan-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 8px;
  background: #fff;
}
.scan-item:last-child { margin-bottom: 0; }
.scan-item .left { flex: 1; min-width: 0; }
.scan-item .code {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin-bottom: 2px;
}
.scan-item .name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.scan-item .right {
  text-align: right;
  flex: none;
}
.scan-item .qty {
  font-size: 15px;
  font-weight: 700;
}
.scan-item .time {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* KV rows like Abholboxen / session */
.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.kv:last-of-type { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
}
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.grey { background: var(--soft); color: var(--muted); }

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

#reader, .reader-box {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  min-height: 240px;
  margin-bottom: 10px;
  position: relative;
}
/* Off: keep layout box for camera init, but collapse visually when unused */
.reader-box.is-off {
  min-height: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.reader-box.is-on {
  min-height: 240px;
  height: auto;
  margin-bottom: 10px;
  opacity: 1;
  pointer-events: auto;
  border: 1px solid #ddd;
}
.scan-result {
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--ok-bg);
  border: 1px solid #b8e8cc;
  color: var(--ink);
}
.scan-result.bad { background: var(--bad-bg); border-color: #f0c2bc; }
.scan-result.warn { background: var(--warn-bg); border-color: #f0d49a; }
.ean-big {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .02em;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

.wedge-hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
#wedge-input {
  position: absolute; left: -9999px; opacity: 0; height: 1px; width: 1px;
}
.choice-list button {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--line-2);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.choice-list button:active { background: var(--soft); border-color: #ccc; }

.menu-link {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  color: var(--ink);
}
.menu-link:last-child { border-bottom: 0; }
.menu-link .sub { display: block; font-weight: 500; color: var(--muted); font-size: 13px; margin-top: 2px; }

.cam-row { display: flex; gap: 8px; margin-top: 8px; }
.cam-row .btn { flex: 1; }
