/* LOEWE SILO: gemeinsame Styles fuer Login, Planung und (spaeter) Zaehlung.
   Farben nach LOEWE-Branding: Gruen #018137, Schwarz. */
:root {
  --gruen: #018137;
  --gruen-dunkel: #01602a;
  --gruen-hell: #e6f2ea;
  --text: #111;
  --grau: #6b7280;
  --linie: #d9dedb;
  --flaeche: #f4f6f5;
  --weiss: #fff;
  --rot: #b42318;
  --gelb: #b54708;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--flaeche); font-size: 15px; }
h1, h2, h3 { margin: 0 0 12px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.klein { font-size: 13px; color: var(--grau); }
.versteckt { display: none !important; }

/* Kopf */
.kopf { display: flex; align-items: center; gap: 16px; background: var(--gruen); color: var(--weiss); padding: 10px 20px; flex-wrap: wrap; }
.kopf .logo { font-weight: 700; letter-spacing: .5px; }
.kopf .logo span { font-weight: 400; opacity: .9; }
.kopf select { padding: 6px 8px; border-radius: 6px; border: 0; }
.kopf .rechts { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 14px; }
.kopf a { color: var(--weiss); }

/* Reiter */
.reiter { display: flex; gap: 4px; padding: 0 20px; background: var(--weiss); border-bottom: 1px solid var(--linie); overflow-x: auto; }
.reiter button { background: none; border: 0; padding: 12px 14px; font: inherit; cursor: pointer; color: var(--grau); border-bottom: 3px solid transparent; white-space: nowrap; }
.reiter button.aktiv { color: var(--gruen); border-bottom-color: var(--gruen); font-weight: 600; }

main.inhalt { padding: 20px; max-width: 1200px; }
.karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.zeile { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.zeile.zwischen { justify-content: space-between; }
.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* Formulare */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--grau); }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--linie); border-radius: 6px; background: var(--weiss); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gruen); outline-offset: -1px; }
.knopf { font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--linie); background: var(--weiss); cursor: pointer; }
.knopf:hover { border-color: var(--gruen); }
.knopf.primaer { background: var(--gruen); border-color: var(--gruen); color: var(--weiss); }
.knopf.primaer:hover { background: var(--gruen-dunkel); }
.knopf.klein { padding: 4px 8px; font-size: 13px; }
.knopf.gefahr { color: var(--rot); }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--grau); font-weight: 600; }
tr.waehlbar { cursor: pointer; }
tr.waehlbar:hover, tr.gewaehlt { background: var(--gruen-hell); }

