/* =========================================================================
   ZweitGlück-App – Gestaltung (Farben und Schriften wie auf der Website)
   ========================================================================= */
:root {
  --leiste: 68px;
  --weiss: #ffffff;
  --creme: #fff8f0;
  --rosa: #f7a8c4;
  --rosa-dunkel: #a53362;
  --rosa-hell: #fde4ee;
  --flieder-hell: #eadff5;
  --flieder-dunkel: #68428e;
  --gruen-hell: #eaf5d6;
  --gruen-dunkel: #3c681b;
  --gelb-hell: #fff5c7;
  --text: #2f2f3a;
  --leise: #5f5f6e;
  --linie: #eee7f3;
  --schatten: 0 4px 14px rgba(95, 60, 120, .08);
  --rund: 20px;
  --schrift-kopf: "Fredoka", "Nunito", system-ui, sans-serif;
  --schrift: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--schrift);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--creme);
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--flieder-dunkel); text-decoration-thickness: 2px; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid #245f96; outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--rosa-hell); color: var(--text); }
input, select { caret-color: var(--rosa-dunkel); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.kopf {
  background: var(--rosa-hell);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid #f6cfdf;
}
.kopf img { width: 132px; }

.rahmen { width: min(100% - 32px, 560px); margin: 0 auto; padding: 24px 0 48px; }

h1, h2 { font-family: var(--schrift-kopf); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.85rem; }
h1:focus { outline: none; }
h2 { font-size: 1.3rem; margin-top: 1.8em; }
p { margin: 0 0 1em; }

.karte {
  background: var(--weiss);
  border: 1px solid var(--linie);
  border-radius: var(--rund);
  box-shadow: var(--schatten);
  padding: 18px;
  margin: 0 0 16px;
}
.karte > :last-child { margin-bottom: 0; }
.karte.leer { background: transparent; box-shadow: none; border-style: dashed; color: var(--leise); }

label { display: block; font-weight: 700; margin-bottom: 4px; }
.hinweis { font-size: .95rem; color: var(--leise); margin: 0 0 10px; }
input {
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  padding: 13px 14px;
  border: 2px solid #d9cfe3;
  border-radius: 12px;
  background: var(--weiss);
  color: var(--text);
  margin-bottom: 14px;
}
input:focus { border-color: var(--flieder-dunkel); outline: none; box-shadow: 0 0 0 3px rgba(104, 66, 142, .2); }
input[aria-invalid="true"] { border-color: #b3261e; }
.code-feld { font-size: 1.7rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }

.knopf {
  display: block;
  width: 100%;
  font: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 14px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--rosa-dunkel);
  color: var(--weiss);
  cursor: pointer;
  min-height: 52px;
}
.knopf:hover { background: #8e2a53; }
.knopf[disabled] { opacity: .6; cursor: progress; }
.knopf-leise {
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  border: 2px solid #d9cfe3;
  border-radius: 999px;
  background: var(--weiss);
  color: var(--flieder-dunkel);
  cursor: pointer;
  min-height: 44px;
}
.knopf-leise:hover { border-color: var(--flieder-dunkel); }
.zeile-knoepfe { display: flex; flex-wrap: wrap; gap: 10px; }
.zeile-knoepfe .knopf { width: auto; flex: 1 1 auto; }

.leise { color: var(--leise); font-size: .97rem; }
.mittig { text-align: center; margin-top: 3rem; }

.meldung {
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 16px;
  background: var(--gelb-hell);
  border: 1px solid #f0dc8a;
  font-weight: 600;
}
.meldung.fehler { background: #fde7e5; border-color: #f2b8b2; color: #7a1d16; }
.meldung.gut { background: var(--gruen-hell); border-color: #c5e2a1; color: var(--gruen-dunkel); }
/* Meldung in der Übersicht: schwebt unten (über der Leiste), damit man sie sieht, egal wo man gerade ist */
.meldung.schwebend {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(100% - 32px, 528px);
  margin: 0;
  transform: translateX(-50%);
  box-shadow: 0 10px 28px rgba(60, 40, 80, .18);
  cursor: pointer;
  animation: hoch .22s cubic-bezier(.16, 1, .3, 1);
}
.mit-leiste .meldung.schwebend { bottom: calc(var(--leiste) + 12px + env(safe-area-inset-bottom)); }
@keyframes hoch { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* Fehler direkt unter dem Feld */
.feld-fehler { color: #8f1f17; font-weight: 700; font-size: .98rem; margin: -6px 0 14px; }
.preis-feld + .feld-fehler { margin-top: -10px; }

/* Buchungen */
.stand { position: relative; }
.stand-kopf { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; }
.stand-nr { margin: 0; }
.stand-nr { font-family: var(--schrift-kopf); font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.marke {
  font-size: .92rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--flieder-hell);
  color: var(--flieder-dunkel);
}
.marke.laeuft { background: var(--gruen-hell); color: var(--gruen-dunkel); }
.marke.vorbei { background: #efedf2; color: var(--leise); }
.stand.vorbei { opacity: .75; }
.angaben { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.angaben dt { color: var(--leise); font-size: .95rem; padding-top: 1px; }
.angaben dd { margin: 0; font-weight: 600; }
.stand-mehr { margin: 12px 0 0; font-weight: 700; }
.stand-mehr a { display: inline-block; padding: 6px 0; }

/* Artikel */
.abschnitt-kopf { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; margin-top: 1.8em; margin-bottom: .6em; }
.abschnitt-kopf h2 { margin: 0; }
.abschnitt-kopf p { margin: 0; font-variant-numeric: tabular-nums; }

.knopf svg, .stufe svg { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.knopf-plus { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; }

.artikel-liste { list-style: none; margin: 0 0 16px; padding: 4px 0; }
.artikel-liste li + li { border-top: 1px solid var(--linie); }
.artikel-zeile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: baseline;
  gap: 2px 14px;
  width: 100%;
  min-height: 56px;
  padding: 11px 18px;
  font: inherit;
  text-align: left;
  color: inherit;
  background: none;
  border: 0;
}
button.artikel-zeile { cursor: pointer; }
button.artikel-zeile:hover { background: var(--creme); }
button.artikel-zeile:focus-visible { outline-offset: -3px; }
.artikel-name { grid-column: 1; font-weight: 700; overflow-wrap: anywhere; }
.artikel-preis { grid-column: 2; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.artikel-info { grid-column: 1 / 3; color: var(--leise); font-size: .97rem; }
.zeilen-symbol { grid-column: 3; grid-row: 1 / span 2; align-self: center; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; color: var(--leise); }
.zeilen-symbol.pfeil { color: var(--flieder-dunkel); }
.zeilen-symbol.haken { color: var(--gruen-dunkel); stroke-width: 2.8; }
.artikel-zeile.verkauft .artikel-preis { color: var(--gruen-dunkel); }
.artikel-zeile.aus .artikel-name, .artikel-zeile.aus .artikel-preis { color: var(--leise); }
/* Gerade geänderter Artikel leuchtet kurz auf */
.artikel-zeile.frisch { animation: frisch 1.8s cubic-bezier(.16, 1, .3, 1); }
@keyframes frisch { from { background: var(--rosa-hell); } to { background: transparent; } }

.frei { font-weight: 400; color: var(--leise); }
select {
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  padding: 13px 14px;
  border: 2px solid #d9cfe3;
  border-radius: 12px;
  background: var(--weiss);
  color: var(--text);
  margin-bottom: 14px;
}
select:focus { border-color: var(--flieder-dunkel); outline: none; box-shadow: 0 0 0 3px rgba(104, 66, 142, .2); }
select[aria-invalid="true"] { border-color: #b3261e; }

.preis-feld { display: grid; grid-template-columns: 56px 1fr 56px; gap: 10px; align-items: center; margin-bottom: 18px; }
.preis-eingabe { position: relative; }
.preis-eingabe input { margin: 0; padding-right: 42px; text-align: right; font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.preis-eingabe span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.2rem; font-weight: 700; color: var(--leise); pointer-events: none; }
.stufe {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid #d9cfe3;
  border-radius: 50%;
  background: var(--weiss);
  color: var(--flieder-dunkel);
  cursor: pointer;
  touch-action: manipulation;
}
.stufe:hover { border-color: var(--flieder-dunkel); }
.stufe:active { background: var(--flieder-hell); }

/* Mehrere gleiche Teile: Frage links, Zähler rechts. Auf sehr schmalen Handys rutscht der Zähler darunter. */
.anzahl-zeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 8px; }
.anzahl-zeile label { margin: 0; }
.anzahl-feld { display: grid; grid-template-columns: 48px 60px 48px; gap: 8px; align-items: center; }
.anzahl-feld .stufe { width: 48px; height: 48px; }
.anzahl-feld input { margin: 0; padding: 9px 4px; text-align: center; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.anzahl-zeile + .feld-fehler { margin: 0 0 8px; }
#anzahl-hinweis { margin-bottom: 18px; }
#anzahl-hinweis.mehrere { color: var(--flieder-dunkel); font-weight: 700; }

/* Auszahlung und Abrechnungen */
.iban-feld { font-variant-numeric: tabular-nums; letter-spacing: .03em; text-transform: uppercase; }
#geld .karte form > :last-child, #geld .karte > div > :last-child { margin-bottom: 0; }
#geld .meldung { margin: 14px 0 0; }
a.artikel-zeile { text-decoration: none; }
a.artikel-zeile:hover { background: var(--creme); }

/* Fotos */
.label { font-weight: 700; margin: 0 0 6px; }
.foto-feld { margin-bottom: 14px; }
.foto-feld .hinweis { margin: 8px 0 0; }
.foto-reihe { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.foto-kachel {
  display: grid; place-items: center; width: 112px; height: 112px; padding: 0; overflow: hidden;
  border: 2px dashed #d9cfe3; border-radius: 16px; background: var(--creme); color: var(--flieder-dunkel);
  font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer;
}
.foto-kachel:hover { border-color: var(--flieder-dunkel); }
.foto-kachel.hat-foto { border-style: solid; }
.foto-kachel img { width: 100%; height: 100%; object-fit: cover; }
.foto-leer { display: grid; justify-items: center; gap: 4px; padding: 8px; text-align: center; line-height: 1.2; }
.foto-leer svg, .foto-kachel svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.foto-knoepfe { display: flex; flex-direction: column; gap: 8px; }
.artikel-zeile.mit-foto { grid-template-columns: 52px minmax(0, 1fr) auto 20px; }
.artikel-foto { grid-column: 1; grid-row: 1 / span 2; width: 52px; height: 52px; object-fit: cover; border-radius: 10px; background: var(--linie); align-self: center; }
.artikel-zeile.mit-foto .artikel-name { grid-column: 2; }
.artikel-zeile.mit-foto .artikel-preis { grid-column: 3; }
.artikel-zeile.mit-foto .zeilen-symbol { grid-column: 4; }
.artikel-zeile.mit-foto .artikel-info { grid-column: 2 / 4; }
.artikel-zeile.aus .artikel-foto { opacity: .6; }

/* Etiketten */
a.knopf { text-align: center; text-decoration: none; }
.zeile-knoepfe .knopf-plus { margin-bottom: 0; }
#etiketten-text:focus { outline: none; }
.frage { font-weight: 700; margin: 1.2em 0 .5em; }
#etiketten .meldung { margin: 14px 0 0; }
#etiketten-start > :last-child, #etiketten-fertig > :last-child { margin-bottom: 0; }

.zwischen { justify-content: space-between; }
.knopf-leise.gefahr { color: #9b211a; border-color: #f2c4bf; }
.knopf-leise.gefahr:hover { border-color: #9b211a; }

.installieren { background: var(--flieder-hell); border-color: #dccdee; box-shadow: none; }
.teilen { font-weight: 800; }

.fuss { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--linie); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.fuss p { margin: 0; }
.fuss a { display: inline-block; padding: 10px 2px; }

/* ---------- Bereiche und Leiste unten ---------- */
.mit-leiste { padding-bottom: calc(var(--leiste) + env(safe-area-inset-bottom)); }
.bereich > h2:first-child { margin-top: 1.2em; }
.leiste {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 0 8px env(safe-area-inset-bottom);
  background: var(--weiss);
  border-top: 1px solid var(--linie);
  box-shadow: 0 -6px 20px rgba(95, 60, 120, .07);
}
.leiste button {
  position: relative;
  flex: 1 1 0;
  max-width: 180px;
  min-height: var(--leiste);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  padding: 6px 4px 8px;
  border: 0;
  background: none;
  color: var(--leise);
  font: 600 .95rem/1.1 var(--schrift-kopf);
  cursor: pointer;
  touch-action: manipulation;
}
.leiste svg { width: 64px; height: 32px; padding: 3px 19px; border-radius: 999px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; transition: background-color .18s ease-out; }
.leiste button[aria-current="page"] { color: var(--rosa-dunkel); }
.leiste button[aria-current="page"] svg { background: var(--rosa-hell); }
.leiste button:focus-visible { outline-offset: -4px; border-radius: 14px; }
/* Punkt an Verkauft: seit dem letzten Blick wurde etwas verkauft */
.leiste button.neu::after { content: ""; position: absolute; top: 9px; left: calc(50% + 14px); width: 10px; height: 10px; border-radius: 50%; background: var(--rosa-dunkel); box-shadow: 0 0 0 2px var(--weiss); }

/* ---------- Verkauft: was sie bekommt ---------- */
.verdienst { margin: 4px 0 8px; padding: 18px 18px 6px; border-radius: var(--rund); background: var(--gruen-hell); color: var(--gruen-dunkel); }
.verdienst-satz { margin: 0 0 4px; font-family: var(--schrift-kopf); font-size: 1.3rem; font-weight: 600; line-height: 1.2; }
.verdienst-satz strong { display: block; font-size: 2.6rem; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: #2e5414; }
.verdienst-unter { margin: 0 0 12px; color: #355d18; }
.verdienst-zeilen { list-style: none; margin: 0; padding: 0; }
.verdienst-zeilen li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; padding: 10px 0; border-top: 1px solid #cfe5b2; }
.verdienst-monat { font-weight: 800; }
.verdienst-wert { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.verdienst-info { grid-column: 1 / -1; font-size: .97rem; color: #355d18; }
.verdienst-iban { margin: 4px 0 12px; color: var(--text); }
.monat-titel { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; margin: 1.4em 0 .5em; font-family: var(--schrift-kopf); font-size: 1.1rem; font-weight: 600; }
.monat-summe { font-family: var(--schrift); font-size: .97rem; font-weight: 700; color: var(--leise); font-variant-numeric: tabular-nums; }

/* Hinweise mit Symbol (Schloss), Warnung vor dem Sperren */
.mit-symbol { display: flex; align-items: flex-start; gap: 8px; }
.symbol { flex: none; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.warnung { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--gelb-hell); border: 1px solid #f0dc8a; }
.knopf-leise.mit-symbol { display: inline-flex; align-items: center; }
.knopf-leise svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.text-knopf { display: inline; padding: 2px 0; border: 0; background: none; font: inherit; font-weight: 800; color: var(--flieder-dunkel); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }
.karte.leer .knopf-leise { display: inline-block; text-decoration: none; margin-top: 4px; }

@media (min-width: 600px) {
  .kopf img { width: 156px; }
  .rahmen { padding-top: 36px; }
  h1 { font-size: 2.2rem; }
}
