/* Werkstattsystem – mobil zuerst. Farben als Tokens; Signalgelb nur für die Hauptaktion. */
:root {
  --bg: #ecede8;
  --surface: #ffffff;
  --ink: #1c2429;
  --muted: #566269;
  --line: #c6cccf;
  --primary: #0d5563;
  --primary-ink: #ffffff;
  --signal: #ffc20e;
  --signal-ink: #1c2429;
  --danger: #b3261e;
  --ok: #1d6b3a;
  --warn-bg: #fff4d1;
  --focus: #1a5fd1;
  --radius: 10px;
  --tap: 52px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.right { margin-left: auto; }

/* Rahmen: Kopf, Inhalt, Navigation */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--primary); color: var(--primary-ink);
  padding: calc(8px + var(--safe-t)) 14px 8px; display: flex; align-items: center; gap: 10px; min-height: 52px;
}
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .back { color: inherit; background: transparent; border: 0; font-size: 1rem; min-height: 44px; min-width: 44px; padding: 0 6px; cursor: pointer; }
.banner { padding: 10px 14px; font-weight: 600; text-align: center; }
.banner.offline { background: var(--danger); color: #fff; }
.banner.update { background: var(--signal); color: var(--signal-ink); display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 14px 14px calc(var(--nav-h) + var(--safe-b) + 28px); }
/* Navigation: unten vier Tabs (Smartphone), ab 900 px Seitenleiste. Beide Darstellungen stehen im DOM, CSS blendet eine aus. */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.nav-side { display: none; }
.nav-tabs { display: flex; width: 100%; }
.nav-tabs a {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--nav-h); text-decoration: none; color: var(--muted); font-size: .8rem; font-weight: 600;
}
.nav a svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current="page"] { color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }
.nav a.cta { color: var(--signal-ink); }
.nav a.cta span.disc { background: var(--signal); border-radius: 50%; width: 46px; height: 46px; display: grid; place-items: center; margin-top: -16px; border: 3px solid var(--surface); }
.nav a.cta[aria-current="page"] { box-shadow: none; }

@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .nav { position: sticky; top: 0; height: 100dvh; flex-direction: column; width: 230px; border-top: 0; border-right: 1px solid var(--line); padding: 14px 0; justify-content: flex-start; flex: none; order: -1; }
  .nav-tabs { display: none; }
  .nav-side { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
  .nav-group { display: flex; flex-direction: column; }
  .nav-bottom { margin-top: auto; }
  .nav-label { padding: 14px 20px 4px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
  .nav-side a { flex: none; display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; padding: 0 20px; min-height: 48px; font-size: 1rem; text-decoration: none; color: var(--muted); font-weight: 600; }
  .nav-side a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--primary); background: #eef3f4; }
  .nav-side a.cta span.disc { margin: 0; width: 34px; height: 34px; border: 0; }
  .nav-side a svg { width: 22px; height: 22px; }
  .content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  main { padding-bottom: 40px; }
  .topbar { position: static; }
}

