:root {
  --ink: #191919; --paper: #fff; --mist: #f3f2ef; --line: #d6d6d6; --muted: #6d6d6d;
  --amber: #efa81a; --amber-deep: #d18f0b; --amber-wash: #fdf3dc;
  --ok: #2c7a3f; --ok-wash: #e3f1e6; --bad: #b9290c; --bad-wash: #fbe5df;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--mist); -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.brand { font-weight: 800; letter-spacing: .04em; }
.brand span { color: var(--amber); }

/* Anmeldung */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--ink); }
.login-box { width: 100%; max-width: 340px; background: var(--paper); border-radius: var(--radius); padding: 24px; display: grid; gap: 14px; }
.login-box .brand { font-size: 20px; }
.login-box label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.login-box input { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 16px; color: var(--ink); }
.login-box button { padding: 11px; border: 0; border-radius: var(--radius); background: var(--amber); font-weight: 700; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.error { margin: 0; color: var(--bad); font-size: 14px; min-height: 1em; }

/* Kopf */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  min-height: 52px; background: var(--ink); color: #fff; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 0; color: #bbb; padding: 15px 10px; border-bottom: 3px solid transparent; font-weight: 600; }
.tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--amber); }
.tabs b { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--amber); color: var(--ink); font-size: 12px; text-align: center; }
.tabs b:empty { display: none; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon { background: none; border: 1px solid #444; color: #fff; border-radius: var(--radius); width: 34px; height: 34px; font-size: 18px; line-height: 1; }
.link { background: none; border: 0; color: #bbb; font-size: 13px; }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* Packen */
.order { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; transition: opacity .3s; }
.order.done { opacity: .35; }
.order-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.order-head .nr { font-weight: 800; font-size: 17px; }
.order-head .meta { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--mist); font-size: 12px; font-weight: 600; }
.badge.pickup { background: var(--amber-wash); color: #7a5306; }
.order-body { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px 24px; margin-top: 10px; }
.addr { font-size: 14px; line-height: 1.45; }
.addr .muted, .muted { color: var(--muted); }
.items { list-style: none; margin: 0; padding: 0; }
.items li { padding: 3px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.items li:last-child { border-bottom: 0; }
.items .qty { font-weight: 800; min-width: 2.2em; }
.items .nr { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.comment { margin-top: 10px; padding: 8px 10px; background: var(--amber-wash); border-radius: var(--radius); font-size: 14px; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.actions input { flex: 1 1 220px; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.btn { padding: 9px 16px; border: 0; border-radius: var(--radius); background: var(--ink); color: #fff; font-weight: 700; }
.btn.confirm { background: var(--amber); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
.waiting { margin-top: 20px; }
.waiting summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.waiting summary b { font-weight: 600; color: var(--muted); }
.wait-row { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; font-size: 14px; }
.wait-row .age.old { color: var(--bad); font-weight: 700; }

/* Bestand */
.toolbar { display: flex; gap: 12px; align-items: center; }
.toolbar input[type=search] { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 16px; background: var(--paper); }
.check { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); white-space: nowrap; }
.help { font-size: 13px; color: var(--muted); margin: 8px 0 12px; }
kbd { font: 12px ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--paper); }
table.stock { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stock th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--mist); }
.stock td { padding: 5px 12px; border-bottom: 1px solid #ececec; vertical-align: middle; }
.stock tr:last-child td { border-bottom: 0; }
.stock tr.inactive td { color: var(--off, #8a8a8a); }
.stock td.nr { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); white-space: nowrap; }
.stock td.unit { white-space: nowrap; color: var(--muted); }
.num, .stock th.num { text-align: right; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); font-size: 18px; line-height: 1; }
.stepper input { width: 64px; padding: 6px 8px; text-align: right; border: 1px solid var(--line); border-radius: var(--radius); font-weight: 700; font-variant-numeric: tabular-nums; background: var(--paper); transition: background .4s, border-color .4s; }
.stepper input:focus { outline: 2px solid var(--amber); outline-offset: 0; border-color: var(--amber); }
.stepper input.zero { color: var(--bad); }
.stepper input.low { color: var(--amber-deep); }
.stepper input.saving { background: var(--mist); }
.stepper input.saved { background: var(--ok-wash); border-color: var(--ok); }
.stepper input.failed { background: var(--bad-wash); border-color: var(--bad); }
.conflict { display: block; font-size: 12px; color: var(--bad); text-align: right; }

.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: var(--radius); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); z-index: 10; }
.toast.show { opacity: 1; }
.toast.bad { background: var(--bad); }

/* Handy */
@media (max-width: 700px) {
  .bar { gap: 8px; padding: 0 8px; flex-wrap: wrap; }
  .bar > .brand { display: none; }
  .tabs button { padding: 14px 8px; }
  .link span { display: none; }
  main { padding: 10px; }
  .order-body { grid-template-columns: 1fr; }
  .help { display: none; }
  table.stock thead { display: none; }
  .stock, .stock tbody, .stock tr, .stock td { display: block; }
  .stock tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name step" "meta step"; padding: 8px 10px; border-bottom: 1px solid #ececec; }
  .stock td { padding: 0; border: 0; }
  .stock td.name { grid-area: name; font-weight: 600; }
  .stock td.nr { grid-area: meta; font-size: 12px; }
  .stock td.unit { display: none; }
  .stock td.nr::after { content: attr(data-unit); margin-left: 8px; font-family: system-ui, sans-serif; }
  .stock td.num { grid-area: step; align-self: center; }
  .stepper button { width: 40px; height: 40px; }
  .stepper input { width: 58px; height: 40px; font-size: 17px; }
}
