/* ══════════════════════════════════════════════
   RESET & VARIABLES (Dark Mode)
══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Touch: 300ms-Verzögerung auf allen interaktiven Elementen entfernen */
button, a, [role="button"],
.water-glass, .cal-day, .cat-tab, .template-chip,
.meal-sel-btn, .recipe-card-header, .sheet-item {
  touch-action: manipulation;
}

/* Kein Textmarkieren auf UI-Elementen */
button, nav, header, .app-card, .bottom-sheet { user-select: none; }

:root {
  --primary:       #22c55e;
  --primary-dark:  #4ade80;
  --primary-xlight: #0f2118;
  --blue:          #38bdf8;
  --orange:        #fb923c;
  --red:           #f87171;
  --danger:        #ef4444;
  --bg:            #0d1117;
  --card:          #161b22;
  --card-2:        #1c2230;
  --text:          #e6edf3;
  --text-2:        #8b949e;
  --text-muted:    #6e7681;
  --border:        #30363d;
  --header-h:      60px;
  --nav-h:         68px;
  --radius:        16px;
  --radius-sm:     10px;
  --shadow:        0 1px 4px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.4);
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  overflow: hidden;
  overscroll-behavior-y: none;       /* Kein Pull-to-Refresh */
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* ══════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════ */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #080b10 0%, #0d2118 100%);
  padding: 24px;
}

.login-wrap {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-icon { font-size: 64px; margin-bottom: 12px; }
.login-title { font-size: 28px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.login-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input {
  width: 100%;
  padding: 15px 18px;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-size: 16px;
  backdrop-filter: blur(10px);
}
.login-form input::placeholder { color: var(--text-muted); }
.login-form input:focus { outline: none; border-color: var(--primary); }

.login-error { color: #fca5a5; font-size: 13px; min-height: 18px; }

.btn-login {
  padding: 15px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 4px;
  transition: background .2s;
}
.btn-login:active { background: #16a34a; }

/* ══════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════ */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ── Top Header ─────────────────────────────── */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}

/* Titel immer mittig – unabhängig von rechten Aktions-Buttons */
#header-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: env(safe-area-inset-top);
  bottom: 0;
  display: flex;
  align-items: center;
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.3px;
  white-space: nowrap;
  pointer-events: none;
}

#header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Content ────────────────────────────────── */
#content {
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 8px;
}

.page { display: none; padding: 12px 12px 16px; }
.page.active { display: block; animation: pageFadeIn .15s ease; }
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Bottom Navigation ──────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr 80px 1fr 1fr;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -1px 0 var(--border), 0 -4px 20px rgba(0,0,0,.3);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 8px 4px;
  color: var(--text-muted);
  transition: color .15s;
  min-height: 44px;
}
.nav-btn.active { color: var(--primary); }
.nav-btn.active .nav-icon { transform: scale(1.1); }
.nav-icon { font-size: 22px; line-height: 1; transition: transform .15s; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: -.2px; }

/* Center FAB */
.nav-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  margin: 0 auto;
  margin-bottom: 10px;
  box-shadow: 0 4px 20px rgba(34,197,94,.45);
  transition: transform .15s, box-shadow .15s;
}
.nav-fab:active { transform: scale(.93); box-shadow: 0 2px 8px rgba(34,197,94,.3); }
.nav-fab-icon {
  font-size: 28px;
  font-weight: 300;
  color: #fff;
  line-height: 1;
  margin-top: -2px;
}

