/* Einfache Oberfläche (Strang A, siehe EINFACH.md): viel Weiß, große Flächen, je Bereich eine Farbe und ein Hintergrundmotiv.
   Scharf: keine Schatten mit Weichzeichner, kein Glühen. Unterkanten der Knöpfe sind harte, versetzte Flächen. */
:root {
  --e-text: #0F1B33; --e-leise: #56627A; --e-linie: #E3E7EF; --e-flaeche: #F5F7FA;
  --e-rot: #D92D20; --e-rot-text: #B42318; --e-orange: #E8730C; --e-orange-text: #B54708; --e-gruen: #12A150; --e-grau: #8C95A6;
}
/* Bereichsfarben: kräftig (--f), zart (--z), Rand/Unterkante (--r), dunkel für Text auf Zart (--d) */
body.einfach, .e-kachel[data-bereich] { --f: #3B4A66; --z: #F3F5F9; --r: #DCE1EA; --d: #2B3850; }
body[data-motiv='hochladen'], body[data-motiv='lesen'], .e-kachel[data-bereich='hochladen'] { --f: #2F6BFF; --z: #EAF0FF; --r: #C6D5FF; --d: #1F4FD6; }
body[data-motiv='status'], .e-kachel[data-bereich='status'] { --f: #12A150; --z: #E7F7EE; --r: #B6E4CA; --d: #0B7A3C; }
body[data-motiv='uebersicht'], body[data-motiv='sache'], .e-kachel[data-bereich='uebersicht'] { --f: #7357FF; --z: #F0ECFF; --r: #D6CCFF; --d: #5236E0; }
body[data-motiv='chat'], .e-kachel[data-bereich='chat'] { --f: #0EA5B7; --z: #E3F7F9; --r: #AFE3EA; --d: #087A88; }

body.einfach { background: #fff; color: var(--e-text); font-size: 18px; line-height: 1.45; }
body.einfach #app { position: relative; z-index: 1; }

/* ---------- Hintergrundmotiv (web/bilder/hintergrund-<motiv>.svg; fehlt die Datei, bleibt es weiß) ---------- */
#hintergrund { display: none; }
/* Das Motiv richtet sich im SVG selbst unten mittig aus (preserveAspectRatio xMidYMax), deshalb 100 % × 100 % */
body.einfach #hintergrund { display: block; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: no-repeat center bottom / 100% 100%; }
body[data-motiv='start'] #hintergrund { background-image: url(bilder/hintergrund-start.svg); }
body[data-motiv='hochladen'] #hintergrund { background-image: url(bilder/hintergrund-hochladen.svg); }
body[data-motiv='lesen'] #hintergrund { background-image: url(bilder/hintergrund-lesen.svg); }
body[data-motiv='status'] #hintergrund { background-image: url(bilder/hintergrund-status.svg); }
body[data-motiv='uebersicht'] #hintergrund { background-image: url(bilder/hintergrund-uebersicht.svg); }
body[data-motiv='sache'] #hintergrund { background-image: url(bilder/hintergrund-sache.svg); }
body[data-motiv='chat'] #hintergrund { background-image: url(bilder/hintergrund-chat.svg); }
body[data-motiv='menue'] #hintergrund { background-image: url(bilder/hintergrund-menue.svg); }
/* Weniger Bewegung gewünscht: im SVG als Bild greift die Media-Query nicht, „#ruhig“ hält das Bild an */
@media (prefers-reduced-motion: reduce) {
  body[data-motiv='start'] #hintergrund { background-image: url(bilder/hintergrund-start.svg#ruhig); }
  body[data-motiv='hochladen'] #hintergrund { background-image: url(bilder/hintergrund-hochladen.svg#ruhig); }
  body[data-motiv='lesen'] #hintergrund { background-image: url(bilder/hintergrund-lesen.svg#ruhig); }
  body[data-motiv='status'] #hintergrund { background-image: url(bilder/hintergrund-status.svg#ruhig); }
  body[data-motiv='uebersicht'] #hintergrund { background-image: url(bilder/hintergrund-uebersicht.svg#ruhig); }
  body[data-motiv='sache'] #hintergrund { background-image: url(bilder/hintergrund-sache.svg#ruhig); }
  body[data-motiv='chat'] #hintergrund { background-image: url(bilder/hintergrund-chat.svg#ruhig); }
  body[data-motiv='menue'] #hintergrund { background-image: url(bilder/hintergrund-menue.svg#ruhig); }
}

/* Langer Inhalt: das Motiv tritt zurück (zarter, kein Weichzeichner, keine Kante) */
body.einfach #hintergrund { transition: opacity .3s ease; }
body.einfach.e-lang #hintergrund { opacity: .35; }

/* ---------- Symbole ---------- */
.sym { display: inline-block; flex: none; width: 24px; height: 24px; background: currentColor;
  -webkit-mask: var(--sym) center / contain no-repeat; mask: var(--sym) center / contain no-repeat; }
html[dir='rtl'] .e-zurueck .sym, html[dir='rtl'] .sym.spiegeln { transform: scaleX(-1); }

/* ---------- Kopf ---------- */
.e-kopf { position: sticky; top: 0; z-index: 10; background: #fff; padding-top: env(safe-area-inset-top); }
.e-kopf-innen { display: flex; align-items: center; gap: 8px; max-width: 552px; margin: 0 auto; min-height: 68px;
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
body.einfach:has(.e-main.breit) .e-kopf-innen { max-width: 1312px; }
.e-logo { display: inline-flex; align-items: center; min-height: 48px; padding: 0 4px; margin-inline-end: auto; }
.e-logo:hover { text-decoration: none; }
.e-logo-bild { height: 34px; width: auto; display: block; }
.e-logo .marke { font-size: 22px; }
.e-kopf-knopf { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 16px; color: var(--e-text); font-size: 28px; line-height: 1; }
.e-kopf-knopf:hover { background: var(--e-flaeche); text-decoration: none; }
.e-kopf-knopf .sym { width: 28px; height: 28px; }
.e-kopf-platz { width: 48px; flex: none; }
.e-kopf-titel { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 21px; font-weight: 700; color: var(--d); }
.e-kopf-titel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-kopf-bild { width: 34px; height: 34px; flex: none; }

/* ---------- Spalte ---------- */
.e-main { max-width: 552px; margin: 0 auto; padding: 4px max(16px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.e-main.breit { max-width: 1312px; }
.e-seite h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.e-seite { padding-top: 8px; }
.e-pfeil { flex: none; width: 10px; height: 10px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(-45deg); opacity: .45; margin-inline-start: auto; }
html[dir='rtl'] .e-pfeil { transform: rotate(135deg); }
.e-punkt { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: currentColor; margin: 7px; }
.e-haken { display: inline-grid; place-items: center; width: 24px; height: 24px; font-weight: 700; }

/* ---------- Knöpfe ---------- */
.e-knopf { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 60px; padding: 0 22px;
  border-radius: 24px; border: 2px solid var(--r); background: var(--z); color: var(--d); box-shadow: 0 4px 0 var(--r);
  font: 600 20px/1.2 var(--schrift); cursor: pointer; text-decoration: none; text-align: center; margin-bottom: 4px;
  transition: transform .08s ease, box-shadow .08s ease; }
.e-knopf:hover { text-decoration: none; }
.e-knopf:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--r); }
.e-knopf.e-haupt { background: var(--f); border-color: var(--d); color: #fff; box-shadow: 0 4px 0 var(--d); }
.e-knopf.e-haupt:active { box-shadow: 0 2px 0 var(--d); }
.e-knopf.e-gross { min-height: 72px; font-size: 21px; }
.e-knopf .sym { width: 28px; height: 28px; }
.e-knopf[disabled] { opacity: .6; cursor: default; }
.e-knopf:focus-visible, .e-leise:focus-visible, .e-kachel:focus-visible, .e-sache-zeile:focus-visible, .e-menue-liste :is(a, button):focus-visible, .e-reiter a:focus-visible, .e-kopf-knopf:focus-visible {
  outline: 3px solid var(--f); outline-offset: 3px; }
.e-leise { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 16px;
  border: 0; background: #fff; color: var(--d); font: 600 18px/1.2 var(--schrift); cursor: pointer; text-decoration: none; }
.e-leise:hover { background: var(--z); text-decoration: none; }
.e-leise .sym { width: 22px; height: 22px; }
.e-leise.e-bestaetigt { color: var(--e-gruen); cursor: default; }
.e-leise.e-bestaetigt:hover { background: #fff; }
/* Text steht nie direkt auf dem Motiv: leise Knöpfe teilen sich eine weiße Fläche */
.e-leise-reihe { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px; width: fit-content; max-width: 100%;
  margin: 12px auto 0; padding: 4px; border-radius: 20px; background: #fff; }
.e-leise-reihe:not(:has(*)) { display: none; }
.e-leise.e-gefahr { color: var(--e-rot-text); }
.e-leise.e-gefahr:hover { background: #FDECEA; }
.e-unten { margin-top: 28px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.e-unten > .e-leise { align-self: center; }

/* ---------- Start ---------- */
.e-hallo { margin: 20px 4px 22px; font-size: 32px !important; }
.e-kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.e-kachel { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; min-height: 168px; padding: 24px 10px 16px;
  border-radius: 28px; border: 2px solid var(--r); background: var(--z); box-shadow: 0 5px 0 var(--r); color: var(--d);
  font-size: 20px; font-weight: 700; line-height: 1.2; text-align: center; transition: transform .08s ease, box-shadow .08s ease; }
.e-kachel:hover { text-decoration: none; }
.e-kachel:active { transform: translateY(2px); box-shadow: 0 3px 0 var(--r); }
.e-kachel-bild { width: 76px; height: 76px; }
.e-kachel span { min-height: 2.4em; display: flex; align-items: center; justify-content: center; }
.e-hilfe-zeile { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 16px 18px; border-radius: 22px;
  background: #FDF1E6; border: 2px solid #F6CFA8; box-shadow: 0 4px 0 #F6CFA8; color: #8A3A05; font-size: 20px; font-weight: 700; }
.e-hilfe-zeile:hover { text-decoration: none; }
.e-hilfe-zeile .sym { width: 28px; height: 28px; color: var(--e-orange); }

/* ---------- Hochladen, Lesen ---------- */
.e-knopfseite { display: flex; flex-direction: column; gap: 16px; padding-top: 28px; }
.e-knopfseite > .e-leise { align-self: center; }
.e-satz-gross { font-size: 26px; line-height: 1.3; font-weight: 700; text-align: center; margin: 8px 0 4px; }
.e-lese-seite { padding-top: 48px; text-align: center; }
.e-lese-zeichen { width: 56px !important; height: 56px !important; color: var(--f); margin-bottom: 12px; }
.e-leise-text { display: table; margin: 8px auto 0; padding: 2px 10px; border-radius: 10px; background: #fff; font-size: 18px; color: var(--e-leise); }

/* ---------- Ergebnis nach dem Lesen ---------- */
.e-ergebnis { padding-top: 16px; }
.e-absender { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; color: var(--e-leise); }
.e-absender .sym { color: var(--f); }
.e-ergebnis h1 { margin-top: 14px; }
.e-satz { font-size: 20px; font-weight: 500; line-height: 1.4; margin-top: 6px; }
.e-nichts { display: flex; align-items: center; gap: 10px; margin-top: 20px; color: var(--e-gruen); font-weight: 600; }
.e-nichts .sym { width: 28px; height: 28px; }

/* ---------- Liste der Sachen ---------- */
.e-liste { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.e-sache-zeile { --zf: var(--e-linie); display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 12px 16px; border-radius: 20px;
  background: #fff; border: 2px solid var(--e-linie); border-inline-start: 6px solid var(--zf); color: var(--e-text); }
.e-sache-zeile:hover { text-decoration: none; background: var(--e-flaeche); }
.e-sache-zeile.zu_spaet { --zf: var(--e-rot); }
.e-sache-zeile.bald { --zf: var(--e-orange); }
.e-art { flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--z); color: var(--f); }
.e-art .sym { width: 26px; height: 26px; }
.e-sache-text { display: flex; flex-direction: column; min-width: 0; }
.e-sache-titel { font-size: 20px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.e-sache-unter { font-size: 16px; color: var(--e-leise); margin-top: 3px; }
.e-sache-zeile.zu_spaet .e-sache-unter { color: var(--e-rot-text); font-weight: 600; }
.e-sache-zeile.bald .e-sache-unter { color: var(--e-orange-text); }
.e-sache-zeile.erledigt { color: var(--e-leise); }
.e-sache-zeile.erledigt .e-art { background: var(--e-flaeche); color: var(--e-grau); }
.e-leer { margin-top: 24px; padding: 20px 16px; border-radius: 22px; background: #fff; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 20px; color: var(--e-leise); text-align: center; }
.e-leer .sym { width: 40px; height: 40px; color: var(--e-gruen); }

/* ---------- Übersicht: drei Reiter ---------- */
.e-reiter { display: flex; gap: 4px; padding: 4px; margin-top: 6px; border-radius: 20px; background: var(--z); border: 2px solid var(--r); }
.e-reiter a { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 4px 6px; border-radius: 16px;
  color: var(--d); font-size: 17px; font-weight: 600; text-align: center; line-height: 1.15; }
.e-reiter a:hover { text-decoration: none; background: rgba(255, 255, 255, .6); }
.e-reiter a.aktiv { background: #fff; color: var(--e-text); box-shadow: 0 2px 0 var(--r); }

/* ---------- Sache ---------- */
.e-sache-kopf { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.e-art-gross { width: 76px; height: 76px; border-radius: 24px; }
.e-art-gross .sym, .e-art-gross .e-haken { width: 42px; height: 42px; font-size: 32px; }
.e-absender-klein { font-size: 16px; font-weight: 600; color: var(--e-leise); margin-bottom: 2px; }
.e-fakten { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 10px; }
.e-fakten li { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: 18px; background: #fff; border: 2px solid var(--e-linie);
  font-size: 20px; font-weight: 500; line-height: 1.35; }
.e-fakten li .sym { width: 26px; height: 26px; color: var(--f); margin-top: 1px; }
.e-fakten li.zu_spaet { color: var(--e-rot-text); font-weight: 600; }
.e-fakten li.zu_spaet .sym { color: var(--e-rot); }
.e-fakten li.bald .sym { color: var(--e-orange); }
.e-fakten li.sonst { font-size: 18px; color: var(--e-leise); }
.e-fakten li.sonst .sym { color: var(--e-leise); }
.e-hinweis { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 16px; border-radius: 18px; background: #FDF1E6; color: #8A3A05; font-weight: 700; font-size: 18px; }
.e-hinweis .sym { color: var(--e-orange); }
.e-erledigt-zeile { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 21px; font-weight: 700; color: var(--e-gruen); min-height: 60px; border-radius: 20px; background: #fff; }
.e-erledigt-zeile .sym { width: 30px; height: 30px; }
.e-sache.erledigt h1 { color: var(--e-leise); }

/* ---------- Status ---------- */
.e-status { padding-top: 16px; }
.e-saetze { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.e-saetze li { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border-radius: 20px; background: #fff; border: 2px solid var(--e-linie);
  font-size: 20px; font-weight: 500; line-height: 1.4; }
.e-zz { flex: none; width: 30px; height: 30px; display: grid; place-items: center; margin-top: 0; }
.e-zz .sym { width: 28px; height: 28px; }
.e-zz b { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.e-zz.zu_spaet { color: var(--e-rot); } .e-zz.bald { color: var(--e-orange); } .e-zz.spaeter { color: var(--e-grau); } .e-zz.gut { color: var(--e-gruen); }
.e-saetze li.zu_spaet { border-color: #F5C2BD; }
.e-stand { margin: 0; font-size: 16px; color: var(--e-leise); text-align: center; }
.e-fuss { width: fit-content; max-width: 100%; margin: 14px auto 0; padding: 10px 8px 4px; border-radius: 20px; background: #fff; }
.e-fuss .e-leise-reihe { margin: 2px auto 0; padding: 0; }
.e-knopf-bild { width: 44px; height: 44px; flex: none; background: #fff; border-radius: 50%; }

/* ---------- Menü und Sprache ---------- */
.e-wer { display: flex; align-items: center; gap: 10px; margin: 10px 4px 14px; font-size: 18px; font-weight: 600; color: var(--e-leise); }
.e-menue-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.e-menue-liste :is(a, button) { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 0 18px; border-radius: 20px;
  background: #fff; border: 2px solid var(--e-linie); box-shadow: 0 3px 0 var(--e-linie); color: var(--e-text);
  font: 600 20px/1.2 var(--schrift); text-align: start; cursor: pointer; }
.e-menue-liste :is(a, button):hover { text-decoration: none; background: var(--e-flaeche); }
.e-menue-liste :is(a, button):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--e-linie); }
.e-menue-liste .sym { width: 26px; height: 26px; color: #3B4A66; }
.e-menue-liste .e-wert { margin-inline-start: auto; font-size: 17px; font-weight: 500; color: var(--e-leise); }
.e-menue-liste .e-wert ~ .e-pfeil { margin-inline-start: 6px; }
.e-sprachen button.aktiv { border-color: #2F6BFF; box-shadow: 0 3px 0 #C6D5FF; }
.e-sprachen button .e-wert, .e-sprachen button .e-haken { color: #2F6BFF; margin-inline-start: auto; }

/* ---------- Meldung (unten, kurz) ---------- */
#meldung { position: fixed; z-index: 50; left: 16px; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; }
#meldung .meldung { width: 100%; max-width: 488px; margin: 0; padding: 14px 18px; border-radius: 18px; background: var(--e-text); color: #fff;
  font-size: 18px; font-weight: 600; text-align: center; }
#meldung .meldung.fehler { background: var(--e-rot-text); color: #fff; }

/* ---------- Brief ---------- */
.e-absender .e-datum { font-weight: 500; white-space: nowrap; }
.e-neuer { margin-top: 18px; }
.e-neuer .sym { color: var(--e-orange); }
.e-rueckfrage { margin-top: 12px; padding: 16px; border-radius: 22px; background: #fff; border: 2px solid #F5C2BD; display: flex; flex-direction: column; gap: 8px; }
.e-rueckfrage p { margin: 0 0 4px; font-size: 20px; font-weight: 700; text-align: center; }
.e-rueckfrage .e-leise { align-self: center; }
.e-knopf.e-loeschen-ja { background: var(--e-rot); border-color: var(--e-rot-text); color: #fff; box-shadow: 0 4px 0 var(--e-rot-text); }

/* ---------- Meine Daten ---------- */
.e-daten { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.e-daten li { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 16px; border-radius: 18px; background: #fff; border: 2px solid var(--e-linie); }
.e-daten-name { font-size: 16px; color: var(--e-leise); }
.e-daten-wert { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Original ---------- */
.e-original .original-seiten { display: flex; flex-direction: column; gap: 12px; }
.e-original .original-seiten img { width: 100%; height: auto; border-radius: 12px; border: 2px solid var(--e-linie); }

/* ---------- Bisherige Seiten im neuen Rahmen (Briefdetail, Meine Daten, Familie, Ausfüllen, Passwort) ---------- */
/* Textreiche Seiten liegen auf einer weißen Fläche, damit das Motiv dahinter den Text nie stört */
.e-main .seite, .e-main .e-alt { max-width: none; margin-top: 8px; padding: 16px 16px 24px; background: #fff; border-radius: 24px; }
.e-main .seite.schmal { max-width: none; }
body.einfach .knopf { border-radius: 18px; min-height: 52px; font-weight: 600; }
body.einfach .knopf.zweit { border-width: 2px; }
body.einfach .eingabe { border-radius: 14px; min-height: 52px; }
body.einfach .lesen section { background: transparent; }
.e-alt .konto-block { margin-top: 12px; }
.e-alt .konto-block h2 { margin-bottom: 12px; }
body.einfach .ausfuellen { height: calc(100vh - 72px - env(safe-area-inset-top)); }
@media (max-width: 900px) { body.einfach .ausfuellen { height: auto; } }

/* ---------- Bewegung nur, wenn gewünscht ---------- */
@media (prefers-reduced-motion: reduce) {
  .e-knopf, .e-kachel, .e-menue-liste :is(a, button) { transition: none; }
}
@media (max-width: 370px) {
  .e-kachel { min-height: 148px; font-size: 18px; }
  .e-kachel-bild { width: 64px; height: 64px; }
}
