/* AIMom — warme "Küchentisch"-Ästhetik. Ergänzt Tailwind (CDN). */
:root {
  --paper:      #FBF5EC;   /* cremiges Papier */
  --paper-2:    #F4EADD;   /* etwas tiefer */
  --card:       #FFFCF7;
  --ink:        #3A322C;   /* warmes Dunkelbraun */
  --ink-soft:   #7B6F65;
  --clay:       #C75B3F;   /* Terrakotta / Primär */
  --clay-deep:  #A8462F;
  --sage:       #7E8A6A;   /* Salbei / Sekundär */
  --sage-deep:  #5F6B4E;
  --honey:      #E8A04B;   /* Honig / Highlight */
  --berry:      #9C4A52;   /* Beere / Budget */
  --line:       #E7DBCB;
  --shadow:     20px 20px 60px rgba(120, 90, 60, .10);
}

* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  /* atmosphärischer, mehrlagiger Hintergrund statt Volltonfläche */
  background:
    radial-gradient(900px 500px at 110% -5%, rgba(232,160,75,.18), transparent 60%),
    radial-gradient(700px 500px at -10% 105%, rgba(126,138,106,.16), transparent 60%),
    var(--paper);
  display: flex; justify-content: center;
}

.font-display { font-family: "Fraunces", Georgia, serif; }

/* --- Telefon-Rahmen ------------------------------------------------------- */
.phone {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;            /* dvh: berücksichtigt die Browser-Leiste auf Mobile */
  background: var(--paper);
  background-image:
    radial-gradient(700px 400px at 120% -10%, rgba(232,160,75,.14), transparent 55%),
    radial-gradient(600px 420px at -20% 110%, rgba(126,138,106,.12), transparent 55%);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
}
@media (min-width: 480px) {
  body { padding: 24px 0; align-items: flex-start; }
  .phone { border-radius: 38px; height: calc(100dvh - 48px); border: 1px solid var(--line); }
}

/* subtile Korn-Textur für Wärme/Tiefe */
.phone::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Scroll-Bereich ------------------------------------------------------- */
.screen { flex: 1; min-height: 0; overflow-y: auto; padding: 0 18px calc(118px + env(safe-area-inset-bottom)); scroll-behavior: smooth; }
.screen::-webkit-scrollbar { width: 0; }

.tab-page { display: none; }
.tab-page.active { display: block; animation: rise .45s cubic-bezier(.2,.7,.2,1); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop  { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* gestaffelte Einblendung von Karten */
.stagger > * { opacity: 0; animation: rise .5s cubic-bezier(.2,.7,.2,1) forwards; }
.stagger > *:nth-child(1){ animation-delay: .04s }
.stagger > *:nth-child(2){ animation-delay: .10s }
.stagger > *:nth-child(3){ animation-delay: .16s }
.stagger > *:nth-child(4){ animation-delay: .22s }
.stagger > *:nth-child(5){ animation-delay: .28s }
.stagger > *:nth-child(6){ animation-delay: .34s }
.stagger > *:nth-child(7){ animation-delay: .40s }

/* --- Karten --------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(120,90,60,.06);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-weight: 700; font-size: 13.5px; color: var(--ink);
  cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s;
  white-space: nowrap;
}
.chip:hover { transform: translateY(-1px); border-color: var(--clay); }
.chip:active { transform: scale(.97); }

.badge {
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase;
}
.badge-veg { background: rgba(126,138,106,.16); color: var(--sage-deep); }
.badge-gf  { background: rgba(232,160,75,.20); color: #9a6516; }
.badge-fav { background: rgba(199,91,63,.14); color: var(--clay-deep); }

/* --- Bottom-Tabbar -------------------------------------------------------- */
.tabbar {
  position: sticky; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,252,247,.86);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.tabbtn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-soft); font-weight: 700; font-size: 10.5px; padding: 4px 0;
  transition: color .15s;
}
.tabbtn .ic { font-size: 21px; line-height: 1; transition: transform .2s; filter: grayscale(.35); opacity: .7; }
.tabbtn.active { color: var(--clay-deep); }
.tabbtn.active .ic { transform: translateY(-2px) scale(1.12); filter: none; opacity: 1; }

/* --- AI Composer (persistent) -------------------------------------------- */
.composer {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: 10px;
  margin: 0 -18px; padding: 10px 16px;
}