/* ══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════ */
.app-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-title-row {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.card-row:last-child { border-bottom: none; }
.card-label { font-size: 14px; color: var(--text-2); }
.card-value { font-size: 15px; font-weight: 700; color: var(--text); }

/* ══════════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════════ */
.ring-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.ring-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}
.ring-num { font-size: 38px; font-weight: 900; color: var(--text); line-height: 1; }
.ring-unit { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
.ring-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Makro-Badges */
.macro-row {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
}
.macro-badge {
  flex: 1;
  text-align: center;
  border-radius: 12px;
  padding: 10px 6px;
}
.macro-badge.macro-p { background: #0f2118; }
.macro-badge.macro-c { background: #0f1a2e; }
.macro-badge.macro-f { background: #221509; }
.mb-val { font-size: 16px; font-weight: 800; }
.macro-badge.macro-p .mb-val { color: var(--primary-dark); }
.macro-badge.macro-c .mb-val { color: #60a5fa; }
.macro-badge.macro-f .mb-val { color: var(--orange); }
.mb-label { font-size: 10px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }

/* Progress bars */
.mini-progress {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin: 4px 0;
}
.mini-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s;
}

.hint-center { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 4px; }
.badge-green { background: #0f2118; color: var(--primary-dark); font-weight: 700; font-size: 13px; padding: 3px 10px; border-radius: 20px; border: 1px solid #1a4030; }

/* Wasser */
.water-glasses {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin: 8px 0;
}
.water-glass {
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  filter: grayscale(1) opacity(.25);
  transition: filter .15s, transform .1s;
}
.water-glass.filled { filter: none; }
.water-glass:active { transform: scale(1.2); }

.water-btn-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
#water-progress-wrap { flex: 1; }
.water-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--card-2);
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 300;
  color: var(--text);
  transition: background .15s, transform .1s;
}
.water-btn:active { transform: scale(.9); }
.water-btn:active { background: var(--border); }
.water-btn-plus { background: var(--primary); color: #fff; }
.water-btn-plus:active { background: #16a34a; }
.water-text { font-size: 14px; font-weight: 600; color: var(--text-2); }

/* Dash list */
.dash-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
}
.dash-list li .kcal { font-weight: 700; color: var(--primary-dark); }

/* kcal badge (used in dash list via JS) */
.kcal-badge {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 12px;
}

/* ══════════════════════════════════════════════
   TAGEBUCH
══════════════════════════════════════════════ */
.diary-date-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.date-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  color-scheme: dark;
}
.date-input:focus { outline: none; }
.icon-btn {
  background: var(--card-2);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.icon-btn:active { background: var(--border); }

/* Summary strip */
.summary-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.summary-strip::-webkit-scrollbar { display: none; }
.summary-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text);
}

/* Collapsible */
.card-collapse { padding: 0; overflow: hidden; }
.collapse-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.collapse-arrow { font-size: 11px; color: var(--text-muted); transition: transform .2s; }
.collapse-trigger.open .collapse-arrow { transform: rotate(180deg); }
.collapse-body { padding: 0 16px 14px; display: none; }
.collapse-body.open { display: flex; flex-direction: column; gap: 8px; }
.collapse-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
}
.collapse-body textarea:focus { outline: none; border-color: var(--primary); }

/* Meal groups */
.meal-group {
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}
.meal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  background: var(--card-2);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
}
.meal-kcal { font-size: 13px; color: var(--text-muted); font-weight: 500; }
/* Swipe-to-delete */
.swipeable { position: relative; overflow: hidden; }
.swipe-content {
  position: relative; z-index: 1;
  background: var(--card);
  transition: transform .22s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.swipeable:last-child .swipe-content { border-bottom: none; }
.swipeable.open .swipe-content { transform: translateX(-80px); }
.swipe-del-reveal {
  position: absolute; right: 0; top: 0; bottom: 0; width: 80px;
  background: var(--danger);
  color: #fff; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  z-index: 0; cursor: pointer;
}

/* Pull-to-Refresh Indikator */
#pull-indicator {
  position: fixed; top: calc(var(--header-h) + env(safe-area-inset-top) + 4px); left: 50%; transform: translateX(-50%) translateY(-8px);
  background: var(--primary); color: #fff;
  border-radius: 20px; padding: 6px 18px;
  font-size: 13px; font-weight: 600;
  z-index: 200; opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none; white-space: nowrap;
}
#pull-indicator.visible {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

