:root {
  --blau: #1f5f8b; --blau-hell: #e7f0f7; --text: #1d2329; --grau: #6b7680; --linie: #dde3e8;
  --hg: #f4f6f8; --karte: #fff; --rot: #b3261e; --rot-hell: #fdecea; --gelb-hell: #fff6dc; --gruen: #2e7d32;
  --radius: 10px; --menue: 220px;
}
@media (prefers-color-scheme: dark) {
  :root { --text: #e6eaee; --grau: #9aa5b0; --linie: #333c45; --hg: #14181c; --karte: #1d2329; --blau-hell: #1a3347; --rot-hell: #3a1f1d; --gelb-hell: #3a3218; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--hg); color: var(--text); }
a { color: var(--blau); }
@media (prefers-color-scheme: dark) { a { color: #7fb6e0; } }
h1 { font-size: 1.5rem; margin: .2em 0 .6em; } h2 { font-size: 1.15rem; margin: 1.4em 0 .5em; } h3 { margin: 0; font-size: 1.05rem; }

.leiste { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--blau); color: #fff; }
.marke-name { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.platz { flex: 1; }
.nutzer { font-size: .85rem; opacity: .85; }
.status { border: 0; border-radius: 99px; padding: 4px 10px; font: inherit; font-size: .85rem; cursor: pointer; background: rgba(255,255,255,.15); color: #fff; }
.status .punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #7ee07e; }
.status.offline .punkt { background: #ffb74d; }

nav { position: fixed; top: 52px; left: 0; bottom: 0; width: var(--menue); background: var(--karte); border-right: 1px solid var(--linie); padding: 8px 0; overflow-y: auto; z-index: 15; }
nav a { display: block; padding: 10px 18px; text-decoration: none; color: var(--text); }
nav a.aktiv { background: var(--blau-hell); color: var(--blau); font-weight: 600; border-left: 3px solid var(--blau); }
main { margin-left: var(--menue); padding: 16px 24px 80px; max-width: 1200px; }
#menueKnopf { display: none; }
body.ohne-menue nav, body.ohne-menue #menueKnopf { display: none !important; }
body.ohne-menue main { margin-left: 0; }
@media (max-width: 820px) {
  #menueKnopf { display: inline-block; color: #fff; font-size: 1.3rem; }
  nav { transform: translateX(-100%); transition: transform .2s; box-shadow: 2px 0 12px rgba(0,0,0,.2); }
  body.menue-offen nav { transform: none; }
  main { margin-left: 0; padding: 12px 12px 80px; }
  .nutzer { display: none; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--linie); border-radius: 8px;
  background: var(--karte); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; min-height: 42px; }
.btn:hover { border-color: var(--blau); }
.btn.primaer { background: var(--blau); border-color: var(--blau); color: #fff; }
.btn.gefahr { color: var(--rot); border-color: var(--rot); }
.btn.gross { min-height: 54px; font-size: 1.05rem; padding: 12px 20px; }
.btn.klein { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.btn.flach { border: 0; background: none; }

.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.karte.warnung, p.warnung { background: var(--gelb-hell); }
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.kopf h1, .kopf h2 { margin-bottom: .3em; }
.schnell, .typen { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.typen .btn { flex: 1; min-width: 110px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kachel { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--grau); }
.kachel b { display: block; font-size: 1.8rem; color: var(--text); }
.kachel.warn b { color: var(--rot); }
.daten { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 18px; }
.daten span { display: block; font-size: .8rem; color: var(--grau); }

label { display: block; margin: 10px 0 4px; font-size: .9rem; color: var(--grau); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 1rem; }
input, select, textarea { width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--linie); border-radius: 8px; background: var(--karte); color: var(--text); min-height: 44px; }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blau); outline-offset: 0; border-color: var(--blau); }
.suche { display: flex; gap: 8px; margin-bottom: 10px; }
.suche input { flex: 1; } .suche select { width: auto; }
.feldinfo { padding: 10px 12px; border: 1px dashed var(--linie); border-radius: 8px; }
.menge-klein { width: 100px; display: inline-block; min-height: 34px; padding: 4px 8px; text-align: right; }
.login { max-width: 380px; margin: 8vh auto; }
.login .btn { width: 100%; margin-top: 16px; }
#formular .btn.gross { width: 100%; margin-top: 16px; }

.tabelle-huelle { overflow-x: auto; background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--linie); text-align: left; white-space: nowrap; }
td:nth-child(2) { white-space: normal; }
th { font-size: .8rem; color: var(--grau); font-weight: 600; background: var(--hg); }
tr:last-child td { border-bottom: 0; }
.r { text-align: right; }
tr.klickbar { cursor: pointer; } tr.klickbar:hover { background: var(--blau-hell); }
tr.niedrig td:nth-child(3), b.niedrig { color: var(--rot); font-weight: 600; }
tr.konflikt { background: var(--rot-hell); }
td.abgelaufen { color: var(--rot); }
.marke { font-size: .7rem; background: var(--blau-hell); color: var(--blau); padding: 1px 5px; border-radius: 4px; }
.st { font-size: .8rem; padding: 2px 8px; border-radius: 99px; background: var(--hg); }
.st-im_lager { background: #e3f3e4; color: var(--gruen); } .st-defekt, .st-verschrottet { background: var(--rot-hell); color: var(--rot); }
@media (prefers-color-scheme: dark) { .st-im_lager { background: #1e3a20; color: #8fd694; } }
.leer, .grau { color: var(--grau); } .klein { font-size: .85rem; } .fehler { color: var(--rot); }
.protokoll { padding-left: 18px; margin: 0; } .protokoll li { padding: 3px 0; }

.fotos { display: flex; flex-wrap: wrap; gap: 10px; }
.fotos figure { position: relative; margin: 0; }
.fotos img { width: 140px; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--linie); display: block; }
.fotos .btn { position: absolute; top: 4px; right: 4px; min-height: 26px; padding: 2px 8px; }

.meldungen { position: sticky; top: 52px; z-index: 12; margin-left: var(--menue); background: var(--gelb-hell); border-bottom: 1px solid var(--linie); padding: 8px 24px; font-size: .9rem; }
@media (max-width: 820px) { .meldungen { margin-left: 0; padding: 8px 12px; } }

.dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--karte); color: var(--text); }
.dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog form { padding: 18px; }
.dialog h2 { margin-top: 0; }
.knoepfe { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #263238; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100;
  max-width: calc(100vw - 32px); box-shadow: 0 4px 16px rgba(0,0,0,.3); transition: opacity .5s; }
.toast-fehler { background: var(--rot); }
.toast.weg { opacity: 0; }

.scanner { position: fixed; inset: 0; background: #000; z-index: 200; display: flex; flex-direction: column; }
.scanner video { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.scanner-rahmen { position: absolute; left: 12%; right: 12%; top: 28%; height: 30%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.scanner-leiste { display: flex; align-items: center; gap: 12px; padding: 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: #111; color: #fff; }
.scanner-info { flex: 1; }
