/* NAFA Design-System (nafa-app-patterns/style-guide): #87BA28, Header-Gradient, Poppins, Dark Mode per Klasse */
:root {
  --nafa-50: #f9f7f2;
  --nafa-100: #f1f6e4;
  --nafa-200: #dcebbd;
  --nafa-500: #87ba28;
  --nafa-600: #6f9a1f;
  --nafa-700: #557717;
  --nafa-800: #415d0c;
  --nafa-900: #344a0a;
  --bg: var(--nafa-50);
  --karte: #ffffff;
  --text: #1f2937;
  --leise: #6b7280;
  --rand: #e5e7eb;
  --gefahr: #dc2626;
  --schatten: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
  --radius: 14px;
}
html.dark {
  --bg: #0f172a;
  --karte: #1e293b;
  --text: #e5e7eb;
  --leise: #94a3b8;
  --rand: #334155;
  --schatten: 0 1px 3px rgba(0, 0, 0, 0.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.versteckt { display: none !important; }

/* Header */
.kopf {
  background: linear-gradient(135deg, #87ba28 0%, #415d0c 100%);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.kopf h1 { font-size: 20px; margin: 0; font-weight: 600; letter-spacing: 0.2px; }
.kopf .unter { opacity: 0.85; font-size: 13px; }
.kopf .rechts { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.kopf .knopf-hell {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
}
.kopf .knopf-hell:hover { background: rgba(255, 255, 255, 0.26); }

main { max-width: 1500px; margin: 0 auto; padding: 22px 24px 60px; }
.hinweis { color: var(--leise); margin: 0 0 18px; }

.standort { margin-bottom: 34px; }
.standort-kopf { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.standort-kopf h2 { margin: 0; font-size: 18px; font-weight: 600; }
.standort-kopf .zahl { color: var(--leise); font-size: 13px; }
.standort-kopf .knopf { margin-left: auto; }

.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }

/* Kachel */
.kachel {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.kachel.ziel { border-color: var(--nafa-500); box-shadow: 0 0 0 3px rgba(135, 186, 40, 0.35); transform: translateY(-2px); }
.kachel-kopf { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.kachel-kopf .titel { font-weight: 600; }
.kachel-kopf .meta { color: var(--leise); font-size: 12px; }
.kachel-kopf .aktionen { margin-left: auto; display: flex; gap: 4px; }
.punkt { width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; flex: none; }
.punkt.an { background: var(--nafa-500); box-shadow: 0 0 0 3px rgba(135, 186, 40, 0.25); }

.buehne {
  margin: 0 14px;
  background: #000;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  max-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.buehne .rahmen { position: relative; height: 100%; max-height: 340px; max-width: 100%; }
.buehne img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.6s; }
.buehne img.sichtbar { opacity: 1; }
.buehne .leer {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #d1d5db; font-size: 13px; text-align: center; padding: 12px; gap: 6px;
  border: 2px dashed rgba(255, 255, 255, 0.25); border-radius: 10px;
}
.buehne .leer b { color: #fff; font-weight: 600; font-size: 14px; }
.buehne .ablage {
  position: absolute; inset: 0; background: rgba(135, 186, 40, 0.82); color: #fff; font-weight: 600;
  display: none; align-items: center; justify-content: center; text-align: center; padding: 12px;
}
.kachel.ziel .buehne .ablage { display: flex; }

.liste { list-style: none; margin: 10px 0 0; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.liste li {
  display: grid; grid-template-columns: 22px 46px 1fr auto; align-items: center; gap: 8px;
  padding: 6px; border-radius: 8px; border: 1px solid transparent;
}
.liste li:hover { background: var(--nafa-100); }
html.dark .liste li:hover { background: #273449; }
.liste li.zieht { opacity: 0.4; }
.liste li.drueber { border-color: var(--nafa-500); }
.liste li.laedt { opacity: 0.7; }
.griff { cursor: grab; color: var(--leise); text-align: center; user-select: none; }
.liste img { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; background: #000; }
.liste .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste .unterzeile { font-size: 11px; color: var(--leise); }
.liste .steuer { display: flex; align-items: center; gap: 2px; }
.dauer { width: 54px; padding: 3px 4px; border: 1px solid var(--rand); border-radius: 6px; background: var(--karte); text-align: right; }

.symbol {
  border: 0; background: transparent; color: var(--leise); width: 28px; height: 28px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.symbol:hover { background: var(--nafa-100); color: var(--nafa-800); }
html.dark .symbol:hover { background: #334155; color: #fff; }
.symbol.gefahr:hover { background: #fee2e2; color: var(--gefahr); }
.symbol:disabled { opacity: 0.3; cursor: default; background: transparent; }

.kachel-fuss { margin-top: auto; padding: 8px 14px 12px; display: flex; gap: 8px; align-items: center; color: var(--leise); font-size: 12px; }
.kachel-fuss select { padding: 3px 6px; border-radius: 6px; border: 1px solid var(--rand); background: var(--karte); }

.knopf {
  border: 0; border-radius: 10px; padding: 8px 14px; background: var(--nafa-500); color: #fff; font-weight: 500;
}
.knopf:hover { background: var(--nafa-600); }
.knopf.zweit { background: transparent; color: var(--nafa-700); border: 1px solid var(--nafa-200); }
html.dark .knopf.zweit { color: var(--nafa-200); border-color: #334155; }
.knopf.zweit:hover { background: var(--nafa-100); }

/* Dialog */
dialog {
  border: 0; border-radius: var(--radius); padding: 0; width: min(440px, 92vw); background: var(--karte); color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(15, 23, 42, 0.5); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
dialog h3 { margin: 0; font-size: 17px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--leise); }
dialog input, dialog select { padding: 8px 10px; border: 1px solid var(--rand); border-radius: 8px; background: var(--bg); color: var(--text); }
dialog .zeile { display: flex; gap: 10px; }
dialog .zeile > * { flex: 1; }
dialog .knoepfe { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
dialog .link { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; background: var(--bg); padding: 8px; border-radius: 8px; }
dialog .warnung { font-size: 12px; color: var(--gefahr); }

/* Meldungen */
#meldungen { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.meldung {
  background: var(--karte); border-left: 4px solid var(--nafa-500); border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); max-width: 380px; font-size: 14px;
}
.meldung.fehler { border-left-color: var(--gefahr); }

/* Anmeldung */
.anmelde-seite { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.anmelde-karte {
  background: var(--karte); border-radius: 18px; box-shadow: var(--schatten); width: min(400px, 100%); overflow: hidden; text-align: center;
}
.anmelde-karte .kopf { position: static; justify-content: center; flex-direction: column; gap: 2px; padding: 26px 20px; }
.anmelde-karte .inhalt { padding: 26px 24px 30px; display: flex; flex-direction: column; gap: 14px; }
.anmelde-karte .knopf { padding: 12px; font-size: 15px; display: block; text-decoration: none; }
.fehlerbox { background: #fee2e2; color: #991b1b; border-radius: 10px; padding: 10px; font-size: 14px; }

@media (max-width: 640px) {
  .kopf { padding: 12px 14px; }
  main { padding: 16px 12px 50px; }
  .kopf .unter { display: none; }
}

/* ---------- Reihe wie im Laden + Zeitsteuerung (20.10.2026) ---------- */
.reihe-rollen { overflow-x: auto; padding-bottom: 6px; }
.raster.reihe { display: grid; gap: 14px; }
.raster.reihe .kachel { min-width: 0; }
.kachel-kopf .geraet { font-size: 12px; color: var(--leise); }
.kachel-kopf .geraet.ok { color: var(--nafa-600, #5a8a12); font-weight: 500; }
.kachel-kopf .geraet.warn { color: var(--gefahr); font-weight: 500; }
.liste li.jetzt { box-shadow: inset 3px 0 0 var(--nafa-500, #87BA28); }
.liste .zeit { white-space: normal; }
.geraete-leiste { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 12px; }
.knopf.klein { padding: 6px 10px; font-size: 13px; }

.zeiten { margin-top: 18px; background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten); padding: 16px; display: grid; gap: 18px; }
.zeiten-kopf { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.zeiten-kopf h3 { margin: 0; }
.pille { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--rand); color: var(--text); }
.pille.ok { background: var(--nafa-100, #eef6dc); color: var(--nafa-700, #4a7310); font-weight: 600; }
.betrieb-titel { font-weight: 600; margin-bottom: 8px; }
.betrieb { display: grid; gap: 6px; max-width: 420px; }
.betrieb-zeile { display: grid; grid-template-columns: 22px 34px 1fr 12px 1fr 30px; align-items: center; gap: 6px; }
.betrieb-zeile .tag { font-weight: 600; }
.betrieb-zeile .aus-text { color: var(--leise); font-size: 12px; visibility: hidden; }
.betrieb-zeile.aus .aus-text { visibility: visible; }
.betrieb-zeile.aus input[type=time] { opacity: .35; }
.betrieb .knopf { justify-self: start; margin-top: 6px; }

.tagesplan { display: grid; gap: 6px; }
.tag-wahl { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.tag-knopf { border: 1px solid var(--rand); background: var(--karte); color: var(--text); border-radius: 8px; padding: 4px 10px; cursor: pointer; font: inherit; }
.tag-knopf.an { background: var(--nafa-500, #87BA28); border-color: var(--nafa-500, #87BA28); color: #fff; font-weight: 600; }
.skala { position: relative; height: 16px; margin-left: 150px; font-size: 11px; color: var(--leise); }
.skala span { position: absolute; transform: translateX(-50%); }
.plan-zeile { display: grid; grid-template-columns: 140px 1fr; gap: 10px; align-items: center; }
.plan-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-leiste { position: relative; height: 30px; background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(127,127,127,.08) 6px 12px); border: 1px solid var(--rand); border-radius: 6px; overflow: hidden; }
.betriebsfenster { position: absolute; top: 0; bottom: 0; background: var(--bg); }
.plan-leiste .block { position: absolute; color: #fff; font-size: 11px; line-height: 1; padding: 0 4px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; border-right: 1px solid rgba(255,255,255,.6); opacity: .92; }
.jetzt-strich { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--gefahr); }
.leiste-aus { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--leise); }

.zeit-editor { display: grid; gap: 10px; }
.editor-gruppe { border-top: 1px solid var(--rand); padding-top: 8px; display: grid; gap: 6px; }
.editor-bs { font-weight: 600; font-size: 13px; }
.zeit-zeile { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zeit-zeile img { width: 27px; height: 48px; object-fit: cover; border-radius: 4px; }
.zeit-zeile .farbe { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.zeit-name { min-width: 120px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.zeit-felder { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag-check { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; }
.zeit-felder .datum { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--leise); }
.versteckt { display: none !important; }
@media (max-width: 640px) {
  .plan-zeile { grid-template-columns: 1fr; }
  .skala { margin-left: 0; }
}

/* Eingaben im Zeiten-Menü lesbar in Hell und Dunkel */
.zeiten input[type=time], .zeiten input[type=date], .zeiten select {
  padding: 4px 6px; border: 1px solid var(--rand); border-radius: 6px; background: var(--bg); color: var(--text); color-scheme: light;
}
html.dark .zeiten input[type=time], html.dark .zeiten input[type=date], html.dark .zeiten select { color-scheme: dark; }
/* Schmale Kacheln in der Reihe: Bedienelemente unter den Namen statt daneben */
.raster.reihe .liste li { grid-template-columns: 18px 40px 1fr; }
.raster.reihe .liste img { width: 40px; height: 40px; }
.raster.reihe .liste .steuer { grid-column: 2 / -1; flex-wrap: wrap; }
