:root {
  --bg: #f3f5f8; --card: #fff; --ink: #14202e; --muted: #5d6b7a; --line: #d9dfe6;
  --brand: #16324f; --brand2: #1f5f99;
  --ok: #157f3b; --ok-bg: #e3f5e9; --warn: #8a5a00; --warn-bg: #fff3d6; --err: #b3261e; --err-bg: #fde7e5;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px 40px; }
a { color: var(--brand2); }
h2 { font-size: 1.05rem; margin: 22px 0 8px; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.muted { color: var(--muted); font-size: .9rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* Kopfzeile */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; background: var(--brand); color: #fff; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.top h1 { font-size: 1.15rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { color: #fff; text-decoration: none; font-size: 2rem; line-height: 1; padding: 0 8px 4px 0; }
.badge-link { background: #e8a317; color: #1a1a1a; border-radius: 99px; min-width: 30px; height: 30px; display: grid; place-items: center; font-weight: 700; text-decoration: none; padding: 0 8px; }

/* Start */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 12px; min-height: 104px; text-decoration: none; color: var(--ink); font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.tile.scan { background: var(--brand2); color: #fff; border-color: var(--brand2); }
.tile .ico { font-size: 1.8rem; line-height: 1; }
.tile:active { transform: scale(.98); }
.pill { background: #e8a317; color: #1a1a1a; border-radius: 99px; padding: 0 8px; font-size: .85rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; }
.stats b { display: block; font-size: 1.3rem; }
.stats span { font-size: .8rem; color: var(--muted); }

/* Formulare */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h2 { margin-top: 0; }
.narrow { max-width: 420px; margin: 30px auto; }
label { display: block; font-weight: 600; margin-bottom: 12px; }
input[type=text], input[type=password], input[type=search], input[type=file], select {
  display: block; width: 100%; margin-top: 6px; font: inherit; padding: 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--brand2); box-shadow: 0 0 0 3px rgba(31,95,153,.2); }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 2px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; text-align: center; cursor: pointer; }
.btn.primary { background: var(--brand2); border-color: var(--brand2); color: #fff; }
.btn.warnbtn { background: #e8a317; border-color: #e8a317; color: #1a1a1a; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.big { display: block; width: 100%; padding: 14px; margin: 8px 0; font-size: 1.05rem; }
.btn:focus-visible { outline: 3px solid #e8a317; outline-offset: 2px; }
.msg { padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.msg.err { background: var(--err-bg); color: var(--err); }

/* Erfassung */
.status { border-radius: var(--radius); padding: 14px; font-weight: 700; font-size: 1.05rem; min-height: 56px; margin-bottom: 12px; transition: background .15s; }
.status.idle { background: #e6edf5; color: var(--brand); }
.status.busy { background: #e6edf5; color: var(--muted); }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.err { background: var(--err-bg); color: var(--err); }
.field { margin-bottom: 12px; }
.field label { margin-bottom: 4px; font-size: .9rem; color: var(--muted); }
.field .row { display: flex; gap: 8px; align-items: center; }
.field input { margin-top: 0; font-size: 1.35rem; font-family: ui-monospace, Menlo, Consolas, monospace; padding: 14px 12px; flex: 1; min-width: 0; }
.field input:disabled { background: #eef1f4; color: #9aa6b2; }
.unit { font-weight: 700; font-size: 1.3rem; color: var(--muted); }
.kbd { flex: 0 0 52px; height: 56px; font-size: 1.4rem; border-radius: 10px; border: 2px solid var(--line); background: #fff; cursor: pointer; }
.kbd.off { opacity: .45; text-decoration: line-through; }
.article { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--brand2); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; cursor: pointer; }
.confirm { background: var(--warn-bg); border: 2px solid #e8a317; border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.confirm p { margin: 0 0 6px; font-weight: 600; color: var(--warn); }
.confirm .row { display: flex; gap: 8px; }
.confirm .btn { margin: 0; }
.recent { list-style: none; padding: 0; margin: 0; }
.recent li { display: grid; grid-template-columns: auto auto 1fr; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.recent .t { color: var(--muted); }
.recent .v { font-family: ui-monospace, Menlo, Consolas, monospace; text-align: right; }
.recent .n { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent li.case .v { color: var(--err); }

/* Listen */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; align-items: center; }
.filters select, .filters input { margin: 0; }
.filters .chk { font-weight: 400; font-size: .9rem; margin: 0; display: flex; gap: 6px; align-items: center; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.l1 { display: flex; justify-content: space-between; gap: 8px; }
.sku { font-family: ui-monospace, Menlo, Consolas, monospace; }
.loc { color: var(--muted); font-size: .85rem; }
.name { font-size: .95rem; margin: 2px 0 6px; overflow-wrap: anywhere; }
.l3 { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: .88rem; font-family: ui-monospace, Menlo, Consolas, monospace; text-decoration: none; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.missing { background: #eceff3; color: var(--muted); font-family: inherit; }
.tag.invalid { background: var(--err-bg); color: var(--err); }
.tag small { font-family: system-ui, sans-serif; opacity: .8; margin-left: 4px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }
.case .actions { display: grid; gap: 8px; }
.warnbox { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px; }

@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: 180px 1fr auto auto; }
}

/* Lagerliste */
.tile.wide { grid-column: 1 / -1; min-height: 92px; background: #e8a317; border-color: #e8a317; color: #1a1a1a; }
.tile.wide .pill { background: #1a1a1a; color: #fff; font-size: 1rem; padding: 2px 10px; }
.tile small { font-weight: 400; font-size: .8rem; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.seg a { background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; text-decoration: none; color: var(--muted); font-size: .82rem; }
.seg a b { display: block; font-size: 1.25rem; color: var(--ink); }
.seg a.on { border-color: var(--brand2); background: #e6edf5; }
.progress { height: 8px; background: #e2e7ee; border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.progress span { display: block; height: 100%; background: var(--ok); }
.filters.one { grid-template-columns: 1fr auto; }
.stocklist li { padding: 0; }
.stocklist a { display: block; padding: 10px 12px; color: inherit; text-decoration: none; }
.stocklist a:active { background: #eef3f8; }
.place { font-size: 1.1rem; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--brand); }
.go { margin-left: auto; color: var(--brand2); font-weight: 600; font-size: .9rem; align-self: center; }
.preview { overflow-x: auto; margin: 8px 0; }
.preview table { border-collapse: collapse; font-size: .8rem; }
.preview td { border: 1px solid var(--line); padding: 4px 6px; white-space: nowrap; }
label.chk { display: flex; gap: 8px; align-items: center; font-weight: 400; }

/* Markierung "hat keine EAN" */
.tag.marked { background: #ece6f7; color: #5b3d99; font-family: inherit; }
.noean { margin: 4px 0 8px; }
.noean .btn { width: 100%; border-style: dashed; color: #5b3d99; border-color: #b9a7dc; }
.noean p { margin: 4px 0 0; }
.tile.stock { background: #e8a317; border-color: #e8a317; color: #1a1a1a; }
.tile.stock .pill { background: #1a1a1a; color: #fff; font-size: 1rem; padding: 2px 10px; }

/* Wo liegt's? */
.tile.where-tile { background: #157f3b; border-color: #157f3b; color: #fff; min-height: 84px; }
.where { border-left: 5px solid var(--ok); }
.where-loc { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 8px; }
.where-loc span { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.where-loc b { font-size: 2.2rem; line-height: 1.1; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--brand); }
.where-stock { margin: -2px 0 8px; font-size: .95rem; color: var(--warn); }
.warntxt { color: var(--err); }
.push-msg { margin: 6px 0 0; font-size: .8rem; overflow-wrap: anywhere; }
.actions { display: grid; gap: 8px; margin-top: 8px; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
