:root {
  --cream: #f7f3ee;
  --warm: #fdfaf6;
  --sage: #7a9e7e;
  --sage-dark: #4a6741;
  --sage-light: #a8c5ac;
  --earth: #8b6f47;
  --deep: #2c2416;
  --muted: #9b8e7e;
  --border: #e8e0d5;
  --soft-green: #f4f9f4;
  --soft-amber: #fdf6ee;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #ede8e0;
  color: var(--deep);
  font-family: "Jost", sans-serif;
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px 14px;
}

.phone {
  width: min(100%, 390px);
  height: min(100vh - 44px, 760px);
  min-height: 640px;
  background: var(--warm);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 34px;
  box-shadow: 0 24px 80px rgba(44,36,22,.16), 0 4px 16px rgba(44,36,22,.08);
  overflow: hidden;
  position: relative;
}

.screen {
  display: none;
  height: 100%;
}

.screen.active {
  display: block;
}

.screen-scroll {
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
}

.screen-scroll::-webkit-scrollbar {
  display: none;
}

.with-nav {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
}

.onboard {
  height: 100%;
  display: grid;
  grid-template-rows: 45% 55%;
}

.onboard-image {
  position: relative;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fdf6ee 0%, #f3e8d8 52%, #e8d5bb 100%);
  overflow: hidden;
}

