/* Rezeptnest v0.4.0 – PWA, Passkeys, Profilfarben und Medien */
:root {
  --primary: #2f9e8f;
  --primary-2: #23796f;
  --primary-soft: #def4ef;
  --surface-soft: #eef7f4;
  --surface-strong: #dcefe9;
  --bg: #f7faf9;
  --border: #d8e7e2;
}

html, body, #app, .app-shell, .detail-page,
.content, .sheet, .auth-card, .setup-card,
.recipe-card, .setting-row, .add-option, .source-link {
  max-width: 100%;
}

/* Sämtliche Titel-/Beschreibungspaare sicher untereinander darstellen. */
.add-option,
.setting-copy,
.profile-copy,
.picker-copy,
.planned-copy,
.source-link-copy,
.sheet-head > div,
.auth-brand > div,
.v4-feature-copy,
.v4-install-copy,
.v4-tag-copy,
.v4-media-copy {
  min-width: 0;
}

.option-title,
.option-text,
.setting-title,
.setting-sub,
.profile-title,
.profile-sub,
.picker-title,
.picker-meta,
.planned-title,
.planned-meta,
.source-link-title,
.source-link-url,
.sheet-title,
.sheet-sub,
.auth-title,
.auth-sub,
.v4-feature-title,
.v4-feature-sub,
.v4-install-title,
.v4-install-text {
  display: block !important;
  width: 100%;
  min-width: 0;
  float: none !important;
  clear: both;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.option-title + .option-text,
.setting-title + .setting-sub,
.profile-title + .profile-sub,
.picker-title + .picker-meta,
.planned-title + .planned-meta,
.v4-feature-title + .v4-feature-sub,
.v4-install-title + .v4-install-text {
  margin-top: 6px;
}

.add-option {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
}

.add-option .option-icon { flex: 0 0 auto; }
.add-option .option-title { line-height: 1.25; }
.add-option .option-text { line-height: 1.45; }

/* Freundlicher Standardakzent */
.brand-mark,
.auth-logo { background: linear-gradient(145deg, var(--primary), color-mix(in srgb, var(--primary) 72%, white)); }
.primary-btn, .fab { background: var(--primary); }
.primary-btn:hover { background: var(--primary-2); }

/* Installationsbanner */
.v4-install-banner {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: 19px;
  background: linear-gradient(135deg, var(--primary-soft), #ffffff 75%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.v4-install-banner::after {
  content: '';
  position: absolute;
  width: 95px;
  height: 95px;
  right: -48px;
  top: -52px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  pointer-events: none;
}
.v4-install-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 27%, transparent);
}
.v4-install-icon svg { width: 22px; height: 22px; }
.v4-install-title { color: var(--text); font-size: 14px; font-weight: 700; line-height: 1.2; }
.v4-install-text { color: var(--text-2); font-size: 11px; line-height: 1.35; }
.v4-install-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 5px; }
.v4-install-button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.v4-install-dismiss {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: rgba(255,255,255,.72);
  color: var(--text-3);
  cursor: pointer;
}
.v4-install-dismiss svg { width: 17px; height: 17px; }
.auth-card .v4-install-banner { margin: 0 0 18px; grid-template-columns: 40px minmax(0,1fr); }
.auth-card .v4-install-actions { grid-column: 1 / -1; }

