/* Anwesenheits-App – mobil-erste Gestaltung, Türkis passend zur Excel-Vorlage */
:root {
  --primaer: #2b7a8c;
  --primaer-dunkel: #205d6b;
  --hintergrund: #f2f6f8;
  --karte: #ffffff;
  --text: #17323b;
  --text-schwach: #5b7480;
  --linie: #dbe6ea;
  --gruen: #1e9e50;
  --gelb: #c07f00;
  --grau: #9aa8b0;
  --rot: #c0392b;
  --radius: 16px;
  --schatten: 0 1px 2px rgba(20, 50, 59, .06), 0 2px 8px rgba(20, 50, 59, .05);
}
/* Dunkle Farben: als System-Standard (sofern nicht auf "hell" erzwungen)
   und bei manueller Wahl "Dunkel" in den Einstellungen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hintergrund: #101c21;
    --karte: #18262d;
    --text: #e4eef2;
    --text-schwach: #93a8b1;
    --linie: #27404a;
    --schatten: 0 1px 3px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --hintergrund: #101c21;
  --karte: #18262d;
  --text: #e4eef2;
  --text-schwach: #93a8b1;
  --linie: #27404a;
  --schatten: 0 1px 3px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--hintergrund);
  color: var(--text);
}

/* Kopfleiste */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--primaer-dunkel);
  color: #fff;
}
.topbar a { color: #fff; text-decoration: none; font-weight: 650; }
.benutzer { display: flex; align-items: center; gap: 10px; min-width: 0; }
.benutzername { font-size: 14px; font-weight: 600; opacity: .9; max-width: 42vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .abmelden { font-weight: 400; font-size: 14px; opacity: .85; }

/* Gruppenkopf mit Tabs */
.gruppenkopf { background: var(--primaer); color: #fff; }
.gruppenkopf-innen { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.kopfzeile { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gruppenkopf h1 { margin: 0; font-size: 22px; padding: 10px 0 12px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zahnrad {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: #fff;
  opacity: .85;
  border-radius: 10px;
}
.zahnrad svg { width: 23px; height: 23px; }
.zahnrad.aktiv, .zahnrad:active { opacity: 1; background: rgba(255, 255, 255, .16); }
.tabs { display: flex; gap: 4px; }
.tabs a {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  color: #fff;
  text-decoration: none;
  border-radius: 10px 10px 0 0;
  font-size: 15px;
  opacity: .85;
}
.tabs a.aktiv { background: var(--hintergrund); color: var(--primaer); font-weight: 700; opacity: 1; }

.inhalt { max-width: 720px; margin: 0 auto; padding: 12px 16px calc(40px + env(safe-area-inset-bottom)); }

/* Sync-Leiste (Aktualisieren + Zeitstempel), unter den Tabs */
.sync-leiste {
  max-width: 720px;
  margin: 0 auto;
  padding: 7px 16px 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-schwach);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sync-leiste .sync-icon { width: 15px; height: 15px; flex-shrink: 0; }
.sync-leiste:active { color: var(--primaer); }
.sync-leiste.laeuft { color: var(--primaer); }
.sync-leiste.laeuft .sync-icon { animation: sync-dreh .8s linear infinite; }
.sync-leiste.warnung { color: var(--gelb); }
@keyframes sync-dreh { to { transform: rotate(360deg); } }

h1.seitentitel { font-size: 22px; margin: 12px 0 4px; }
h2 { font-size: 19px; margin: 12px 0 4px; }
.abschnitt { color: var(--text-schwach); font-size: 15px; margin: 22px 0 2px; }
.seitenkopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.seitenkopf h2 { margin: 0; }

/* Karten */
.karte {
  background: var(--karte);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 10px 0;
  box-shadow: var(--schatten);
}
.karte.klickbar { display: block; text-decoration: none; color: inherit; transition: transform .12s ease; }
.karte.klickbar:active { transform: scale(.99); }
.karten-titel { font-weight: 650; font-size: 17px; }
.karten-titel.gross { font-size: 21px; }
.karten-unterzeile { color: var(--text-schwach); font-size: 14px; margin-top: 3px; }
.beschreibung { color: var(--text-schwach); margin: 8px 0 0; white-space: pre-line; }
.hinweis { color: var(--text-schwach); font-size: 14px; }
.fehler { background: rgba(192, 57, 43, .12); color: var(--rot); padding: 10px 12px; border-radius: 10px; }
.flash { padding: 10px 14px; border-radius: 12px; font-size: 14px; margin: 4px 0 12px; }
.flash-erfolg { background: rgba(30, 158, 80, .16); color: var(--gruen); }
.flash-fehler { background: rgba(192, 57, 43, .13); color: var(--rot); }
.flash-info { background: rgba(43, 122, 140, .14); color: var(--primaer); }
.ehemalig { opacity: .6; }

/* Kennzahlen-Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.kachel {
  background: var(--karte);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--schatten);
}
.kachel .wert { font-size: 26px; font-weight: 750; color: var(--primaer); }
.kachel .beschriftung { font-size: 13px; margin-top: 2px; }
.kachel .klein { font-size: 12px; color: var(--text-schwach); margin-top: 2px; }

/* Knöpfe und Formulare */
button, .knopf {
  font: inherit;
  border: 1px solid var(--linie);
  background: var(--karte);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.primaer { background: var(--primaer); border-color: var(--primaer); color: #fff; font-weight: 600; }
.gefahr { background: none; border-color: var(--rot); color: var(--rot); }
.breit { width: 100%; margin-top: 10px; }

.formular label, .feldname {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 4px;
  color: var(--text-schwach);
}
input[type=text], input[type=password], input[type=email], input[type=date], textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: var(--hintergrund);
  color: var(--text);
}
textarea { resize: vertical; }
.zeile { display: flex; gap: 8px; align-items: flex-end; }
.zeile input { flex: 1; }
.radio-zeile { display: flex; gap: 20px; padding: 8px 0 2px; }
.radio-zeile label { display: flex; gap: 8px; align-items: center; font-size: 16px; }
.radio-zeile input { width: 20px; height: 20px; accent-color: var(--primaer); }
.export-zeile label { flex: 1; font-size: 13px; color: var(--text-schwach); font-weight: 600; }
.export-zeile input { margin-top: 4px; }

/* Anwesenheits-Erfassung */
.zaehler { margin-top: 10px; font-size: 15px; }

/* Status-Symbol: ein Icon, das den Zustand zeigt und beim Antippen durchschaltet
   (abwesend ✕ → anwesend ✓ → zu spät 🕐 → abwesend). Kein Rahmen, kompakt. */
.status-toggle {
  border: none;
  background: none;
  padding: 8px;
  margin: -8px -4px -8px 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s ease, color .15s ease;
}
.status-toggle .ic { width: 21px; height: 21px; display: none; }
.status-toggle[data-status=abwesend] { color: var(--grau); }
.status-toggle[data-status=anwesend] { color: var(--gruen); }
.status-toggle[data-status=zu_spaet] { color: var(--gelb); }
.status-toggle[data-status=abwesend] .ic-abwesend { display: block; }
.status-toggle[data-status=anwesend] .ic-anwesend { display: block; }
.status-toggle[data-status=zu_spaet] .ic-zuspaet { display: block; }
.status-toggle:active { transform: scale(.82); }

/* Flache Listenzeile: Name/Termininfo links, Status-Symbol rechts, ohne eigenen Rahmen */
.liste { padding: 2px 16px; }
.zeile-eintrag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--linie);
}
.zeile-eintrag:last-child { border-bottom: none; }
.name-link { text-decoration: none; color: inherit; font-weight: 600; min-width: 0; }
.termin-info { display: flex; flex-direction: column; gap: 1px; text-decoration: none; color: inherit; min-width: 0; }
.termin-info .tdatum { font-weight: 600; }
.termin-info .ttitel { font-size: 13px; color: var(--text-schwach); }

/* Stift-Symbol (bearbeiten) */
.termin-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.termin-kopf-text { min-width: 0; }
.stift {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--primaer);
  background: var(--hintergrund);
  border: 1px solid var(--linie);
}
.stift svg { width: 20px; height: 20px; }
.stift:active { background: var(--linie); }


/* Personenliste */
.geschlecht {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 9px;
  border-radius: 99px;
  vertical-align: 2px;
  text-transform: uppercase;
}
.geschlecht.w { background: #f6e3ef; color: #a63d79; }
.geschlecht.m { background: #e1edf9; color: #2c6cad; }
@media (prefers-color-scheme: dark) {
  .geschlecht.w { background: #46243a; color: #eda9d2; }
  .geschlecht.m { background: #1e3a52; color: #9cc6ef; }
}
.statistik { display: flex; gap: 16px; margin-top: 6px; font-size: 14px; color: var(--text-schwach); flex-wrap: wrap; }
.statistik strong { color: var(--text); }

/* Anmeldung und Verwaltung */
.login-karte { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.login-karte h1 { color: var(--primaer); margin: 6px 0; }
.login-karte form { text-align: left; }
.wechsel { margin-top: 16px; margin-bottom: 0; }
.wechsel a { color: var(--primaer); font-weight: 600; }

/* Löschbestätigung */
.gefahr-voll {
  background: var(--rot);
  border-color: var(--rot);
  color: #fff;
  font-weight: 700;
}
.loeschen-frage h2 { margin-top: 0; color: var(--rot); }
.loeschen-frage .knopf.breit { margin-top: 10px; }

/* Geteilte Gruppe: Badge und Freigabe-Liste */
.marke-geteilt {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(43, 122, 140, .14);
  color: var(--primaer);
  vertical-align: 2px;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.freigabe-liste { list-style: none; margin: 12px 0 0; padding: 0; }
.freigabe-liste li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--linie);
}
.freigabe-liste li:last-child { border-bottom: none; }
.freigabe-liste span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.klein-knopf { padding: 6px 10px; font-size: 13px; flex-shrink: 0; }
.freigabe-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 99px;
  margin-left: 4px;
  vertical-align: 1px;
  background: rgba(192, 127, 0, .16);
  color: var(--gelb);
}
.freigabe-status.ok { background: rgba(30, 158, 80, .16); color: var(--gruen); }

/* Einladungskarte auf der Gruppenliste */
.karte.einladung { border-left: 4px solid var(--primaer); }
.einladung-aktionen { margin-top: 10px; }
.einladung-aktionen form { flex: 1; }
.einladung-aktionen button { width: 100%; }

/* Themenumschalter (Darstellung) */
.thema-wahl { display: flex; gap: 6px; margin-top: 10px; }
.thema-wahl button {
  flex: 1;
  padding: 10px 6px;
  border: 1px solid var(--linie);
  background: var(--hintergrund);
  color: var(--text-schwach);
  border-radius: 10px;
}
.thema-wahl button.aktiv {
  background: var(--primaer);
  border-color: var(--primaer);
  color: #fff;
  font-weight: 650;
}
