:root {
  --bg: #f4f5f2;
  --card: #ffffff;
  --text: #1c1f1a;
  --muted: #6b7065;
  --line: #e3e5df;
  --accent: #15803d;
  --accent-soft: #dcfce7;
  --accent-text: #ffffff;
  --danger: #c2410c;
  --chip: #eef0eb;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121411;
    --card: #1c1f1b;
    --text: #eceee9;
    --muted: #9aa094;
    --line: #2b2f2a;
    --accent: #22c55e;
    --accent-soft: #163a22;
    --accent-text: #06210f;
    --danger: #fb923c;
    --chip: #262a25;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overscroll-behavior-y: contain;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; }

/* ---------- Kopfzeile ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: var(--bg);
}
.top h1 { font-size: 24px; margin: 0; flex: 1; letter-spacing: -.01em; }
.count { color: var(--muted); font-size: 15px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 20px; display: grid; place-items: center;
}
.icon-btn:active { background: var(--chip); }

main { max-width: 640px; margin: 0 auto; padding: 0 12px calc(96px + var(--safe-b)); }

/* ---------- Eingabe ---------- */
.addbar-wrap { position: sticky; top: calc(64px + var(--safe-t)); z-index: 15; padding-bottom: 8px; background: var(--bg); }
.addbar {
  display: flex; gap: 8px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px; border: 1px solid var(--line);
}
.addbar input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  padding: 10px 10px; font-size: 17px;
}
.add-btn {
  width: 46px; height: 46px; border-radius: 11px;
  background: var(--accent); color: var(--accent-text);
  font-size: 28px; line-height: 1; font-weight: 500;
}
.add-btn:active { transform: scale(.95); }

.suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 2px 2px; }
.suggest-label { width: 100%; font-size: 13px; color: var(--muted); padding-left: 4px; }
.chip {
  padding: 8px 12px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); font-size: 15px;
}
.chip:active { background: var(--accent-soft); }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.quick-row { display: flex; gap: 8px; margin: 4px 2px 12px; }
.quick-row .btn { flex: 1; }

/* ---------- Liste ---------- */
.group { margin: 0 0 14px; }
.group-h {
  font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 4px 6px 6px; text-transform: uppercase; letter-spacing: .03em;
}
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); }
.item {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 6px 4px 6px 14px;
  border-top: 1px solid var(--line);
  user-select: none;
}
.item:first-child { border-top: 0; }
.item:active { background: var(--chip); }
.check {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--muted); display: grid; place-items: center;
  font-size: 15px; color: transparent;
}
.item.done .check { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.item-main { flex: 1; min-width: 0; padding: 6px 0; }
.item-name { overflow-wrap: anywhere; }
.item-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.item.done .item-name { text-decoration: line-through; color: var(--muted); }
.qty {
  flex: none; font-size: 15px; font-weight: 600;
  background: var(--accent-soft); color: var(--text);
  padding: 4px 10px; border-radius: 999px; max-width: 40%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item.done .qty { background: var(--chip); color: var(--muted); }
.edit-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; color: var(--muted); font-size: 18px; }
.edit-btn:active { background: var(--line); }

.done-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 22px 2px 8px;
}
.done-toggle { font-weight: 600; color: var(--muted); padding: 10px 4px; }

.empty { text-align: center; padding: 48px 20px 24px; color: var(--muted); }
.empty .big { font-size: 48px; margin-bottom: 8px; }
.empty p { margin: 6px 0; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 16px; border-radius: 12px;
  background: var(--chip); font-weight: 600; font-size: 16px;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--danger); background: transparent; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }

