/* David - Oberflaeche
 *
 * Leitbild: ein Blatt Papier, auf dem geschrieben wird. Warm, ruhig, gross
 * genug fuer Haende mit Arbeitshandschuhen. Keine Verlaeufe, keine Schatten,
 * die glaenzen, kein Dunkelblau mit Neon. Ein Arbeitsprogramm.
 *
 * Alles ist zuerst fuers Handy gebaut, der grosse Bildschirm kommt danach.
 */

:root {
  --papier:        #faf7f2;
  --papier-tief:   #f3eee6;
  --linie:         #e3dbcd;
  --linie-stark:   #cfc4b0;
  --tinte:         #23201c;
  --tinte-leise:   #6d6558;
  --tinte-still:   #938a7b;
  --eigen:         #ece4d6;   /* eigene Nachricht */
  --akzent:        #8a5a2b;   /* geduecktes Braun, kein Knallblau */
  --akzent-tief:   #6f4720;
  --gold:          #b98a3c;   /* Marke, feine Linien */
  --warnung:       #a23c14;
  --gruen:         #4a6b3f;
  --weiss:         #fffdfa;

  --rund:          14px;
  --rund-gross:    20px;
  --leiste-hoehe:  calc(68px + env(safe-area-inset-bottom, 0px));
  --kopf-hoehe:    calc(58px + env(safe-area-inset-top, 0px));

  --schrift: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Muss vor allen Regeln mit eigenem display stehen: ein Element mit dem
 * Merkmal "hidden" bekaeme sonst von .seitenblatt{display:flex} sein
 * display zurueck und waere trotzdem sichtbar. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: var(--schrift);
  /* 17px: unter 16px zoomt iOS beim Antippen von Feldern herein. */
  font-size: 17px;
  line-height: 1.5;
  color: var(--tinte);
  background: var(--papier);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

svg { width: 24px; height: 24px; fill: none; stroke: currentColor;
      stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- Anmelden */

.anmeldeseite {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--papier);
}

.anmeldekasten {
  width: 100%;
  max-width: 380px;
}

.marke { text-align: center; margin-bottom: 30px; }
.marke h1 {
  font-size: 30px; font-weight: 600; letter-spacing: -0.4px;
  margin: 10px 0 4px;
}
.marke-zeile { margin: 0; color: var(--tinte-leise); font-size: 15px; }

.anmeldeform { display: flex; flex-direction: column; gap: 6px; }
.anmeldeform label {
  font-size: 13px; font-weight: 600; color: var(--tinte-leise);
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 12px;
}
.anmeldeform input {
  font: inherit;
  padding: 15px 16px;
  border: 1.5px solid var(--linie);
  border-radius: var(--rund);
  background: var(--weiss);
  color: var(--tinte);
}
.anmeldeform input:focus {
  outline: none;
  border-color: var(--akzent);
}

.knopf-gross {
  font: inherit; font-weight: 600;
  margin-top: 22px;
  padding: 16px;
  min-height: 54px;
  border: none;
  border-radius: var(--rund);
  background: var(--akzent);
  color: #fff;
  cursor: pointer;
}
.knopf-gross:active { background: var(--akzent-tief); }

.fehler {
  background: #fbeae4;
  border: 1.5px solid #e8b9a6;
  color: var(--warnung);
  padding: 12px 14px;
  border-radius: var(--rund);
  font-size: 15px;
  margin: 0 0 14px;
}

.hinweis-klein {
  margin: 18px 0 0; text-align: center;
  font-size: 14px; color: var(--tinte-leise);
}
.hilfe-fuss {
  margin: 34px 0 0; text-align: center;
  font-size: 14px; color: var(--tinte-still); line-height: 1.6;
}
.hilfe-fuss a { color: var(--akzent); font-weight: 600; text-decoration: none; }

/* ------------------------------------------------------------------- Kopf */

.kopf {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: var(--kopf-hoehe);
  padding: env(safe-area-inset-top, 0px) 6px 0;
  display: flex; align-items: center; gap: 4px;
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--linie);
}

.kopf-knopf {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: none; background: none; color: var(--tinte-leise);
  border-radius: 12px; cursor: pointer;
}
.kopf-knopf:active { background: var(--papier-tief); }