.meal-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.meal-entry:last-child { border-bottom: none; }
.meal-entry-name { font-size: 14px; font-weight: 600; }
.meal-entry-detail { font-size: 12px; color: var(--text-muted); }
.meal-entry-right { display: flex; align-items: center; gap: 10px; }
.meal-entry-kcal { font-size: 14px; font-weight: 700; color: var(--primary-dark); }

/* Delete buttons */
.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 8px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.btn-delete:active { color: var(--red); background: rgba(248,113,113,.15); }

/* Kategorie-Tabs (Food-Modal) */
.cat-tabs {
  display: flex;
  gap: 8px;
}
.cat-tab {
  flex: 1;
  padding: 8px 6px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.cat-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Food-Form Buttons */
.food-form-btns {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.food-form-btns .btn-full-green { flex: 2; }
.food-form-btns .btn-outline     { flex: 1; }


/* ══════════════════════════════════════════════
   KALENDER
══════════════════════════════════════════════ */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}
.calendar-weekdays > div {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
  text-transform: uppercase;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .1s;
}
.cal-day:not(.cal-future):active { opacity: .6; }
.cal-day-num { font-size: 14px; font-weight: 700; }
.cal-day-kcal { font-size: 9px; margin-top: 1px; }
.cal-day.today { border-color: var(--primary); }
.cal-day.cal-ok { background: #0f2118; color: var(--primary-dark); }
.cal-day.cal-over { background: #2a0e0e; color: #f87171; }
.cal-day.cal-empty { background: var(--card-2); color: var(--text-muted); }
.cal-day.cal-future { background: transparent; color: var(--border); cursor: default; }
.cal-legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--text-muted); justify-content: center; }
.cal-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
.cal-month-nav span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
}
.cal-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cal-ok-dot { background: #0f2118; border: 1px solid #1e4030; }
.cal-over-dot { background: #2a0e0e; border: 1px solid #5a1a1a; }


/* ══════════════════════════════════════════════
   FORMS (universal)
══════════════════════════════════════════════ */
/* Zahlen-Spinner auf Mobile ausblenden */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;             /* ≥16px = kein iOS-Zoom beim Fokussieren */
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color .2s;
  margin-bottom: 10px;
  color-scheme: dark;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card-2);
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}

.input-row { display: flex; gap: 10px; }
.input-col { flex: 1; min-width: 0; }
.input-col input, .input-col select { margin-bottom: 10px; }

.btn-full-green {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  margin-top: 4px;
}
.btn-full-green:active { background: #16a34a; transform: scale(.98); }

.btn-sm-green {
  padding: 9px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: transform .1s;
}
.btn-sm-green:active { transform: scale(.95); }

.btn-outline {
  display: block;
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--primary-dark);
  border: 1.5px solid var(--primary);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  margin-bottom: 10px;
  transition: background .15s;
}
.btn-outline:active { background: var(--primary-xlight); }

.btn-outline-block {
  display: block;
  padding: 13px;
  background: var(--card-2);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn-outline-sm {
  padding: 10px 14px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-2);
}

.error-msg { color: var(--red); font-size: 13px; margin: -4px 0 8px; min-height: 16px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--card-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════
   REZEPTE
══════════════════════════════════════════════ */
.recipe-search-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.recipe-search-wrap .input-col { min-width: 100px; }

.recipe-ings { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.recipe-ingredient-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.ri-info { font-size: 11px; color: var(--text-muted); }
.recipe-total {
  background: var(--primary-xlight);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--primary-dark);
  border: 1px solid #1a4030;
}
.recipe-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--card);
}
.recipe-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  cursor: pointer;
  background: var(--card-2);
  transition: background .15s;
}
.recipe-card-header:active { background: var(--border); }
.recipe-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.recipe-card-body { padding: 12px 16px; display: none; }
.recipe-card-body.open { display: block; }
.recipe-card-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }

