:root {
  --bg: #f4f6f1;
  --flaeche: #ffffff;
  --text: #17231b;
  --leise: #5d6b61;
  --rand: #dfe5dc;
  --gruen: #1f7a4a;
  --gruen-dunkel: #155c37;
  --gruen-hell: #e3f3e8;
  --gelb: #f2b705;
  --gelb-hell: #fff6d6;
  --rot: #b3261e;
  --rot-hell: #fde7e5;
  --radius: 14px;
  --schatten: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 5%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1612;
    --flaeche: #17211b;
    --text: #e6eee8;
    --leise: #9aab9f;
    --rand: #2a3830;
    --gruen: #3fbf7a;
    --gruen-dunkel: #2f9c61;
    --gruen-hell: #173325;
    --gelb: #f5c842;
    --gelb-hell: #3a3215;
    --rot: #ff8a80;
    --rot-hell: #3d1d1b;
    --schatten: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 64px; }
main.breit { max-width: 1100px; }
main.eng { max-width: 420px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 12px; }
a { color: var(--gruen); }
small, .leise { color: var(--leise); }

.kopf {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; max-width: 1100px; margin: 0 auto;
}
.kopf .marke { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; color: var(--text); }
.kopf .marke img { width: 30px; height: 30px; }
.kopf .rechts { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--schatten);
}
.karte.hervor { border-color: var(--gruen); background: var(--gruen-hell); }
.karte.warn { border-color: var(--gelb); background: var(--gelb-hell); }
.karte.fehler { border-color: var(--rot); background: var(--rot-hell); }

.saldo { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.saldo small { font-size: 1rem; font-weight: 600; }
.gross { font-size: 1.8rem; font-weight: 700; }

button, .knopf {
  appearance: none;
  font: inherit; font-weight: 600;
  border: 1px solid var(--rand);
  background: var(--flaeche);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
}
button:hover, .knopf:hover { border-color: var(--gruen); }
button.primaer, .knopf.primaer { background: var(--gruen); border-color: var(--gruen); color: #fff; }
button.primaer:hover { background: var(--gruen-dunkel); }
button.gefahr { color: var(--rot); }
button.klein { min-height: 32px; padding: 4px 10px; font-size: 0.875rem; }
button:disabled { opacity: 0.55; cursor: default; }
.breit { width: 100%; margin-top: 8px; }

input, select {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--rand);
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--gruen); outline-offset: 1px; }
label { display: block; font-size: 0.875rem; color: var(--leise); margin: 10px 0 4px; }
.zeile { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.zeile > * { flex: 1 1 140px; }
.zeile > button { flex: 0 0 auto; }

.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rand); }
.liste li:first-child { border-top: 0; }
.liste .wachsen { flex: 1; min-width: 0; }
.betrag { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.betrag.plus { color: var(--gruen); }

.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--gruen-hell); color: var(--gruen-dunkel); font-size: 0.8rem; font-weight: 600; margin: 2px 4px 2px 0;
}
.chip.grau { background: var(--rand); color: var(--leise); }
.chip.rot { background: var(--rot-hell); color: var(--rot); }
.chip.gelb { background: var(--gelb-hell); color: #7a5b00; }

.tabs { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; margin-bottom: 14px; border-bottom: 1px solid var(--rand); }
.tabs a {
  padding: 10px 14px; text-decoration: none; color: var(--leise); font-weight: 600; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a.aktiv { color: var(--gruen); border-color: var(--gruen); }

.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kachel { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 14px; }
.kachel b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.kachel span { color: var(--leise); font-size: 0.85rem; }

.tabelle-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rand); vertical-align: top; }
th { color: var(--leise); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.9em; }

.anfrage { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.anfrage .info { flex: 1 1 200px; }
.anfrage .knoepfe { display: flex; gap: 8px; }
.anfrage .knoepfe button { min-height: 52px; padding: 0 22px; font-size: 1.05rem; }

.qr { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 12px; }
.qr svg { width: 100%; max-width: 260px; height: auto; }
.code-gross { font-family: ui-monospace, Consolas, monospace; font-size: 2rem; letter-spacing: 0.15em; text-align: center; font-weight: 700; }

.hinweis { background: var(--gelb-hell); border: 1px dashed var(--gelb); padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; max-width: calc(100% - 32px);
  box-shadow: 0 6px 24px rgb(0 0 0 / 25%); z-index: 10; font-weight: 500;
}
.toast.fehler { background: var(--rot); color: #fff; }
.mittig { text-align: center; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%; margin: 12px auto;
  border: 4px solid var(--rand); border-top-color: var(--gruen); animation: dreh 0.9s linear infinite;
}
@keyframes dreh { to { transform: rotate(360deg); } }
.tag-muenze {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 10px;
  background: radial-gradient(circle at 35% 30%, #ffe27a, var(--gelb) 60%, #c99400);
  display: grid; place-items: center; color: #4a3600; font-weight: 800; font-size: 1.6rem;
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / 15%), 0 4px 14px rgb(242 183 5 / 35%);
}
[hidden] { display: none !important; }
