:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-2: #e8eeea;
  --text: #17201b;
  --muted: #5f6b64;
  --line: #dbe3de;
  --accent: #1f7a5a;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe6;
  --red: #c2372b;
  --red-soft: #fbe7e4;
  --warn-soft: #fff3d6;
  --warn-ink: #6b4b00;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .06);
  --radius: 16px;
  color-scheme: light;

  --c-rest: #2d3033;   --i-rest: #ffffff;
  --c-bio: #2e8540;    --i-bio: #ffffff;
  --c-gelb: #f2c200;   --i-gelb: #2a2200;
  --c-papier: #1f5fbf; --i-papier: #ffffff;
  --c-glas: #8a929a;   --i-glas: #ffffff;
  --c-baum: #136b3a;   --i-baum: #ffffff;
  --c-schadstoff: #d9661f; --i-schadstoff: #ffffff;
  --c-sonst: #7a6fb0;  --i-sonst: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111613;
    --surface: #1a211d;
    --surface-2: #232c27;
    --text: #e8efea;
    --muted: #9aa8a0;
    --line: #2f3a34;
    --accent: #5cc79b;
    --accent-ink: #0b2219;
    --accent-soft: #1c3a2e;
    --red: #f07366;
    --red-soft: #3a211e;
    --warn-soft: #3a3016;
    --warn-ink: #f5d68a;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
    color-scheme: dark;
    --c-rest: #6a7075;
    --c-bio: #3fa356;
    --c-papier: #3d7fe0;
    --c-glas: #8e979f;
    --c-baum: #2b8f55;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.klein { font-size: .85rem; }
[hidden] { display: none !important; }