.kopf-mitte {
  flex: 1 1 auto; min-width: 0; text-align: center;
  display: flex; flex-direction: column; line-height: 1.25;
}
.kopf-titel {
  font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kopf-betrieb {
  font-size: 11.5px; letter-spacing: 0.3px;
  color: var(--gold); font-weight: 600;
}

/* ----------------------------------------------------------------- Verlauf */

.blatt {
  position: absolute;
  top: var(--kopf-hoehe); bottom: var(--leiste-hoehe);
  left: 0; right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.verlauf {
  max-width: 740px;
  margin: 0 auto;
  padding: 18px 16px 24px;
  display: flex; flex-direction: column; gap: 16px;
}

.nachricht { display: flex; flex-direction: column; max-width: 100%; }
.nachricht.ich { align-items: flex-end; }

.blase {
  max-width: 86%;
  padding: 12px 15px;
  border-radius: var(--rund-gross);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.ich .blase {
  background: var(--eigen);
  border-bottom-right-radius: 6px;
}
.david .blase {
  background: transparent;
  padding-left: 0; padding-right: 0;
  max-width: 100%;
}

.fotos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fotos img {
  width: 128px; height: 128px; object-fit: cover;
  border-radius: 12px; border: 1px solid var(--linie);
  background: var(--papier-tief);
}

/* Dokumentkarte: sieht aus wie ein Blatt, das herausgereicht wird. */
.dokument {
  display: flex; align-items: center; gap: 13px;
  margin-top: 10px;
  padding: 14px 16px;
  min-height: 62px;
  background: var(--weiss);
  border: 1.5px solid var(--linie-stark);
  border-radius: var(--rund);
  text-decoration: none; color: inherit;
}
.dokument:active { background: var(--papier-tief); }
.dokument .blatt-symbol {
  flex: 0 0 auto; width: 30px; height: 30px; color: var(--akzent);
}
.dokument-text { min-width: 0; flex: 1 1 auto; }
.dokument-name { font-weight: 600; font-size: 16px; }
.dokument-unten { font-size: 13px; color: var(--tinte-still); }
.dokument .pfeil { flex: 0 0 auto; color: var(--tinte-still); width: 20px; height: 20px; }

.dokument-mail {
  display: block; width: 100%;
  margin-top: 7px; padding: 12px;
  min-height: 48px;
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--akzent);
  background: none;
  border: 1.5px solid var(--linie-stark);
  border-radius: var(--rund);
  cursor: pointer;
}
.dokument-mail:active { background: var(--papier-tief); }

/* Versandfenster. Die Adresse steht sichtbar da, bevor etwas rausgeht --
 * eine verschickte Mail holt niemand zurueck. */
.mailfenster {
  position: fixed; z-index: 55;
  left: 14px; right: 14px; bottom: 14px;
  max-width: 480px; margin: 0 auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--papier);
  border: 1.5px solid var(--linie-stark);
  border-radius: var(--rund-gross);
  display: flex; flex-direction: column;
}
.mailfenster h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.mail-was {
  margin: 0 0 14px; font-size: 14.5px; color: var(--tinte-still);
}
.mailfenster label {
  font-size: 13px; font-weight: 600; color: var(--tinte-leise);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 10px 0 6px;
}
.mailfenster input, .mailfenster textarea {
  font: inherit;
  padding: 13px 14px;
  border: 1.5px solid var(--linie);
  border-radius: var(--rund);
  background: var(--weiss); color: var(--tinte);
  resize: none;
}
.mailfenster input:focus, .mailfenster textarea:focus {
  outline: none; border-color: var(--akzent);
}
.mail-warnung {
  margin: 14px 0 0; font-size: 14px; color: var(--warnung);
}
.mail-knoepfe { display: flex; gap: 10px; margin-top: 16px; }
.mail-knoepfe .knopf-gross { flex: 1 1 auto; margin-top: 0; }
.knopf-still {
  font: inherit; font-weight: 600;
  padding: 16px 18px; min-height: 54px;
  border: 1.5px solid var(--linie-stark); border-radius: var(--rund);
  background: none; color: var(--tinte-leise); cursor: pointer;
}

.dokument-hinweis {
  margin-top: 6px; font-size: 14px; color: var(--warnung);
  display: flex; gap: 7px; align-items: flex-start;
}

/* David denkt */
.tippt { display: flex; gap: 5px; padding: 6px 0 2px; }
.tippt span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tinte-still);
  animation: huepf 1.3s infinite ease-in-out;
}
.tippt span:nth-child(2) { animation-delay: 0.18s; }
.tippt span:nth-child(3) { animation-delay: 0.36s; }
@keyframes huepf {
  0%, 70%, 100% { opacity: 0.3; transform: translateY(0); }
  35%           { opacity: 1;   transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .tippt span { animation: none; opacity: 0.55; }
}

.tippt-hinweis {
  font-size: 14.5px; color: var(--tinte-still);
  padding: 2px 0 4px;
}

.leer-hinweis {
  margin: 36px auto 0; max-width: 420px; text-align: center;
  color: var(--tinte-leise);
}
.leer-hinweis h2 {
  font-size: 19px; font-weight: 600; color: var(--tinte); margin: 0 0 8px;
}
.leer-hinweis p { margin: 0 0 6px; font-size: 15.5px; }

/* ------------------------------------------------------------- Eingabe */

.anhang-leiste {
  position: fixed; left: 0; right: 0;
  bottom: var(--leiste-hoehe);
  z-index: 25;
  display: flex; gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  background: var(--papier);
  border-top: 1px solid var(--linie);
}
.anhang { position: relative; flex: 0 0 auto; }
.anhang img {
  width: 62px; height: 62px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--linie);
}
.anhang button {
  position: absolute; top: -6px; right: -6px;
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: var(--tinte); color: #fff;
  font-size: 15px; line-height: 1; cursor: pointer;
}

