/* ==========================================================================
   HaushaltsHub — iOS-first CSS
   Mobile-First. Desktop-Ergaenzungen in @media (min-width: 768px).
   ========================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--accent-blue); text-decoration: none; }

/* ---------- Design-Tokens ---------- */
:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-input: #ffffff;
  --text: #000000;
  --text-secondary: rgba(60,60,67,0.6);
  --separator: #c6c6c8;
  --separator-opaque: #e5e5ea;
  --accent: #34c759;
  --accent-warn: #ff9500;
  --accent-danger: #ff3b30;
  --accent-blue: #007aff;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --nav-h: 44px;
  --tab-h: 49px;

  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);

  --easing-ios: cubic-bezier(0.25, 0.1, 0.25, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-elevated: #2c2c2e;
    --surface-input: #1c1c1e;
    --text: #ffffff;
    --text-secondary: rgba(235,235,245,0.6);
    --separator: #38383a;
    --separator-opaque: #2c2c2e;
  }
}

/* ---------- Page-Layout ---------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }

.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.page--with-tabs { padding-bottom: calc(var(--tab-h) + var(--safe-bottom)); }

.nav-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: end;
  height: calc(var(--nav-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.5) blur(18px);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  border-bottom: 0.5px solid var(--separator);
}
.nav-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  margin: 0;
  padding-bottom: 11px;
}
.nav-back, .nav-action {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-blue);
}
.nav-action svg, .nav-back svg { width: 22px; height: 22px; }

.page-body { flex: 1; padding: 16px; }

/* ---------- Bottom-Tabs ---------- */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.5) blur(18px);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  border-top: 0.5px solid var(--separator);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 10;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 44px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  gap: 2px;
  transition: color .15s var(--easing-ios);
}
.tab svg { width: 26px; height: 26px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab:active { transform: scale(0.94); filter: brightness(0.9); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 17px;
  transition: transform .1s var(--easing-ios), filter .1s var(--easing-ios);
}
.btn:active { transform: scale(0.97); filter: brightness(0.92); }
.btn--primary { background: var(--accent); color: #fff; width: 100%; }
.btn--secondary { color: var(--accent-blue); background: transparent; }
.btn--danger { background: var(--accent-danger); color: #fff; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-left: 4px;
}
.field__input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-input);
  border: 1px solid var(--separator-opaque);
  color: var(--text);
  font-size: 17px;
  transition: border-color .15s var(--easing-ios);
}
.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent);
}
.field__error {
  font-size: 13px;
  color: var(--accent-danger);
  padding-left: 4px;
}