/* Status-Marken */
.marke { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--flaeche); border: 1px solid var(--linie); white-space: nowrap; }
.marke.laeuft { background: #fff7e6; border-color: #f5c26b; color: var(--gelb); }
.marke.gezaehlt, .marke.geprueft { background: var(--gruen-hell); border-color: #9fd0b0; color: var(--gruen-dunkel); }
.marke.abgeschlossen { background: var(--gruen); color: var(--weiss); border-color: var(--gruen); }
.marke.inaktiv { color: var(--grau); text-decoration: line-through; }

.balken { height: 6px; background: var(--flaeche); border-radius: 3px; overflow: hidden; min-width: 80px; }
.balken > div { height: 100%; background: var(--gruen); }

/* Ortsbaum */
.baum ul { list-style: none; margin: 0; padding-left: 20px; }
.baum > ul { padding-left: 0; }
.baum li { margin: 2px 0; }
.knoten { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; }
.knoten:hover { background: var(--gruen-hell); }
.knoten .auf { width: 20px; text-align: center; cursor: pointer; color: var(--grau); user-select: none; }
.knoten .typ { font-size: 12px; color: var(--grau); }
.knoten .aktionen { margin-left: auto; display: none; gap: 4px; }
.knoten:hover .aktionen { display: flex; }
.knoten.inaktiv .name { color: var(--grau); text-decoration: line-through; }

/* Hinweise */
.hinweis { padding: 10px 12px; border-radius: 6px; background: var(--gruen-hell); margin: 8px 0; }
.hinweis.fehler { background: #fde8e7; color: var(--rot); }
#meldung { position: fixed; bottom: 20px; right: 20px; max-width: 360px; z-index: 50; }

/* Dialog */
dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form > * + * { margin-top: 12px; }
dialog .knoepfe { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-karte { background: var(--weiss); padding: 28px; border-radius: var(--radius); width: min(380px, 100%); border-top: 6px solid var(--gruen); }
.login-karte .logo { font-size: 22px; font-weight: 700; color: var(--gruen); margin-bottom: 16px; }
.login-karte .logo span { color: var(--text); font-weight: 400; }
.login-karte form { display: flex; flex-direction: column; gap: 12px; }

/* ---- Vorbereitung ----------------------------------------------------------------------- */
.gross-balken { height: 10px; margin: 12px 0 6px; }
.schritt { display: grid; grid-template-columns: 36px 1fr; gap: 12px; }
.schritt .ampel { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--weiss); background: var(--gelb); }
.schritt.ok .ampel { background: var(--gruen); }
.schritt.info .ampel { background: var(--grau); }
.schritt .aktion { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.schritt details { margin-top: 6px; font-size: 13px; color: var(--grau); }
.schritt .ergebnis { margin-top: 8px; }

/* ---- Zaehloberflaeche ---------------------------------------------------------------- */
body.zaehlen { font-size: 16px; }
.knopf.gross { padding: 14px 18px; font-size: 17px; width: 100%; }
.wahl-liste { display: grid; gap: 10px; }
.rechtsbuendig { text-align: right; white-space: nowrap; }
.nur-schmal { display: none; }
.sync { font-size: 13px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.15); }
.sync.warn { background: #fff7e6; color: var(--gelb); }
.sync.fehler { background: #fde8e7; color: var(--rot); }

.zaehl-layout { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 52px); }
.orte-leiste { background: var(--weiss); border-right: 1px solid var(--linie); overflow-y: auto; max-height: calc(100vh - 52px); position: sticky; top: 0; }
.ort-zeile { display: flex; align-items: center; gap: 6px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--flaeche); }
.ort-zeile:hover { background: var(--gruen-hell); }
.ort-zeile.aktiv { background: var(--gruen); color: var(--weiss); }
.ort-zeile.aktiv .marke { background: var(--weiss); color: var(--gruen); }
.ort-zeile .auf { width: 22px; text-align: center; color: inherit; opacity: .7; }
.ort-zeile .ort-name { flex: 1; }
.ort-kinder { padding-left: 16px; }
.zaehl-inhalt { padding: 16px; max-width: 900px; }

.scan-karte { position: sticky; top: 0; z-index: 5; }
.eingabe { flex: 1; font-size: 18px; padding: 12px; }
.vorschlaege { display: flex; flex-direction: column; margin-top: 6px; max-height: 50vh; overflow-y: auto; }
.vorschlag { text-align: left; background: var(--weiss); border: 0; border-bottom: 1px solid var(--linie); padding: 12px 8px; font: inherit; cursor: pointer; }
.vorschlag:hover { background: var(--gruen-hell); }

.erfassen { background: var(--gruen-hell); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.erfassen input[type=number] { font-size: 22px; width: 140px; padding: 10px; }
.erfassen .einheit { font-size: 17px; min-width: 60px; }
.erfassen-artikel { margin-bottom: 8px; font-size: 17px; }
table.positionen td { padding: 10px 8px; }

.kamera-ebene { position: fixed; inset: 0; background: #000; z-index: 100; display: flex; flex-direction: column; }
.kamera-ebene video { flex: 1; width: 100%; object-fit: cover; }
.kamera-rahmen { position: absolute; left: 10%; right: 10%; top: 35%; height: 30%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px; pointer-events: none; }
.kamera-knoepfe { position: absolute; bottom: 24px; left: 0; right: 0; display: flex; justify-content: center; gap: 12px; }

@media (max-width: 800px) {
  .nur-schmal { display: inline-block; }
  .zaehl-layout { grid-template-columns: 1fr; }
  .orte-leiste { display: none; position: fixed; inset: 52px 0 0 0; z-index: 20; max-height: none; }
  .orte-leiste.offen { display: block; }
  .zaehl-inhalt { padding: 10px; }
}

@media (max-width: 640px) {
  main.inhalt { padding: 12px; }
  .knoten .aktionen { display: flex; }
  th:nth-child(n+5), td:nth-child(n+5) { display: none; }
}
