:root {
  --bg: #f7f4ef;
  --card: #ffffff;
  --ink: #1f2421;
  --muted: #6b716d;
  --line: #e6e1d8;
  --accent: #2f5d50;
  --accent-soft: #e3ece8;
  --warm: #c8693a;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161917;
    --card: #1f2321;
    --ink: #ecefed;
    --muted: #9aa29d;
    --line: #2e3431;
    --accent: #7fb8a5;
    --accent-soft: #24302c;
    --warm: #e08a5c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

button { font: inherit; color: inherit; cursor: pointer; }

.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 14px) 16px 10px;
  border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0 0 10px; font-size: 1.35rem; letter-spacing: -0.01em; }

.tabs { display: flex; gap: 6px; background: var(--accent-soft); padding: 4px; border-radius: 999px; }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 7px 0; border-radius: 999px;
  font-weight: 600; font-size: .95rem; color: var(--muted);
}
.tabs button[aria-selected="true"] { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

main { max-width: 680px; margin: 0 auto; padding: 16px; }

.datenav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.datenav > button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); font-size: 1.6rem; line-height: 1; flex: none;
}
.datum { flex: 1; text-align: center; }
#datum-text { font-weight: 600; }
#datum-text::first-letter { text-transform: uppercase; }
.link { border: 0; background: none; color: var(--accent); font-size: .9rem; padding: 2px; text-decoration: underline; }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.04); border: 1px solid var(--line); }

.typ { display: inline-block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--warm); }
.card h2 { margin: 4px 0 6px; font-size: 1.6rem; line-height: 1.2; letter-spacing: -0.015em; }
.meta { color: var(--muted); font-size: .92rem; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

.portioner { display: inline-flex; align-items: center; gap: 8px; }
.portioner button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font-size: 1.1rem; line-height: 1;
}
.portioner strong { min-width: 1.5ch; text-align: center; color: var(--ink); }

.card h3, .sub { font-size: 1rem; margin: 22px 0 8px; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; gap: 12px; align-items: baseline; padding: 9px 2px; cursor: pointer; }
.checklist input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; transform: translateY(3px); }
.checklist .amt { min-width: 5.5em; font-variant-numeric: tabular-nums; color: var(--muted); }
.checklist input:checked ~ span { text-decoration: line-through; opacity: .5; }
.checklist.muted label { color: var(--muted); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: .85rem; display: grid; place-items: center;
}

.weeklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.weeklist button {
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius);
  padding: 12px 14px; display: grid; grid-template-columns: 4.5em 1fr auto; gap: 10px; align-items: center;
}
.weeklist .wd { font-weight: 700; color: var(--accent); }
.weeklist .wd::first-letter { text-transform: uppercase; }
.weeklist .wd small { display: block; font-weight: 400; color: var(--muted); }
.weeklist .wn { font-weight: 600; }
.weeklist .wt { color: var(--muted); font-size: .85rem; }
.weeklist .today { border-color: var(--accent); }

.hint { color: var(--muted); margin: 0 0 12px; font-size: .92rem; }
.handla-top { margin-bottom: 8px; }
.handla-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.btn { border: 0; background: var(--accent); color: #fff; padding: 9px 14px; border-radius: 10px; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
#view-handla .checklist { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 10px 16px 28px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-size: .9rem;
}
