:root {
  --gruen: #2E7D32;
  --gruen-dunkel: #1B5E20;
  --gruen-hell: #E8F5E9;
  --gruen-mittel: #A5D6A7;
  --grund: #F4F7F4;
  --flaeche: #FFFFFF;
  --text: #1F2A1F;
  --leise: #66736A;
  --linie: #DDE5DD;
  --rot: #C62828;
  --gelb: #F9A825;
  --kopf-h: 44px;
  --tab-h: 52px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #101510; --flaeche: #1A221A; --text: #E6EEE6; --leise: #9AA79E;
    --linie: #2C382C; --gruen-hell: #1F3321; --gruen: #43A047;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--grund); color: var(--text);
  padding-top: calc(var(--kopf-h) + env(safe-area-inset-top));
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
header#kopf {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  height: calc(var(--kopf-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
  background: var(--gruen); color: #fff; display: flex; align-items: center; gap: 6px; padding-left: 8px; padding-right: 10px;
}
header h1 { font-size: 16px; font-weight: 600; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#zurueck { background: none; border: 0; color: #fff; font-size: 28px; line-height: 1; padding: 0 8px 4px 2px; }
#sync { font-size: 12px; opacity: .9; }
nav#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--flaeche); border-top: 1px solid var(--linie);
}
nav#tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--leise); text-decoration: none; font-size: 11px; gap: 1px; position: relative;
}
nav#tabs a .i { font-size: 20px; line-height: 22px; }
nav#tabs a.aktiv { color: var(--gruen); font-weight: 600; }
nav#tabs .punkt { position: absolute; top: 5px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--rot); }
main { padding: 8px 0 16px; }

