/* Nexoralis Verwaltung – dunkles Design in den Logo-Farben */
:root {
  --bg: #000;
  --bg2: #07090a;
  --card: #0e1113;
  --card2: #151a1d;
  --line: #1f272b;
  --line2: #2b363b;
  --text: #eef3f4;
  --muted: #8b9aa0;
  --t1: #00f0d4;
  --t2: #00b7e4;
  --accent: #00d9dc;
  --grad: linear-gradient(135deg, var(--t1), var(--t2));
  --ok: #2fd98a;
  --warn: #ffb547;
  --bad: #ff5d6c;
  --info: #3ec9ff;
  --r: 14px;
  --side: 240px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--t1); }
h1 { font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h1 small { font-size: 15px; font-weight: 500; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0 0 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
h2:not(:first-child) { margin-top: 24px; }
h2 a { text-transform: none; letter-spacing: 0; }
code { font-family: var(--mono); background: var(--card2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.code { font-family: var(--mono); font-size: .92em; letter-spacing: .02em; }
.pre { white-space: pre-wrap; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -4px; }
h1 .ic { width: 26px; height: 26px; color: var(--accent); }

/* ---------- Layout ---------- */
.side { display: none; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(0,0,0,.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand img { width: 30px; height: 30px; }
.brand b { font-size: 15px; letter-spacing: .16em; }
.brand small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.main { padding: 18px 16px 110px; max-width: 1180px; margin: 0 auto; }

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 6px; color: var(--text); }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 42px; min-width: 190px; background: var(--card2); border: 1px solid var(--line2); border-radius: 12px; padding: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--line); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(7,9,10,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 8px; color: var(--muted); font-size: 11px; }
.tabbar a .ic { width: 23px; height: 23px; }
.tabbar a.on { color: var(--t1); }
.tabbar .tab-scan .ic { background: var(--grad); color: #001417; border-radius: 10px; padding: 4px; width: 32px; height: 32px; margin-top: -8px; box-shadow: 0 4px 18px rgba(0,220,220,.35); }
.tabbar .tab-scan { color: var(--text); }

@media (min-width: 900px) {
  .top, .tabbar { display: none; }
  .side {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--side);
    background: var(--bg2); border-right: 1px solid var(--line); padding: 20px 14px;
  }
  .side .brand { padding: 0 8px 22px; }
  .side .brand img { width: 38px; height: 38px; }
  .side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .side nav a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
  .side nav a:hover { color: var(--text); background: var(--card); }
  .side nav a.on { color: var(--text); background: var(--card2); box-shadow: inset 3px 0 0 var(--t1); }
  .side nav a.on .ic { color: var(--t1); }
  .side nav a.sub { padding-left: 44px; font-size: 14px; }
  .side-sep { height: 1px; background: var(--line); margin: 12px 4px; }
  .side-user { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
  .side-user small { display: block; color: var(--muted); font-size: 12px; }
  .main { margin-left: var(--side); padding: 28px 32px 48px; max-width: calc(1180px + var(--side)); }
}

/* ---------- Bausteine ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .muted { margin-top: 4px; }
.back { display: inline-block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.card > summary { cursor: pointer; }
.card > summary + .list { margin-top: 10px; }
.grid2 { display: grid; gap: 0 16px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid2 .span2 { grid-column: 1 / -1; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line2); background: var(--card2); color: var(--text);
  font: 600 14px var(--font); cursor: pointer; white-space: nowrap; transition: border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); border: 0; color: #00161a; }
.btn-primary:hover { color: #00161a; filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: rgba(255,93,108,.45); color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.btn-link:hover { color: var(--text); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge-ok { color: var(--ok); background: rgba(47,217,138,.1); border-color: rgba(47,217,138,.25); }
.badge-warn { color: var(--warn); background: rgba(255,181,71,.1); border-color: rgba(255,181,71,.3); }
.badge-bad { color: var(--bad); background: rgba(255,93,108,.1); border-color: rgba(255,93,108,.3); }
.badge-info { color: var(--t1); background: rgba(0,240,212,.08); border-color: rgba(0,240,212,.25); }
.badge-mute { color: var(--muted); background: var(--card2); border-color: var(--line2); }

.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; border: 1px solid; font-size: 14px; }
.alert-ok { color: var(--ok); background: rgba(47,217,138,.08); border-color: rgba(47,217,138,.3); }
.alert-warn { color: var(--warn); background: rgba(255,181,71,.08); border-color: rgba(255,181,71,.3); }
.alert-bad { color: var(--bad); background: rgba(255,93,108,.08); border-color: rgba(255,93,108,.3); }

/* Formulare */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-wide { max-width: 720px; }
label { display: block; font-size: 13px; font-weight: 600; color: #c5d0d3; }
label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea { display: block; margin-top: 6px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2);
  background: #0a0d0e; color: var(--text); font: 15px var(--font);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,217,220,.18); }
input[type=file] { padding: 9px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
label.check { display: flex; flex-direction: row; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; color: var(--text); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { min-width: 0; }
.grow { flex: 1 1 200px; }
.w-qty { flex: 0 0 120px; width: 120px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: flex; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line2); background: #0a0d0e; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg input:checked + span { color: var(--text); border-color: var(--accent); background: rgba(0,217,220,.1); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(0,217,220,.25); }
.seg .seg-ok input:checked + span { border-color: var(--ok); background: rgba(47,217,138,.1); }
.seg .seg-bad input:checked + span { border-color: var(--bad); background: rgba(255,93,108,.1); }
.seg .seg-warn input:checked + span { border-color: var(--warn); background: rgba(255,181,71,.1); }
.seg .seg-mute input:checked + span { border-color: var(--muted); }
.seg-big label { flex: 1 1 200px; }
.seg-big span { flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; width: 100%; }
.seg-big b { color: var(--text); font-size: 15px; }
.seg-big small { font-weight: 400; }

[data-kind="single"] .only-bulk, [data-kind="bulk"] .only-single { display: none !important; }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; color: var(--muted); font-size: 13px; position: relative; overflow: hidden; }
.stat span { display: block; font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--text); margin-bottom: 2px; letter-spacing: -.02em; }
a.stat:hover { border-color: var(--line2); color: var(--muted); }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); }
.stat-bad span { color: var(--bad); }
.stat-bad::after { background: var(--bad); }
.stat-wide { grid-column: 1 / -1; }
.stat-wide span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 2px; color: var(--text); }
.list a:hover { color: var(--t1); }
.list a > span:first-child { min-width: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters select { flex: 1 1 140px; width: auto; min-width: 0; }
.filters .grow { flex: 1 1 100%; }
@media (min-width: 900px) { .filters .grow { flex: 2 1 260px; } }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item-row { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding-left: 12px; }
.item-row:hover { border-color: var(--line2); }
.item-row > a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 0; color: var(--text); }
.thumb { width: 46px; height: 46px; border-radius: 10px; background: var(--card2); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-txt { flex: 1; min-width: 0; }
.item-txt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-txt small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-end { flex: none; }
.bulkbar { position: sticky; top: 60px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 16px; margin-bottom: 10px; border-radius: 12px; background: var(--card2); border: 1px solid var(--accent); }
@media (min-width: 900px) { .bulkbar { top: 12px; } }

.facts { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 10px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.photo { width: 100%; max-height: 360px; object-fit: contain; background: #fff1; border-radius: 10px; margin-bottom: 16px; }
.photo-edit { display: flex; align-items: center; gap: 14px; }
.photo-edit img { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; }

.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14px; }
.log li + li { border-top: 1px solid var(--line); }
.log-main { min-width: 0; }
.log-detail { display: block; color: var(--muted); font-size: 13px; }
.log-meta { text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }

.table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 8px 8px; }
.table td { padding: 6px 8px; border-top: 1px solid var(--line); }
.table input { min-height: 38px; }

.empty { text-align: center; padding: 30px 16px; }
.empty h1 { justify-content: center; margin-bottom: 8px; }
.danger-zone { margin-top: 28px; padding-top: 16px; border-top: 1px dashed var(--line2); }
.pager { display: flex; gap: 10px; justify-content: center; }

/* Scanner */
.scan-card { max-width: 560px; margin: 0 auto; }
.scanner { position: relative; aspect-ratio: 1; background: #050607; border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); border: 2px solid var(--t1); }
.scan-frame::after { content: ""; position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: var(--grad); box-shadow: 0 0 12px var(--t1); animation: scanline 2s ease-in-out infinite; }
@keyframes scanline { 0%,100% { transform: translateY(-40%); opacity: .4; } 50% { transform: translateY(40%); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .scan-frame::after { animation: none; } }
.scan-msg { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px; text-align: center; font-size: 14px; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.scan-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; }
.scan-overlay .scanner { width: min(92vw, 480px); }

/* Anmeldung */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at top, #002a2e 0%, #000 60%); }
.auth-box { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; }
.auth-logo { display: block; width: 150px; height: 150px; margin: -8px auto 8px; }
.auth-box h1 { justify-content: center; font-size: 18px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 20px; }
.steps { padding-left: 20px; line-height: 1.7; }

[hidden] { display: none !important; }
.items { grid-template-columns: minmax(0, 1fr); }
.item-row { min-width: 0; }

/* Eingabefeld mit Scan-Knopf */
.input-scan { display: flex; gap: 8px; margin-top: 6px; }
.input-scan input { margin-top: 0 !important; flex: 1; min-width: 0; }
.input-scan .btn { flex: none; padding: 0 12px; }
.filters .input-scan { margin-top: 0; }
@media (max-width: 520px) { .hide-sm { display: none; } }

/* Scanner-Erweiterungen */
.scanner .scan-torch { position: absolute; top: 10px; right: 10px; min-height: 36px; padding: 0 12px; background: rgba(0,0,0,.6); }
.scan-torch.on { border-color: var(--warn); color: var(--warn); }
.scan-wide .scanner { aspect-ratio: 4 / 3; }
.scan-wide .scan-frame { inset: 30% 6%; border-radius: 10px; }
.scan-tools { justify-content: center; }
.scan-result { width: min(92vw, 480px); background: var(--card); border: 1px solid var(--accent); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.scan-val { font: 700 20px var(--mono); word-break: break-all; }
.scan-warn { color: var(--warn); }
.scan-result .row .btn { flex: 1; }
.scan-zoom { display: flex; align-items: center; gap: 10px; flex: 1 1 100%; justify-content: center; color: var(--muted); font-weight: 500; }
.scan-zoom input { width: min(60vw, 260px); min-height: 0; padding: 0; border: 0; background: none; accent-color: var(--accent); margin: 0 !important; }
.scan-tools { flex-wrap: wrap; width: min(92vw, 480px); }
.scan-cam { flex: 1 1 100%; min-height: 40px; font-size: 14px; }

/* ---------- Stufe 2: Produktionen ---------- */
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 16px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs a { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tabs a.on { background: var(--card2); color: var(--text); box-shadow: inset 0 -2px 0 var(--t1); }
.tabs-mode { width: 100%; }
.tabs-mode a { flex: 1; text-align: center; }
.tabs-mode a.on { background: var(--grad); color: #00161a; box-shadow: none; }
.tabs-mode a.on-in { background: linear-gradient(135deg, #ffcf6b, var(--warn)); }

.prods { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.prod-row { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--text); }
.prod-row:hover { border-color: var(--line2); color: var(--text); }
.datebox { flex: none; width: 50px; text-align: center; border-radius: 10px; background: var(--card2); padding: 6px 0; line-height: 1.1; }
.datebox b { display: block; font-size: 20px; }
.datebox small { color: var(--t1); font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: .06em; }
.prod-txt { flex: 1; min-width: 0; }
.prod-txt b { display: block; overflow-wrap: anywhere; line-height: 1.3; }
.prod-txt small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.progress { display: block; height: 4px; background: var(--line); border-radius: 4px; margin-top: 7px; overflow: hidden; max-width: 220px; }
.progress i { display: block; height: 100%; background: var(--grad); border-radius: 4px; }
.progress-lg { height: 8px; max-width: none; margin: 0 0 12px; }

.scan-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.btn-lg { min-height: 56px; font-size: 16px; border-radius: 12px; }
.btn-lg .ic { width: 22px; height: 22px; }
.stats-3 { grid-template-columns: repeat(3, 1fr) !important; }
.stats-3 .stat span { font-size: 24px; }

.txt-bad { color: var(--bad); display: block; }
.txt-warn { color: var(--warn); display: block; }
.txt-warn a { color: var(--warn); text-decoration: underline; }

.pl { list-style: none; margin: 0; padding: 0; }
.pl-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 14px 0 4px; font-weight: 700; }
.pl-cat:first-child { padding-top: 0; }
.pl-row { border-top: 1px solid var(--line); }
.pl-row summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 10px 2px; cursor: pointer; }
.pl-row summary::-webkit-details-marker { display: none; }
.pl-row[open] summary, .pl-row summary:hover { color: var(--t1); }
.pl-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line2); }
.dot-ok { background: var(--ok); } .dot-info { background: var(--t1); box-shadow: 0 0 8px var(--t1); } .dot-warn { background: var(--warn); }
.pl-txt { flex: 1; min-width: 0; }
.pl-txt b { display: block; }
.pl-txt small { display: block; color: var(--muted); }
.pl-txt small.txt-bad { color: var(--bad); } .pl-txt small.txt-warn { color: var(--warn); }
.pl-qty { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.pl-actions { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 14px 22px; }
.pl-actions .row { align-items: center; }
.pl-actions input { min-height: 36px; padding: 6px 10px; }
.pl-actions .w-qty { flex: 0 0 80px; width: 80px; }
.pl-zurueck .pl-txt b { color: var(--muted); }

.crew-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; }
.list .crew-row { border-top: 0; }
.list li.crew-row + li.crew-row { border-top: 1px solid var(--line); }
.crew-add { margin-top: 14px; gap: 8px; }
.grid-tight { gap: 14px 16px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
legend { padding: 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

/* Live-Buchung */
.scan-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.pscan { max-width: 620px; margin: 0 auto 16px; }
.scanner-short { aspect-ratio: 16 / 10; max-height: 42vh; width: 100%; margin-bottom: 10px; }
.scanner-short .scan-frame { inset: 14% 22%; }
.pscan-result { border-radius: 14px; padding: 14px; margin-bottom: 10px; border: 1px solid; display: flex; flex-direction: column; gap: 10px; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pscan-result { animation: none; } }
.pscan-text { font-weight: 700; font-size: 16px; }
.pscan-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pscan-actions input { min-height: 42px; }
.pscan-actions .w-qty { width: 100px; flex: 0 0 100px; }
.res-ok { background: rgba(47,217,138,.1); border-color: rgba(47,217,138,.45); color: var(--ok); }
.res-warn { background: rgba(255,181,71,.1); border-color: rgba(255,181,71,.45); color: var(--warn); }
.res-bad { background: rgba(255,93,108,.12); border-color: rgba(255,93,108,.5); color: var(--bad); }
.pscan-result .pscan-actions { color: var(--text); }
.pscan-manual { margin-bottom: 4px; }
.all-done { color: var(--ok); font-weight: 700; font-size: 17px; margin: 6px 0; }
.pscan-todo li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 2px; }
.pscan-done { margin-top: 10px; }
.pscan-done summary { cursor: pointer; }
.pscan-done li { display: flex; justify-content: space-between; padding: 8px 2px; color: var(--muted); }
.tabbar a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- Leihgeräte ---------- */
[data-own="eigen"] .only-rent { display: none !important; }
.only-rent { display: flex; flex-direction: column; gap: 12px; }
.lbl-leihe, .lbl-leihe-block { display: none; }
[data-own="leihe"] .lbl-miete { display: none; }
[data-own="leihe"] .lbl-leihe { display: inline; }
[data-own="leihe"] .lbl-leihe-block { display: block; }
.badge-own { color: #c9a7ff; background: rgba(170,120,255,.1); border-color: rgba(170,120,255,.35); margin-left: 6px; vertical-align: 1px; font-size: 11px; padding: 2px 7px; }
.rent-box { border-color: rgba(170,120,255,.35); }
.rent-box h2 { color: #c9a7ff; }
.due-overdue { color: var(--bad); font-weight: 700; }
.due-soon { color: var(--warn); font-weight: 700; }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 2px 0; border-top: 1px solid var(--line2); margin-top: 6px; font-weight: 700; }
.rent-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; flex: none; }
.alert-own { color: #d9c4ff; background: rgba(170,120,255,.08); border-color: rgba(170,120,255,.35); }
.alert-own a { color: #fff; text-decoration: underline; }

/* ---------- Foto + Hintergrund entfernen ---------- */
.photo-box { display: flex; flex-direction: column; gap: 10px; }
.photo-work { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.photo-prev { width: 150px; height: 150px; border-radius: 12px; overflow: hidden; background: repeating-conic-gradient(#1a2024 0 25%, #12171a 0 50%) 0 0 / 16px 16px; flex: none; border: 1px solid var(--line2); }
.photo-prev img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bg-tools { display: flex; flex-direction: column; gap: 8px; flex: 1 1 200px; min-width: 0; }
.bg-tools select { max-width: 260px; }
.bg-tools .btn[disabled] { opacity: .6; cursor: wait; }
.btn .ic { width: 18px; height: 18px; }

/* ---------- Texterkennung ---------- */
.ocr-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.85); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 700px) { .ocr-overlay { align-items: center; padding: 20px; } }
.ocr-box { width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; background: var(--card); border: 1px solid var(--line2); border-radius: 18px 18px 0 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 700px) { .ocr-box { border-radius: 18px; } }
.ocr-head { display: flex; justify-content: space-between; align-items: center; }
.ocr-img img { width: 100%; max-height: 28vh; object-fit: contain; border-radius: 10px; background: #000; display: block; }
.ocr-lines { display: flex; flex-direction: column; gap: 6px; }
.ocr-line { text-align: left; font: 500 15px var(--font); color: var(--text); background: #0a0d0e; border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; cursor: pointer; overflow-wrap: anywhere; }
.ocr-line.on { border-color: var(--accent); background: rgba(0,217,220,.12); }
.ocr-line.low { color: var(--muted); }
.ocr-line.used { opacity: .45; text-decoration: line-through; }
.ocr-use { display: flex; flex-direction: column; gap: 10px; position: sticky; bottom: -16px; background: var(--card); padding: 10px 0 4px; border-top: 1px solid var(--line); }
.ocr-targets { display: flex; flex-wrap: wrap; gap: 8px; }
.ocr-targets .btn { min-height: 40px; padding: 0 12px; }
input.ocr-filled, textarea.ocr-filled { border-color: var(--ok) !important; box-shadow: 0 0 0 3px rgba(47,217,138,.25); }
/* Live-Texterkennung */
.ocr-cam { aspect-ratio: 4 / 3; width: 100%; margin: 0; }
.ocr-frame { position: absolute; left: 6%; right: 6%; top: 42%; height: 16%; border: 2px solid var(--t1); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); }
.ocr-live.locked .ocr-frame { border-color: var(--ok); }
.ocr-read { display: flex; flex-direction: column; gap: 2px; }
.ocr-cur { font: 700 20px var(--mono); color: var(--muted); overflow-wrap: anywhere; min-height: 28px; }
.ocr-cur.good { color: var(--text); }
.ocr-live.locked .ocr-cur { color: var(--ok); }
.ocr-zoom { display: flex; align-items: center; gap: 10px; }
.ocr-zoom input { flex: 1; min-height: 0; padding: 0; border: 0; background: none; accent-color: var(--accent); }

/* Produktbild aus dem Netz */
.photo-web { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.paste-zone { flex: 1 1 220px; min-height: 44px; padding: 11px 12px; border-radius: 10px; border: 1px dashed var(--line2); background: #0a0d0e; color: var(--text); font-size: 14px; outline: none; cursor: text; -webkit-user-select: text; user-select: text; }
.paste-zone:empty::before { content: attr(data-ph); color: var(--muted); }
.paste-zone:focus { border-color: var(--accent); border-style: solid; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0 !important; }
.photo-box.drop { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: 12px; }
.photo, .thumb img, .photo-edit img { background: transparent; }
