:root {
  --bg: #0e0f11;
  --surface: #16181b;
  --surface-2: #1e2125;
  --line: #262a2f;
  --text: #eceef1;
  --muted: #8b9099;
  --faint: #5c616a;
  --accent: #8ab4f8;
  --accent-ink: #0b1220;
  --accent-soft: rgba(138, 180, 248, 0.14);
  --ok: #5fd39a;
  --ok-soft: rgba(95, 211, 154, 0.14);
  --warn: #f6ae6b;
  --warn-soft: rgba(246, 174, 107, 0.14);
  --danger: #ff7272;
  --radius: 14px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea, select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px; /* verhindert iOS-Zoom */
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 96px; }
input[type="date"] { min-height: 46px; }
svg { display: block; }

.boot { height: 100vh; display: grid; place-items: center; }
.logo-mark {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 34px; letter-spacing: -1px;
}

/* ---------- Layout ---------- */
.shell { min-height: 100vh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.topbar {
  position: sticky; top: 0; z-index: 5;
  padding: calc(var(--safe-t) + 14px) 18px 10px;
  background: linear-gradient(var(--bg) 70%, rgba(14, 15, 17, 0));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar h1 { margin: 0; font-size: 28px; font-weight: 750; letter-spacing: -0.5px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.icon-btn:active { transform: scale(0.96); }
.view { padding: 4px 16px 0; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(18, 19, 22, 0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(6, 1fr);
}
.nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 11px; font-weight: 600; position: relative;
}
.nav button.active { color: var(--accent); }
.nav .badge {
  position: absolute; top: 8px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

.fab {
  position: fixed; right: 18px; z-index: 9;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.fab:active { transform: scale(0.95); }

/* ---------- Bausteine ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip.active { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 14px;
}
.segmented button { padding: 9px 8px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); }
.segmented button.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset; }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 4px 8px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.2px;
}
.section-title.danger { color: var(--danger); }
.section-title .link { color: var(--accent); font-weight: 600; font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 54px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; text-align: left; }
.row-title { font-size: 16px; overflow-wrap: anywhere; }
.row-meta { color: var(--muted); font-size: 13px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.row-amount { color: var(--muted); font-size: 14px; flex: none; max-width: 40%; text-align: right; overflow-wrap: anywhere; }
.row.done .row-title { color: var(--faint); text-decoration: line-through; }

.check {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--faint); display: grid; place-items: center; color: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.check.on { background: var(--ok); border-color: var(--ok); color: #0b1a12; }
.check.square { border-radius: 8px; }

.who {
  display: inline-flex; align-items: center; gap: 5px; color: var(--c, var(--muted)); font-weight: 600;
}
.who::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--muted)); }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.today { color: var(--warn); font-weight: 600; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted);
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 4px 0; }

.addbar { display: flex; gap: 8px; margin-bottom: 10px; }
.addbar input { flex: 1; }
.addbar .icon-btn { width: 48px; height: 48px; flex: none; }
.icon-btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.icon-btn.listening, .mic.listening { background: var(--danger); color: #fff; border-color: transparent; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 114, 114, 0.5); } 50% { box-shadow: 0 0 0 8px rgba(255, 114, 114, 0); } }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.action {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); text-align: left; font-size: 14px; font-weight: 600;
}
.action .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.action small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: 14px; font-weight: 700; font-size: 16px;
  background: var(--surface-2); border: 1px solid var(--line); width: 100%;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn:disabled { opacity: 0.5; }
.btn-row { display: flex; gap: 8px; margin-top: 16px; }

.switch {
  flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--surface-2);
  border: 1px solid var(--line); position: relative; transition: background 0.15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--faint); transition: transform 0.15s, background 0.15s;
}
.switch.on { background: var(--ok-soft); border-color: transparent; }
.switch.on::after { transform: translateX(18px); background: var(--ok); }

/* ---------- Woche ---------- */
.weeknav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.weeknav .label { font-weight: 700; text-align: center; }
.weeknav .label small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.day { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); min-height: 58px; }
.day:last-child { border-bottom: 0; }
.day-label { width: 42px; flex: none; text-align: center; padding-top: 2px; }
.day-label .wd { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.day-label .dn { font-size: 20px; font-weight: 700; }
.day.today .day-label .wd, .day.today .day-label .dn { color: var(--accent); }
.day.past { opacity: 0.55; }
.day-meals { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; justify-content: center; }
.meal-pill {
  text-align: left; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; width: 100%;
}
.meal-pill .t { font-weight: 600; overflow-wrap: anywhere; }
.meal-pill .m { color: var(--muted); font-size: 12px; margin-top: 2px; }
.day-add { color: var(--faint); font-size: 14px; text-align: left; padding: 8px 0; }

/* ---------- Bottom Sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.18s ease-out;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(20px + var(--safe-b));
  animation: slide 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 14px; font-size: 21px; letter-spacing: -0.3px; }
.sheet .field { margin-bottom: 14px; }
.sheet label.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 7px 2px; }
.sheet .card { background: var(--bg); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.input-mic { display: flex; gap: 8px; }
.input-mic input, .input-mic textarea { flex: 1; }
.input-mic .icon-btn { width: 48px; height: 48px; flex: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateY(40px); opacity: 0.6; } }

.steps { margin: 0; padding-left: 22px; color: var(--text); }
.steps li { margin-bottom: 8px; }

.spinner {
  width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 14px;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { text-align: center; padding: 36px 10px; color: var(--muted); }

.photo-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 26px 12px; border-radius: var(--radius); border: 1.5px dashed var(--line); color: var(--muted);
  text-align: center; cursor: pointer; margin-bottom: 14px;
}
.photo-drop .ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.photo-drop strong { color: var(--text); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 4px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 22px calc(32px + var(--safe-b)); max-width: 440px; margin: 0 auto; }
.auth .logo-mark { margin-bottom: 18px; }
.auth h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -0.5px; }
.auth p { color: var(--muted); margin: 0 0 24px; }
.auth form { display: flex; flex-direction: column; gap: 10px; }
.auth .err { color: var(--danger); font-size: 14px; min-height: 20px; }
.auth .switch-link { margin-top: 14px; color: var(--accent); font-size: 14px; text-align: center; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 10px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; background: #2a2e34; color: var(--text); padding: 11px 16px; border-radius: 12px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); display: flex; gap: 14px; align-items: center;
  animation: slide 0.2s ease-out; max-width: 100%;
}
.toast button { color: var(--accent); font-weight: 700; }

.member { display: flex; align-items: center; gap: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--c); color: #0e0f11; flex: none; }
.code-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; margin: 8px 0; }

/* ---------- Kalender ---------- */
.month { padding: 8px 6px 6px; }
.month-head, .month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-head span { text-align: center; font-size: 11px; font-weight: 700; color: var(--faint); padding: 2px 0 6px; }
.mday { height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; padding-top: 5px; border-radius: 12px; }
.mday .n { width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 50%; font-size: 15px; font-weight: 600; }
.mday.other .n { color: var(--faint); }
.mday.today .n { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.mday.sel .n { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.mday .bars { display: flex; gap: 3px; height: 5px; }
.mday .bars i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.evbar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); flex: none; }
.segmented.colored button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.segmented.colored .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.segmented.colored button.active { color: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nav button span { white-space: nowrap; }
.row-meta.loc { margin-top: 3px; overflow-wrap: anywhere; }
a.icon-btn { text-decoration: none; }

/* ---------- Videothek ---------- */
.decide { display: flex; gap: 8px; flex: none; }
.decide .icon-btn { width: 44px; height: 44px; font-size: 19px; }
.decide .icon-btn.yes { background: var(--ok-soft); border-color: transparent; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
a.btn { text-decoration: none; color: inherit; }
.pick { text-align: center; padding: 8px 0 4px; }
.pick-ico { font-size: 44px; margin-bottom: 6px; }
.nav button span { font-size: 10px; letter-spacing: -0.1px; }

/* ---------- Start / Feed ---------- */
.ico-cell { width: 26px; flex: none; text-align: center; font-size: 18px; }
.row-title.news { font-size: 15px; }
.recipe-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.rc-img { display: block; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.rc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc-body { padding: 12px 14px 14px; }
.rc-title { font-size: 18px; font-weight: 700; margin: 8px 0 4px; letter-spacing: -0.2px; }
.recipe-card .btn-row { margin-top: 12px; }
.recipe-card .btn { padding: 11px 12px; font-size: 15px; }
.recipe-card .icon-btn { width: 46px; height: 46px; flex: none; font-size: 18px; }
.who:empty::before { margin-right: -5px; }
.row-meta .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

/* ---------- Später kaufen ---------- */
.later-head { margin: 10px 4px 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.card.later { opacity: 0.85; }
.card.later .row-title { color: var(--muted); }
.field input[type="date"] { margin-top: 8px; }

.action-row.three { grid-template-columns: repeat(3, 1fr); }
.action-row.three .action { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 10px; }
.action-row.three .action small { display: none; }
