:root {
  --bg: #f6efe6;
  --card: #fffaf3;
  --ink: #2b2622;
  --muted: #8a7f74;
  --line: #e7dccf;
  --accent: #c8643b;
  --accent-ink: #fff;
  --raphael: #2f6f8f;
  --veronika: #b5527a;
  --beide: #6b7a3f;
  --ok: #4f8a5b;
  --danger: #b3412f;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 18px rgba(60, 40, 20, .07);
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1a17;
    --card: #282420;
    --ink: #f2ebe2;
    --muted: #a99d90;
    --line: #3a342e;
    --accent: #e07d52;
    --raphael: #6aaecf;
    --veronika: #e186ab;
    --beide: #a7b770;
    --ok: #7dbb88;
    --danger: #e0715f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
  :root .chip, :root .bubble.mine, :root .badge { color: #1d1a17; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.brand { font-family: Fraunces, Georgia, serif; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.brand.small { font-size: 26px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--danger); min-height: 1.4em; font-size: 14px; margin: 8px 0 0; }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 360px; text-align: center; display: grid; gap: 12px; }
.auth-chapi { width: 100%; max-width: 320px; height: auto; margin: 0 auto -6px; filter: drop-shadow(0 10px 14px rgba(60,40,20,.18)); }
.auth .brand { font-size: 40px; }
.auth .muted { margin: 0 0 16px; }
.setup { display: grid; gap: 10px; margin-top: 6px; text-align: left; }

/* ---------- Buttons & inputs ---------- */
.btn { border: 0; border-radius: 12px; padding: 12px 16px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.big { padding: 16px; font-size: 17px; }
.btn.link { background: none; box-shadow: none; color: var(--muted); font-weight: 500; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 12px; font-size: 16px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
label.field { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 0; color: #fff; font-weight: 700; cursor: pointer; }
#view { padding: 4px 16px calc(var(--safe-b) + 110px); max-width: 640px; margin: 0 auto; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex;
  padding: 6px 4px calc(var(--safe-b) + 6px); background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.tabbar button { position: relative; flex: 1; border: 0; background: none; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; cursor: pointer; }
.tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--accent); }
.badge { position: absolute; top: 0; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-style: normal; line-height: 18px; text-align: center; }
.badge:empty { display: none; }
.badge.dot { min-width: 10px; height: 10px; padding: 0; top: 2px; left: calc(50% + 10px); color: transparent; overflow: hidden; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--safe-b) + 78px); z-index: 7; width: 58px; height: 58px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; font-size: 32px; line-height: 1; box-shadow: 0 6px 20px rgba(200, 100, 59, .4); cursor: pointer;
}

/* ---------- Cards & lists ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin: 0 0 12px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; font-weight: 700; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; font-weight: 700; }
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); min-height: 52px; }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.item .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.item.done .title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.item button.tick {
  width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid var(--line); background: none; cursor: pointer; display: grid; place-items: center; color: #fff; font-size: 15px;
}
.item.done button.tick { background: var(--ok); border-color: var(--ok); }
.item.clickable { cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; font-size: 15px; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; vertical-align: 1px; }
.chip.raphael { background: var(--raphael); }
.chip.veronika { background: var(--veronika); }
.chip.beide { background: var(--beide); }
.bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.bar.raphael { background: var(--raphael); }
.bar.veronika { background: var(--veronika); }
.bar.beide { background: var(--beide); }
.overdue { color: var(--danger); font-weight: 600; }

/* ---------- Heute ---------- */
.hero { text-align: center; margin: 0 0 14px; }
.hero img { width: 78%; max-width: 330px; height: auto; display: block; margin: 0 auto -4px; filter: drop-shadow(0 10px 14px rgba(60,40,20,.18)); }
.hero .hello, .hero .hello-sub { text-align: center; }
.hello { font-family: Fraunces, Georgia, serif; font-size: 28px; font-weight: 500; margin: 6px 4px 2px; }
.hello-sub { margin: 0 4px 14px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; border: 0; text-align: left; cursor: pointer; }
.stat b { display: block; font-size: 24px; font-family: Fraunces, Georgia, serif; }
.stat span { font-size: 12px; white-space: nowrap; color: var(--muted); }

/* ---------- Kalender ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.cal-head h2 { font-family: Fraunces, Georgia, serif; font-size: 22px; font-weight: 500; margin: 0; }
.cal-head button { border: 0; background: var(--card); box-shadow: var(--shadow); width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.cal-head .today-btn { width: auto; border-radius: 999px; padding: 0 14px; font-size: 14px; font-weight: 600; }
.cal { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal .dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal .day { aspect-ratio: 1 / 1.05; border: 0; background: none; border-radius: 10px; display: grid; grid-template-rows: 1fr auto; justify-items: center; padding: 4px 0; cursor: pointer; font-size: 15px; }
.cal .day.other { color: var(--muted); opacity: .45; }
.cal .day.today span { background: var(--accent); color: #fff; border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; font-weight: 700; }
.cal .day.sel { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.cal .dots { display: flex; gap: 3px; height: 6px; }
.cal .dots i { width: 6px; height: 6px; border-radius: 50%; }
.cal .dots i.raphael { background: var(--raphael); }
.cal .dots i.veronika { background: var(--veronika); }
.cal .dots i.beide { background: var(--beide); }

/* ---------- Einkauf ---------- */
.quick-add { display: flex; gap: 8px; margin-bottom: 12px; }
.quick-add input { flex: 1; }
.quick-add input.amount { flex: 0 0 82px; }
.quick-add button { flex: none; width: 50px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 24px; cursor: pointer; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.actions .btn { flex: 1; font-size: 14px; padding: 10px 12px; }
.del { border: 0; background: none; color: var(--muted); font-size: 20px; padding: 4px 6px; cursor: pointer; }

/* ---------- Stupser ---------- */
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.presets button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 12px; font-size: 14px; cursor: pointer; }
.bubble-list { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; }
.bubble .meta { font-size: 11px; opacity: .7; margin-top: 3px; }

/* ---------- Sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(20, 14, 8, .35); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 92dvh; overflow: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 10px 16px calc(var(--safe-b) + 20px);
  box-shadow: 0 -8px 30px rgba(0,0,0,.18); max-width: 640px; margin: 0 auto;
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet h3 { font-family: Fraunces, Georgia, serif; font-size: 22px; font-weight: 500; margin: 0 0 14px; }
.sheet form { display: grid; gap: 12px; }
.sheet .foot { display: flex; gap: 10px; margin-top: 6px; }
.sheet .foot .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 150px); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 30; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (min-width: 700px) {
  .fab { right: calc(50% - 300px); }
}

/* ---------- Chapi-Dienst ---------- */
.tabbar button { font-size: 10.5px; }
.hero.small img { width: 52%; max-width: 220px; }
.invite { display: grid; gap: 10px; text-align: center; margin-bottom: 6px; }
.invite-hello { font-family: Fraunces, Georgia, serif; font-size: 24px; margin: 0; }
.center { text-align: center; }
.ok { color: var(--ok); font-weight: 600; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.ph-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; }
.ph-big { width: 100%; border-radius: 14px; display: block; margin-bottom: 10px; }
.ph-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 10px 0 6px; }
.btn.upload { display: block; text-align: center; width: 100%; cursor: pointer; }
.check-item { cursor: pointer; }
.check-item input { width: 24px; height: 24px; accent-color: var(--ok); flex: none; margin: 0; }
.checks { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.checks li.yes { color: var(--ok); }
.checks li.no { color: var(--muted); }
.report-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; }
.report-head span { font-size: 13px; }
.note { margin: 10px 0 0; padding: 10px 12px; background: var(--bg); border-radius: 10px; font-size: 14px; white-space: pre-wrap; }
.daychips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin-bottom: 4px; }
.daychips button { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer; }
.daychips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.send-btn { width: 100%; margin-top: 14px; }
#sit-note { margin: 0; }
.period-form { display: grid; gap: 10px; }
body.sitter #view { padding-bottom: calc(var(--safe-b) + 40px); }
input[type=date], input[type=time] { min-width: 0; -webkit-appearance: none; appearance: none; }
.period-form .row > label { min-width: 0; }
.btn.back { padding: 6px 0 12px; font-size: 15px; }
/* Reaktionen & Antworten */
.thread { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.card > .thread:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.reacts { display: flex; gap: 6px; flex-wrap: wrap; }
.react { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 5px 10px; font-size: 18px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.react span { font-size: 13px; font-weight: 700; color: var(--muted); }
.react.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }
.react-who { font-size: 12px; color: var(--muted); margin-top: 6px; }
.comments { display: grid; gap: 6px; margin-top: 10px; }
.cmt { background: var(--bg); border-radius: 12px; padding: 8px 11px; font-size: 14px; overflow-wrap: anywhere; }
.cmt.mine { background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.cmt .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.linkish { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 11px; padding: 0; cursor: pointer; }
.small-presets { margin: 10px 0 8px; gap: 6px; }
.small-presets button { font-size: 13px; padding: 6px 10px; }
.reply-form { margin-bottom: 0; }
/* Prioritäten & Fristen */
.bar.prio-gruen { background: #4f8a5b; }
.bar.prio-gelb { background: #e0a526; }
.bar.prio-rot { background: #c2412f; }
.chip.rot { background: #c2412f; }
.duechips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.duechips button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.duechips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-seg="priority"] button { font-size: 13px; padding: 9px 2px; }
.ph-like { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.btn.liked { color: #c2412f; }
/* Vorschläge */
.sugg-row { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.sugg-row:first-of-type { border-top: 0; padding-top: 2px; }
.sugg-row .title { font-weight: 600; }
.sugg-row .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sugg-actions { display: flex; gap: 8px; }
.sugg-actions .btn { padding: 8px 12px; font-size: 14px; }
.sugg-actions .btn.link { padding: 8px 4px; }
.dot-prio { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot-prio.prio-gruen { background: #4f8a5b; } .dot-prio.prio-gelb { background: #e0a526; } .dot-prio.prio-rot { background: #c2412f; }
.upcoming { margin-top: 22px; }
.upcoming-head { font-family: Fraunces, Georgia, serif; font-size: 20px; margin: 0 4px -4px; }