.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  min-height: var(--leiste-hoehe);
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: flex-end; gap: 7px;
  background: var(--papier);
  border-top: 1px solid var(--linie);
}

.leiste-knopf {
  flex: 0 0 auto;
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border: none; border-radius: 15px;
  background: var(--papier-tief);
  color: var(--tinte-leise);
  cursor: pointer;
}
.leiste-knopf:active { background: var(--linie); }
.leiste-knopf svg { width: 25px; height: 25px; }

.leiste-knopf.senden { background: var(--akzent); color: #fff; }
.leiste-knopf.senden:disabled { background: var(--papier-tief); color: var(--tinte-still); }
.leiste-knopf.mikro.laeuft { background: var(--warnung); color: #fff; }

#eingabe {
  flex: 1 1 auto; min-width: 0;
  font: inherit;
  resize: none;
  max-height: 150px;
  padding: 13px 15px;
  border: 1.5px solid var(--linie);
  border-radius: 15px;
  background: var(--weiss);
  color: var(--tinte);
}
#eingabe:focus { outline: none; border-color: var(--linie-stark); }
/* Die Bildlaufleiste blitzt sonst im Feld auf, obwohl es mitwaechst. */
#eingabe { scrollbar-width: none; }
#eingabe::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------- Aufnahme */

.aufnahme {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--papier);
  border-top: 1px solid var(--linie);
}
.aufnahme-innen {
  display: flex; align-items: center; gap: 11px;
  max-width: 740px; margin: 0 auto;
}
.punkt {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--warnung);
  animation: pulsieren 1.4s infinite;
}
@keyframes pulsieren { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .punkt { animation: none; } }