/* ---------- Login ---------- */
.login {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 40px 24px;
  gap: 28px;
  padding-top: calc(40px + var(--safe-top));
  padding-bottom: calc(40px + var(--safe-bottom));
}
.login__brand {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.login__logo {
  width: 84px; height: 84px; border-radius: 22px;
  background: linear-gradient(135deg, #34c759, #30b350);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(52,199,89,0.35);
  color: #fff;
  font-size: 38px;
  font-weight: 700;
}
.login__title {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
}
.login__subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
  text-align: center;
}
.login__form { display: flex; flex-direction: column; gap: 14px; }
.login__footer {
  margin-top: auto;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---------- Toasts ---------- */
.toast {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  top: calc(var(--safe-top) + 8px);
  background: var(--accent-danger);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  z-index: 100;
  animation: toast-in .25s var(--easing-ios);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Skeleton-Loader ---------- */
.skeleton {
  background: linear-gradient(90deg,
    color-mix(in oklab, var(--separator-opaque) 60%, transparent) 0%,
    color-mix(in oklab, var(--separator-opaque) 90%, transparent) 50%,
    color-mix(in oklab, var(--separator-opaque) 60%, transparent) 100%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ---------- Dashboard (Phase 0: leer) ---------- */
.dashboard__empty {
  display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.dashboard__empty h2 { margin: 0; font-size: 22px; font-weight: 600; }
.dashboard__empty p  { margin: 0; font-size: 15px; color: var(--text-secondary); }

/* ---------- Desktop-Ergaenzungen ---------- */
@media (min-width: 768px) {
  .login { max-width: 380px; margin: 0 auto; }
  .page-body { max-width: 640px; margin: 0 auto; }
}

/* ============================================================
   Phase 1: Kalender-Kern
   ============================================================ */

/* Segmented Control für Week/Month */
.seg {
  display: inline-flex;
  background: var(--separator-opaque);
  border-radius: var(--radius-md);
  padding: 2px;
}
.seg__btn {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 8px;
  min-height: 32px;
}
.seg__btn--on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Kalender-Kontrollen (oberhalb der Liste) */
.cal-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--separator);
  position: sticky;
  top: calc(var(--nav-h) + var(--safe-top));
  z-index: 8;
}
.cal-controls__nav { display: flex; gap: 6px; }
.cal-controls__nav .btn {
  min-height: 36px;
  min-width: 44px;
  padding: 0 10px;
  font-size: 15px;
  background: var(--separator-opaque);
  color: var(--text);
  border-radius: 8px;
  width: auto;
}

.cal-body { padding-bottom: 120px; }

/* Wochenansicht */
.cal-week { display: flex; flex-direction: column; gap: 18px; }
.cal-day {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 10px 0;
  overflow: hidden;
}
.cal-day--today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-day__header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
}
.cal-day__plus {
  font-size: 20px;
  color: var(--accent);
  font-weight: 400;
  width: 28px;
  text-align: center;
}
.cal-day__empty {
  margin: 0;
  padding: 6px 14px 10px;
  color: var(--text-secondary);
  font-size: 14px;
}

.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-top: 0.5px solid var(--separator);
  background: var(--surface);
  min-height: 56px;
}
.cal-item__time {
  min-width: 52px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 1px;
}
.cal-item__body { flex: 1; }
.cal-item__title { font-size: 16px; font-weight: 600; }
.cal-item__sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* Kategorie-Farbcodes: linker Strich */
.cal-item.cat-termin    { border-left: 3px solid var(--accent-blue); padding-left: 11px; }
.cal-item.cat-kochtag   { border-left: 3px solid var(--accent-warn); padding-left: 11px; }
.cal-item.cat-haushalt  { border-left: 3px solid var(--accent); padding-left: 11px; }
.cal-item.cat-privat    { border-left: 3px solid #af52de; padding-left: 11px; }
.cal-item.cat-sonstiges { border-left: 3px solid var(--text-secondary); padding-left: 11px; }

/* Swipe-Row */
.swipe-row {
  position: relative;
  overflow: hidden;
  background: var(--surface);
}
.swipe-row__bg {
  position: absolute;
  top: 0; bottom: 0;
  display: flex; align-items: center; padding: 0 18px;
  color: #fff; font-weight: 600; font-size: 14px;
}
.swipe-row__bg--primary { left: 0; background: var(--accent); }
.swipe-row__bg--danger  { right: 0; background: var(--accent-danger); justify-content: flex-end; }
.swipe-row__fg {
  position: relative;
  transition: transform 0.15s var(--easing-ios);
  background: var(--surface);
  cursor: pointer;
  touch-action: pan-y;
}

/* Monatsraster */
.cal-month { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--separator-opaque);
}
.cal-grid--head { background: var(--surface); gap: 0; padding: 8px 0; }
.cal-grid__head {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.cal-cell {
  aspect-ratio: 1 / 1;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 0;
  font-size: 14px;
  min-height: 0;
  border: none;
  color: var(--text);
}
.cal-cell--other  { color: var(--text-secondary); opacity: 0.5; }
.cal-cell--today  .cal-cell__num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.cal-cell__num { min-height: 28px; }
.cal-cell__dots { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; justify-content: center; max-width: 36px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-secondary); }
.cal-dot.cat-termin    { background: var(--accent-blue); }
.cal-dot.cat-kochtag   { background: var(--accent-warn); }
.cal-dot.cat-haushalt  { background: var(--accent); }
.cal-dot.cat-privat    { background: #af52de; }

/* FAB */
.fab {
  position: fixed;
  right: calc(16px + var(--safe-right));
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 16px);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  line-height: 56px;
  font-weight: 300;
  box-shadow: 0 6px 18px rgba(52,199,89,0.4);
  z-index: 9;
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(0.94); filter: brightness(0.92); }

/* Sheet-Modal */
.sheet-modal__backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: sheet-backdrop-in 0.2s var(--easing-ios);
}
.sheet-modal {
  width: 100%;
  max-width: 640px;
  max-height: 90dvh;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.3s var(--easing-ios);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
}
.sheet-modal__grabber {
  width: 40px; height: 4px;
  border-radius: 2px;
  background: var(--separator);
  margin: 8px auto 4px;
  flex-shrink: 0;
}
.sheet-modal__header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 4px 0 8px;
  border-bottom: 0.5px solid var(--separator);
  flex-shrink: 0;
}
.sheet-modal__close {
  width: 44px; height: 44px;
  font-size: 18px;
  color: var(--text-secondary);
}
.sheet-modal__title {
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}
.sheet-modal__body { padding: 16px 18px 24px; overflow-y: auto; }

