:root {
  --hintergrund: #f5f3ef;
  --flaeche: #ffffff;
  --text: #1d2327;
  --text-leise: #6b7378;
  --akzent: #1f3b4d;
  --akzent-text: #ffffff;
  --vera-blase: #ffffff;
  --du-blase: #1f3b4d;
  --du-text: #ffffff;
  --rahmen: #e3dfd8;
  --auflegen: #c0392b;
  --info: #8a7a55;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hintergrund: #14191c;
    --flaeche: #1d2428;
    --text: #e8ecee;
    --text-leise: #93a0a7;
    --akzent: #7fb3cf;
    --akzent-text: #0e1417;
    --vera-blase: #232c31;
    --du-blase: #2f5870;
    --du-text: #ffffff;
    --rahmen: #2c363b;
    --auflegen: #e0564a;
    --info: #c9b88f;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--hintergrund);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.logo {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--akzent); color: var(--akzent-text);
  font-weight: 700; font-size: 28px;
}
.logo.klein { width: 40px; height: 40px; font-size: 18px; }

/* Anmeldung */
.anmeldung { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.karte {
  width: 100%; max-width: 360px; padding: 28px 24px;
  background: var(--flaeche); border: 1px solid var(--rahmen); border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.karte h1 { margin: 4px 0 8px; font-size: 24px; }
.karte label { align-self: flex-start; font-size: 14px; color: var(--text-leise); }
.karte input {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--rahmen); border-radius: 12px;
  background: var(--hintergrund); color: var(--text);
}
.knopf-primaer {
  width: 100%; margin-top: 6px; padding: 12px; font-size: 16px; font-weight: 600;
  border: 0; border-radius: 12px; background: var(--akzent); color: var(--akzent-text);
}
.oder { margin: 4px 0 0; font-size: 13px; color: var(--text-leise); }
.knopf-klein {
  margin-left: auto; padding: 8px 12px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--akzent); border-radius: 10px; background: transparent; color: var(--akzent);
}
.fehler { color: var(--auflegen); margin: 4px 0 0; font-size: 14px; }

/* Hauptbereich */
.hauptbereich {
  height: 100%; display: flex; flex-direction: column;
  max-width: 720px; margin: 0 auto;
}
.kopf {
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  border-bottom: 1px solid var(--rahmen); background: var(--hintergrund);
}
.titel { font-weight: 700; font-size: 18px; }
.status { font-size: 13px; color: var(--text-leise); }

.verlauf {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.blase {
  max-width: 85%; padding: 10px 14px; border-radius: 18px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.blase.vera { align-self: flex-start; background: var(--vera-blase); border: 1px solid var(--rahmen); border-bottom-left-radius: 6px; }
.blase.du { align-self: flex-end; background: var(--du-blase); color: var(--du-text); border-bottom-right-radius: 6px; }
.blase.info { align-self: center; max-width: 95%; font-size: 13px; color: var(--info); background: none; padding: 2px 8px; text-align: center; }
.blase .herkunft { display: block; font-size: 11px; opacity: 0.7; margin-bottom: 2px; }
.freigabe {
  align-self: stretch; padding: 12px 14px; border-radius: 16px;
  background: var(--flaeche); border: 2px solid var(--akzent);
  display: flex; flex-direction: column; gap: 8px;
}
.freigabe-titel { font-weight: 700; font-size: 14px; color: var(--akzent); }
.freigabe-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.freigabe-knoepfe { display: flex; gap: 8px; }
.freigabe-knoepfe button { flex: 1; padding: 12px; font-size: 16px; font-weight: 600; border-radius: 12px; border: 0; }
.freigabe-ja { background: var(--akzent); color: var(--akzent-text); }
.freigabe-nein { background: transparent; color: var(--text); border: 1px solid var(--rahmen) !important; }
.freigabe-knoepfe button:disabled { opacity: 0.5; }
.freigabe.erledigt { border-color: var(--rahmen); }
.freigabe.erledigt .freigabe-titel { color: var(--text-leise); }
.leer { margin: auto; text-align: center; color: var(--text-leise); padding: 24px; }

.fuss {
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
  border-top: 1px solid var(--rahmen); background: var(--hintergrund);
  display: flex; flex-direction: column; gap: 10px;
}
.anruf-knopf {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 16px; font-size: 17px; font-weight: 600;
  border: 0; border-radius: 16px; background: var(--akzent); color: var(--akzent-text);
}
.anruf-knopf svg { width: 22px; height: 22px; fill: currentColor; }
.anruf-knopf.aktiv { background: var(--auflegen); color: #fff; }
.anruf-knopf.aktiv svg { transform: rotate(135deg); }
.anruf-knopf:disabled { opacity: 0.6; }

.chat-formular { display: flex; gap: 8px; }
.chat-formular input {
  flex: 1; min-width: 0; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--rahmen); border-radius: 22px;
  background: var(--flaeche); color: var(--text);
}
.senden {
  width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%;
  background: var(--akzent); color: var(--akzent-text); display: grid; place-items: center;
}
.senden svg { width: 20px; height: 20px; fill: currentColor; }
button { cursor: pointer; font: inherit; }