.aufnahme-zeit { font-variant-numeric: tabular-nums; font-weight: 600; }
.aufnahme-text { flex: 1 1 auto; color: var(--tinte-leise); font-size: 15px; }
.aufnahme-abbruch, .aufnahme-fertig {
  font: inherit; font-weight: 600;
  padding: 12px 17px; min-height: 48px;
  border-radius: 13px; cursor: pointer;
}
.aufnahme-abbruch {
  border: 1.5px solid var(--linie-stark); background: none; color: var(--tinte-leise);
}
.aufnahme-fertig { border: none; background: var(--akzent); color: #fff; }

/* Markenblock in der Seitenleiste. Sichtbar fuer den Betrieb, nie fuer
 * dessen Kunden -- auf deren Dokumenten steht nichts von uns. */
.marke-leiste {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--linie);
}
.marke-leiste img { border-radius: 9px; flex: 0 0 auto; }
.marke-leiste span { display: flex; flex-direction: column; min-width: 0; }
.marke-leiste strong {
  font-size: 15px; font-weight: 600; letter-spacing: 0.2px;
  color: var(--tinte);
}
.marke-leiste em {
  font-style: normal; font-size: 12.5px; color: var(--tinte-still);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ----------------------------------------------------------- Seitenblatt */

.schatten {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(35, 32, 28, 0.35);
}

.seitenblatt {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  width: min(86vw, 330px);
  display: flex; flex-direction: column;
  background: var(--papier);
  border-right: 1px solid var(--linie);
  padding-top: env(safe-area-inset-top, 0px);
}
.seitenblatt-kopf {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 10px 12px 18px;
  font-weight: 600;
  border-bottom: 1px solid var(--linie);
}
.vorgangsliste { flex: 1 1 auto; overflow-y: auto; padding: 8px; }
.vorgang {
  display: block; width: 100%; text-align: left;
  font: inherit; color: inherit;
  padding: 13px 14px; min-height: 56px;
  border: none; background: none; border-radius: 12px; cursor: pointer;
}
.vorgang:active, .vorgang.aktiv { background: var(--papier-tief); }
.vorgang-titel {
  display: block; font-size: 15.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vorgang-zeit { display: block; font-size: 12.5px; color: var(--tinte-still); }

.seitenblatt-fuss {
  border-top: 1px solid var(--linie);
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  font-size: 14px; color: var(--tinte-still);
}
.seitenblatt-fuss a { color: var(--akzent); font-weight: 600; text-decoration: none; }
.abmelden {
  font: inherit; margin-top: 12px; padding: 10px 14px;
  border: 1.5px solid var(--linie-stark); border-radius: 11px;
  background: none; color: var(--tinte-leise); cursor: pointer;
}

/* -------------------------------------------------------------- Meldung */

.meldung {
  position: fixed; z-index: 60;
  left: 14px; right: 14px;
  bottom: calc(var(--leiste-hoehe) + 14px);
  max-width: 640px; margin: 0 auto;
  padding: 13px 16px;
  border-radius: var(--rund);
  background: var(--tinte); color: #fff;
  font-size: 15.5px; line-height: 1.45;
}
.meldung.warnung { background: var(--warnung); }

/* ---------------------------------------------------------- Firmendaten */

.einstellungsseite { background: var(--papier); }

.formularblatt {
  max-width: 620px;
  margin: 0 auto;
  padding: calc(var(--kopf-hoehe) + 18px) 18px
           calc(34px + env(safe-area-inset-bottom, 0px));
}

.datenform { display: flex; flex-direction: column; }
.datenform label {
  font-size: 13px; font-weight: 600; color: var(--tinte-leise);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 20px 0 6px;
}
.datenform input[type="text"],
.datenform input[type="tel"],
.datenform input[type="email"],
.datenform textarea {
  font: inherit;
  padding: 14px 15px;
  border: 1.5px solid var(--linie);
  border-radius: var(--rund);
  background: var(--weiss);
  color: var(--tinte);
  resize: vertical;
}
.datenform input:focus, .datenform textarea:focus {
  outline: none; border-color: var(--akzent);
}
.datenform input[type="file"] {
  font-size: 15px; padding: 10px 0; color: var(--tinte-leise);
}

.feldhilfe {
  margin: 7px 0 0;
  font-size: 14px; line-height: 1.45; color: var(--tinte-still);
}

.gut {
  background: #eaf0e6;
  border: 1.5px solid #bcccb0;
  color: var(--gruen);
  padding: 12px 14px; border-radius: var(--rund);
  font-size: 15px; margin: 0 0 6px;
}

.fuss-link {
  display: block; padding: 11px 0;
  color: var(--akzent); font-weight: 600;
  text-decoration: none; font-size: 15px;
}

/* ------------------------------------------- Hilfe, Gemerktes, Verbrauch */

.hilfe-ueber {
  font-size: 17px; font-weight: 600; color: var(--tinte);
  margin: 30px 0 10px;
}
.hilfe-ueber:first-child { margin-top: 4px; }

.hilfe-text {
  margin: 0 0 12px;
  font-size: 15.5px; line-height: 1.55; color: var(--tinte-leise);
}
.hilfe-text a { color: var(--akzent); font-weight: 600; text-decoration: none; }

.hilfe-karte {
  display: flex; align-items: center; gap: 14px;
  margin: 10px 0 4px;
  padding: 15px 16px; min-height: 66px;
  background: var(--weiss);
  border: 1.5px solid var(--linie-stark);
  border-radius: var(--rund);
  text-decoration: none; color: inherit;
}
.hilfe-karte:active { background: var(--papier-tief); }
.hilfe-karte.wichtig { border-color: var(--akzent); }
.hilfe-karte svg { flex: 0 0 auto; width: 26px; height: 26px; color: var(--akzent); }
.hilfe-karte span { display: flex; flex-direction: column; min-width: 0; }
.hilfe-karte strong { font-size: 16px; }
.hilfe-karte em {
  font-style: normal; font-size: 13.5px; color: var(--tinte-still);
  overflow-wrap: anywhere;
}

.hilfe-frage {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 0;
  border-bottom: 1px solid var(--linie);
}
.hilfe-frage strong { font-size: 15.5px; }
.hilfe-frage span { font-size: 15px; line-height: 1.5; color: var(--tinte-leise); }

.leer-kasten {
  display: flex; flex-direction: column; gap: 5px;
  padding: 18px;
  background: var(--papier-tief);
  border-radius: var(--rund);
  margin: 6px 0 14px;
}
.leer-kasten strong { font-size: 15.5px; }
.leer-kasten span { font-size: 15px; line-height: 1.5; color: var(--tinte-leise); }

.notiz {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--linie);
}
.notiz-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notiz-text strong { font-size: 14px; color: var(--akzent); }
.notiz-text span { font-size: 15.5px; line-height: 1.5; }
.notiz-text em {
  font-style: normal; font-size: 12.5px; color: var(--tinte-still);
}
.notiz-weg {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: none; background: none; cursor: pointer;
  border-radius: 11px; color: var(--tinte-still);
}
.notiz-weg:active { background: var(--papier-tief); color: var(--warnung); }

.zahlen { width: 100%; border-collapse: collapse; font-size: 15px; margin: 6px 0 10px; }
.zahlen th {
  text-align: left; font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--tinte-still);
  padding: 0 0 7px; border-bottom: 1px solid var(--linie);
}
.zahlen th.r, .zahlen td.r { text-align: right; }
.zahlen td { padding: 11px 0; border-bottom: 1px solid var(--linie); vertical-align: top; }
.zahlen td em {
  display: block; font-style: normal;
  font-size: 12.5px; color: var(--tinte-still);
}