/* --- Chat-Sheet ----------------------------------------------------------- */
.sheet-backdrop {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(58,50,44,.34); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 41;
  height: 86%;
  background: var(--paper);
  border-radius: 30px 30px 0 0;
  box-shadow: 0 -18px 50px rgba(80,55,35,.22);
  transform: translateY(102%); transition: transform .38s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.sheet.open { transform: none; }

.bubble { max-width: 84%; padding: 12px 15px; border-radius: 20px; line-height: 1.5; font-size: 14.5px; animation: pop .3s ease; }
.bubble-ai   { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; color: var(--ink); }
.bubble-user { background: var(--clay); color: #fff; border-bottom-right-radius: 6px; margin-left: auto; box-shadow: 0 6px 16px rgba(199,91,63,.3); }
.bubble strong { font-weight: 800; }

.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 1.5px; border-radius: 50%; background: var(--ink-soft); opacity: .5; animation: blink 1.2s infinite; }
.typing span:nth-child(2){ animation-delay: .2s } .typing span:nth-child(3){ animation-delay: .4s }
@keyframes blink { 0%,60%,100%{ transform: translateY(0); opacity:.4 } 30%{ transform: translateY(-4px); opacity:1 } }

/* AI-Avatar */
.avatar {
  width: 46px; height: 46px; border-radius: 16px; flex: none;
  display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(140deg, var(--honey), var(--clay));
  box-shadow: 0 8px 20px rgba(199,91,63,.32);
}
.avatar-sm { width: 34px; height: 34px; border-radius: 12px; font-size: 18px; }
.avatar-lg { width: 60px; height: 60px; border-radius: 20px; font-size: 30px; }

.btn-clay {
  background: var(--clay); color: #fff; border: 0; border-radius: 14px;
  font-weight: 800; padding: 11px 16px; cursor: pointer; transition: transform .12s, background .15s;
  box-shadow: 0 8px 18px rgba(199,91,63,.28);
}
.btn-clay:hover { background: var(--clay-deep); }
.btn-clay:active { transform: scale(.97); }

/* Fortschrittsbalken */
.bar { height: 10px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--sage), var(--honey)); }

/* Checkbox-Liste */
.check { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; cursor: pointer; transition: .15s; color: transparent; font-weight: 900; }
.check.on { background: var(--sage); border-color: var(--sage); color: #fff; }
.line-done { text-decoration: line-through; color: var(--ink-soft); }

/* Spend-Balkendiagramm */
.spendbars { display: flex; align-items: flex-end; gap: 7px; height: 120px; }
.spendbars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.spendbars .col > i { width: 100%; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--clay), var(--honey)); transition: height .6s cubic-bezier(.2,.8,.2,1); }
.spendbars .col.cur > i { background: linear-gradient(180deg, var(--sage), var(--sage-deep)); }
.spendbars .col small { font-size: 9px; color: var(--ink-soft); }

/* --- Floating Navpill + zentraler Sprech-Button -------------------------- */
.navpill {
  position: absolute; z-index: 30;
  left: 14px; right: 14px; bottom: calc(10px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr 1fr 72px 1fr 1fr; align-items: center;
  background: rgba(255,252,247,.78);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 30px;
  box-shadow: 0 14px 34px rgba(120,90,60,.22), inset 0 1px 0 rgba(255,255,255,.6);
  padding: 9px 8px;
}
.np-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-soft); font-weight: 700; font-size: 10.5px; padding: 2px 0;
  transition: color .15s;
}
.np-tab .ic { font-size: 20px; line-height: 1; transition: transform .2s; filter: grayscale(.4); opacity: .65; }
.np-tab.active { color: var(--clay-deep); }
.np-tab.active .ic { transform: translateY(-2px) scale(1.12); filter: none; opacity: 1; }

.np-center { display: flex; justify-content: center; align-items: flex-end; height: 100%; }
.np-label { font-size: 10px; font-weight: 800; color: var(--clay-deep); opacity: .85; }

.np-mic {
  position: absolute; left: 50%; top: -24px; transform: translateX(-50%);
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--paper); cursor: pointer;
  background: linear-gradient(145deg, var(--honey), var(--clay));
  box-shadow: 0 14px 28px rgba(199,91,63,.48);
  display: grid; place-items: center;
  transition: transform .15s;
}
.np-mic .np-mic-ic { font-size: 26px; line-height: 1; }
.np-mic::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid rgba(199,91,63,.4); animation: ring 2.4s ease-out infinite;
}
.np-mic:active { transform: translateX(-50%) scale(.93); }
@keyframes ring { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.55); opacity: 0; } }

/* --- Voice-Sheet --------------------------------------------------------- */
.voice-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 46;
  height: 94%;
  background:
    radial-gradient(600px 360px at 50% -5%, rgba(232,160,75,.22), transparent 60%),
    var(--paper);
  border-radius: 32px 32px 0 0;
  box-shadow: 0 -18px 50px rgba(80,55,35,.28);
  transform: translateY(102%); transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.voice-sheet.open { transform: none; }