.onboard-image.green {
  background: linear-gradient(135deg, #eef4ee 0%, #dce8dc 50%, #c8dbc8 100%);
}

.ing3d, .orb {
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: absolute;
  box-shadow: inset -10px -10px 24px rgba(0,0,0,.26), inset 6px 6px 14px rgba(255,255,255,.24), 0 12px 36px rgba(90,138,94,.28);
  animation: floatA 4.6s ease-in-out infinite;
}

.ing-main { width: 108px; height: 108px; font-size: 46px; background: radial-gradient(circle at 35% 30%, #f5d08a, #d4900a 45%, #8b5a05); z-index: 3; }
.ing-left { width: 68px; height: 68px; font-size: 28px; background: radial-gradient(circle at 35% 30%, #b8d4bc, #5a8a5e 45%, #2c4a30); left: 52px; top: 118px; z-index: 2; animation-name: floatB; }
.ing-right { width: 58px; height: 58px; font-size: 24px; background: radial-gradient(circle at 35% 30%, #e8c4a0, #c4844a 45%, #7a4a20); right: 58px; top: 128px; animation-name: floatC; }
.ing-dot-one { width: 38px; height: 38px; font-size: 16px; background: radial-gradient(circle at 35% 30%, #f5d898, #c9a030 45%, #7a5a10); right: 38px; top: 38px; }
.ing-dot-two { width: 34px; height: 34px; font-size: 14px; background: radial-gradient(circle at 35% 30%, #c8e8c8, #5a9a5e 45%, #2a4a2e); left: 40px; top: 42px; animation-name: floatB; }
.bowl { width: 102px; height: 102px; font-size: 42px; background: radial-gradient(circle at 35% 30%, #c8e0c8, #5a9a5e 45%, #2a5a30); }
.grain { width: 64px; height: 64px; font-size: 26px; background: radial-gradient(circle at 35% 30%, #f0c878, #c98a10 45%, #7a5005); left: 48px; top: 122px; animation-name: floatB; }
.calm { width: 54px; height: 54px; font-size: 22px; background: radial-gradient(circle at 35% 30%, #d4a8d4, #8a5a8a 45%, #4a2a4a); right: 56px; top: 132px; animation-name: floatC; }
.sprig { width: 36px; height: 36px; font-size: 15px; background: radial-gradient(circle at 35% 30%, #f5d898, #c9a030 45%, #7a5a10); right: 40px; top: 42px; }

.onboard-content {
  padding: 30px 28px 34px;
  display: flex;
  flex-direction: column;
}

.onboard-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--border);
}

.dot.active {
  width: 22px;
  background: var(--sage);
}

h1, h2, p {
  margin-top: 0;
}

.onboard h1, .screen-header h1, .dash-header h1 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
}

.onboard h1 {
  font-size: 32px;
  line-height: 1.08;
  margin-bottom: 12px;
}

.onboard p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: auto;
}

.btn, .btn-outline {
  width: 100%;
  padding: 15px 18px;
  border-radius: 999px;
  border: 0;
  background: var(--sage-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .7px;
}

.btn:disabled {
  opacity: .62;
  cursor: wait;
}

.btn-outline {
  margin-top: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--sage-dark);
}

.btn-outline.danger {
  color: #9d3d2b;
}

.splash-btn:disabled {
  opacity: .62;
  cursor: wait;
}

.splash {
  height: 100%;
  min-height: 640px;
  padding: 42px 32px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #2c3d2a 0%, #3d5c39 42%, #4a6741 100%);
}

.splash:before {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168,197,172,.15), transparent 70%);
  top: -82px;
  right: -82px;
}

.splash-mark {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d8ead8, #7a9e7e 48%, #2c4a30);
  box-shadow: inset -14px -14px 28px rgba(0,0,0,.35), inset 8px 8px 18px rgba(255,255,255,.22), 0 18px 48px rgba(0,0,0,.24);
  display: grid;
  place-items: center;
  font-size: 48px;
  z-index: 1;
}

.splash h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: 46px;
  font-weight: 300;
  letter-spacing: 2px;
  color: #f0ebe3;
  margin: 18px 0 7px;
  z-index: 1;
}

.splash-tagline {
  color: rgba(240,235,227,.65);
  font-size: 12px;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 22px;
  z-index: 1;
}

.splash-copy {
  color: rgba(240,235,227,.8);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  margin-bottom: 36px;
  z-index: 1;
}

.splash-btn {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: #f0ebe3;
  color: var(--sage-dark);
  padding: 15px 18px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .8px;
  z-index: 1;
}

.splash-btn.outline {
  color: #f0ebe3;
  border: 1px solid rgba(240,235,227,.32);
  background: rgba(255,255,255,.08);
}

.auth-panel {
  display: none;
  width: 100%;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(240,235,227,.22);
  border-radius: 20px;
  background: rgba(255,255,255,.08);
  z-index: 1;
}

.auth-panel.show {
  display: block;
}

.auth-panel p {
  margin-bottom: 12px;
  color: rgba(240,235,227,.7);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.auth-panel input {
  width: 100%;
  margin-bottom: 10px;
  padding: 13px 14px;
  border: 1px solid rgba(240,235,227,.24);
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  color: #fff;
}

.auth-panel input::placeholder {
  color: rgba(240,235,227,.58);
}

.auth-helper {
  color: rgba(240,235,227,.68);
  font-size: 11px;
  line-height: 1.45;
  margin: -2px 0 10px;
}

.auth-helper.invalid {
  color: #ffd3c9;
}

.auth-helper.valid {
  color: #d9f0d9;
}

.orb-turmeric { width: 90px; height: 90px; top: -20px; right: -10px; background: radial-gradient(circle at 35% 30%, #f5d08a, #d4900a 45%, #8b5a05); }
.orb-sage { width: 52px; height: 52px; top: 70px; right: 82px; background: radial-gradient(circle at 35% 30%, #c8e0c8, #5a9a5e 45%, #2a5a30); animation-name: floatB; }
.orb-earth { width: 40px; height: 40px; top: 42px; left: 26px; background: radial-gradient(circle at 35% 30%, #d8b88a, #8b6f47 45%, #4a3420); animation-name: floatC; }

.screen-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--warm);
}

.back-btn {
  padding: 0;
  border: 0;
  color: var(--sage);
  background: transparent;
  font-size: 12px;
  letter-spacing: 1px;
  margin-bottom: 9px;
}

.screen-header h1 {
  margin-bottom: 6px;
  font-size: 27px;
  line-height: 1.14;
}

.screen-header p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 0;
}

.content {
  padding: 20px 24px 28px;
}

.form-label, .eyebrow {
  display: block;
  margin: 14px 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--sage);
  margin-top: 18px;
}

.form-input, .form-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--cream);
  color: var(--deep);
  padding: 12px 15px;
  outline: 0;
}

.form-textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.5;
}

.helper {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin: 6px 0 10px;
}

.card, .stack-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin: 16px 0;
}

.relation-grid, .feel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.relation-btn, .pill, .chip, .feel-card {
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--deep);
  border-radius: 14px;
  padding: 11px 12px;
  text-align: left;
}

.relation-btn.selected, .pill.selected, .chip.selected, .feel-card.selected {
  border-color: var(--sage);
  background: var(--soft-green);
  color: var(--sage-dark);
  box-shadow: 0 5px 16px rgba(122,158,126,.12);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill, .chip {
  border-radius: 999px;
  font-size: 12px;
  text-align: center;
}

.health-category h2 {
  margin: 12px 0 8px;
  color: var(--earth);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.health-category:last-of-type {
  margin-bottom: 26px;
}

#saveProfileBtn {
  margin-top: 0;
}

.dash-header {
  min-height: 132px;
  padding: 30px 24px 20px;
  background: linear-gradient(135deg, #eef4ee 0%, #fdfaf6 100%);
  position: relative;
  overflow: hidden;
}

.dash-greeting {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.dash-header h1 {
  font-size: 34px;
  margin: 8px 0 0;
}

.orb.small.turmeric {
  width: 58px;
  height: 58px;
  top: -12px;
  right: 20px;
  background: radial-gradient(circle at 35% 30%, #f5d08a, #d4900a 45%, #8b5a05);
}

.stack-card h2 {
  margin-bottom: 5px;
  font-size: 17px;
  font-weight: 600;
}

.feel-card {
  min-height: 78px;
}

.feel-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.feel-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.feel-grid.two {
  grid-template-columns: 1fr 1fr;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.help-btn {
  width: 24px;
  height: 24px;
  border: 1px solid var(--sage-light);
  border-radius: 50%;
  background: var(--soft-green);
  color: var(--sage-dark);
  font-weight: 700;
}

.sticky-action {
  position: sticky;
  bottom: 0;
  padding: 14px 24px 18px;
  background: linear-gradient(transparent, var(--warm) 24%);
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 8px 0 6px;
}

.bottom-nav button {
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  justify-items: center;
  gap: 1px;
  font-size: 18px;
}

.bottom-nav span {
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.bottom-nav small {
  font-size: 8px;
}

.bottom-nav button.active {
  color: var(--sage-dark);
  font-weight: 700;
}

.bottom-nav button:disabled {
  opacity: .38;
}

.result-banner {
  border-radius: 20px;
  background: linear-gradient(135deg, var(--soft-green), var(--soft-amber));
  border: 1px solid var(--border);
  padding: 18px;
  margin-bottom: 16px;
}

.result-banner h2 {
  margin-bottom: 5px;
  color: var(--sage-dark);
  font-size: 16px;
  line-height: 1.35;
}

.result-banner p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: 0;
}

.meal-cards {
  display: grid;
  gap: 12px;
}

.health-disclaimer {
  border: 1px solid rgba(139, 111, 71, .24);
  border-radius: 16px;
  background: #fffaf2;
  color: var(--earth);
  padding: 12px 14px;
  margin: 14px 0 16px;
  font-size: 11px;
  line-height: 1.55;
}

.meal-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  padding: 14px;
}

.meal-head {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
}

.meal-orb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  box-shadow: inset -4px -4px 10px rgba(0,0,0,.26), inset 2px 2px 6px rgba(255,255,255,.24);
}

.meal-orb.sun { background: radial-gradient(circle at 35% 30%, #f5e098, #d4a020 45%, #8a5a05); }
.meal-orb.leaf { background: radial-gradient(circle at 35% 30%, #a8d4ac, #5a9a5e 45%, #2c5a30); }
.meal-orb.moon { background: radial-gradient(circle at 35% 30%, #c8c0e8, #7a70c0 45%, #3a3470); }
.meal-orb.snack { background: radial-gradient(circle at 35% 30%, #e4c29b, #9b6c3f 45%, #573415); }

.meal-time {
  color: var(--sage);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.meal-name {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 600;
}

.meal-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
}

.meal-arrow {
  color: var(--muted);
  font-size: 24px;
}

.meal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.meal-action {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--cream);
  color: var(--earth);
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 700;
}

.meal-action.primary {
  border-color: rgba(122,158,126,.3);
  background: var(--soft-green);
  color: var(--sage-dark);
}

.saved-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.saved-list {
  display: grid;
  gap: 12px;
}

.saved-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  padding: 15px;
}

.saved-title {
  color: var(--deep);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  margin: 4px 0 7px;
}

.saved-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: var(--cream);
  color: var(--muted);
  padding: 18px;
  text-align: center;
  font-size: 13px;
}

.recipe-hero {
  padding: 24px;
  background: linear-gradient(135deg, var(--soft-amber), var(--soft-green));
}

.recipe-badge {
  color: var(--sage);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.recipe-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 34px;
  line-height: 1.08;
}

.recipe-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
}

.recipe-section {
  margin-bottom: 18px;
}

.recipe-section-title {
  color: var(--earth);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 9px;
}

.recipe-list {
  margin: 0;
  padding-left: 20px;
  color: var(--deep);
  font-size: 13px;
  line-height: 1.7;
}

.recipe-box {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
  background: rgba(44,36,22,.38);
  padding: 18px;
  z-index: 10;
}

.modal-backdrop.show {
  display: grid;
}

.modal-card {
  width: min(100%, 390px);
  max-height: min(86vh, 680px);
  overflow-y: auto;
  border-radius: 24px;
  background: var(--warm);
  padding: 22px;
  box-shadow: 0 24px 80px rgba(44,36,22,.24);
}

.modal-header h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 4px;
}

.modal-header p {
  color: var(--muted);
  font-size: 12px;
}

.modal-body h3 {
  margin: 18px 0 8px;
  color: var(--earth);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-tags button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--deep);
  padding: 9px 11px;
  font-size: 12px;
}

.modal-tags button.selected {
  border-color: var(--sage);
  background: var(--soft-green);
  color: var(--sage-dark);
}

.replace-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.replace-choice {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--deep);
  padding: 12px 14px;
  text-align: left;
}

.replace-choice span {
  font-size: 14px;
  font-weight: 600;
}

.replace-choice small {
  color: var(--muted);
  font-size: 11px;
}

.replace-choice.selected {
  border-color: var(--sage);
  background: var(--soft-green);
  box-shadow: 0 0 0 2px rgba(76, 105, 68, .12);
}

.toast {
  color: var(--sage-dark);
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  width: min(360px, calc(100vw - 32px));
  transform: translateX(-50%);
  border-radius: 18px;
  background: var(--sage-dark);
  color: #fff;
  padding: 13px 16px;
  box-shadow: 0 16px 48px rgba(44, 36, 22, .28);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.app-toast.error {
  background: #9d3d2b;
}

.app-status-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(28, 37, 25, .34);
  backdrop-filter: blur(5px);
}

.app-status-overlay.show {
  display: grid;
}

.app-status-card {
  width: min(330px, calc(100vw - 48px));
  border: 1px solid rgba(255, 255, 255, .44);
  border-radius: 22px;
  background: var(--warm);
  box-shadow: 0 24px 80px rgba(44, 36, 22, .3);
  padding: 28px 22px;
  text-align: center;
}

.app-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(76, 105, 68, .18);
  border-top-color: var(--sage-dark);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin .86s linear infinite;
}

.app-status-title {
  color: var(--deep);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.app-status-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes floatA {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}

@keyframes floatB {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes floatC {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(-3deg); }
}

@media (max-width: 430px) {
  .app-shell { padding: 0; }
  .phone {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
  }
}
