/* =============================================================================
   app.css — Oberfläche der Anwendung
   Auf Tablet-Bedienung ausgelegt: große Flächen, klare Kontraste.
   ============================================================================= */

:root {
  --grund:        #f4f5f7;
  --flaeche:      #ffffff;
  --linie:        #dfe3e8;
  --text:         #1c2530;
  --text-leise:   #61707f;
  --akzent:       #1f5d8c;
  --akzent-hell:  #e8f1f8;
  --gut:          #1d7a4b;
  --gut-hell:     #e6f4ec;
  --warn:         #a3341f;
  --warn-hell:    #fbeceA;
  --wartend:      #8a6414;
  --wartend-hell: #fdf3dd;
  --radius:       12px;
  --schatten:     0 1px 2px rgba(20,30,45,.06), 0 8px 24px rgba(20,30,45,.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Kopfleiste ---------------------------------------------------- */

.leiste {
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 0;
  z-index: 10;
}

.leiste-innen {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.marke {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -.01em;
}

.marke img { width: 30px; height: 30px; display: block; }

.wer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wer-name { font-weight: 600; }

/* ---------- Grundgerüst --------------------------------------------------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

main.schmal {
  max-width: 480px;
  padding-top: 48px;
}

h1 { font-size: 1.7rem; margin: 0 0 6px; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 0 0 14px; letter-spacing: -.01em; }

.willkommen { margin-bottom: 24px; }
.lead { color: var(--text-leise); margin: 0; }

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--schatten);
}

.klein-grau { color: var(--text-leise); font-size: .88rem; }

/* ---------- Kacheln ------------------------------------------------------- */

.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.kachel {
  display: block;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--schatten);
  min-height: 132px;
}

.kachel:hover, .kachel:focus-visible {
  border-color: var(--akzent);
  outline: none;
  transform: translateY(-1px);
}

.kachel h2 { margin-bottom: 6px; color: var(--akzent); }
.kachel p  { margin: 0; color: var(--text-leise); font-size: .93rem; }

.kachel.gesperrt { opacity: .62; }
.kachel.gesperrt h2 { color: var(--text); }
.kachel.gesperrt .abzeichen { margin-top: 12px; display: inline-block; }

/* ---------- Anmeldung ----------------------------------------------------- */

.anmeldebox {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--schatten);
}

.anmelde-marke {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.anmelde-marke img { width: 38px; height: 38px; }
.anmelde-marke h1  { margin: 0; font-size: 1.4rem; }

/* ---------- Formulare ----------------------------------------------------- */

label {
  display: block;
  font-weight: 600;
  font-size: .92rem;
  margin: 16px 0 6px;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  color: var(--text);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 9px;
  min-height: 48px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px var(--akzent-hell);
}

.knopf {
  display: inline-block;
  padding: 13px 20px;
  min-height: 48px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--akzent);
  border: 1px solid var(--akzent);
  border-radius: 9px;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}

.knopf:hover { filter: brightness(1.08); }

.knopf.breit { width: 100%; margin-top: 22px; }

.knopf.leise {
  background: var(--flaeche);
  color: var(--akzent);
  border-color: var(--linie);
}

.knopf.klein {
  padding: 8px 12px;
  min-height: 40px;
  font-size: .86rem;
}

.reihe {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.reihe .feld { flex: 1 1 190px; }
.reihe .feld label { margin-top: 0; }

form.mini { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
form.mini select { width: auto; min-width: 130px; padding: 8px 10px; min-height: 40px; }

/* ---------- Hinweise ------------------------------------------------------ */

.hinweis {
  margin: 0 0 18px;
  padding: 13px 16px;
  border-radius: 9px;
  background: var(--akzent-hell);
  border: 1px solid #cfe1ee;
  font-size: .94rem;
}

.hinweis.warnung { background: var(--warn-hell); border-color: #f0cfc7; color: var(--warn); }
.hinweis.gut     { background: var(--gut-hell);  border-color: #c9e6d6; color: var(--gut); }

.abzeichen {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 650;
  background: var(--akzent-hell);
  color: var(--akzent);
  white-space: nowrap;
}

.abzeichen.gut     { background: var(--gut-hell);     color: var(--gut); }
.abzeichen.aus     { background: #eceff2;             color: var(--text-leise); }
.abzeichen.wartend { background: var(--wartend-hell); color: var(--wartend); }

/* ---------- Zugangsdaten -------------------------------------------------- */

.zugangsdaten {
  background: var(--wartend-hell);
  border: 1px solid #ecd9a6;
  border-radius: 9px;
  padding: 16px 18px;
}

.zugangsdaten dl { margin: 12px 0 0; }
.zugangsdaten dt { font-size: .8rem; color: var(--text-leise); font-weight: 650; }
.zugangsdaten dd { margin: 2px 0 12px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.zugangsdaten dd.gross { font-size: 1.25rem; font-weight: 650; letter-spacing: .01em; }

/* ---------- Tabelle ------------------------------------------------------- */

.tabelle-rahmen { overflow-x: auto; }

.tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: .93rem;
}

.tabelle th {
  text-align: left;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-leise);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--linie);
  white-space: nowrap;
}

.tabelle td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--linie);
  vertical-align: middle;
}

.tabelle tr.stillgelegt td { opacity: .55; }
.tabelle .rechts { text-align: right; }

.tabelle code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--grund);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: .9em;
}