@keyframes sheet-in    { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheet-backdrop-in { from { opacity: 0; } to { opacity: 1; } }

/* Event-Form */
.event-form { display: flex; flex-direction: column; gap: 14px; }
.event-form__actions {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 8px;
}
.event-form__actions .btn { width: 100%; }
.field__input--textarea { min-height: 72px; resize: vertical; }

.toggle-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0;
}
.toggle-row input { width: 20px; height: 20px; }

/* Chip-Group (für Kategorie-Auswahl) */
.chip-group {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.chip {
  padding: 8px 14px;
  min-height: 36px;
  border-radius: 18px;
  background: var(--separator-opaque);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.chip--on {
  background: var(--accent);
  color: #fff;
}
.chip--kochtag.chip--on  { background: var(--accent-warn); }
.chip--haushalt.chip--on { background: var(--accent); }
.chip--privat.chip--on   { background: #af52de; }
.chip--termin.chip--on   { background: var(--accent-blue); }
.chip--sonstiges.chip--on { background: var(--text-secondary); }

/* ============================================================
   Phase 1.5: Scopes, Kategorien-Verwaltung, Desktop-breit
   ============================================================ */

/* Kategorie-Strich am Event: Farbe aus inline-style "border-left-color" */
.cal-item {
  border-left: 3px solid var(--text-secondary);
  padding-left: 11px !important;
}
.cal-item--ro { opacity: 0.78; }

.cal-item__icon { margin-right: 6px; }

.cal-item__source {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 9px;
  background: var(--separator-opaque);
  color: var(--text-secondary);
  white-space: nowrap;
}
.cal-item__source.is-shared   { background: color-mix(in oklab, var(--accent) 18%, transparent); color: var(--accent); }
.cal-item__source.is-personal { background: color-mix(in oklab, var(--accent-blue) 18%, transparent); color: var(--accent-blue); }

.cal-item__ro-badge {
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Filter-Leiste (Chips) */
.cal-filters {
  display: flex;
  gap: 6px;
  padding: 8px 16px 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
.chip--filter {
  white-space: nowrap;
  opacity: 0.45;
  filter: saturate(0.6);
}
.chip--filter.chip--on {
  opacity: 1;
  filter: none;
  background: var(--text);
  color: var(--surface);
}

/* Segmented-full: volle Breite (Kalender-Scope im Event-Form) */
.seg--full { display: grid; grid-template-columns: 1fr 1fr; width: 100%; padding: 3px; }
.seg--full .seg__btn { width: 100%; min-height: 36px; font-size: 14px; }

/* Settings-View */
.settings__sec     { font-size: 22px; margin: 24px 0 10px; }
.settings__subsec  { font-size: 14px; font-weight: 600;
                     color: var(--text-secondary);
                     margin: 18px 0 8px;
                     text-transform: uppercase; letter-spacing: 0.04em; }
.settings__card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  font-size: 15px;
}
.settings__sub { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

.settings__cat-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.settings__cat-row {
  display: grid;
  grid-template-columns: 24px 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-top: 0.5px solid var(--separator);
  cursor: pointer;
  min-height: 52px;
}
.settings__cat-row:first-child { border-top: 0; }
.settings__cat-row:active { background: var(--separator-opaque); }
.settings__cat-swatch { width: 18px; height: 18px; border-radius: 50%; }
.settings__cat-icon   { font-size: 18px; text-align: center; }
.settings__cat-name   { font-size: 16px; font-weight: 500; }
.settings__cat-sys    { font-size: 12px; color: var(--text-secondary); }
.settings__add        { width: 100%; margin: 10px 0 4px; font-weight: 500; }

/* Farbauswahl */
.color-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.color-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.color-swatch--on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.color-picker { width: 40px; height: 32px; border: none; background: transparent; cursor: pointer; }

/* Icon-Picker */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.icon-pick {
  height: 36px;
  border-radius: 8px;
  background: var(--separator-opaque);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.icon-pick--on { background: var(--accent); color: #fff; }

/* ============================================================
   Desktop: breiter, aber mit Maximum
   ============================================================ */
@media (min-width: 768px) {
  .page-body { max-width: min(1100px, 92vw); margin: 0 auto; padding: 20px; }
  .cal-body  { max-width: min(1200px, 94vw); margin: 0 auto; padding: 20px 20px 120px; }
  .cal-controls { padding: 10px max(20px, calc(50vw - 600px)); }
  .cal-filters  { padding: 8px max(20px, calc(50vw - 600px)) 2px; }
  .nav-bar {
    grid-template-columns: 44px 1fr 44px;
    padding: 0 max(20px, calc(50vw - 600px));
    padding-top: var(--safe-top);
  }
}

/* ab 1200px: 2-Spalten-Kalender (die 7 Tage in 2 Reihen von 4+3) */
@media (min-width: 1200px) {
  .cal-week {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

/* Event-Formular und Sheet-Modal auf Desktop breiter */
@media (min-width: 768px) {
  .sheet-modal {
    max-width: 680px;
    border-radius: 18px;
    max-height: 85dvh;
    margin-bottom: 5vh;
  }
  .sheet-modal__backdrop { padding: 0 20px; }
}

/* ============================================================
   Phase 3: Einkaufsliste
   ============================================================ */
.field-row { display: flex; gap: 10px; }

.shop-group { margin-bottom: 22px; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.shop-group__head {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px 4px;
  margin: 0;
}
.shop-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 0.5px solid var(--separator);
  background: var(--surface);
  min-height: 56px;
}
.shop-item--bought { opacity: 0.55; }
.shop-item--bought .shop-item__title { text-decoration: line-through; }
.shop-item__check {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--separator);
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--accent);
}
.shop-item__check--on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.shop-item__qty { color: var(--text-secondary); font-weight: 500; }
.shop-item__title { font-size: 16px; font-weight: 500; }
.shop-item__sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.shop-bought-toggle {
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  background: transparent;
  text-align: left;
  border-top: 0.5px solid var(--separator);
}

/* ============================================================
   Phase 4: Rezepte
   ============================================================ */
.recipes-search { margin: 12px 0 8px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; }
.chip {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--separator);
  cursor: pointer;
}
.chip--on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip--static { border-color: var(--separator); cursor: default; }

.recipe-list { display: grid; gap: 10px; padding: 0; list-style: none; margin: 6px 0; }
.recipe-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.recipe-card__photo {
  width: 72px; height: 72px;
  object-fit: cover;
}
.recipe-card__photo--ph {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  font-size: 28px;
}
.recipe-card__body {
  padding: 10px 12px 10px 0;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  min-width: 0;
}
.recipe-card__title {
  font-size: 16px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recipe-card__meta {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.recipe-card__cat { text-transform: capitalize; }
.recipe-card__portions::before { content: '· '; }
.recipe-card__priv {
  color: var(--warn, #ff9500);
}

.recipe-detail { padding-bottom: 40px; }
.recipe-detail__photo {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin: 8px 0 12px;
}
.recipe-detail__meta {
  display: flex; gap: 10px; align-items: center; margin: 4px 0 10px;
}
.recipe-detail__owner { color: var(--text-secondary); font-size: 13px; }

.recipe-section { background: var(--surface); border-radius: var(--radius-lg); padding: 14px; margin: 10px 0; }
.recipe-section__head { font-size: 14px; font-weight: 700; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 0.05em; margin: 0 0 8px; }
.recipe-empty { color: var(--text-secondary); font-size: 14px; }
.recipe-instructions { white-space: pre-wrap; line-height: 1.45; font-size: 15px; }
.recipe-danger { background: transparent; padding: 14px 0; }

.portions-ctrl { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.portions-ctrl label { color: var(--text-secondary); min-width: 80px; }
.pbtn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--separator);
  background: var(--surface);
  font-size: 18px; line-height: 1; font-weight: 600;
  cursor: pointer;
}
.portions-val { font-weight: 600; font-size: 18px; min-width: 32px; text-align: center; }
.portions-base { color: var(--text-secondary); font-size: 12px; margin-left: 8px; }

.ingredients { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.ingredient-row {
  display: grid;
  grid-template-columns: 80px 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 0.5px solid var(--separator);
  font-size: 15px;
}
.ingredient-row:first-child { border-top: none; }
.ingredient-row__amount { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ingredient-row__name { font-weight: 500; }
.ingredient-row__note { color: var(--text-secondary); font-size: 13px; grid-column: 2 / 4; }
.mini-btn {
  border: none; background: transparent;
  width: 28px; height: 28px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}
.mini-btn--danger { color: var(--danger, #ff3b30); }

.ingredient-add { display: grid; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 0.5px solid var(--separator); }

.to-shopping { padding: 4px 0; }
.to-shopping__head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-secondary); margin-bottom: 8px;
}
.link { background: transparent; border: none; color: var(--accent); font-size: 14px; cursor: pointer; }
.to-shopping__list { list-style: none; padding: 0; margin: 0 0 14px; max-height: 50vh; overflow-y: auto; }
.to-shopping__row {
  display: grid;
  grid-template-columns: 28px 80px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 2px;
  border-bottom: 0.5px solid var(--separator);
  cursor: pointer;
}
.checkmark {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--separator);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--accent);
}
.checkmark--on { background: var(--accent); border-color: var(--accent); color: #fff; }
.to-shopping__amount { color: var(--text-secondary); font-variant-numeric: tabular-nums; font-size: 14px; }
.to-shopping__name { font-size: 15px; font-weight: 500; }
.to-shopping__cat {
  font-size: 11px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
}

.toggle-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 14px; }

.btn--full { width: 100%; }
.btn--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--separator);
}
.btn--danger {
  background: var(--danger, #ff3b30);
  color: #fff;
  border: none;
}

/* Desktop breite Karten */
@media (min-width: 768px) {
  .recipe-list { grid-template-columns: repeat(2, 1fr); }
  .recipe-detail { max-width: 760px; margin: 0 auto; }
}

/* +-Button pro Zutat (Rezept-Detail) */
.ingredient-row {
  grid-template-columns: 34px 80px 1fr auto auto auto;
}
.add-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--success, #34c759);
  color: #fff;
  font-size: 18px; font-weight: 700; line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 160ms ease, transform 120ms ease;
}
.add-btn:active { transform: scale(0.92); }
.add-btn--loading {
  background: var(--text-secondary);
  cursor: progress;
}
.add-btn--done {
  background: var(--accent, #007aff);
}
.add-btn--error {
  background: var(--danger, #ff3b30);
}

/* NavBar-Action als Textlabel (statt +-Icon) */
.nav-action--text {
  width: auto;
  min-width: 44px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent, #007aff);
  background: transparent;
  border: none;
}

/* Zurueck-Button mit Label (deutlich sichtbar) */
.nav-bar { grid-template-columns: auto 1fr auto; }
.nav-back--labeled {
  width: auto;
  min-width: 44px;
  padding: 0 14px 0 10px;
  gap: 2px;
  font-size: 16px;
  font-weight: 500;
  color: var(--accent-blue, #007aff);
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex; align-items: center;
}
.nav-back__chev { font-size: 28px; line-height: 1; font-weight: 400; margin-right: 2px; }
.nav-back__label { font-weight: 500; }

/* Admin-Liste fuer Rezepte in Settings */
.settings__recipe-list { list-style: none; padding: 0; margin: 10px 0 0; }
.settings__recipe-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border-top: 0.5px solid var(--separator);
}
.settings__recipe-row:first-child { border-top: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.settings__recipe-row:last-child  { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.settings__recipe-title { font-weight: 500; }
.settings__recipe-cat { color: var(--text-secondary); font-size: 13px; text-transform: capitalize; }
.btn--sm { padding: 6px 12px; font-size: 13px; }

/* Prominenter Edit-Button im Rezept-Detail */
.recipe-detail__actions { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.recipe-detail__edit { min-width: 140px; }

/* Grundvorrat (Staples) */
.staples-intro { color: var(--text-secondary); font-size: 14px; margin: 8px 0 12px; }
.staples-msg {
  padding: 10px 14px;
  background: var(--success, #34c759);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 10px;
}
.staples-list { list-style: none; padding: 0; margin: 0; }
.staple-row {
  display: grid;
  grid-template-columns: 32px 80px 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-top: 0.5px solid var(--separator);
  background: var(--surface);
  min-height: 52px;
}
.staple-row:first-child { border-top: none; }
.staple-amount { color: var(--text-secondary); font-variant-numeric: tabular-nums; font-size: 14px; }
.staple-name { font-weight: 500; font-size: 15px; }
.staple-note { color: var(--text-secondary); font-size: 13px; grid-column: 3 / 4; margin-top: 2px; }

.staples-actions {
  position: sticky;
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 10px);
  display: flex; gap: 10px; justify-content: space-between;
  padding: 10px;
  background: var(--bg);
  border-radius: 14px;
  margin-top: 14px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.staples-actions .btn { flex: 1; }

/* Bottom-Tabs: 5 Tabs statt 4 — engere Ausrichtung */
.tabs { grid-template-columns: repeat(5, 1fr); }

/* =========================================================
   Phase 5: Startseite (Home)
   ========================================================= */
.home { padding-top: 8px; }
.home__hello {
  font-size: 17px;
  color: var(--text-secondary);
  margin: 4px 0 6px;
}
.home__hello-name {
  color: var(--text-primary);
  font-weight: 600;
}

.home__quote {
  margin: 12px 0 22px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  font-style: italic;
  font-size: 17px;
  line-height: 1.4;
  color: var(--text-primary);
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.home__quote-mark {
  color: var(--accent, #007aff);
  font-size: 22px;
  font-weight: 700;
  margin: 0 4px;
  font-style: normal;
}

.home__tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 8px 0 24px;
}
.home__tile {
  aspect-ratio: 1;
  border: none;
  border-radius: var(--radius-lg);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  transition: transform 120ms ease, box-shadow 120ms ease;
  padding: 20px;
}
.home__tile:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.home__tile-icon {
  font-size: 54px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.home__tile-label {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Liebesbotschaft — nur fuer Christina */
.home__love {
  margin: 18px 0 10px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #ffd1e0 0%, #ffadc8 100%);
  color: #5a1333;
  text-align: center;
  box-shadow: 0 2px 12px rgba(255, 60, 110, 0.18);
}
.home__love-main {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.home__love-quote {
  font-size: 15px;
  font-style: italic;
  line-height: 1.4;
  opacity: 0.85;
}

/* Tablet / Desktop: 2x2 bleibt, aber groessere Fliesen */
@media (min-width: 768px) {
  .home { max-width: 680px; margin: 0 auto; }
  .home__tiles { gap: 20px; }
  .home__tile-icon { font-size: 72px; }
  .home__tile-label { font-size: 22px; }
  .home__quote { font-size: 19px; padding: 22px 28px; }
}

/* Bottom-Tabs jetzt 5 Tabs (Start, Kalender, Einkauf, Vorrat, Rezepte) */
.tabs { grid-template-columns: repeat(5, 1fr); }

/* =========================================================
   Barcode-Scanner
   ========================================================= */
.scanner-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: #000;
  color: #fff;
  display: flex; flex-direction: column;
}
.scanner-head {
  display: grid; grid-template-columns: 1fr auto 1fr;
  padding: calc(var(--safe-top) + 8px) 14px 12px;
  background: rgba(0,0,0,0.6);
}
.scanner-title { text-align: center; font-weight: 600; font-size: 16px; }
.scanner-close {
  justify-self: start;
  background: transparent; border: none; color: #0a84ff;
  font-size: 16px; font-weight: 500; padding: 4px 2px;
}
.scanner-stage {
  flex: 1; position: relative; overflow: hidden;
}
.scanner-video {
  width: 100%; height: 100%; object-fit: cover;
}
.scanner-frame {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.scanner-frame::before {
  content: ''; width: min(80vw, 360px); height: 180px;
  border: 3px solid #34c759;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
}
.scanner-foot {
  padding: 16px; padding-bottom: calc(var(--safe-bottom) + 16px);
  background: rgba(0,0,0,0.6);
  min-height: 60px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}
.scanner-status { color: rgba(255,255,255,0.9); font-size: 14px; }
.scanner-error { color: #ff6b6b; font-size: 14px; font-weight: 500; }

/* FAB-Stack (Scanner-Knopf + FAB uebereinander) */
.fab-stack {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 14px);
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  z-index: 40;
}
.fab-stack .fab { position: static; }
.fab--secondary {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #5856d6;
  color: #fff;
  border: none;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(88, 86, 214, 0.35);
  cursor: pointer;
}
.fab--secondary:active { transform: scale(0.94); }

.scanner-counter { margin-left: 10px; opacity: 0.7; font-size: 12px; }