/* ---------- Rezepte ---------- */
.recipe-card { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; margin-bottom: 10px; }
.recipe-main { flex: 1; min-width: 0; padding: 4px 0; }
.recipe-name { font-weight: 600; font-size: 18px; overflow-wrap: anywhere; }
.recipe-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.fab {
  position: fixed; right: 18px; bottom: calc(84px + var(--safe-b)); z-index: 25;
  width: 58px; height: 58px; border-radius: 18px;
  background: var(--accent); color: var(--accent-text);
  font-size: 32px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.fab:active { transform: scale(.95); }

/* ---------- Rezeptbilder ---------- */
.recipe-card { padding-left: 10px; }
.recipe-thumb {
  flex: none; width: 60px; height: 60px; border-radius: 12px; overflow: hidden;
  background: var(--chip); display: grid; place-items: center; font-size: 26px;
}
.recipe-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-hero { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; margin-bottom: 14px; }
.img-drop {
  display: flex; align-items: center; justify-content: center; min-height: 92px;
  border: 2px dashed var(--line); border-radius: 14px; color: var(--muted); font-weight: 600; cursor: pointer;
}
.img-drop:active { background: var(--chip); }
.img-actions { margin: -4px 0 4px; justify-content: space-between; }
.img-actions label { cursor: pointer; }

/* ---------- Bewertung, Gesundheit, Zeit ---------- */
.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }
.stars, .health { display: inline-flex; white-space: nowrap; }
.st { color: #d6d9d2; font-size: 16px; line-height: 1; }
.st.on { color: #f2a516; }
.hl { font-size: 14px; line-height: 1; margin-right: 1px; filter: grayscale(1); opacity: .25; }
.hl.on { filter: none; opacity: 1; }
.time { font-size: 14px; color: var(--muted); margin-top: 4px; }
.view-badges { margin: -6px 0 6px; }
.view-badges .st { font-size: 20px; }
.view-badges .hl { font-size: 18px; }
@media (prefers-color-scheme: dark) { .st { color: #3d423b; } }

.rate-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.rate-pick { display: flex; align-items: center; }
.rate-pick .big { width: 38px; height: 42px; font-size: 28px; display: grid; place-items: center; }
.rate-pick .hl.big { font-size: 25px; }
.rate-num { width: 34px; text-align: right; font-size: 14px; color: var(--muted); font-weight: 600; }
.time-row .time-in { width: 120px; }
.time-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.time-quick .chip { padding: 6px 10px; font-size: 14px; }

.to-list-btn {
  flex: none; width: 58px; height: 58px; border-radius: 14px;
  background: var(--accent); color: var(--accent-text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.to-list-btn span { font-size: 22px; line-height: 1; }
.to-list-btn small { font-size: 12px; font-weight: 700; }
.to-list-btn:active { transform: scale(.95); }
.recipe-thumb { width: 72px; height: 72px; }

/* ---------- Vorrat ---------- */
.ing-help { margin: -2px 0 10px; line-height: 1.5; }
.stock-btn { width: 40px; height: 44px; flex: none; border-radius: 10px; background: var(--accent-soft); font-size: 19px; }
.ing-row.is-stock .stock-btn { background: var(--chip); }
.ing-row.is-stock .field { color: var(--muted); }
.ing-row .qty-in { width: 26%; }
.ing-row .del { width: 32px; }
.stock-list .pick-name, .stock-list .q { color: var(--muted); }

.out-btn { margin-top: 10px; }
.meal.out { background: #fff1d6; color: #7a4a00; font-weight: 600; }
@media (prefers-color-scheme: dark) { .meal.out { background: #3a2a0c; color: #ffd28a; } }

/* ---------- Essensplan ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.week-nav .icon-btn { font-size: 30px; background: var(--card); border: 1px solid var(--line); }
.week-title { text-align: center; display: flex; flex-direction: column; }
.week-title b { font-size: 18px; }
.week-title span { color: var(--muted); font-size: 14px; }
.week-back { text-align: center; margin: -2px 0 12px; }
.day { margin-bottom: 12px; padding: 4px 0; scroll-margin-top: calc(72px + var(--safe-t)); }
.day.today { border: 2px solid var(--accent); }
.day.past { opacity: .6; }
.day-h { font-weight: 700; padding: 10px 14px 4px; display: flex; align-items: center; gap: 8px; }
.today-badge { font-size: 12px; font-weight: 700; background: var(--accent); color: var(--accent-text); padding: 2px 8px; border-radius: 999px; }
.slot { display: flex; align-items: flex-start; gap: 10px; padding: 6px 10px 6px 14px; border-top: 1px solid var(--line); }
.slot:first-of-type { border-top: 0; }
.slot-l { flex: none; width: 118px; font-size: 14px; color: var(--muted); padding-top: 9px; }
.slot-items { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; }
.meal { padding: 7px 12px; border-radius: 10px; background: var(--chip); font-size: 15px; text-align: left; overflow-wrap: anywhere; }
.meal.recipe { background: var(--accent-soft); font-weight: 600; }
.meal:active { filter: brightness(.95); }
.slot-add { width: 36px; height: 36px; border-radius: 10px; border: 1.5px dashed var(--line); color: var(--muted); font-size: 22px; line-height: 1; }
.slot-add:active { background: var(--chip); }
.p-list { margin-top: 10px; min-height: 120px; }

/* ---------- Haushaltsbuch ---------- */
.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 4px 8px; }
.sec-h > span:first-child { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.link-btn { color: var(--accent); font-weight: 600; font-size: 14px; padding: 4px; }
.pad { padding: 0 6px; }
.intro { padding: 16px; margin-bottom: 4px; }
.intro p { margin: 8px 0 14px; }
.pot { display: block; width: 100%; text-align: left; padding: 12px 14px 10px; margin-bottom: 10px; }
.pot:active { transform: scale(.99); }
.pot-top { display: flex; align-items: center; gap: 12px; }
.pot-ico { font-size: 26px; width: 34px; text-align: center; flex: none; }
.pot-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pot-name b { overflow-wrap: anywhere; }
.pot-name small, .pot-rest small { font-size: 13px; color: var(--muted); font-weight: 400; }
.pot-rest { text-align: right; display: flex; flex-direction: column; flex: none; }
.pot-rest b { font-size: 20px; letter-spacing: -.01em; }
.bar { height: 12px; border-radius: 999px; background: var(--chip); overflow: hidden; margin: 10px 0 6px; }
.bar .fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .3s; }
.pot.mid .fill { background: #eab308; }
.pot.low .fill { background: #f97316; }
.pot.over .pot-rest b { color: var(--danger); }
.pot.low .pot-rest b { color: #ea580c; }
.pot-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.bar.save .fill { background: #3b82f6; }
.saving { padding: 12px 14px 10px; margin-bottom: 10px; }
.nopot { padding: 4px 0 0; }
.nopot-row { display: flex; width: 100%; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); text-align: left; gap: 10px; }
.nopot-row:first-child { border-top: 0; }
.nopot-hint { font-size: 12px; color: var(--muted); padding: 6px 14px 10px; border-top: 1px solid var(--line); }
.calc { padding: 10px 14px; }
.calc-row { display: flex; justify-content: space-between; padding: 6px 0; gap: 10px; }
.calc-row.sum { border-top: 1px solid var(--line); margin-top: 2px; padding-top: 8px; font-weight: 600; }
.calc-row.big b { font-size: 20px; }
.pos { color: var(--accent); }
.neg { color: var(--danger); }
.calc p { margin: 8px 0 2px; }
.months { padding: 4px 0 0; }
.month-row { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); text-align: left; }
.month-row:first-child { border-top: 0; }
.month-row.sel { background: var(--accent-soft); }
.m-name { width: 66px; flex: none; font-weight: 600; white-space: nowrap; }
.m-bar { flex: 1; height: 8px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.m-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.m-fill.neg { background: var(--danger); }
.m-vals { width: 104px; flex: none; text-align: right; display: flex; flex-direction: column; }
.m-vals small { font-size: 12px; }
.exp-row { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); text-align: left; }
.exp-row:first-child { border-top: 0; }
.exp-ico { font-size: 22px; width: 28px; text-align: center; flex: none; }
.exp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.exp-main span { overflow-wrap: anywhere; }
.exp-main small { font-size: 13px; color: var(--muted); }
.exp-amt { flex: none; }
.card.flat { box-shadow: none; }
.amount-wrap { display: flex; align-items: center; gap: 8px; }
.amount-wrap span { font-size: 28px; font-weight: 700; color: var(--muted); }
.amount-in { font-size: 32px; font-weight: 700; text-align: right; padding: 10px 14px; }
.cfg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.cfg-row:first-child { border-top: 0; }
.cfg-row .f-name { flex: 1 1 140px; min-width: 0; }
.cfg-row .f-icon { width: 54px; text-align: center; padding-left: 6px; padding-right: 6px; }
.cfg-row select.field { width: auto; flex: 1 1 130px; padding: 11px 10px; }
.cfg-row .del { width: 36px; height: 40px; flex: none; color: var(--muted); font-size: 20px; border-radius: 50%; }
.amount-mini { display: flex; align-items: center; gap: 4px; flex: 0 1 120px; }
.amount-mini .field { text-align: right; min-width: 0; }
.amount-mini span { color: var(--muted); font-weight: 600; }
.mini-lbl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); flex: 1 1 150px; }
.mini-lbl .field { flex: 1; min-width: 0; }

/* Verschwommene Übersicht */
.privacy { position: relative; }
.privacy:not(.shown) > .card { filter: blur(9px); pointer-events: none; user-select: none; }
.reveal-btn {
  position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.15);
  padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 16px;
}
.reveal-btn:active { transform: translate(-50%, -50%) scale(.96); }

/* ---------- Aufgaben ---------- */
.task-board { display: grid; gap: 10px; align-items: start; }
.task-col { background: var(--chip); border-radius: var(--radius); padding: 8px; min-height: 200px; border: 2px solid transparent; transition: border-color .15s, background .15s; }
.task-col.mine { background: var(--accent-soft); }
.task-col.drop-target { border-color: var(--accent); background: var(--card); }
.col-h { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 8px; gap: 6px; }
.col-h b { font-size: 17px; }
.col-h > span { font-size: 13px; color: var(--muted); }
.col-body { display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.col-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 6px 0; flex: 1; }
.task {
  display: flex; align-items: flex-start; gap: 8px; background: var(--card); border-radius: 12px;
  padding: 12px 12px; min-height: 48px; cursor: pointer; box-shadow: var(--shadow); border: 1px solid var(--line);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.task.pressing { transform: scale(.97); }
.task.dragging { opacity: .3; }
.task.is-overdue { border-color: var(--danger); }
.task.ghost { position: fixed; z-index: 80; pointer-events: none; box-shadow: 0 10px 28px rgba(0,0,0,.25); transition: none; }
.tcheck { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); color: transparent; font-size: 14px; display: grid; place-items: center; margin-top: 1px; }
.task.done .tcheck { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.t-main { flex: 1; min-width: 0; }
.t-title { font-size: 16px; overflow-wrap: anywhere; line-height: 1.25; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.t-meta { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.due.overdue { color: var(--danger); font-weight: 700; }
.due.today { color: #ea580c; font-weight: 700; }
.due.soon { color: var(--text); font-weight: 600; }
.task-hint { text-align: center; font-size: 13px; color: var(--muted); margin: 12px 8px 0; }
.done-tasks { display: flex; flex-direction: column; gap: 8px; }
.suggest.center { justify-content: center; }

/* ---------- Kalender ---------- */
.cal-bar {
  position: sticky; top: calc(64px + var(--safe-t)); z-index: 15; background: var(--bg); padding: 2px 0 10px;
}
.cal-bar-row { display: flex; gap: 8px; align-items: center; }
.seg { flex: 1; display: flex; background: var(--chip); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.cal-sentinel { height: 1px; }
.bday-banner {
  display: flex; align-items: center; gap: 10px; margin: 8px 0 0; padding: 9px 12px; border-radius: var(--radius);
  background: linear-gradient(120deg, #fde68a, #fbcfe8, #bfdbfe); color: #3b0a2a; font-size: 15px;
  box-shadow: var(--shadow);
}
.bday-banner span:not(.conf) { flex: 1; }
.bday-banner .conf { font-size: 22px; animation: wiggle 1.2s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(12deg) scale(1.1); } }

/* Kalender nutzt die volle Breite */
#calendar { margin: 0 -11px; }
.cal-bar { padding: 2px 11px 10px; }
.cal-mh, .cal-mh2 { font-size: 19px; font-weight: 700; padding: 12px 13px 8px; }
.cal-month { margin-bottom: 14px; }
.cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 3px; }

/* Wochenzeile (Monat und 2 Wochen) */
.wk2, .wkm { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 1px; row-gap: 2px; margin-bottom: 1px; }
.wkm { min-height: 74px; }
.wk-bg { background: var(--card); cursor: pointer; border: 1px solid var(--line); border-radius: 4px; }
.wk-bg.alt { background: color-mix(in srgb, var(--card) 88%, var(--chip)); }
.wkm .wk-bg.we { background: color-mix(in srgb, var(--card) 85%, var(--chip)); }
.wk-bg.out { background: transparent; border: 0; cursor: default; }
.wk-h, .wk-list { pointer-events: none; min-width: 0; }
.wk-h { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 3px 0 2px; }
.wk-h span { font-size: 10px; color: var(--muted); }
.wk-h b { font-size: 14px; }
.wk2 .wk-h { margin: 1px 1px 0; padding: 2px 0 1px; }
.wk-h.today { background: var(--accent) !important; color: var(--accent-text); border-radius: 6px; }
.wk-h.today span { color: inherit; opacity: .9; }
.wk-h.m { align-items: flex-start; padding: 2px 4px 1px; font-size: 12px; font-weight: 600; }
.wk-h.m.today { justify-self: start; align-self: start; margin: 2px; padding: 0 6px; border-radius: 999px; font-weight: 800; }
.wk-list { display: flex; flex-direction: column; gap: 2px; padding: 0 0 3px; align-self: start; }
.ev2, .evbar, .mc-ev { pointer-events: auto; }

/* Zeitleiste 0–24 Uhr (2 Wochen): Stundenhöhe passt sich dem Bildschirm an, eine Linie pro Stunde */
.tg { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 1px; margin: 1px 0 3px; }
.tg-col {
  position: relative; cursor: pointer; min-width: 0;
  background-image: linear-gradient(to bottom, color-mix(in srgb, var(--line) 80%, transparent) 1px, transparent 1px);
  background-size: 100% 18px;
}
.tg-hr { position: absolute; left: 2px; font-size: 8px; line-height: 1; color: var(--muted); opacity: .75; pointer-events: none; transform: translateY(1px); }

/* einzelner Termin: Titel oben, darunter die Uhrzeit; Farbstreifen oben */
.ev2 {
  position: absolute; z-index: 1; display: block; text-align: left; overflow: hidden;
  font-size: 9px; line-height: 1.1; padding: 1px 2px 1px; letter-spacing: -.01em;
  background: color-mix(in srgb, var(--c) 24%, var(--card)); border-top: 3px solid var(--c); border-radius: 3px;
  box-shadow: 0 0 0 1px var(--card); word-break: normal; overflow-wrap: break-word; hyphens: manual;
}
.ev2-n { display: block; font-weight: 600; line-height: 1.1; }
.ev-t { display: block; font-weight: 700; font-size: 8.5px; opacity: .85; }
.ev-t span { display: block; white-space: nowrap; line-height: 1.05; }

/* mehrtägiger Termin als durchgehender Balken */
.evbar {
  margin: 0 1px; text-align: left; font-size: 9.5px; line-height: 1.2; padding: 1px 4px 2px; min-width: 0;
  background: color-mix(in srgb, var(--c) 26%, var(--card)); border-top: 3px solid var(--c); border-radius: 3px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; align-self: start;
}
.evbar b { font-weight: 700; }

/* Monat: einzeilige Einträge */
.mc-ev {
  display: block; font-size: 9.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--c) 20%, var(--card)); border-top: 2px solid var(--c); border-radius: 2px; padding: 0 2px 1px;
}
.mc-ev b { font-weight: 700; }
.mc-more { font-size: 9.5px; color: var(--muted); padding-left: 2px; }

/* Woche */
.cal-week { margin-bottom: 16px; padding: 0 11px; }
.cal-wh { font-weight: 700; padding: 8px 4px; }
.wr { display: flex; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); min-height: 58px; cursor: pointer; }
.wr:first-child { border-top: 0; }
.wr.today .wr-date { background: var(--accent); color: var(--accent-text); border-radius: 10px; }
.wr.today .wr-date span { color: inherit; }
.wr-date { width: 38px; flex: none; display: flex; flex-direction: column; align-items: center; padding: 3px 0; align-self: flex-start; }
.wr-date span { font-size: 12px; color: var(--muted); }
.wr-date b { font-size: 20px; }
.wr-evs { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.wr-empty { color: var(--line); }
.ev3 {
  display: grid; grid-template-columns: auto 1fr; column-gap: 10px; text-align: left; width: 100%;
  background: color-mix(in srgb, var(--c) 18%, var(--card)); border-top: 3px solid var(--c); border-radius: 8px; padding: 6px 10px;
}
.ev3-time { font-weight: 700; font-size: 14px; grid-row: span 2; align-self: center; min-width: 46px; }
.ev3-title { font-weight: 600; overflow-wrap: anywhere; }
.ev3-grp { font-size: 12px; color: var(--muted); }
.ev3-note { grid-column: 2; font-size: 13px; color: var(--muted); white-space: pre-wrap; margin-top: 2px; }
.ev3.big { margin-bottom: 8px; padding: 10px 12px; }

/* Termin-Formular */
.chip.grp { display: inline-flex; align-items: center; gap: 6px; }
.chip.grp i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); display: inline-block; }
.chip.grp.on { background: color-mix(in srgb, var(--c) 25%, var(--card)); border-color: var(--c); color: var(--text); font-weight: 600; }
.dt-row .field { flex: 1; min-width: 0; }
.dt-row .field.t { flex: 0 0 132px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }

/* Geburtstag: Kalender-Reiter festlich */
.tabs button.bday { color: #db2777; background: linear-gradient(180deg, #fdf2f8, #fef3c7); }
.tabs button.bday .tab-ico { filter: none; opacity: 1; animation: wiggle 1.4s ease-in-out infinite; }
@media (prefers-color-scheme: dark) {
  .tabs button.bday { background: linear-gradient(180deg, #4a1d3a, #3d2e0b); color: #f9a8d4; }
  .bday-banner { color: #3b0a2a; }
}

/* ---------- Tabs unten ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabs button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: 11px; color: var(--muted); font-weight: 600; min-width: 0; letter-spacing: -.01em;
}
.tabs .tab-ico { font-size: 22px; filter: grayscale(1); opacity: .7; }
.tabs button.active { color: var(--accent); }
.tabs button.active .tab-ico { filter: none; opacity: 1; }

/* ---------- Sheet (Fenster von unten) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); animation: fade .15s ease-out; }
.sheet {
  position: relative; background: var(--card); color: var(--text);
  border-radius: 20px 20px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 8px 18px calc(18px + var(--safe-b));
  width: 100%; max-width: 640px; margin: 0 auto;
  animation: up .2s ease-out;
}
.sheet-top {
  position: sticky; top: -8px; z-index: 5; margin: -8px -18px 6px; padding: 10px 10px 6px;
  background: var(--card); display: flex; align-items: center; justify-content: center; min-height: 44px;
  touch-action: none; cursor: grab;
}
.sheet-grab { width: 44px; height: 5px; border-radius: 3px; background: var(--muted); opacity: .45; }
.sheet-close {
  position: absolute; right: 10px; top: 6px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--chip); color: var(--text); font-size: 17px; font-weight: 700; display: grid; place-items: center;
}
.sheet-close:active { background: var(--line); }
.sheet h2 { margin: 0 0 14px; padding-right: 30px; font-size: 21px; overflow-wrap: anywhere; }
.sheet label.lbl { display: block; font-size: 14px; color: var(--muted); font-weight: 600; margin: 14px 0 6px; }
.field {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); outline: 0; font-size: 17px;
}
.field:focus { border-color: var(--accent); }
textarea.field { min-height: 110px; resize: vertical; }
.row { display: flex; gap: 8px; align-items: center; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; }
.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.ing-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.ing-row .qty-in { flex: none; }
.ing-row .name-in { flex: 1; min-width: 0; }
.ing-row .del { width: 40px; height: 40px; flex: none; color: var(--muted); font-size: 20px; border-radius: 50%; }

.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--chip); border-radius: 12px; padding: 3px; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; font-size: 22px; font-weight: 600; }
.stepper button:active { background: var(--line); }
.stepper span { min-width: 92px; text-align: center; font-weight: 600; }

.pick { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); }
.pick:first-child { border-top: 0; }
.pick input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.pick .pick-name { flex: 1; overflow-wrap: anywhere; }
.pick .hint { display: block; font-size: 13px; color: var(--muted); }
.pick .q { color: var(--muted); font-weight: 600; white-space: nowrap; }

.list-btn { display: flex; width: 100%; text-align: left; align-items: center; gap: 12px; padding: 14px 4px; border-top: 1px solid var(--line); }
.list-btn:first-child { border-top: 0; }
.list-btn .grow { flex: 1; }

.notes-view { white-space: pre-wrap; background: var(--bg); border-radius: 12px; padding: 12px 14px; }

/* ---------- Anmeldung ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-logo { width: 84px; height: 84px; border-radius: 20px; }
.login h1 { margin: 12px 0 4px; }
.user-pick { display: flex; gap: 10px; margin: 12px 0 16px; }
.user-pick button {
  flex: 1; min-height: 56px; border-radius: 14px; background: var(--card);
  border: 2px solid var(--line); font-weight: 600; font-size: 18px;
}
.user-pick button.on { border-color: var(--accent); background: var(--accent-soft); }
#pinInput {
  width: 100%; text-align: center; font-size: 26px; letter-spacing: .3em;
  padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  margin-bottom: 12px; outline: 0;
}
#pinInput:focus { border-color: var(--accent); }

/* ---------- Hinweise ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + var(--safe-b)); z-index: 60;
  display: flex; align-items: center; gap: 14px;
  background: #222; color: #fff; border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); max-width: calc(100% - 32px); font-size: 15px;
}
.toast button { color: #86efac; font-weight: 700; padding: 4px 2px; }
.offline {
  position: fixed; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 70;
  background: var(--danger); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 14px;
}

@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
