:root {
  --bg: #f4f5f7;
  --flaeche: #ffffff;
  --flaeche-2: #fafbfc;
  --rand: #dfe3e8;
  --rand-stark: #c3cad3;
  --text: #16202c;
  --text-leise: #5d6b7a;
  --akzent: #0b5fa5;
  --akzent-hell: #e8f1fa;
  --gruen: #12734a;
  --gruen-hell: #e6f4ec;
  --rot: #b32318;
  --rot-hell: #fdeceb;
  --gelb-hell: #fff6e5;
  --gelb-rand: #e8c26a;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(16,32,48,.06), 0 4px 16px rgba(16,32,48,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161c; --flaeche: #191f27; --flaeche-2: #1e252e; --rand: #2c353f;
    --rand-stark: #3d4854; --text: #e8edf3; --text-leise: #9aa7b5; --akzent: #5aa9f0;
    --akzent-hell: #16293c; --gruen: #4ac98a; --gruen-hell: #14301f; --rot: #f08a80;
    --rot-hell: #341b19; --gelb-hell: #302713; --gelb-rand: #6b5722;
    --schatten: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--akzent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 2rem 0 .75rem; letter-spacing: -.01em; }
h3 { font-size: .9rem; margin: 0 0 .5rem; }
.leise { color: var(--text-leise); }
.klein { font-size: .82rem; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Kopfzeile */
header.kopf {
  background: var(--flaeche); border-bottom: 1px solid var(--rand);
  position: sticky; top: 0; z-index: 20;
}
.kopf-inhalt {
  max-width: 1180px; margin: 0 auto; padding: .6rem 16px;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.marke { font-weight: 700; letter-spacing: -.02em; font-size: 1.02rem; text-decoration: none; color: var(--text); }
.marke span { color: var(--akzent); }
nav.haupt { display: flex; gap: .15rem; flex-wrap: wrap; flex: 1; }
nav.haupt a {
  padding: .35rem .7rem; border-radius: 7px; text-decoration: none;
  color: var(--text-leise); font-size: .88rem; font-weight: 500; white-space: nowrap;
}
nav.haupt a:hover { background: var(--flaeche-2); color: var(--text); }
nav.haupt a.aktiv { background: var(--akzent-hell); color: var(--akzent); }
.konto { display: flex; align-items: center; gap: .6rem; font-size: .82rem; color: var(--text-leise); }
main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 16px 4rem; }

/* ---------------------------------------------------------------- Bausteine */
.karte {
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--schatten);
}
.karte + .karte { margin-top: 1rem; }
.raster { display: grid; gap: 1rem; }
.raster.zwei { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.raster.drei { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .3rem; color: var(--text-leise); }
input[type=text], input[type=number], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--rand-stark);
  border-radius: 7px; background: var(--flaeche); color: var(--text);
  font: inherit; font-variant-numeric: tabular-nums;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--akzent); outline-offset: -1px; border-color: var(--akzent);
}
input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--akzent); }
.feld { margin-bottom: .85rem; }
.feld-reihe { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.knopf {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem;
  border-radius: 7px; border: 1px solid var(--rand-stark); background: var(--flaeche);
  color: var(--text); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer;
  text-decoration: none;
}
.knopf:hover { background: var(--flaeche-2); }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.primaer:hover { filter: brightness(1.08); }
.knopf.gefahr { color: var(--rot); border-color: var(--rot); background: transparent; }
.knopf.gefahr:hover { background: var(--rot-hell); }
.knopf.klein { padding: .3rem .6rem; font-size: .8rem; font-weight: 500; }
.knopfreihe { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.meldung { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .88rem; border: 1px solid; }
.meldung.ok { background: var(--gruen-hell); border-color: var(--gruen); color: var(--gruen); }
.meldung.fehler { background: var(--rot-hell); border-color: var(--rot); color: var(--rot); }
.meldung.warnung { background: var(--gelb-hell); border-color: var(--gelb-rand); }

table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { padding: .45rem .55rem; text-align: left; border-bottom: 1px solid var(--rand); }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-leise); font-weight: 600; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--flaeche-2); }
.tabelle-rahmen { overflow-x: auto; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche); }
.tabelle-rahmen table th { position: sticky; top: 0; background: var(--flaeche); z-index: 1; }

