:root {
  --bg: #0b0f18;
  --surface: #141a27;
  --surface-2: #1b2333;
  --line: #27314599;
  --text: #e8edf7;
  --muted: #8e9ab4;
  --accent: #2f9e5e;
  --radius: 18px;
  --shadow: 0 18px 40px -20px #000c;
  --rest: #8a93a6;
  --bio: #7ec24a;
  --papier: #4f8ff7;
  --gelb: #f0c22b;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5fa;
    --surface: #ffffff;
    --surface-2: #eef1f8;
    --line: #d7dded;
    --text: #131a29;
    --muted: #5d6880;
    --shadow: 0 16px 34px -22px #26324d66;
    --rest: #6b7280;
    --bio: #5f9c2f;
    --papier: #2563eb;
    --gelb: #c99500;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 0 max(16px, env(safe-area-inset-left)) calc(28px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

main { max-width: 720px; margin: 0 auto; }

/* Farbiger Schein hinter dem Hero, folgt der nächsten Fraktion */
.glow {
  position: fixed;
  inset: -30vh 0 auto;
  height: 60vh;
  background: radial-gradient(50% 50% at 50% 60%, var(--glow-color, #2f9e5e) 0%, transparent 70%);
  opacity: .16;
  filter: blur(30px);
  pointer-events: none;
  transition: background .6s ease;
  z-index: 0;
}

body > *:not(.glow) { position: relative; z-index: 1; }

/* ---------- Kopfzeile ---------- */
.topbar {
  max-width: 720px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 8px; flex: none; }
.brand > div { min-width: 0; }
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand span {
  display: block; font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- Hero: nächste Abholung ---------- */
.hero {
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 16px;
  overflow: hidden;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--hero-color, var(--accent));
}

.hero-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
}

.hero-when {
  font-size: clamp(30px, 8.5vw, 44px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.03em;
  margin: 2px 0 0;
}

.hero-date { color: var(--muted); font-size: 14.5px; margin-top: 6px; }

.hero-bins { display: flex; flex-wrap: wrap; gap: 10px; }

.hero-note {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 13.5px; color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.hero-note svg { width: 16px; height: 16px; fill: currentColor; flex: none; margin-top: 2px; }

/* Tonnen-Chip */
.bin {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  color: var(--text);
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
}
.bin svg { width: 20px; height: 20px; fill: var(--c); flex: none; }
.bin.sm { font-size: 13px; padding: 5px 11px 5px 8px; font-weight: 500; }
.bin.sm svg { width: 16px; height: 16px; }

/* ---------- Banner ---------- */
.banner {
  margin-top: 14px;
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.banner.ok { border-color: color-mix(in srgb, var(--bio) 45%, transparent); color: var(--text); }
.banner b { color: var(--text); font-weight: 600; }
.banner button {
  margin-left: auto; flex: none;
  background: none; border: 0; padding: 0;
  color: var(--accent); font: inherit; font-weight: 600; cursor: pointer;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin: 22px 0 16px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.tab {
  flex: 1;
  padding: 9px 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab.is-active { background: var(--surface-2); color: var(--text); }

/* ---------- Terminliste ---------- */
.month-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); margin: 22px 0 8px 4px;
}
.month-label:first-child { margin-top: 0; }

.item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 8px;
}
.item.is-past { opacity: .45; }
.item.is-next { border-color: color-mix(in srgb, var(--c) 55%, transparent); }

.item-date {
  flex: none; width: 46px; text-align: center; line-height: 1.15;
}
.item-date b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.item-date span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.item-bins { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.item-rel { margin-left: auto; flex: none; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------- Jahresübersicht ---------- */
.year { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }

.mini {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.mini h4 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mini-grid span {
  font-size: 10px; color: var(--muted); text-align: center;
  padding-bottom: 3px;
}
.day {
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-size: 11.5px;
  border-radius: 7px;
  color: var(--muted);
  position: relative;
}
.day.has-pickup { color: var(--text); font-weight: 600; background: var(--surface-2); }
.day.is-today { outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.day.is-holiday { color: #ef6b6b; }
.dots { position: absolute; bottom: 2px; display: flex; gap: 2px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--c); }

.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

/* ---------- Infos ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; }
.card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.card dt { color: var(--muted); }
.card dd { margin: 0; }
.card a { color: var(--accent); }
.card ul { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 10px; }
.card li span { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Einstellungen ---------- */
.sheet {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  max-height: min(85vh, 760px);
  box-shadow: var(--shadow);
}
.sheet::backdrop { background: #05080fbb; backdrop-filter: blur(3px); }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
  border-radius: 20px 20px 0 0;
}
.sheet-head h2 { margin: 0; font-size: 17px; }
.sheet-body { padding: 18px; overflow: auto; }

.group { margin-bottom: 26px; }
.group:last-child { margin-bottom: 4px; }
.group h3 { margin: 0 0 4px; font-size: 15px; }
.hint { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }
.hint code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }

.toggles { display: grid; gap: 8px; }
.toggle {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
}
.toggle svg { width: 20px; height: 20px; fill: var(--c); flex: none; }
.toggle input { margin-left: auto; accent-color: var(--accent); width: 18px; height: 18px; }
.toggle.is-off { opacity: .5; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: 14.5px; }
.row input[type=time] {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 11px;
  font: inherit;
}

.push-state {
  font-size: 13.5px;
  color: var(--muted);
  padding: 11px 14px;
  background: var(--surface-2);
  border-radius: 12px;
  margin-bottom: 12px;
}
.push-state.ok { color: var(--text); }
.push-state.warn { color: #f0a93b; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit; font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  transition: filter .15s, opacity .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-ghost { background: none; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 10;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot {
  max-width: 720px;
  margin: 30px auto 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