/* Abschnitte und schlanke Listen */
.abschnitt { margin: 0 0 10px; }
.abschnitt > h2 {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  color: var(--leise); margin: 10px 12px 4px; display: flex; justify-content: space-between;
}
.liste { background: var(--flaeche); border-top: 1px solid var(--linie); border-bottom: 1px solid var(--linie); }
.zeile {
  display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 12px;
  border-bottom: 1px solid var(--linie); color: inherit; text-decoration: none;
}
.zeile:last-child { border-bottom: 0; }
.zeile .haupt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zeile .neben { color: var(--leise); font-size: 13px; white-space: nowrap; max-width: 38%; overflow: hidden; text-overflow: ellipsis; }
.zeile .nr { color: var(--leise); font-variant-numeric: tabular-nums; font-size: 13px; width: 54px; flex: none; }
.zeile .zeit { font-variant-numeric: tabular-nums; font-size: 13px; width: 86px; flex: none; }
.zeile.pfeil::after { content: "›"; color: var(--leise); font-size: 18px; margin-left: 2px; }
.leer { color: var(--leise); padding: 10px 12px; font-size: 13px; }
.marke { font-size: 11px; padding: 1px 6px; border-radius: 9px; background: var(--gruen-hell); color: var(--gruen); white-space: nowrap; }
.marke.rot { background: #FDECEA; color: var(--rot); }
.marke.gelb { background: #FFF8E1; color: #8D6E00; }
.marke.grau { background: var(--linie); color: var(--leise); }

/* Formulare */
.formular { background: var(--flaeche); border-top: 1px solid var(--linie); border-bottom: 1px solid var(--linie); }
.feld { display: flex; align-items: center; gap: 8px; padding: 4px 12px; min-height: 40px; border-bottom: 1px solid var(--linie); }
.feld:last-child { border-bottom: 0; }
.feld > label { width: 96px; flex: none; color: var(--leise); font-size: 13px; }
.feld input, .feld select, .feld textarea {
  flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: inherit; padding: 6px 0; outline: none;
  font-size: 16px; /* verhindert Zoom auf iOS */
}
.feld textarea { resize: vertical; min-height: 60px; }
.knoepfe { display: flex; gap: 8px; padding: 10px 12px; }
button.k, a.k {
  flex: 1; border: 0; border-radius: 8px; padding: 10px 12px; font: inherit; font-weight: 600; text-align: center;
  background: var(--gruen); color: #fff; text-decoration: none;
}
button.k.zweit, a.k.zweit { background: var(--gruen-hell); color: var(--gruen); }
button.k.rot { background: var(--rot); }
button.k:disabled { opacity: .5; }

/* Zeiterfassung */
.uhr { background: var(--flaeche); border-bottom: 1px solid var(--linie); padding: 10px 12px; display: flex; align-items: center; gap: 12px; }
.uhr .dauer { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.uhr .info { flex: 1; min-width: 0; font-size: 13px; color: var(--leise); }
.uhr .info b { color: var(--text); display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.startstopp { width: 64px; height: 64px; border-radius: 50%; border: 0; color: #fff; font-size: 15px; font-weight: 700; background: var(--gruen); flex: none; }
.startstopp.laeuft { background: var(--rot); }

/* Kalender */
.segment { display: flex; margin: 8px 12px; background: var(--linie); border-radius: 8px; padding: 2px; }
.segment button { flex: 1; border: 0; background: transparent; padding: 5px; border-radius: 6px; font: inherit; font-size: 13px; color: var(--text); }
.segment button.an { background: var(--flaeche); font-weight: 600; }
.wochenkopf { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; font-size: 13px; color: var(--leise); }
.wochenkopf button { border: 0; background: none; color: var(--gruen); font-size: 22px; padding: 0 10px; }

/* Chat */
.chat { padding: 8px 10px 70px; display: flex; flex-direction: column; gap: 4px; }
.blase { max-width: 80%; padding: 6px 10px; border-radius: 12px; background: var(--flaeche); border: 1px solid var(--linie); align-self: flex-start; }
.blase.ich { align-self: flex-end; background: var(--gruen-hell); border-color: var(--gruen-mittel); }
.blase .wer { font-size: 11px; color: var(--leise); }
.blase img { max-width: 100%; border-radius: 8px; display: block; margin-top: 4px; }
.eingabe {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  display: flex; gap: 6px; padding: 6px 8px; background: var(--flaeche); border-top: 1px solid var(--linie);
}
.eingabe input[type=text] { flex: 1; border: 1px solid var(--linie); border-radius: 18px; padding: 7px 12px; font: inherit; font-size: 16px; background: var(--grund); color: inherit; }
.eingabe button, .eingabe label { border: 0; background: var(--gruen); color: #fff; border-radius: 18px; padding: 0 14px; font-weight: 600; display: flex; align-items: center; }
.eingabe label { background: var(--gruen-hell); color: var(--gruen); }

/* Fotos */
.vorschau { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 6px 12px; }
.vorschau img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.fortschritt { height: 3px; background: var(--linie); margin: 0 12px; border-radius: 2px; overflow: hidden; }
.fortschritt > div { height: 100%; background: var(--gruen); width: 0; transition: width .2s; }

/* Stundenkonto */
table.konto { width: 100%; border-collapse: collapse; background: var(--flaeche); font-size: 14px; font-variant-numeric: tabular-nums; }
table.konto th, table.konto td { padding: 5px 12px; border-bottom: 1px solid var(--linie); text-align: right; }
table.konto th:first-child, table.konto td:first-child { text-align: left; }
table.konto th { font-size: 12px; color: var(--leise); font-weight: 600; }
.minus { color: var(--rot); }

#toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 10px); z-index: 20;
  background: #263238; color: #fff; padding: 9px 12px; border-radius: 8px; font-size: 14px; text-align: center;
}
.anmeldung { padding: 24px 16px; text-align: center; }
.anmeldung img { width: 72px; border-radius: 16px; }
.anmeldung p { color: var(--leise); font-size: 14px; }
.anmeldung input { width: 100%; font-size: 22px; letter-spacing: .15em; text-align: center; padding: 10px; border: 1px solid var(--linie); border-radius: 8px; text-transform: uppercase; background: var(--flaeche); color: inherit; }
