/* =====================================================================
   Mitarbeiter-PWA – Papenfuß Norderney
   Design: clean, flat, mobile-first. Vanilla CSS, kein Framework.
   ===================================================================== */

:root {
  --gold:        #bba791;
  --gold-dunkel: #9a8672;
  --akzent:      #8b7355;
  --bg:          #f8f6f3;
  --karte:       #ffffff;
  --erfolg:      #5b9a6e;
  --warnung:     #c44;
  --text:        #3a3a3a;
  --text-hell:   #888;
  --linie:       #ececec;
  /* Kategorie-Farben wie im Backend (an_und_abreise_liste): Abreise rot, Anreise grün, Wechsel orange */
  --kat-ab:      #c47a7f;
  --kat-an:      #6aab73;
  --kat-we:      #c4944a;
  --schatten:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --nav-hoehe:   62px;
  --radius:      14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--akzent); }

/* ---- Branding-Serif ---- */
.serif {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: .03em;
}

/* =====================================================================
   App-Layout
   ===================================================================== */
#app { min-height: 100%; }

.view {
  padding: 16px 16px calc(var(--nav-hoehe) + var(--safe-bottom) + 16px);
  max-width: 640px;
  margin: 0 auto;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- Kopfzeile ---- */
.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.kopf .gruss { font-size: 13px; color: var(--text-hell); }
.kopf .name  { font-size: 21px; font-weight: 700; line-height: 1.2; }
.kopf .datum { font-size: 13px; color: var(--text-hell); margin-top: 2px; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--gold); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; flex: 0 0 auto;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* =====================================================================
   Karten
   ===================================================================== */
.karte {
  background: var(--karte);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 16px;
  margin-bottom: 14px;
}
.karte-titel {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-hell); margin: 0 0 10px;
}

/* ---- Zähler-Kacheln ---- */
.zaehler-reihe { display: flex; gap: 12px; margin-bottom: 14px; }
.zaehler {
  flex: 1; background: var(--karte); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 16px 12px; text-align: center;
}
.zaehler .zahl { font-size: 30px; font-weight: 800; line-height: 1; }
.zaehler .label { font-size: 12px; color: var(--text-hell); margin-top: 6px; }
.zaehler.abreise .zahl { color: var(--kat-ab); }
.zaehler.anreise .zahl { color: var(--kat-an); }
.zaehler.wechsel .zahl { color: var(--kat-we); }

/* =====================================================================
   Heute – farbcodierte Bereiche (wie an_und_abreise_liste.php im Backend)
   Abreisen = rot, Anreisen = grün, Wechsel = orange
   ===================================================================== */
