*, *::before, *::after { box-sizing: border-box; }
/* Nebenbefund ("im Handy kann man die Sachen nach links/rechts bewegen"): ohne explizites
   overflow-x:hidden reicht ein einzelnes, minimal zu breites Element (z.B. durch Rundungsfehler
   bei Flex-Gaps oder ein natives <input>-Steuerelement), damit iOS Safari die ganze Seite
   horizontal wischbar/wackelig macht - width:100% allein verhindert das nicht zuverlaessig. */
html, body { margin: 0; padding: 0; overflow-x: hidden; width: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f5f7;
  color: #1c2230;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primaer: #2f5233;
  --primaer-dunkel: #23401f;
  --rand: #dde1e6;
  --karte: #ffffff;
  --text-schwach: #626b79;
  --gefahr: #b3261e;
  --warn: #a05a00;
  --info: #3a5a9c;
}

h1, h2, h3 { margin: 0 0 12px 0; }

input, textarea, select, button { font: inherit; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-schwach);
  margin-bottom: 14px;
  overflow-wrap: break-word;
  word-break: break-word;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="search"], textarea {
  font-weight: 400;
  color: #1c2230;
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 16px; /* verhindert Auto-Zoom beim Fokussieren auf iOS Safari */
  background: #fff;
  width: 100%;
  min-width: 0;
}
textarea { resize: vertical; min-height: 80px; }

button {
  cursor: pointer;
  border-radius: 8px;
  border: none;
  padding: 11px 16px;
  font-weight: 600;
  font-size: 14.5px;
}
/* Sichtbares Feedback waehrend eine Aktion laeuft (siehe mitSperre() in app.js) - ohne das wirkte
   ein Klick "totes", da nichts sich veraenderte, bis die Antwort da war. */
button:disabled { opacity: 0.55; cursor: wait; }
.btn-primaer { background: var(--primaer); color: #fff; }
.btn-primaer:active { background: var(--primaer-dunkel); }
.btn-still { background: #eceef1; color: #1c2230; }
.btn-gefahr { background: var(--gefahr); color: #fff; }

.fehlertext { color: var(--gefahr); font-size: 13.5px; font-weight: 600; }
.erfolgstext { color: var(--primaer); font-size: 13.5px; font-weight: 600; }
.hinweistext { color: var(--text-schwach); font-size: 13px; }

/* Login */
.login-huelle {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-huelle[hidden] { display: none; }
.login-karte {
  background: var(--karte);
  border-radius: 14px;
  padding: 28px 24px;
  width: 100%; max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}
.login-karte button { width: 100%; margin-top: 6px; }

/* Kopfleiste */
.kopfleiste {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: var(--karte);
  border-bottom: 1px solid var(--rand);
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
}
.kopfleiste-marke { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 700; font-size: 16px; }
.kopfleiste-marke img { height: 32px; width: auto; border-radius: 4px; }
.kopfleiste-marke span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopfleiste-aktionen { display: flex; gap: 8px; flex-shrink: 0; }
.kopfleiste-aktionen button { padding: 9px 12px; font-size: 13px; }

.inhalt { max-width: 760px; margin: 0 auto; padding: 16px; padding-bottom: 48px; }

.suchleiste { display: flex; gap: 10px; margin-bottom: 14px; }
.suchleiste input { flex: 1; min-width: 0; }
.suchleiste .btn-primaer { flex-shrink: 0; white-space: nowrap; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn { background: transparent; color: var(--text-schwach); border: 1px solid var(--rand); }
.tab-btn.aktiv { background: var(--primaer); color: #fff; border-color: var(--primaer); }

.leerer-hinweis { color: var(--text-schwach); text-align: center; padding: 32px 0; }

.wartungs-liste { display: flex; flex-direction: column; gap: 10px; }
.wartungs-karte {
  background: var(--karte);
  border-radius: 12px;
  border: 1px solid var(--rand);
  padding: 14px;
}
.wartungs-karte-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.wartungs-karte-titel { font-weight: 700; font-size: 15px; min-width: 0; overflow-wrap: break-word; }
.wartungs-karte-unter { color: var(--text-schwach); font-size: 13.5px; margin-bottom: 8px; }
.status-abzeichen { flex-shrink: 0; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.status-ueberfaellig { background: #fbe6e4; color: var(--gefahr); }
.status-faellig { background: #fbeed6; color: var(--warn); }
.status-unerledigt { background: #e5eaf5; color: var(--info); }
.status-geplant { background: #e7ede8; color: var(--primaer-dunkel); }
.wartungs-karte-notiz { font-size: 13.5px; color: #444; white-space: pre-wrap; margin-bottom: 10px; }
.wartungs-karte-aktionen { display: flex; flex-wrap: wrap; gap: 8px; }
.wartungs-karte-aktionen button { padding: 8px 12px; font-size: 13px; }

/* Modals */
/* Bugfix (24.08.2026): Autoren-CSS mit gleicher Spezifitaet wie die eingebaute [hidden]-Regel
   des Browsers gewinnt gegen diese - ohne den expliziten [hidden]-Selektor unten blieb "display:
   flex" IMMER aktiv, unabhaengig vom hidden-Attribut, wodurch alle vier Modals gleichzeitig
   sichtbar uebereinander lagen (nur das zuletzt im HTML stehende - Einstellungen - war optisch
   oben). Per Headless-Browser-Screenshot gefunden: die Elemente meldeten sich per JS korrekt als
   "hidden", waren aber trotzdem sichtbar gerendert. */
/* Nebenbefund ("wie ein fixiertes Fenster, wie bei der Speisekarte"): vorher unten angedockter
   Bottom-Sheet auf dem Handy (align-items:flex-end) - jetzt wie das Chatbot-PDF-Overlay immer
   zentriert mit Rand ringsum, auf jeder Bildschirmgroesse gleich. */
.modal-huelle {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20,24,30,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal-huelle[hidden] { display: none; }
.modal-karte {
  background: var(--karte);
  border-radius: 16px;
  padding: 20px;
  width: 100%; max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.modal-karte-klein { max-width: 420px; }
.modal-aktionen { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
/* Nebenbefund ("Nächste fällige Wartung läuft über den Rand"): auf schmalen Handy-Breiten bleibt
   fürs Label + den nativen Datepicker in zwei nebeneinanderliegenden Feldern schlicht zu wenig
   Platz - mobile-first daher standardmäßig untereinander, ab ausreichend Platz (480px) wieder
   nebeneinander wie am Desktop. */
.feld-zeile { display: flex; flex-direction: column; gap: 12px; }
.feld-zeile > label { flex: 1; min-width: 0; }
@media (min-width: 480px) {
  .feld-zeile { flex-direction: row; }
}

.einstellungen-abschnitt { border-top: 1px solid var(--rand); padding-top: 14px; margin-top: 14px; }
.einstellungen-abschnitt:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.logo-vorschau { max-height: 60px; max-width: 200px; margin-top: 6px; border-radius: 4px; }