.voice-close { position: absolute; top: 14px; right: 18px; font-size: 30px; line-height: 1; color: var(--ink-soft); background: none; border: 0; cursor: pointer; }
.voice-inner { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 0 28px calc(28px + env(safe-area-inset-bottom)); text-align: center; }
.voice-avatar {
  width: 74px; height: 74px; border-radius: 24px; display: grid; place-items: center; font-size: 38px; margin-bottom: 4px;
  background: linear-gradient(140deg, var(--honey), var(--clay)); box-shadow: 0 12px 28px rgba(199,91,63,.34);
  animation: float 3.5s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.voice-title { font-size: 26px; font-weight: 600; color: var(--ink); }
.voice-status { font-size: 15px; color: var(--ink-soft); font-weight: 700; min-height: 44px; max-width: 280px; }

.waveform { display: flex; align-items: center; justify-content: center; gap: 5px; height: 70px; margin: 4px 0; }
.waveform > span { width: 5px; height: 9px; border-radius: 4px; background: linear-gradient(180deg, var(--honey), var(--clay)); opacity: .45; transition: height .12s ease; }
.waveform.live > span { opacity: 1; animation: wave 1s ease-in-out infinite; }
.waveform.live > span:nth-child(2n) { animation-duration: .78s; }
.waveform.live > span:nth-child(3n) { animation-duration: 1.25s; }
.waveform.live > span:nth-child(1){animation-delay:0s} .waveform.live > span:nth-child(2){animation-delay:.08s}
.waveform.live > span:nth-child(3){animation-delay:.16s} .waveform.live > span:nth-child(4){animation-delay:.24s}
.waveform.live > span:nth-child(5){animation-delay:.32s} .waveform.live > span:nth-child(6){animation-delay:.40s}
.waveform.live > span:nth-child(7){animation-delay:.48s} .waveform.live > span:nth-child(8){animation-delay:.40s}
.waveform.live > span:nth-child(9){animation-delay:.32s} .waveform.live > span:nth-child(10){animation-delay:.24s}
.waveform.live > span:nth-child(11){animation-delay:.16s} .waveform.live > span:nth-child(12){animation-delay:.08s}
@keyframes wave { 0%,100% { height: 8px; } 50% { height: 50px; } }

.mic-big {
  width: 96px; height: 96px; border-radius: 50%; border: 0; cursor: pointer; position: relative;
  background: linear-gradient(145deg, var(--honey), var(--clay)); color: #fff; font-size: 40px;
  display: grid; place-items: center; margin-top: 8px;
  box-shadow: 0 18px 42px rgba(199,91,63,.45); transition: transform .15s, background .2s;
}
.mic-big:active { transform: scale(.95); }
.mic-big.rec { background: linear-gradient(145deg, var(--clay), var(--berry)); }
.mic-big.rec::before, .mic-big.rec::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(156,74,82,.5); animation: ring 1.8s ease-out infinite;
}
.mic-big.rec::after { animation-delay: .9s; }
.voice-hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; }
.voice-type { margin-top: 14px; }

/* --- Lucide Icons -------------------------------------------------------- */
svg.lucide { stroke-width: 2; vertical-align: middle; display: inline-block; flex: none; }
.chip svg, .btn-clay svg, .badge svg { vertical-align: -2px; }

/* runde, weiche Icon-Kachel (für Karten/Listen) */
.icon-tile {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  display: inline-grid; place-items: center;
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1px rgba(120,90,60,.06);
}
.icon-tile-lg { width: 52px; height: 52px; border-radius: 16px; }

/* Icon-Größen für die statischen Platzhalter (Nav, Mikro, Avatare) */
.np-tab .ic svg { width: 22px; height: 22px; }
.np-mic svg { width: 26px; height: 26px; color: #fff; }
.voice-avatar svg { width: 38px; height: 38px; color: #fff; }
.mic-big svg { width: 40px; height: 40px; color: #fff; }
.avatar svg { color: #fff; }

/* --- Wunschlisten-Reservieren -------------------------------------------- */
.reserve-btn {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex: none;
  padding: 8px 13px; border-radius: 999px; font-weight: 800; font-size: 12.5px; cursor: pointer;
  background: var(--clay); color: #fff; border: 0; box-shadow: 0 6px 14px rgba(199,91,63,.28);
  transition: transform .12s;
}
.reserve-btn:active { transform: scale(.96); }
.reserve-btn.is-res { background: #fff; color: var(--sage-deep); border: 1.5px solid var(--sage); box-shadow: none; }
