:root {
  --bg: #f6f5f1; --flaeche: #ffffff; --text: #1c1c1a; --leise: #6b6a64; --linie: #e3e1da;
  --gruen: #166534; --gruen-hell: #dcfce7; --rot: #b91c1c; --rot-hell: #fee2e2; --gelb: #92400e; --gelb-hell: #fef3c7;
  --akzent: #14532d; --akzent-text: #ffffff; --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121311; --flaeche: #1c1d1a; --text: #ecebe6; --leise: #9d9b93; --linie: #2e2f2b;
    --gruen: #86efac; --gruen-hell: #14301e; --rot: #fca5a5; --rot-hell: #3a1717; --gelb: #fcd34d; --gelb-hell: #3a2d0c;
    --akzent: #4ade80; --akzent-text: #0b1a10;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
main { max-width: 760px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
header { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; }
h1 { font-size: 19px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 1px solid var(--linie); background: var(--flaeche); border-radius: 999px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
button:disabled { opacity: .6; }
button.primaer { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); font-weight: 600; }
button.gefahr { color: var(--rot); }
button.icon { border: 0; background: none; font-size: 20px; padding: 4px 8px; }
.leise { color: var(--leise); font-size: 13px; }
.fehler { color: var(--rot); }
.leer { color: var(--leise); text-align: center; padding: 32px 8px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 12px; scrollbar-width: none; }
.chips button.aktiv { background: var(--text); color: var(--bg); border-color: var(--text); }
.chips button.pausiert { opacity: .55; }
.chips button.neu { border-style: dashed; color: var(--leise); }
.zahl { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--akzent); color: var(--akzent-text); font-size: 12px; font-weight: 700; }

.profil-kopf { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin: 4px 0 12px; }
.profil-kopf p { margin: 2px 0 0; }
.knopfreihe { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--linie); margin-bottom: 12px; overflow-x: auto; }
.tabs button { border: 0; border-radius: 0; background: none; padding: 8px 12px; color: var(--leise); border-bottom: 2px solid transparent; }
.tabs button.aktiv { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

.karte { display: grid; grid-template-columns: 132px 1fr; gap: 14px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.karte.weg, .karte.aussortiert { opacity: .6; }
.bild { display: block; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: var(--linie); }
.bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inhalt { min-width: 0; }
.zeile1 { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; }
.titel { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.titel:hover { text-decoration: underline; }
.punkte { flex: none; min-width: 34px; text-align: center; border-radius: 8px; padding: 2px 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.punkte.gut { background: var(--gruen-hell); color: var(--gruen); }
.punkte.mittel { background: var(--gelb-hell); color: var(--gelb); }
.punkte.schlecht, .punkte.raus { background: var(--rot-hell); color: var(--rot); }
.preis { font-size: 17px; font-weight: 700; margin-top: 2px; }
.fakten { font-size: 13px; margin-top: 2px; }
.gruende { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.grund, .warnung { font-size: 12px; border-radius: 6px; padding: 1px 7px; }
.grund.plus { background: var(--gruen-hell); color: var(--gruen); }
.grund.minus { background: var(--rot-hell); color: var(--rot); }
.warnung { background: var(--gelb-hell); color: var(--gelb); font-weight: 600; }
.aktionen { display: flex; gap: 8px; margin-top: 10px; }
.aktionen button { padding: 5px 12px; font-size: 13px; }

form label { display: block; margin: 12px 0 0; font-weight: 600; font-size: 14px; }
form label .leise { font-weight: 400; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche); }
textarea.mono { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 12px; }
.reihe[hidden], [hidden] { display: none !important; }
label.haken { display: flex; gap: 8px; align-items: center; }
label.haken input { width: auto; margin: 0; }
form .knopfreihe { margin-top: 20px; }
.form-kopf { display: flex; justify-content: space-between; align-items: center; padding: 14px 0 4px; }

.anleitung { padding-left: 20px; }
.thema { display: flex; gap: 8px; align-items: center; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 8px 8px 8px 12px; }
.thema code { flex: 1; overflow-wrap: anywhere; font-size: 14px; }
#ansicht-einstellungen h2 { margin-top: 24px; }
#ansicht-einstellungen > button { margin-top: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--linie); vertical-align: top; }
td.fehler { font-size: 12px; }

#login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 320px; text-align: center; }
.login-box .logo { font-size: 44px; color: var(--akzent); }
.login-box form { display: grid; gap: 10px; }

#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 10; }

@media (max-width: 480px) {
  .karte { grid-template-columns: 96px 1fr; gap: 10px; padding: 10px; }
  .profil-kopf .knopfreihe { width: 100%; }
  .profil-kopf .knopfreihe button { flex: 1; }
}