/* Login mit Passkey */
.v4-auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 13px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
}
.v4-auth-divider::before,
.v4-auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.v4-passkey-login {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--border));
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-2);
  font-weight: 700;
  cursor: pointer;
}
.v4-passkey-login svg { width: 21px; height: 21px; }
.v4-inline-message {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.4;
}
.v4-inline-message.info { background: var(--primary-soft); color: var(--primary-2); }
.v4-inline-message.error { background: var(--danger-soft); color: var(--danger); }
.v4-inline-message.success { background: #e4f6ec; color: #167347; }

/* Einstellungsbereiche */
.v4-section-label {
  margin: 14px 3px 7px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.v4-setting-badge {
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-2);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}
.v4-setting-badge.muted { background: #edf0f2; color: var(--text-2); }
.setting-row[data-v4-action] { position: relative; }

/* Eigene Bottom-Sheet-Inhalte */
.v4-sheet-lead { margin: 0 0 15px; color: var(--text-2); font-size: 13px; line-height: 1.45; }
.v4-feature-list { display: grid; gap: 9px; }
.v4-feature-row {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.v4-feature-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: 0 0 auto;
}
.v4-feature-icon svg { width: 20px; height: 20px; }
.v4-feature-copy { flex: 1; }
.v4-feature-title { font-size: 13px; font-weight: 700; line-height: 1.25; }
.v4-feature-sub { color: var(--text-3); font-size: 11px; line-height: 1.4; }

/* Akzentfarben */
.v4-palette { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.v4-color-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.v4-color-option.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.v4-color-swatch { width: 28px; height: 28px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); flex: 0 0 auto; }
.v4-density { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.v4-density button { min-height: 43px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); font-weight: 700; cursor: pointer; }
.v4-density button.active { background: var(--primary-soft); color: var(--primary-2); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
body[data-card-density="compact"] .recipe-grid { gap: 8px; }
body[data-card-density="compact"] .recipe-card { min-height: 112px; }
body[data-card-density="compact"] .card-media { min-height: 112px; }
body[data-card-density="compact"] .card-body { padding-top: 10px; padding-bottom: 9px; }

/* Tags */
.v4-tag-list { display: grid; gap: 8px; }
.v4-tag-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.v4-tag-name { min-width: 0; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.v4-tag-count { color: var(--text-3); font-size: 10px; }
.v4-tag-button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--bg); color: var(--text-2); cursor: pointer; }
.v4-tag-button.danger { background: var(--danger-soft); color: var(--danger); }
.v4-tag-button svg { width: 17px; height: 17px; }

/* Upload */
.v4-upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 20px;
  border: 1.5px dashed color-mix(in srgb, var(--primary) 42%, var(--border));
  border-radius: 19px;
  background: linear-gradient(135deg, var(--primary-soft), rgba(255,255,255,.76));
  text-align: center;
  cursor: pointer;
}
.v4-upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.v4-upload-zone svg { width: 34px; height: 34px; margin-bottom: 9px; color: var(--primary); }
.v4-upload-title { font-size: 15px; font-weight: 700; }
.v4-upload-sub { margin-top: 5px; color: var(--text-2); font-size: 11px; line-height: 1.4; }
.v4-file-name { margin-top: 9px; color: var(--primary-2); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.v4-upload-progress { display: none; height: 7px; overflow: hidden; border-radius: 99px; background: #e4ece9; }
.v4-upload-progress.active { display: block; }
.v4-upload-progress span { display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--primary); animation: v4upload 1.15s ease-in-out infinite alternate; }
@keyframes v4upload { from { transform: translateX(-60%); } to { transform: translateX(160%); } }

/* Medien in Rezeptdetails */
.v4-media-section video,
.v4-media-section img { width: 100%; max-height: 460px; border-radius: 15px; object-fit: contain; background: #101719; }
.v4-media-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 13px; }
.v4-media-actions button { width: 100%; }

/* Installationsanleitung */
.v4-install-steps { counter-reset: step; display: grid; gap: 10px; margin: 15px 0 0; }
.v4-install-step { position: relative; min-height: 46px; padding: 11px 12px 11px 48px; border-radius: 14px; background: var(--bg); color: var(--text-2); font-size: 12px; line-height: 1.45; }
.v4-install-step::before { counter-increment: step; content: counter(step); position: absolute; left: 12px; top: 10px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary-2); font-weight: 700; }

/* Passkey-Hinweis */
.v4-passkey-state { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 13px; border-radius: 15px; background: var(--primary-soft); color: var(--primary-2); }
.v4-passkey-state svg { width: 23px; height: 23px; flex: 0 0 auto; }
.v4-passkey-state strong, .v4-passkey-state span { display: block; }
.v4-passkey-state span { margin-top: 3px; font-size: 11px; line-height: 1.35; }

/* Wochenansicht: keine feste Mahlzeitenspalte, maximaler Platz für Tage. */
.week-overview-grid {
  min-width: 830px !important;
  grid-template-columns: repeat(7, minmax(112px, 1fr)) !important;
}
.overview-corner,
.overview-meal-label { display: none !important; }

@media (max-width: 540px) {
  .v4-install-banner { grid-template-columns: 40px minmax(0,1fr); }
  .v4-install-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .v4-install-button { flex: 1; }
  .v4-palette { grid-template-columns: 1fr 1fr; }
  .v4-media-actions { grid-template-columns: 1fr; }
  .v4-tag-row { grid-template-columns: minmax(0,1fr) auto auto; }
}