.sektion {
  background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten);
  overflow: hidden; margin-bottom: 14px; border: 1.5px solid var(--linie);
}
.sektion-kopf {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.sektion-kopf .anz {
  background: rgba(255,255,255,.28); border-radius: 20px; padding: 1px 11px; font-size: 13px;
}
.sektion-body { padding: 0; }
.sektion-body .eintrag { padding-left: 16px; padding-right: 16px; }

.sektion-abreise { border-color: #d4918f; }
.sektion-abreise .sektion-kopf { background: var(--kat-ab); }
.sektion-abreise .eintrag:nth-of-type(even) { background: #faf0f0; }
.sektion-abreise .wohnung { background: #f3e0e0; color: #a85458; }

.sektion-anreise { border-color: #8dbc8f; }
.sektion-anreise .sektion-kopf { background: var(--kat-an); }
.sektion-anreise .eintrag:nth-of-type(even) { background: #f0f7f0; }
.sektion-anreise .wohnung { background: #e0ede1; color: #4a7d52; }

.sektion-wechsel { border-color: #d4b07a; }
.sektion-wechsel .sektion-kopf { background: var(--kat-we); }
.sektion-wechsel .eintrag:nth-of-type(even) { background: #faf3e8; }
.sektion-wechsel .wohnung { background: #f0e5d3; color: #9a6f28; }
.sektion-wechsel .gast .pfeil { color: var(--kat-we); font-weight: 700; }

/* Icon-Strip (sauber/schmutzig + Ausstattung) im Eintrag */
.eintrag .icons {
  flex: 0 0 auto; display: flex; align-items: center; gap: 5px;
  flex-wrap: wrap; justify-content: flex-end; max-width: 132px;
}
.eintrag .icons img { width: 22px; height: 22px; object-fit: contain; display: block; }
.eintrag .icons img.status { width: 20px; height: 20px; }

/* ---- Listeneintrag (Gast/Wohnung) ---- */
.eintrag {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--linie);
}
.eintrag:last-child { border-bottom: 0; }
.eintrag .wohnung {
  flex: 0 0 56px; height: 40px; border-radius: 10px;
  background: var(--bg); color: var(--akzent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.eintrag .info { flex: 1; min-width: 0; }
.eintrag .info .gast { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag .info .meta { font-size: 12px; color: var(--text-hell); }
.eintrag .badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge.ab { background: #fbe9e9; color: var(--warnung); }
.badge.an { background: #e7f3ec; color: var(--erfolg); }
.badge.we { background: #f3eee6; color: var(--gold-dunkel); }

.leer {
  text-align: center; color: var(--text-hell);
  padding: 28px 12px; font-size: 14px;
}

/* =====================================================================
   Bottom-Navigation – IMMER fixed, nie scrollend
   ===================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-top: 1px solid var(--linie);
  padding-bottom: var(--safe-bottom);
  height: calc(var(--nav-hoehe) + var(--safe-bottom));
}
.bottom-nav button {
  flex: 1; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-hell); font-size: 11px; font-weight: 600;
  padding: 8px 2px; transition: color .15s;
}
.bottom-nav button svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.bottom-nav button.aktiv { color: var(--gold-dunkel); }
.bottom-nav[hidden] { display: none; }

/* =====================================================================
   Login
   ===================================================================== */
.login-wrap {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 24px calc(32px + var(--safe-bottom));
  background:
    radial-gradient(120% 80% at 50% 0%, #fff 0%, var(--bg) 60%);
}
.login-marke { text-align: center; margin-bottom: 34px; }
.login-marke .logo {
  width: 78px; height: 78px; border-radius: 20px;
  background: var(--gold); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, serif; font-size: 42px; font-weight: 700;
  margin: 0 auto 18px; box-shadow: var(--schatten);
}
.login-marke .titel { font-size: 24px; font-weight: 700; }
.login-marke .unter { font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-dunkel); margin-top: 2px; }

.login-card {
  width: 100%; max-width: 360px;
  background: var(--karte); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 22px;
}
.feld { margin-bottom: 14px; }
.feld label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-hell); }
.feld input {
  width: 100%; padding: 13px 14px; font-size: 16px;
  border: 1px solid var(--linie); border-radius: 11px; background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.feld input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(187,167,145,.18); }

.btn-primaer {
  width: 100%; padding: 14px; border: 0; border-radius: 11px;
  background: var(--gold); color: #fff; font-size: 16px; font-weight: 700;
  transition: background .15s, transform .05s;
}
.btn-primaer:active { transform: scale(.985); }
.btn-primaer:disabled { opacity: .6; }

.btn-text {
  width: 100%; padding: 12px; border: 0; background: none;
  color: var(--warnung); font-size: 14px; font-weight: 600;
}

.hinweis {
  font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px;
  display: none;
}
.hinweis.fehler { display: block; background: #fbe9e9; color: var(--warnung); }
.hinweis.ok     { display: block; background: #e7f3ec; color: var(--erfolg); }

/* =====================================================================
   Hilfsklassen / Lade-Spinner
   ===================================================================== */
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--linie); border-top-color: var(--gold);
  animation: dreh .7s linear infinite; margin: 40px auto;
}
@keyframes dreh { to { transform: rotate(360deg); } }

.platzhalter {
  text-align: center; color: var(--text-hell); padding: 60px 24px;
}
.platzhalter .icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.platzhalter h2 { font-size: 18px; color: var(--text); margin: 0 0 6px; }

/* =====================================================================
   Housekeeping – Aufgaben & Checkliste
   ===================================================================== */

/* Topbar mit Zurück-Button (Detailansicht) */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.topbar .zurueck {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--linie);
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text); flex: 0 0 auto;
}
.topbar .titel { font-size: 19px; font-weight: 700; line-height: 1.15; }
.topbar .titel small { display: block; font-size: 12px; color: var(--text-hell); font-weight: 400; }

/* Typ-/Status-Badges */
.tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.tag.wechsel      { background: #f3eee6; color: var(--gold-dunkel); }
.tag.endreinigung { background: #fbe9e9; color: var(--warnung); }
.tag.zwischenreinigung, .tag.handtuch { background: #eef2f6; color: #5a6b7a; }
.tag.offen     { background: #eef0f2; color: #7a818a; }
.tag.in_arbeit { background: #fff4e0; color: #b07d2b; }
.tag.erledigt  { background: #e7f3ec; color: var(--erfolg); }

/* Aufgaben-Karte */
.aufgabe-karte { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 14px 16px; margin-bottom: 12px; cursor: pointer; border: 1px solid transparent;
  transition: border-color .12s, transform .05s; }
.aufgabe-karte:active { transform: scale(.992); }
.aufgabe-karte.erledigt { opacity: .72; }
.aufgabe-karte .zeile1 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.aufgabe-karte .wohnung-name { font-size: 17px; font-weight: 700; }
.aufgabe-karte .gast { font-size: 13px; color: var(--text-hell); margin-top: 4px; }
.aufgabe-karte .gast b { color: var(--text); font-weight: 600; }
.aufgabe-karte .meine { font-size: 11px; color: var(--gold-dunkel); font-weight: 700; }

/* Fortschrittsbalken */
.progress { height: 7px; border-radius: 5px; background: var(--bg); overflow: hidden; margin-top: 12px; }
.progress > span { display: block; height: 100%; background: var(--erfolg); border-radius: 5px; transition: width .25s; }
.progress-text { font-size: 12px; color: var(--text-hell); margin-top: 6px; display: flex; justify-content: space-between; }

/* Checklisten-Punkt */
.check-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 4px;
  border-bottom: 1px solid var(--linie); cursor: pointer; }
.check-item:last-child { border-bottom: 0; }
.check-box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--linie);
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; transition: background .12s, border-color .12s; }
.check-item.an .check-box { background: var(--erfolg); border-color: var(--erfolg); }
.check-item .ci-text { flex: 1; }
.check-item .ci-name { font-weight: 600; }
.check-item.an .ci-name { text-decoration: line-through; color: var(--text-hell); font-weight: 400; }
.check-item .ci-desc { font-size: 12px; color: var(--text-hell); margin-top: 2px; }

/* Fertig-Leiste (über der Bottom-Nav) */
.aktionsleiste { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-hoehe) + var(--safe-bottom));
  padding: 10px 16px; background: linear-gradient(to top, var(--bg) 60%, rgba(248,246,243,0));
  max-width: 640px; margin: 0 auto; z-index: 900; }
.btn-erfolg { width: 100%; padding: 14px; border: 0; border-radius: 11px; background: var(--erfolg);
  color: #fff; font-size: 16px; font-weight: 700; }
.btn-erfolg:disabled { opacity: .5; }
.view.mit-aktion { padding-bottom: calc(var(--nav-hoehe) + var(--safe-bottom) + 80px); }

/* Datumszeile / Refresh */
.listen-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.listen-kopf .titel { font-size: 21px; font-weight: 700; }
.listen-kopf .datum { font-size: 13px; color: var(--text-hell); }
.refresh-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--linie);
  background: #fff; font-size: 16px; color: var(--text); }

/* =====================================================================
   Stempeluhr
   ===================================================================== */
.stempel-karte { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 26px 20px; text-align: center; margin-bottom: 16px; }
.stempel-status-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px;
  font-weight: 700; padding: 5px 14px; border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; }
.stempel-status-pill .dot { width: 9px; height: 9px; border-radius: 50%; }
.sp-aus    { background: #eef0f2; color: #7a818a; }
.sp-aus .dot    { background: #b6bcc2; }
.sp-aktiv  { background: #e7f3ec; color: var(--erfolg); }
.sp-aktiv .dot  { background: var(--erfolg); animation: puls 1.6s infinite; }
.sp-pause  { background: #fff4e0; color: #b07d2b; }
.sp-pause .dot  { background: #d99a2b; }
@keyframes puls { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.stempel-uhr { font-size: 46px; font-weight: 800; letter-spacing: .01em; margin: 16px 0 4px;
  font-variant-numeric: tabular-nums; }
.stempel-unter { font-size: 13px; color: var(--text-hell); }
.stempel-heute { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--linie);
  font-size: 14px; color: var(--text-hell); }
.stempel-heute b { font-size: 20px; color: var(--text); font-weight: 800; display: block; margin-top: 2px;
  font-variant-numeric: tabular-nums; }

.stempel-buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.btn-stempel { width: 100%; padding: 16px; border: 0; border-radius: 13px; font-size: 17px; font-weight: 700; color: #fff; }
.btn-stempel:active { transform: scale(.99); }
.btn-stempel:disabled { opacity: .55; }
.btn-stempel.ein  { background: var(--erfolg); }
.btn-stempel.aus  { background: var(--warnung); }
.btn-stempel.pause{ background: #fff; color: var(--akzent); border: 1px solid var(--linie); }
.btn-zeile { display: flex; gap: 10px; }
.btn-zeile .btn-stempel { flex: 1; }

/* Monatsübersicht */
.monat-summe { display: flex; gap: 10px; margin-bottom: 14px; }
.monat-summe .box { flex: 1; background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 14px 8px; text-align: center; }
.monat-summe .box .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.monat-summe .box .l { font-size: 11px; color: var(--text-hell); margin-top: 4px; }
.monat-summe .box .v.plus  { color: var(--erfolg); }
.monat-summe .box .v.minus { color: var(--warnung); }
.monat-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.monat-nav button { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--linie);
  background: #fff; font-size: 16px; color: var(--text); }
.monat-nav .label { font-weight: 700; font-size: 16px; }
.tag-zeile { display: flex; justify-content: space-between; align-items: center; padding: 11px 0;
  border-bottom: 1px solid var(--linie); font-size: 14px; }
.tag-zeile:last-child { border-bottom: 0; }
.tag-zeile .tz-datum { color: var(--text); }
.tag-zeile .tz-datum small { color: var(--text-hell); }
.tag-zeile .tz-ist { font-weight: 700; font-variant-numeric: tabular-nums; }

/* =====================================================================
   Kalender (Wechsel-Timeline)
   ===================================================================== */
.kal-tag { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten);
  margin-bottom: 10px; overflow: hidden; }
.kal-tag.leer { opacity: .6; }
.kal-tag.heute { border: 1.5px solid var(--gold); }
.kal-kopf { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; }
.kal-datum { flex: 0 0 auto; min-width: 78px; }
.kal-datum .wt { font-weight: 700; font-size: 15px; }
.kal-datum .dt { font-size: 12px; color: var(--text-hell); }
.kal-datum .heute-tag { display: inline-block; font-size: 9px; font-weight: 700; color: var(--gold-dunkel);
  text-transform: uppercase; letter-spacing: .05em; }
.kal-counts { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.kal-chip { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.kal-chip.ab { background: #fbe9e9; color: var(--warnung); }
.kal-chip.an { background: #e7f3ec; color: var(--erfolg); }
.kal-chip.we { background: #f3eee6; color: var(--gold-dunkel); }
.kal-chip.frei { background: var(--bg); color: var(--text-hell); }
.kal-fortschritt { flex: 0 0 auto; font-size: 11px; color: var(--text-hell); text-align: right; }
.kal-pfeil { flex: 0 0 auto; color: var(--text-hell); transition: transform .15s; font-size: 14px; }
.kal-tag.offen .kal-pfeil { transform: rotate(90deg); }
.kal-detail { padding: 0 16px 12px; }
.kal-detail .sektion { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-hell); margin: 12px 0 4px; }

/* =====================================================================
   Schadensmeldungen
   ===================================================================== */
.prio { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.prio-niedrig  { background: #eef0f2; color: #7a818a; }
.prio-mittel   { background: #eef5fb; color: #3b7bbf; }
.prio-hoch     { background: #fff4e0; color: #b07d2b; }
.prio-dringend { background: #fbe9e9; color: var(--warnung); }

.schaden-karte { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 14px 16px; margin-bottom: 12px; }
.schaden-karte.erledigt { opacity: .7; }
.schaden-karte .zeile1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.schaden-karte .wohnung-name { font-size: 15px; font-weight: 700; }
.schaden-karte .text { font-size: 14px; }
.schaden-karte .fuss { font-size: 12px; color: var(--text-hell); margin-top: 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.foto-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.foto-thumb { width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--bg);
  border: 1px solid var(--linie); position: relative; }
.foto-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-thumb .del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: 0; font-size: 13px; line-height: 20px; padding: 0; }

.foto-add { width: 72px; height: 72px; border-radius: 10px; border: 1.5px dashed var(--gold);
  background: #fff; color: var(--gold-dunkel); font-size: 26px; display: flex; align-items: center; justify-content: center; }

.feld textarea, .feld select { width: 100%; padding: 12px 14px; font-size: 16px; border: 1px solid var(--linie);
  border-radius: 11px; background: #fff; outline: none; font-family: inherit; }
.feld textarea:focus, .feld select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(187,167,145,.18); }
.feld textarea { min-height: 96px; resize: vertical; }

.prio-wahl { display: flex; gap: 8px; }
.prio-wahl button { flex: 1; padding: 9px 4px; border: 1px solid var(--linie); border-radius: 10px;
  background: #fff; font-size: 13px; font-weight: 600; color: var(--text-hell); }
.prio-wahl button.aktiv { border-color: var(--gold); background: #f7f1e8; color: var(--akzent); }