.merksatz {
  display: flex; flex-direction: column; gap: 5px;
  margin: 24px 0 8px; padding: 15px 16px;
  background: var(--papier-tief);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--rund) var(--rund) 0;
}
.merksatz strong { font-size: 15px; }
.merksatz span { font-size: 14.5px; line-height: 1.55; color: var(--tinte-leise); }
.merksatz em { font-style: italic; }

.fassung { font-size: 12.5px; color: var(--tinte-still); }

/* ------------------------------------------------------- Grosser Schirm */

@media (min-width: 820px) {
  .verlauf { padding: 26px 24px 30px; }
  .blase { max-width: 76%; }

  /* Eingabeleiste und Anhaenge auf dieselbe Spalte wie der Verlauf bringen.
   * Sonst zieht sich das Textfeld am Laptop ueber die ganze Breite, waehrend
   * die Nachrichten in der Mitte stehen -- das wirkt unfertig. */
  .leiste,
  .anhang-leiste {
    padding-left:  max(16px, calc((100% - 740px) / 2));
    padding-right: max(16px, calc((100% - 740px) / 2));
  }
  .leiste { padding-top: 12px; padding-bottom: 12px; }
}

/* Summenzeile der Verbrauchsuebersicht: die eine Zahl, auf die es ankommt. */
.zahlen tfoot td {
  padding-top: 12px;
  border-bottom: none;
  border-top: 2px solid var(--linie);
  font-weight: 600;
}
