:root {
  --bean: #5b3a29;
  --bean-2: #7a5340;
  --paper: #f3ead9;
  --paper-2: #e2d2b8;
  --ink: #2b1d15;
  --muted: #65513f;
  --danger: #a3341f;
  --card: #fbf6ee;
  --focus: #1f6feb;
  --on-bean: #fbf6ee;
  --radius: 14px;
  --nav-h: 3.9rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1f1712;
    --paper-2: #3a2c22;
    --card: #2a201a;
    --ink: #f3ead9;
    --muted: #cdbca9;
    --bean: #d9b48f;
    --bean-2: #c49a75;
    --danger: #ff8a73;
    --on-bean: #1f1712;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 1.0625rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom));
  overflow-wrap: anywhere;
}
button, input, textarea, .button { font: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
a { color: var(--bean); }

.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: .75rem;
  background: #5b3a29; color: #fbf6ee;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem;
}
@media (prefers-color-scheme: dark) { .top { background: #3a271d; } }
.top-title { margin: 0; font-size: 1.15rem; font-weight: 700; flex: 1; }
.top-title:focus { outline: none; }
.lang-switch {
  min-height: 2.25rem; padding: .2rem .7rem; border-radius: 999px;
  border: 1.5px solid rgba(251, 246, 238, .7); color: #fbf6ee; background: transparent;
  font-size: .9rem; font-weight: 700;
}

main { max-width: 34rem; margin: 0 auto; padding: 1rem; }

/* Sammeln */
.intro { max-width: 20rem; margin: 0 auto 1rem; text-align: center; }
.intro a { font-weight: 600; }
.pocket {
  position: relative;
  aspect-ratio: 3 / 4;
  width: min(15.5rem, 70vw);
  margin: 0 auto;
  background: url(img/beans-bg.webp) center / cover no-repeat, #d7c3a6;
  border-radius: var(--radius);
  color: #fbf6ee;
  text-align: center;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 6% 10% 0;
}
.pocket > p { text-shadow: 0 1px 3px rgba(0,0,0,.8), 0 0 12px rgba(60,35,20,.95); }
.pocket-label { margin: 0; font-weight: 700; font-size: .95rem; }
.pocket-count { margin: 0; font-size: 3.6rem; font-weight: 800; line-height: 1; }
.pocket-count:empty { display: none; }
.pocket-sub { margin: .25rem 0 0; font-size: .85rem; }
.pocket.bump .pocket-count { animation: bump .6s ease; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
.flying-bean {
  position: fixed; width: 34px; height: 24px; border-radius: 50%;
  background: radial-gradient(ellipse at 40% 35%, #8a5a3c, #3b2418 70%);
  pointer-events: none; z-index: 20;
  transition: transform .6s cubic-bezier(.3,.7,.3,1), opacity .6s;
}
@media (prefers-reduced-motion: reduce) {
  .pocket.bump .pocket-count { animation: none; }
  .flying-bean { display: none; }
}

.add {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: min(100%, 19rem); margin: 1rem auto 0;
  min-height: 3.5rem; border: 0; border-radius: 999px;
  background: var(--bean); color: var(--on-bean); font-weight: 700; font-size: 1.1rem;
  cursor: pointer;
}
.add-plus { font-size: 1.6rem; line-height: 1; }

.install-banner {
  display: flex; gap: .75rem; align-items: flex-start;
  max-width: 22rem; margin: 1rem auto 0; padding: .8rem;
  background: var(--card); border-radius: var(--radius); border: 1.5px solid var(--paper-2);
}
.install-banner img { border-radius: 10px; flex: none; }
.install-banner p { margin: 0 0 .5rem; }
.install-banner-t { font-weight: 700; }
.install-banner .row { margin: 0; }
.hint { max-width: 22rem; margin: .9rem auto 0; text-align: center; color: var(--muted); }
.hint-box { background: var(--card); border-radius: 10px; padding: .6rem .8rem; color: var(--ink); }
.hint-box button { margin-top: .4rem; }
.recent-title { max-width: 22rem; margin: 1.4rem auto .2rem; font-size: .95rem; color: var(--muted); }
.recent { list-style: none; padding: 0; margin: 0 auto; max-width: 22rem; }
.recent button {
  display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--paper-2);
  border-radius: 0; padding: .55rem 0; color: var(--ink); background: none; min-height: 2.75rem;
}
.recent b { font-weight: 600; }
.recent .when { color: var(--muted); }

/* Allgemein */
button, .button {
  min-height: 2.75rem; padding: .45rem 1rem; border-radius: 10px;
  border: 1.5px solid var(--bean); background: transparent; color: var(--bean);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; text-align: center;
}
button.primary { background: var(--bean); color: var(--on-bean); }
button.danger { border-color: var(--danger); color: var(--danger); }
button.link { border: 0; padding-left: 0; padding-right: 0; text-decoration: underline; text-underline-offset: 3px; }
.chip { min-height: 2.5rem; padding: .3rem .8rem; border-radius: 999px; font-size: .95rem; }
.chip[aria-pressed="true"] { background: var(--bean); color: var(--on-bean); }
.muted { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .6rem; }
.row.stack > * { flex: 1 1 14rem; }
input[type=date], input[type=time] {
  min-height: 2.75rem; padding: .35rem .6rem; border-radius: 10px; max-width: 100%;
  border: 1.5px solid var(--paper-2); background: var(--card); color: var(--ink);
}
.card { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card h2 { margin: 0 0 .5rem; font-size: 1.1rem; }
.card p { margin: 0 0 .75rem; }
.card.care { border-left: 4px solid var(--bean); }
.care a { font-weight: 700; }
.danger-zone { background: transparent; border: 1.5px dashed var(--paper-2); }

/* Liste */
.quick, .filter { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.filter label { display: flex; align-items: center; gap: .4rem; }
.seg { display: inline-flex; border: 1.5px solid var(--bean); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 2.5rem; font-size: .95rem; }
.seg button[aria-pressed="true"] { background: var(--bean); color: var(--on-bean); }
.small-add { margin-left: auto; min-height: 2.5rem; gap: .3rem; }
.day { margin: 1.1rem 0 .4rem; font-size: .95rem; color: var(--muted); font-weight: 700; }
.bean-item {
  display: flex; width: 100%; gap: .6rem; justify-content: space-between; align-items: flex-start; text-align: left;
  background: var(--card); color: var(--ink); border: 0; border-radius: 10px;
  padding: .75rem .9rem; margin-bottom: .5rem; min-height: 3rem; white-space: pre-wrap;
}
.bean-item .edit { flex: none; color: var(--bean); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); margin-top: 2rem; }

/* Statistik */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.kpi { background: var(--card); border-radius: 10px; padding: .6rem .75rem; }
.kpi b { display: block; font-size: 1.6rem; line-height: 1.1; }
.kpi span { font-size: .9rem; color: var(--muted); }
.chart { margin: 0 0 1.5rem; }
.chart figcaption { font-weight: 700; margin-bottom: .4rem; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 9rem; border-bottom: 1.5px solid var(--paper-2); }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bar i { display: block; width: 100%; background: var(--bean); border-radius: 4px 4px 0 0; }
.bar.now i { background: var(--bean-2); outline: 2px solid var(--bean); outline-offset: 1px; }
.bar b { font-size: .75rem; font-weight: 600; color: var(--muted); }
.bar-labels { display: flex; gap: 3px; margin-top: .2rem; }
.bar-labels span { flex: 1; font-size: .72rem; color: var(--muted); text-align: center; min-width: 0; overflow: visible; white-space: nowrap; display: flex; justify-content: center; }
.bar-labels span.hide { visibility: hidden; }

/* Navigation unten */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--card); border-top: 1px solid var(--paper-2);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  border: 0; border-radius: 0; flex-direction: column; gap: 0; padding: .3rem .2rem;
  min-height: var(--nav-h); color: var(--muted); font-size: .85rem; min-width: 0;
  border-top: 3px solid transparent;
}
.tabs .tl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs .ti { font-size: 1.1rem; line-height: 1.2; }
.tabs button[aria-current="page"] { color: var(--bean); font-weight: 700; border-top-color: var(--bean); }

/* Dialog */
dialog {
  width: min(32rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 1.5rem); border: 0; border-radius: var(--radius);
  padding: 1.1rem; background: var(--card); color: var(--ink);
}
dialog::backdrop { background: rgba(30, 20, 14, .55); }
dialog h2 { margin: 0 0 .6rem; font-size: 1.1rem; }
dialog textarea {
  width: 100%; border-radius: 10px; border: 1.5px solid var(--paper-2);
  padding: .6rem; background: var(--paper); color: var(--ink); resize: vertical;
}
.date-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .7rem 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .4rem; }
.dialog-actions button { flex: 0 1 9rem; }
.dialog-delete { margin-top: .6rem; padding-top: .4rem; border-top: 1px solid var(--paper-2); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + .9rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 10px; z-index: 30;
  width: max-content; max-width: calc(100% - 2rem); display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
}
.toast button { min-height: 2.5rem; padding: .25rem .8rem; color: var(--paper); border-color: var(--paper); }

#about p, #care-text p { margin: 0 0 .6rem; }