/* ---------- Schmale Geräte ------------------------------------------------ */

@media (max-width: 720px) {
  .tabelle thead { display: none; }
  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; width: 100%; }

  .tabelle tr {
    border: 1px solid var(--linie);
    border-radius: 10px;
    margin-bottom: 14px;
    padding: 6px 4px;
  }

  .tabelle td {
    border: none;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .tabelle td::before {
    content: attr(data-titel);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-leise);
    font-weight: 650;
  }

  .tabelle .rechts { text-align: left; }
}

/* ---------- Dunkler Modus ------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --grund:        #141920;
    --flaeche:      #1c232c;
    --linie:        #2c3641;
    --text:         #e6ebf1;
    --text-leise:   #9aa8b6;
    --akzent:       #6db3e8;
    --akzent-hell:  #1d2f3d;
    --gut:          #6ed39b;
    --gut-hell:     #16302380;
    --warn:         #f2907c;
    --warn-hell:    #3a1f1a;
    --wartend:      #e3bd66;
    --wartend-hell: #33291394;
    --schatten:     0 1px 2px rgba(0,0,0,.3);
  }

  .knopf { color: #101820; }
  .hinweis { border-color: #2c4356; }
  .zugangsdaten { border-color: #4a3c1c; }
  .tabelle code { background: #141920; }
}

/* =============================================================================
   Preisberechnung
   ============================================================================= */

.reihe .feld.breit-2 { flex: 2 1 260px; }

.schmal-feld { width: 92px !important; padding: 8px 10px; min-height: 40px; }
.einheit     { color: var(--text-leise); font-size: .86rem; }

/* ---------- Ergebniskarte ------------------------------------------------- */

.ergebnis { padding-bottom: 8px; }

.zahlen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 20px;
}

.zahl { display: flex; flex-direction: column; gap: 3px; }

.etikett {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-leise);
  font-weight: 700;
}

.wert {
  font-size: 1.55rem;
  font-weight: 680;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.gross-abzeichen { font-size: 1.05rem; padding: 5px 14px; }

.vorschlag {
  margin-top: 22px;
  padding: 16px 18px;
  border-top: 1px solid var(--linie);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--akzent-hell);
  border-radius: 0 0 var(--radius) var(--radius);
  margin-left: -22px;
  margin-right: -22px;
  margin-bottom: -8px;
  padding-left: 22px;
  padding-right: 22px;
}

.vorschlag strong { display: block; }

/* ---------- Anteilsbalken ------------------------------------------------- */

.balken {
  display: inline-block;
  vertical-align: middle;
  width: 74px;
  height: 8px;
  background: var(--linie);
  border-radius: 999px;
  overflow: hidden;
  margin-right: 8px;
}

.balken > span { display: block; height: 100%; background: var(--akzent); border-radius: 999px; }