/* ══════════════════════════════════════════════
   BERECHNEN
══════════════════════════════════════════════ */
.calc-result {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--card-2);
  border-radius: 8px;
  font-size: 14px;
}
.result-row strong { color: var(--primary-dark); font-size: 15px; }

/* ══════════════════════════════════════════════
   BOTTOM SHEETS (Mehr & Modal)
══════════════════════════════════════════════ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 200;
  backdrop-filter: blur(3px);
  cursor: pointer;
  opacity: 0;
  transition: opacity .28s ease;
}
.sheet-overlay.open { opacity: 1; }
.sheet-overlay:not(.open) { pointer-events: none; }

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  z-index: 201;
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.32,.72,0,1);
  will-change: transform;           /* GPU-Beschleunigung */
}
.bottom-sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin: 10px auto 0;
}

/* Mehr-Sheet */
.sheet-menu {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
}
.sheet-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  transition: background .15s;
  text-align: left;
}
.sheet-item:active { background: var(--card-2); }
.sheet-icon { font-size: 22px; width: 28px; text-align: center; }
.sheet-divider { height: 1px; background: var(--border); margin: 4px 20px; }
.sheet-logout {
  display: block;
  width: calc(100% - 40px);
  margin: 12px 20px;
  padding: 14px;
  background: rgba(248,113,113,.12);
  color: var(--red);
  border: 1px solid rgba(248,113,113,.25);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* Food Bottom-Sheet */
.food-sheet {
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.food-sheet::-webkit-scrollbar { display: none; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}
.modal-header span { font-size: 17px; font-weight: 800; color: var(--text); }
.modal-close-btn {
  width: 44px;
  height: 44px;
  background: var(--card-2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.modal-close-btn:active { background: var(--border); color: var(--text); }

.modal-section { padding: 14px 20px 0; }
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

/* Meal selector buttons */
.meal-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.meal-sel-btn {
  padding: 8px 12px;
  min-height: 38px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--card-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-2);
  transition: all .15s;
}
.meal-sel-btn:active { opacity: .7; }
.meal-sel-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Selected food */
.selected-food {
  background: var(--primary-xlight);
  border-radius: 10px;
  padding: 10px 16px;
  margin: 10px 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid #1a4030;
}
.sel-badge {
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* Modal preview */
.modal-preview {
  margin: 10px 20px 0;
  background: var(--card-2);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
  border: 1px solid var(--border);
}

/* Modal inputs */
.modal-section input[type="text"],
.modal-section input[type="number"] {
  margin-bottom: 0;
}

/* Search dropdown */
.search-dropdown {
  list-style: none;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 6px;
  box-shadow: var(--shadow);
}
.search-dropdown:empty { display: none; }
.search-dropdown li {
  padding: 14px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.search-dropdown li:last-child { border-bottom: none; }
.search-dropdown li:active { background: var(--card-2); }
.food-kcal { font-size: 12px; color: var(--text-muted); }

/* Template chips */
.template-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.template-chip {
  background: var(--primary-xlight);
  color: var(--primary-dark);
  border: 1px solid #1a4030;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.template-chip:active { background: #162e1e; }

/* Modal actions */
.modal-actions {
  display: flex;
  gap: 10px;
  padding: 14px 20px 18px;
  align-items: center;
}
.modal-actions .btn-full-green { flex: 1; margin: 0; }

/* ══════════════════════════════════════════════
   VORLAGEN (Einstellungen)
══════════════════════════════════════════════ */
.template-manage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.template-manage-row:last-child { border-bottom: none; }
.tpl-info { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.badge-custom {
  font-size: 10px;
  background: var(--primary-xlight);
  color: var(--primary-dark);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid #1a4030;
}

/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  animation: toastUp .25s ease;
}
.toast.toast-error { background: #2a0e0e; color: var(--red); border-color: #5a1a1a; }
@keyframes toastUp { from { opacity: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 4px); } to { opacity: 1; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