/* ---------- Kopf ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand img { border-radius: 7px; }
.brand h1 { font-size: 1.25rem; margin: 0; }
.sync { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync[data-state="live"] .dot { background: #2fb36d; }
.sync[data-state="off"] .dot { background: var(--red); }
.sync[data-state="demo"] .dot { background: #e0a423; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 12px; background: transparent; font-size: 1.4rem;
}
.icon-btn svg { fill: currentColor; }
.icon-btn:active { background: var(--surface-2); }

main, .login { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

.banner { max-width: 608px; margin: 4px auto 12px; padding: 10px 14px; border-radius: 12px; font-size: .92rem; }
.banner.demo { background: var(--warn-soft); color: var(--warn-ink); margin: 4px 16px 12px; }
@media (min-width: 640px) { .banner.demo { margin: 4px auto 12px; } }
.banner.warn { background: var(--warn-soft); color: var(--warn-ink); }

/* ---------- Farben je Tonne ---------- */
.art-rest { --c: var(--c-rest); --i: var(--i-rest); }
.art-bio { --c: var(--c-bio); --i: var(--i-bio); }
.art-gelb { --c: var(--c-gelb); --i: var(--i-gelb); }
.art-papier { --c: var(--c-papier); --i: var(--i-papier); }
.art-glas { --c: var(--c-glas); --i: var(--i-glas); }
.art-baum { --c: var(--c-baum); --i: var(--i-baum); }
.art-schadstoff { --c: var(--c-schadstoff); --i: var(--i-schadstoff); }
.art-sonst { --c: var(--c-sonst); --i: var(--i-sonst); }
.sym { width: 24px; height: 24px; flex: none; }
.sym .f { fill: var(--c); }
.sym .z { fill: var(--i); }
.art-gelb .sym .f { stroke: #b38f00; stroke-width: .6; }

.ausrufe {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: .75rem; font-weight: 800; vertical-align: 1px;
}

/* ---------- Nächste Abfuhr ---------- */
.hero { padding: 18px 16px 16px; margin-bottom: 16px; border-top: 5px solid var(--line); }
.hero.dringend { border-top-color: var(--accent); }
.hero.fertig { border-top-color: #2fb36d; }
.hero-wann { font-size: 1.5rem; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.hero-datum { color: var(--muted); margin: 2px 0 14px; }
.hero-tonnen { display: grid; gap: 8px; }
.tonne {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 14px; border: 2px solid var(--c);
  background: color-mix(in srgb, var(--c) 10%, var(--surface));
  transition: background .15s, transform .1s;
}
.tonne .sym { width: 34px; height: 34px; }
.tonne:not(:disabled):active { transform: scale(.98); }
.tonne-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tonne-name { font-weight: 700; font-size: 1.05rem; }
.tonne-status { font-size: .85rem; color: var(--muted); }
.tonne .haken {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  border: 2px solid color-mix(in srgb, var(--c) 60%, var(--line));
  display: grid; place-items: center; font-weight: 800;
}
.tonne:disabled .haken { display: none; }
.tonne.ok { background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.tonne.ok .haken { background: #2fb36d; border-color: #2fb36d; color: #fff; }
.tonne.ok .tonne-status { color: var(--text); }
.hero-hinweis { margin: 12px 0 0; font-weight: 600; }
.hero-warn { margin: 8px 0 0; color: var(--red); font-size: .92rem; }
.danach { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ---------- Ansicht + Filter ---------- */
.leiste { display: flex; justify-content: center; margin-bottom: 10px; }
.segment { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.segment button { border: 0; background: transparent; padding: 7px 22px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.segment button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.filter { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .85rem;
}
.filter-chip .punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.filter-chip.aus { opacity: .45; text-decoration: line-through; }

/* ---------- Liste ---------- */
.monat-titel { font-size: .95rem; color: var(--muted); margin: 18px 4px 8px; font-weight: 700; }
.tag-zeile { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px; }
.tag-zeile.bald { outline: 2px solid var(--accent); outline-offset: -2px; }
.tag-datum { display: flex; flex-direction: column; align-items: center; width: 34px; flex: none; }
.tag-nr { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.tag-wt { font-size: .78rem; color: var(--muted); text-transform: uppercase; }
.tag-chips { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-rel { font-size: .78rem; color: var(--muted); text-align: right; flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 6px;
  border-radius: 999px; border: 1.5px solid var(--c);
  background: color-mix(in srgb, var(--c) 10%, var(--surface)); font-size: .88rem; font-weight: 600;
}
.chip .sym { width: 20px; height: 20px; }
.chip:disabled { color: inherit; opacity: 1; }
.chip.ok { background: color-mix(in srgb, var(--c) 25%, var(--surface)); }
.chip-ok { color: #1f9a5c; font-weight: 800; }
.leer { text-align: center; padding: 30px 0; }

/* ---------- Monat ---------- */
.monat-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.monat-kopf h2 { font-size: 1.1rem; margin: 0; }
.raster { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 8px; }
.raster .wt { text-align: center; font-size: .75rem; color: var(--muted); padding: 4px 0; }
.zelle {
  position: relative; aspect-ratio: 1 / 1.05; border: 0; border-radius: 10px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 6px 0 0; gap: 4px;
}
.zelle .zahl { font-size: .95rem; }
.zelle.vorbei { opacity: .5; }
.zelle.heute .zahl { background: var(--accent); color: var(--accent-ink); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; font-weight: 700; margin-top: -3px; }
.zelle.gewaehlt { background: var(--surface-2); }
.punkte { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 34px; }
.punkte i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); display: block; }
.punkte i.art-gelb { box-shadow: inset 0 0 0 1px #b38f00; }
.punkte i.vers { outline: 2px solid var(--red); outline-offset: 1px; }
.zelle-ok { position: absolute; top: 2px; right: 4px; font-size: .7rem; color: #1f9a5c; font-weight: 800; }
.detail { padding: 14px; margin-top: 12px; }
.detail-kopf { margin-bottom: 10px; display: flex; justify-content: space-between; gap: 8px; }

.fuss { text-align: center; font-size: .8rem; margin: 26px 0 0; }

/* ---------- Anmeldung ---------- */
.login { padding-top: 6vh; }
.login form { padding: 24px; display: grid; gap: 12px; text-align: center; }
.login form img { margin: 0 auto; border-radius: 14px; }
.login h2 { margin: 0; }
.login p { margin: 0; }
label { display: grid; gap: 4px; text-align: left; font-size: .9rem; color: var(--muted); }
input[type=email], input[type=password], input[type=text], input[type=url], input[type=number], input[type=time], select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.error { color: var(--red); font-size: .9rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.gefahr { color: var(--red); }
.btn:disabled { opacity: .5; }
.btn.datei { cursor: pointer; color: var(--text); font-size: 1rem; }

/* ---------- Einstellungen ---------- */
.sheet {
  width: min(560px, 100%); max-height: min(92vh, 900px); margin: auto auto 0; padding: 0 0 calc(20px + env(safe-area-inset-bottom));
  border: 0; border-radius: 20px 20px 0 0; background: var(--bg); color: var(--text); overflow-y: auto;
}
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet::backdrop { background: rgb(0 0 0 / .4); }
.sheet-kopf { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 18px; background: var(--bg); }
.sheet-kopf h2 { margin: 0; font-size: 1.2rem; }
.block { background: var(--surface); margin: 0 12px 12px; padding: 14px; border-radius: 14px; }
.block h3 { margin: 0 0 6px; font-size: 1rem; }
.block p { margin: 4px 0 8px; }
.status { font-weight: 600; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.zeile { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.zeile select { flex: 1 1 190px; min-width: 190px; }
.zeile:has(select) { flex-wrap: wrap; }
.zeile input[type=time] { flex: 1; min-width: 96px; }
.zeile input.jahr { width: 96px; flex: none; }
.schalter { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 1rem; }
.schalter input { width: 20px; height: 20px; accent-color: var(--accent); }
.arten { display: flex; flex-wrap: wrap; gap: 6px; }
.art-wahl {
  display: inline-flex; flex-direction: row; align-items: center; gap: 6px; padding: 5px 10px 5px 6px;
  border-radius: 999px; border: 1.5px solid var(--c); color: var(--text); font-size: .88rem;
}
.art-wahl input { accent-color: var(--accent); margin: 0; }
.art-wahl .sym { width: 20px; height: 20px; }
.import-zeile { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.import-zeile:last-child { border-bottom: 0; }
.import-jahr { font-weight: 800; font-size: 1.1rem; width: 48px; }
.import-zeile.status-fehler b { color: var(--red); }
.mehr summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-top: 4px; }
.infos { margin: 0; padding-left: 18px; font-size: .92rem; display: grid; gap: 6px; }

/* ---------- Meldung ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 50;
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: .92rem;
}
.toast button { border: 0; background: transparent; color: var(--accent-soft); font-weight: 700; padding: 0; }