/* Gruppen mit Linkzeilen (Verwaltung / Mehr) */
.linkpage { display: block; }
.linkgroup { margin: 0 0 18px; min-width: 0; }
.linkgroup > h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 4px 6px; font-weight: 700; }
.linklist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.linklist li + li { border-top: 1px solid var(--line); }
.linkrow { display: flex; align-items: center; gap: 12px; min-height: 56px; min-width: 44px; padding: 8px 14px; text-decoration: none; color: inherit; }
.linkrow:hover { background: #f3f6f6; }
.linkrow:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.linkrow .lr-ico, .linkrow .lr-chev { flex: none; display: inline-flex; color: var(--primary); }
.linkrow .lr-chev { color: var(--muted); }
.linkrow svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.linkrow .lr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.linkrow .lr-title { font-weight: 600; overflow-wrap: anywhere; }
.linkrow .lr-sub { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
@media (min-width: 900px) { .only-mobile { display: none; } }

/* Bedienelemente */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 20px;
  border-radius: var(--radius); border: 2px solid var(--primary); background: var(--surface); color: var(--primary);
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.signal { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: .95rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.stack-mobile > * { flex: 1 1 200px; }
.stack > * + * { margin-top: 12px; }
label.field { display: block; font-weight: 600; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 4px; }
label.field small { font-weight: 400; color: var(--muted); display: block; margin-top: 3px; }
input[type=text], input[type=search], input[type=password], input[type=number], select, textarea {
  width: 100%; min-height: var(--tap); font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: 26px; height: 26px; accent-color: var(--primary); flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
details.panel > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.notice { background: var(--warn-bg); border-left: 5px solid var(--signal); padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; }
.notice.error { background: #fde7e5; border-left-color: var(--danger); }
.notice.ok { background: #e1f3e8; border-left-color: var(--ok); }
.chip { display: inline-block; border-radius: 99px; padding: 2px 10px; font-size: .82rem; font-weight: 700; background: #e3e7e8; color: var(--ink); }
.chip.warn { background: var(--warn-bg); border: 1px solid #e5c24a; }
.chip.bad { background: #fde7e5; color: var(--danger); }
.chip.good { background: #e1f3e8; color: var(--ok); }

/* Katalogliste */
.toolbar { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
.toolbar .search { grid-column: 1 / -1; }
@media (min-width: 700px) { .toolbar { grid-template-columns: 2fr 1fr 1fr; } .toolbar .search { grid-column: auto; } }
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 8px; text-decoration: none; color: inherit; min-height: 84px;
}
.item:active { background: #f1f4f4; }
.thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; background: #dfe3e4; flex: none; display: grid; place-items: center; color: var(--muted); font-weight: 700; font-size: 1.4rem; }
.item .meta { min-width: 0; flex: 1; }
.item .name { font-weight: 700; overflow-wrap: anywhere; }
.item .sub { color: var(--muted); font-size: .95rem; }
.item .place { font-size: .9rem; margin-top: 2px; }
.item .place.none { color: var(--muted); font-style: italic; }
/* Kacheln: so viele Spalten nebeneinander, wie Platz ist (mind. 300px pro Kachel) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 8px; }
.tiles > li, .tiles > .panel { min-width: 0; margin: 0; }
.list.tiles .item { margin-bottom: 0; height: 100%; }
/* Listenseiten (page.wide) dürfen auf großen Bildschirmen die ganze Breite nutzen */
main.wide { max-width: 1600px; }
.count { color: var(--muted); margin: 4px 0 10px; }
.empty { text-align: center; padding: 34px 10px; }
.empty h2 { margin-bottom: 6px; }

/* Fotos */
.gallery-main { width: 100%; max-height: 62vh; object-fit: contain; background: #000; border-radius: var(--radius); display: block; cursor: zoom-in; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.strip button { border: 3px solid transparent; padding: 0; background: none; border-radius: 10px; flex: none; cursor: pointer; }
.strip button[aria-current="true"] { border-color: var(--primary); }
.strip img { width: 76px; height: 76px; object-fit: cover; border-radius: 7px; display: block; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.photo-cell { position: relative; border-radius: 10px; overflow: hidden; background: #dfe3e4; aspect-ratio: 1; }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cell .x { position: absolute; top: 4px; right: 4px; min-width: 40px; min-height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; font-size: 1.2rem; cursor: pointer; }
.photo-cell .redo { position: absolute; left: 4px; bottom: 4px; min-height: 36px; border-radius: 18px; border: 0; background: rgba(0,0,0,.7); color: #fff; padding: 0 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.photo-cell .st { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; font-size: .8rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.65); }
.photo-cell .st.bad { background: rgba(179,38,30,.92); }
.photo-cell .st.good { background: rgba(29,107,58,.92); }
.bar { height: 6px; background: rgba(255,255,255,.35); } .bar > i { display: block; height: 100%; background: var(--signal); width: 0; }
.marked { position: relative; display: block; width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; }
.marked img { width: 100%; display: block; }
.mk { position: absolute; pointer-events: none; }
.mk.point { width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 5px solid var(--signal); box-shadow: 0 0 0 3px rgba(0,0,0,.65), inset 0 0 0 3px rgba(0,0,0,.65); }
.mk.rect { border: 5px solid var(--signal); box-shadow: 0 0 0 3px rgba(0,0,0,.65), inset 0 0 0 3px rgba(0,0,0,.65); border-radius: 4px; }
.mk-label { position: absolute; background: var(--signal); color: var(--signal-ink); font-size: .8rem; font-weight: 700; padding: 1px 7px; border-radius: 4px; pointer-events: none; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 0 0 2px rgba(0,0,0,.6); }
.mk-label.point { transform: translate(-50%, 24px); }
.mk-label.rect { transform: translateY(-100%); }
.place-box { border: 2px solid var(--primary); border-radius: var(--radius); padding: 12px; background: #f1f7f8; }
.place-box .where { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; overflow-wrap: anywhere; }

/* Vollbild-Ebenen */
.layer { position: fixed; inset: 0; height: 100dvh; z-index: 100; background: #0b0f11; color: #fff; display: flex; flex-direction: column; overflow: hidden; }
.layer header, .layer footer { flex: none; }
.layer header { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 12px 8px; background: rgba(0,0,0,.6); }
.layer header strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer .body { flex: 1 1 0; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative; touch-action: none; }
.layer .body img, .layer .body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.layer footer { padding: 10px 12px calc(10px + var(--safe-b)); display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; background: rgba(0,0,0,.6); }
.layer .btn { background: #1d272c; color: #fff; border-color: #44535a; }
.layer .btn.signal { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 6px solid #fff; background: var(--signal); cursor: pointer; padding: 0; }
.shutter:active { transform: scale(.94); }
.guide { background: rgba(0,0,0,.72); padding: 10px 14px; font-size: .95rem; }
.guide .row { margin-top: 6px; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .18s ease-out; }
@keyframes flash { from { opacity: .7; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .flash.go { animation: none; } * { scroll-behavior: auto !important; } }
.editor-stage { position: relative; display: block; flex: none; touch-action: none; cursor: crosshair; line-height: 0; }
.layer .body .editor-stage img { max-width: none; max-height: none; display: block; user-select: none; -webkit-user-drag: none; }
/* Foto-Editor: Ausschnitt ziehen, Ecken greifen */
.crop-stage { position: relative; display: block; flex: none; line-height: 0; touch-action: none; user-select: none; }
.crop-canvas { display: block; }
.crop-box { position: absolute; box-sizing: border-box; border: 2px solid var(--signal); box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; touch-action: none; }
.crop-h { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; touch-action: none; }
.crop-h::after { content: ""; position: absolute; inset: 9px; background: var(--signal); border: 2px solid #000; border-radius: 3px; }
.crop-h.nw { left: 0; top: 0; cursor: nwse-resize; }
.crop-h.ne { left: 100%; top: 0; cursor: nesw-resize; }
.crop-h.sw { left: 0; top: 100%; cursor: nesw-resize; }
.crop-h.se { left: 100%; top: 100%; cursor: nwse-resize; }
.layer .crop-footer { display: block; }
.crop-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.crop-controls .small { margin: 0; flex: 1 1 100%; text-align: center; }
.layer select { background: #1d272c; color: #fff; border: 1px solid #44535a; border-radius: 8px; padding: 8px; max-width: 100%; min-height: 44px; }
.layer-hint { flex: 1 1 100%; text-align: center; font-weight: 600; }
.layer .btn[aria-pressed="true"] { background: var(--primary); border-color: #8fd0dc; }

/* Schrittanzeige (echte Abfolge) */
.steps { display: flex; gap: 6px; margin-bottom: 14px; padding: 0; list-style: none; counter-reset: s; }
.steps li { flex: 1; text-align: center; padding: 8px 4px; border-radius: 8px; background: #dde1e2; color: var(--muted); font-weight: 700; font-size: .92rem; counter-increment: s; }
.steps li::before { content: counter(s) ". "; }
.steps li.now { background: var(--primary); color: #fff; }
.steps li.done { background: #cfe3e6; color: var(--primary); }

/* Import */
.imp { display: grid; grid-template-columns: 84px 1fr; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.imp.dim { opacity: .65; }
.imp .fn { font-weight: 700; overflow-wrap: anywhere; font-size: .95rem; }
.imp .thumb { width: 84px; height: 84px; }
.imp select, .imp input { min-height: 48px; margin-top: 6px; }

/* Erkennung */
.detect-stage { position: relative; display: block; width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: 12px; }
.detect-stage img { width: 100%; display: block; }
.box { position: absolute; border: 4px solid; border-radius: 3px; pointer-events: none; }
.box.off { opacity: .35; }
.box b { position: absolute; left: -4px; top: -4px; transform: translateY(-100%); color: #fff; padding: 1px 7px; font-size: .85rem; border-radius: 4px 4px 0 0; white-space: nowrap; }
.box.top b { transform: none; top: 0; border-radius: 0 0 4px 0; }
.hit { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; border-left-width: 10px; }
.hit.uncertain { background: #fffaf0; }
.hit .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.hit .head label { display: flex; gap: 10px; align-items: center; font-weight: 700; flex: 1; min-width: 0; }
.cand { display: flex; gap: 10px; align-items: center; padding: 8px; border: 2px solid var(--line); border-radius: 10px; margin-top: 8px; cursor: pointer; min-height: 60px; }
.cand.on { border-color: var(--primary); background: #eef5f6; }
.cand .thumb { width: 48px; height: 48px; font-size: 1rem; }

.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); display: grid; gap: 8px; justify-items: center; z-index: 200; pointer-events: none; padding: 0 12px; }
@media (min-width: 900px) { .toast-wrap { bottom: 20px; } }
.layer-open .toast-wrap { bottom: auto; top: 70px; }
.toast { pointer-events: auto; max-width: 560px; width: 100%; padding: 12px 16px; border-radius: 10px; background: #1c2429; color: #fff; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.toast.error { background: var(--danger); } .toast.ok { background: var(--ok); }
.login { max-width: 420px; margin: 8vh auto 0; padding: 0 14px; }
.login .brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.login .brand img { width: 56px; height: 56px; border-radius: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.savebar { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); background: var(--bg); padding: 10px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
@media (min-width: 900px) { .savebar { bottom: 0; } }
.status { font-weight: 700; } .status.saving { color: var(--muted); } .status.ok { color: var(--ok); } .status.bad { color: var(--danger); }

/* Status: Farbe plus Symbol/Text */
.chip.in { background: #dff3e6; color: #14532d; border: 1px solid #6bbf8a; }
.chip.in::before { content: "\2713  "; }
.chip.out { background: #fde7e5; color: #8f1d16; border: 1px solid #e08c85; }
.chip.out::before { content: "\2197  "; }
.chip.out.late { background: var(--danger); color: #fff; border-color: var(--danger); }
.status-panel { border-left-width: 10px; }
.status-panel.in { border-left-color: var(--ok); background: #f4fbf6; }
.status-panel.out { border-left-color: var(--danger); background: #fff6f5; }
.status-panel .where { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.banner.late { display: block; background: var(--danger); color: #fff; text-decoration: none; }
.item[style*="margin-left"] { border-left: 4px solid var(--line); }

/* Scannen */
.scan-stage { position: relative; width: 100%; height: min(62vh, 78vw); min-height: 240px; background: #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 16% 16%; border: 4px solid var(--signal); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; transition: border-color .15s; }
.scan-frame.ok { border-color: #3ddc84; }
.scan-status { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px; background: rgba(0,0,0,.7); color: #fff; font-weight: 600; text-align: center; }
.scan-stage.compact { height: min(26vh, 44vw); min-height: 130px; }
.scan-actions { margin: 12px 0 8px; }
.btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }
@media (min-width: 900px) { .scan { max-width: 640px; margin: 0 auto; } .scan-stage { height: 50vh; } }

code { background: #eef1f2; padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.label-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.label-row .small { min-width: 70px; }

.toolbar .search { grid-column: 1 / -1 !important; }
@media (min-width: 700px) { .toolbar { grid-template-columns: repeat(4, 1fr) !important; } }
.chip + .chip { margin-left: 6px; }

/* Zubehör: Art-Chip, Werkzeug-Auswahl */
.chip.kind { background: #e9e3f7; color: #3b2a73; }
.picker { display: grid; gap: 8px; }
.picker-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--line, #cfd6d8); border-radius: 10px; padding: 4px; background: #fff; }
.picker-row { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 4px 8px; border-radius: 8px; }
.picker-row:hover { background: #f1f4f5; }
.picker-row input { width: 22px; height: 22px; }
.chip-x { border: 0; background: transparent; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { display: flex; gap: 8px; align-items: center; min-height: 44px; padding: 6px 12px; border: 1px solid var(--line, #cfd6d8); border-radius: 10px; background: #fff; }
.choice input { width: 20px; height: 20px; }

/* Etikettendruck */
.layer .body.scroll { display: block; overflow-y: auto; touch-action: pan-y; padding: 12px; }
.label-dialog { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; color: var(--ink, #1c2429); }
.layer .label-dialog { color: #fff; }
.layer .label-dialog .panel, .layer .label-dialog .field span, .layer .label-dialog .small { color: inherit; }
.label-preview { background: #fff; border-radius: 6px; padding: 8px; display: flex; justify-content: center; }
.label-canvas { width: min(100%, 400px); height: auto; image-rendering: pixelated; border: 1px dashed #9aa5ab; background: #fff; }
.label-status { min-height: 1.4em; font-weight: 600; margin: 0; }
.label-status.ok { color: #7ee2a0; } .label-status.bad { color: #ff9b9b; }

/* Aufklapper im Etikett-Dialog: eigene Darstellung, damit er im dunklen Dialog lesbar ist und zugeklappt bleibt */
.label-more { border: 1px solid #33414a; border-radius: 10px; background: #141b1f; color: #fff; }
.label-more > summary { padding: 12px 14px; min-height: 44px; cursor: pointer; font-weight: 600; }
.label-more:not([open]) > .label-more-body { display: none; }
.label-more-body { padding: 0 14px 12px; display: grid; gap: 8px; }
.label-check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.label-check input { width: 22px; height: 22px; }
/* Hinweise im dunklen Etikett-Dialog: dunkler Grund, helle Schrift */
.layer .label-dialog .notice { background: #1f2a30; color: #fff; border-left: 4px solid #5aa9bd; }
.layer .label-dialog .notice.error { background: #3a1517; color: #ffd9d9; border-left-color: #e05b5b; }

/* Material */
.item .right { margin-left: auto; text-align: right; display: grid; gap: 4px; justify-items: end; }
.big { font-size: 1.6rem; margin: 6px 0; }

/* Lizenz & Rechtliches */
.legal-text { white-space: pre-wrap; word-break: break-word; max-height: 55vh; overflow: auto; padding: 10px; border: 1px solid #cfd8dc; border-radius: 8px; background: #f7f9fa; font-size: .8rem; line-height: 1.45; }
.legal-text[hidden] { display: none; }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid #e3e8eb; }
.login.terms { max-width: 720px; }

/* ---- Scanstation (Vollbild, Bedienung nur mit Handscanner) und Druckbögen für Ausweise/Steuercodes ---- */
.station { max-width: 760px; margin: 0 auto; padding: 16px; min-height: 100vh; }
.station-head h1 { margin: 0; font-size: 1.3rem; }
.station-who { font-size: 2.2rem; font-weight: 800; line-height: 1.15; margin: 18px 0 6px; overflow-wrap: anywhere; }
.station-who.waiting { color: var(--muted); }
.station-who.active { color: var(--primary); }
.station-mode { font-size: 1.4rem; font-weight: 700; margin-bottom: 10px; }
.station-mode[data-mode="take"] { color: var(--ok); }
.station-mode[data-mode="return"] { color: var(--primary); }
.station-mode[data-mode="none"] { color: var(--muted); }
.station-pending { background: var(--warn-bg); border-left: 8px solid var(--signal); padding: 12px 14px; border-radius: 8px; font-size: 1.25rem; margin-bottom: 12px; }
.station-result { min-height: 4.5em; border-radius: 12px; padding: 14px 16px; font-size: 1.3rem; font-weight: 600; background: var(--surface); border: 2px solid var(--line); margin-bottom: 10px; overflow-wrap: anywhere; }
.station-result.ok { border-color: var(--ok); background: #e1f3e8; }
.station-result.pending { border-color: var(--signal); background: var(--warn-bg); }
.station-result.error { border-color: var(--danger); background: #fde7e5; }
.station-history { list-style: none; padding: 0; margin: 0; }
.station-history .bad { color: var(--danger); }
.station-audio { margin-bottom: 8px; gap: 14px; }
.scan-field { margin-top: 18px; }
.scan-input { width: 100%; min-height: 44px; padding: 0 12px; border: 2px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 1rem; }
.scan-input:focus { border-color: var(--focus); }
.station-code { font: 700 2rem/1.2 ui-monospace, "DejaVu Sans Mono", monospace; letter-spacing: .08em; text-align: center; background: var(--warn-bg); padding: 14px; border-radius: 10px; user-select: all; }
.panel.inner { background: var(--brand-surface, #f6f7ef); }
.badge-row { justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.print-panel { color: #1c2429; max-width: 640px; margin: 16px; }
.print-panel h2 { color: #1c2429; }
.print-name { display: block; font-size: 1.15rem; }
.print-cards { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; }
.print-card { margin: 0; text-align: center; width: 190px; }
.print-card canvas { width: 180px; height: 180px; image-rendering: pixelated; }
@media print {
  body > *:not(.print-root) { display: none !important; }
  .print-root, .print-root .body { position: static !important; background: #fff !important; box-shadow: none !important; }
  .print-root .panel { border: 0; padding: 0; }
  .no-print { display: none !important; }
}

/* Aufmaß (Etappe 5): Tabellen scrollen innerhalb ihres Rahmens, nie die ganze Seite */
.scroll-x, .table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.table-wrap .table th { white-space: normal; overflow-wrap: anywhere; min-width: 5.5rem; }      /* lange Spaltenköpfe (Wertübersicht) umbrechen statt die Seite zu verbreitern */
.table tr[data-kind="deduction"] td { color: var(--muted); }
/* Eine zu breite Tabelle darf weder Karte noch Seite verbreitern (sonst skaliert das Smartphone die ganze Seite herunter) */
.panel, .stack, .stack > *, .content, main, .tiles > * { min-width: 0; }
.panel { max-width: 100%; }

/* Rechnungen zu den Kaufdaten */
.invoices { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); min-width: 0; }
.invoice-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.invoice-item { display: flex; gap: 10px; align-items: flex-start; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.invoice-item .info { flex: 1 1 0; min-width: 0; }
.invoice-item .name { font-weight: 600; overflow-wrap: anywhere; }
.invoice-thumb { width: 56px; height: 56px; flex: none; border-radius: 6px; object-fit: cover; background: var(--bg); }
.invoice-thumb.pdf { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: var(--muted); }
.invoice-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; min-width: 0; }
.invoice-actions .btn { text-decoration: none; }