.b0{width:0}     .b5{width:5%}    .b10{width:10%}  .b15{width:15%}  .b20{width:20%}
.b25{width:25%}  .b30{width:30%}  .b35{width:35%}  .b40{width:40%}  .b45{width:45%}
.b50{width:50%}  .b55{width:55%}  .b60{width:60%}  .b65{width:65%}  .b70{width:70%}
.b75{width:75%}  .b80{width:80%}  .b85{width:85%}  .b90{width:90%}  .b95{width:95%}
.b100{width:100%}

/* ---------- Ampel --------------------------------------------------------- */

.abzeichen.schlecht { background: var(--warn-hell); color: var(--warn); }

/* ---------- Preisverlauf -------------------------------------------------- */

.verlauf {
  background: var(--grund);
  border-radius: 10px;
  padding: 16px 18px;
}

.verlauf h3 { margin: 0 0 10px; font-size: .98rem; }
.verlauf ul { margin: 0 0 14px; padding-left: 0; list-style: none; }
.verlauf li { padding: 7px 0; border-bottom: 1px solid var(--linie); font-size: .9rem; }
.verlauf li:last-child { border-bottom: none; }

.verlauf-datum {
  display: inline-block;
  min-width: 132px;
  color: var(--text-leise);
  font-variant-numeric: tabular-nums;
}

/* ---------- Zahlen rechtsbündig ausrichten -------------------------------- */

.tabelle td strong { font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .vorschlag { margin-left: -22px; margin-right: -22px; }
  .verlauf-datum { min-width: 0; display: block; }
}

.abstand-oben { margin-top: 14px; }
.feld .klein-grau { display: block; margin-top: 5px; line-height: 1.35; }

.lieferbez { display: block; margin-top: 3px; max-width: 260px; line-height: 1.3; }

/* ---------- Löschen bestätigen -------------------------------------------- */

.gefahr {
  background: var(--warn-hell);
  border: 1px solid #f0cfc7;
  border-radius: 10px;
  padding: 16px 18px;
}

.gefahr p { margin: 0 0 10px; }

.knopf.gefaehrlich {
  background: var(--warn);
  border-color: var(--warn);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .gefahr { border-color: #5a3129; }
  .knopf.gefaehrlich { color: #1a0f0c; }
}

/* ---------- Feldgruppen im Formular --------------------------------------- */

.gruppe-titel {
  flex: 1 1 100%;
  margin: 18px 0 -4px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--akzent);
  border-top: 1px solid var(--linie);
  padding-top: 16px;
}

.gruppe-titel:first-of-type { margin-top: 0; border-top: none; padding-top: 0; }
.gruppe-titel .klein-grau { text-transform: none; letter-spacing: 0; font-weight: 500; }

.gruppe-abschluss {
  flex: 1 1 100%;
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--linie);
}

/* =============================================================================
   Seitenkopf mit Aktion
   ============================================================================= */

.seitenkopf {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.seitenkopf h1 { margin-bottom: 4px; }

.knopf.gross { padding: 15px 24px; min-height: 54px; font-size: 1rem; }

.hinweis.allein { margin-bottom: 22px; }

/* =============================================================================
   Fenster über der Seite
   ============================================================================= */

.fenster-grund {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(14, 22, 32, .55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 16px 48px;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}

.fenster {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(10, 18, 28, .28);
  width: 100%;
  max-width: 760px;
  margin: auto;
}

.fenster.schmal { max-width: 520px; }

.fenster-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 0;
  background: var(--flaeche);
  border-radius: 14px 14px 0 0;
}

.fenster-kopf h2 { margin: 0; font-size: 1.1rem; }

.fenster-zu {
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  text-decoration: none;
  color: var(--text-leise);
  font-size: 1.6rem;
  line-height: 1;
  border: 1px solid transparent;
}

.fenster-zu:hover { background: var(--grund); color: var(--text); border-color: var(--linie); }

.fenster-inhalt { padding: 22px; }
.fenster-inhalt > p:first-child { margin-top: 0; }
.fenster-inhalt .verlauf { background: transparent; padding: 0; }

/* Hintergrund nicht mitscrollen lassen, wo der Browser es kann */
body:has(.fenster-grund) { overflow: hidden; }

@media (max-width: 720px) {
  .fenster-grund { padding: 0; }
  .fenster { border-radius: 0; min-height: 100%; border: none; }
  .fenster-kopf { border-radius: 0; }
  .seitenkopf .knopf.gross { width: 100%; }
}