.marke-kennz { display: inline-block; padding: .1rem .45rem; border-radius: 5px; font-size: .72rem;
  font-weight: 600; background: var(--akzent-hell); color: var(--akzent); }
.marke-kennz.grau { background: var(--flaeche-2); color: var(--text-leise); border: 1px solid var(--rand); }
.marke-kennz.rot { background: var(--rot-hell); color: var(--rot); }

/* ---------------------------------------------------------------- Preisabfrage */
.preis-layout {
  display: grid; gap: 1rem; align-items: start;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}
@media (max-width: 880px) { .preis-layout { grid-template-columns: 1fr; } }
.schritte { display: grid; gap: .9rem; }
.schritt { border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche);
  padding: .9rem 1rem; box-shadow: var(--schatten); }
.schritt.gesperrt { opacity: .45; pointer-events: none; }
.schritt-kopf { display: flex; align-items: center; gap: .55rem; margin-bottom: .7rem; }
.nummer { width: 22px; height: 22px; border-radius: 50%; background: var(--akzent); color: #fff;
  display: grid; place-items: center; font-size: .76rem; font-weight: 700; flex: none; }
.schritt.gesperrt .nummer { background: var(--rand-stark); }
.schritt-titel { font-weight: 650; font-size: .92rem; }
.wahl { display: flex; flex-wrap: wrap; gap: .4rem; }
.wahl button {
  padding: .45rem .8rem; border-radius: 8px; border: 1px solid var(--rand-stark);
  background: var(--flaeche); color: var(--text); font: inherit; font-size: .88rem;
  font-weight: 550; cursor: pointer; font-variant-numeric: tabular-nums;
}
.wahl button:hover { border-color: var(--akzent); }
.wahl button[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.wahl button .unter { display: block; font-size: .72rem; font-weight: 400; opacity: .75; }

.bh-zeile { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.bh-zeile input[type=range] { flex: 1; min-width: 180px; accent-color: var(--akzent); }
.bh-wert { width: 100px; }

.ergebnis { position: sticky; top: 72px; }
.preis-gross { font-size: 2.1rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.nebenwaehrungen { display: flex; gap: 1.1rem; margin-top: .1rem; flex-wrap: wrap;
  font-size: .95rem; color: var(--text-leise); font-variant-numeric: tabular-nums; }
.nebenwaehrungen b { color: var(--text); font-weight: 650; }
.waehrungswahl { display: inline-flex; border: 1px solid var(--rand-stark); border-radius: 7px;
  overflow: hidden; }
.waehrungswahl a { padding: .4rem .8rem; font-size: .85rem; font-weight: 600; text-decoration: none;
  color: var(--text-leise); border-right: 1px solid var(--rand); }
.waehrungswahl a:last-child { border-right: none; }
.waehrungswahl a.aktiv { background: var(--akzent); color: #fff; }

.preis-zeile { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0;
  border-bottom: 1px dashed var(--rand); font-size: .88rem; }
.preis-zeile:last-child { border-bottom: none; }
.preis-zeile b { font-variant-numeric: tabular-nums; text-align: right; }
.rabatt-chip { background: var(--gruen-hell); color: var(--gruen); padding: .12rem .5rem;
  border-radius: 5px; font-size: .78rem; font-weight: 650; }

details.kalk { margin-top: .9rem; border-top: 1px solid var(--rand); padding-top: .7rem; }
details.kalk summary { cursor: pointer; font-size: .82rem; color: var(--text-leise); font-weight: 600; }

/* ---------------------------------------------------------------- Anmeldung */
.login-huelle { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-karte { width: 100%; max-width: 380px; }
.login-karte .marke { font-size: 1.3rem; display: block; margin-bottom: .2rem; }

@media (max-width: 880px) {
  .ergebnis { position: static; }
}
@media (max-width: 640px) {
  .kopf-inhalt { padding: .5rem 12px; }
  main { padding: 1rem 12px 3rem; }
}
@media print {
  header.kopf, .knopfreihe, .drucken-aus { display: none !important; }
  body { background: #fff; }
  .karte, .tabelle-rahmen { box-shadow: none; border: none; }
}
