:root {
  /* Muted sage & beige — calm, modern, playful */
  --bg: #f0ebe3;
  --bg-2: #e8e2d8;
  --glass: rgba(255, 252, 247, 0.82);
  --glass-border: rgba(130, 145, 130, 0.14);
  --surface: #fffcf7;
  --surface-2: rgba(168, 185, 168, 0.14);
  --sage: #7aafa0;
  --sage-dim: #6a9d8f;
  --sage-deep: #4f7d70;
  --sage-glow: rgba(122, 175, 160, 0.2);
  --sand: #c8b9a4;
  --beige: #e5ddd0;
  --beige-deep: #d4c8b6;
  --text: #2c322e;
  --muted: rgba(44, 50, 46, 0.52);
  --protein: #8aadc4;
  --carbs: #c9a87a;
  --fat: #c49a9a;
  --water: #8ab8c4;
  --danger: #c49a9a;
  --radius: 26px;
  --radius-organic: 28px 22px 32px 24px / 24px 30px 22px 28px;
  --shadow-soft: 0 8px 32px rgba(120, 140, 120, 0.08);
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Outfit", -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* Organic pastel background */
.watercolor-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(165deg, #faf7f1 0%, #f0ebe3 42%, #e9f0eb 100%);
}
.wc-wash {
  position: absolute;
  filter: blur(58px);
  mix-blend-mode: multiply;
  opacity: 0.5;
}
.wc-wash-1 {
  width: 72vw;
  height: 54vh;
  top: -10vh;
  left: -16vw;
  background: radial-gradient(ellipse at 38% 42%, rgba(212, 200, 182, 0.75) 0%, rgba(229, 221, 208, 0.45) 40%, transparent 72%);
  border-radius: 62% 38% 58% 42% / 48% 54% 46% 52%;
  transform: rotate(-12deg);
}
.wc-wash-2 {
  width: 58vw;
  height: 50vh;
  top: 20vh;
  right: -14vw;
  background: radial-gradient(ellipse at 55% 45%, rgba(168, 195, 180, 0.55) 0%, rgba(190, 215, 200, 0.3) 42%, transparent 70%);
  border-radius: 44% 56% 40% 60% / 58% 42% 56% 44%;
  transform: rotate(16deg);
}
.wc-wash-3 {
  width: 46vw;
  height: 40vh;
  bottom: 6vh;
  left: -8vw;
  background: radial-gradient(ellipse at 50% 50%, rgba(140, 180, 165, 0.38) 0%, rgba(175, 205, 190, 0.2) 48%, transparent 76%);
  border-radius: 64% 36% 52% 48% / 44% 56% 44% 56%;
  transform: rotate(6deg);
  opacity: 0.42;
}
.wc-wash-4 {
  width: 50vw;
  height: 42vh;
  bottom: -8vh;
  right: -10vw;
  background: radial-gradient(ellipse at 42% 52%, rgba(200, 185, 164, 0.6) 0%, rgba(232, 224, 212, 0.32) 42%, transparent 68%);
  border-radius: 52% 48% 46% 54% / 54% 46% 58% 42%;
  transform: rotate(-8deg);
}
.wc-wash-5 {
  width: 40vw;
  height: 34vh;
  top: 44vh;
  left: 26vw;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 252, 247, 0.9) 0%, rgba(245, 240, 232, 0.45) 55%, transparent 82%);
  border-radius: 68% 32% 54% 46% / 46% 54% 42% 58%;
  filter: blur(40px);
  mix-blend-mode: soft-light;
  opacity: 0.7;
}
.wc-wash-6 {
  width: 32vw;
  height: 28vh;
  top: 6vh;
  right: 20vw;
  background: radial-gradient(ellipse at 50% 50%, rgba(155, 190, 175, 0.35) 0%, transparent 72%);
  border-radius: 42% 58% 50% 50% / 52% 48% 54% 46%;
  transform: rotate(20deg);
  opacity: 0.38;
}
.wc-paper {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(110% 85% at 50% -5%, rgba(255, 252, 247, 0.6), transparent 52%),
    radial-gradient(85% 65% at 0% 100%, rgba(229, 221, 208, 0.28), transparent 58%);
  mix-blend-mode: soft-light;
}
.wc-grain {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  mix-blend-mode: multiply;
}

/* Background nature decor */
.bg-nature {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.butterfly, .leaf {
  position: absolute;
  filter: blur(0.2px);
}
.butterfly {
  color: var(--sage);
  opacity: 0.11;
}
.leaf {
  color: #8eb89e;
  opacity: 0.1;
}

.butterfly-1 { width: 72px; height: 72px; left: 4%; top: 8%; animation: bfFloatL1 9s ease-in-out infinite; }
.butterfly-2 { width: 52px; height: 52px; left: 1%; top: 34%; opacity: 0.09; animation: bfFloatL2 11s ease-in-out infinite 1.5s; }
.butterfly-3 { width: 44px; height: 44px; left: 7%; top: 58%; opacity: 0.1; color: var(--sand); animation: bfFloatL3 10s ease-in-out infinite 3s; }
.butterfly-4 { width: 68px; height: 68px; right: 3%; top: 12%; animation: bfFloatR1 10s ease-in-out infinite 0.8s; }
.butterfly-5 { width: 56px; height: 56px; right: 1%; top: 38%; opacity: 0.09; color: var(--beige-deep); animation: bfFloatR2 12s ease-in-out infinite 2.2s; }
.butterfly-6 { width: 40px; height: 40px; left: 3%; top: 76%; opacity: 0.08; animation: bfFloatL4 13s ease-in-out infinite 4s; }
.butterfly-7 { width: 60px; height: 60px; right: 5%; top: 58%; opacity: 0.1; animation: bfFloatR3 9.5s ease-in-out infinite 1.2s; }
.butterfly-8 { width: 36px; height: 36px; right: 0; top: 78%; opacity: 0.08; color: var(--sand); animation: bfFloatR4 11.5s ease-in-out infinite 2.8s; }
.butterfly-9 { width: 48px; height: 48px; left: 0; top: 20%; opacity: 0.09; animation: bfFloatL5 10.5s ease-in-out infinite 0.4s; }
.butterfly-10 { width: 54px; height: 54px; right: 6%; top: 28%; opacity: 0.1; animation: bfFloatR5 8.5s ease-in-out infinite 3.6s; }

.leaf-1 { width: 58px; height: 86px; left: 1%; top: 44%; animation: leafSwayL1 14s ease-in-out infinite; }
.leaf-2 { width: 42px; height: 62px; left: 5%; top: 66%; color: #9eb8a4; opacity: 0.08; animation: leafSwayL2 16s ease-in-out infinite 2s; }
.leaf-3 { width: 64px; height: 48px; left: 0; top: 88%; color: #a8c0b0; opacity: 0.09; animation: leafSwayL3 12s ease-in-out infinite 1s; }
.leaf-4 { width: 50px; height: 74px; right: 2%; top: 6%; animation: leafSwayR1 15s ease-in-out infinite 0.6s; }
.leaf-5 { width: 38px; height: 56px; right: 6%; top: 48%; color: #9eb8a4; opacity: 0.08; animation: leafSwayR2 13s ease-in-out infinite 2.4s; }
.leaf-6 { width: 54px; height: 80px; right: 0; top: 68%; animation: leafSwayR3 17s ease-in-out infinite 3.2s; }
.leaf-7 { width: 70px; height: 52px; right: 4%; top: 86%; color: #a8c0b0; opacity: 0.07; animation: leafSwayR4 11s ease-in-out infinite 1.8s; }
.leaf-8 { width: 34px; height: 50px; left: 8%; top: 10%; color: #b0c8b8; opacity: 0.07; animation: leafSwayL4 18s ease-in-out infinite 4.5s; }
.leaf-9 { width: 56px; height: 42px; right: 8%; top: 44%; color: #b0c8b8; opacity: 0.08; animation: leafSwayR5 14s ease-in-out infinite 0.9s; }
.leaf-10 { width: 46px; height: 68px; left: 2%; top: 90%; color: #8eb09e; opacity: 0.07; animation: leafSwayL5 15s ease-in-out infinite 2.6s; }

@keyframes bfFloatL1 {
  0%, 100% { transform: rotate(-18deg) scaleX(-1) translateY(0); }
  50% { transform: rotate(-14deg) scaleX(-1) translateY(-10px); }
}
@keyframes bfFloatL2 {
  0%, 100% { transform: rotate(12deg) scaleX(-1) translateY(0); }
  50% { transform: rotate(16deg) scaleX(-1) translateY(-8px); }
}
@keyframes bfFloatL3 {
  0%, 100% { transform: rotate(-8deg) scaleX(-1) translateY(0); }
  50% { transform: rotate(-4deg) scaleX(-1) translateY(-12px); }
}
@keyframes bfFloatL4 {
  0%, 100% { transform: rotate(6deg) scaleX(-1) translateY(0); }
  50% { transform: rotate(10deg) scaleX(-1) translateY(-6px); }
}
@keyframes bfFloatL5 {
  0%, 100% { transform: rotate(-24deg) scaleX(-1) translateY(0); }
  50% { transform: rotate(-20deg) scaleX(-1) translateY(-9px); }
}
@keyframes bfFloatR1 {
  0%, 100% { transform: rotate(22deg) translateY(0); }
  50% { transform: rotate(26deg) translateY(-10px); }
}
@keyframes bfFloatR2 {
  0%, 100% { transform: rotate(-14deg) translateY(0); }
  50% { transform: rotate(-10deg) translateY(-8px); }
}
@keyframes bfFloatR3 {
  0%, 100% { transform: rotate(18deg) translateY(0); }
  50% { transform: rotate(22deg) translateY(-11px); }
}
@keyframes bfFloatR4 {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50% { transform: rotate(-2deg) translateY(-7px); }
}
@keyframes bfFloatR5 {
  0%, 100% { transform: rotate(28deg) translateY(0); }
  50% { transform: rotate(32deg) translateY(-9px); }
}

@keyframes leafSwayL1 {
  0%, 100% { transform: rotate(-32deg) translateY(0); }
  50% { transform: rotate(-26deg) translateY(-6px); }
}
@keyframes leafSwayL2 {
  0%, 100% { transform: rotate(18deg) translateY(0); }
  50% { transform: rotate(22deg) translateY(-5px); }
}
@keyframes leafSwayL3 {
  0%, 100% { transform: rotate(-12deg) translateY(0); }
  50% { transform: rotate(-8deg) translateY(-4px); }
}
@keyframes leafSwayL4 {
  0%, 100% { transform: rotate(40deg) translateY(0); }
  50% { transform: rotate(44deg) translateY(-5px); }
}
@keyframes leafSwayL5 {
  0%, 100% { transform: rotate(-8deg) translateY(0); }
  50% { transform: rotate(-4deg) translateY(-6px); }
}
@keyframes leafSwayR1 {
  0%, 100% { transform: rotate(24deg) translateY(0); }
  50% { transform: rotate(20deg) translateY(-6px); }
}
@keyframes leafSwayR2 {
  0%, 100% { transform: rotate(-16deg) translateY(0); }
  50% { transform: rotate(-12deg) translateY(-5px); }
}
@keyframes leafSwayR3 {
  0%, 100% { transform: rotate(36deg) translateY(0); }
  50% { transform: rotate(32deg) translateY(-7px); }
}
@keyframes leafSwayR4 {
  0%, 100% { transform: rotate(-22deg) translateY(0); }
  50% { transform: rotate(-18deg) translateY(-4px); }
}
@keyframes leafSwayR5 {
  0%, 100% { transform: rotate(10deg) translateY(0); }
  50% { transform: rotate(14deg) translateY(-5px); }
}

@media (max-width: 480px) {
  .butterfly-1, .butterfly-2, .butterfly-3, .butterfly-6, .butterfly-9 { left: -3%; }
  .butterfly-4, .butterfly-5, .butterfly-7, .butterfly-8, .butterfly-10 { right: -3%; }
  .leaf-1, .leaf-2, .leaf-3, .leaf-8, .leaf-10 { left: -4%; }
  .leaf-4, .leaf-5, .leaf-6, .leaf-7, .leaf-9 { right: -4%; }
}

#app {
  position: relative; z-index: 1;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
}

.view {
  display: none;
  padding: 20px 20px 100px;
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.view.active { display: block; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glass */
.glass {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-organic);
  box-shadow: var(--shadow-soft);
}
.glass-nav {
  background: rgba(250, 247, 241, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--glass-border);
}
.card-pad { padding: 22px; margin-bottom: 16px; }

/* Hero */
.hero { margin-bottom: 24px; }
.hero.compact { margin-bottom: 20px; }
.hero-greeting {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage-dim);
  margin-bottom: 6px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero-date, .hero-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}
.hero-row {
  display: flex; align-items: flex-start; justify-content: space-between;
}
.date-nav { display: flex; gap: 6px; }

.ghost-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.25s;
}
.ghost-btn:active { transform: scale(0.92); background: var(--sage-glow); }

.section-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 10px;
}

/* Calorie ring */
.ring-card {
  padding: 28px 24px;
  margin-bottom: 16px;
  text-align: center;
  border-radius: 32px 26px 34px 22px / 26px 32px 24px 30px;
}
.ring-wrap {
  position: relative;
  width: 160px; height: 160px;
  margin: 0 auto 20px;
}
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 8; }
.ring-fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 364.42;
  stroke-dashoffset: 364.42;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-kcal {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--sage-deep);
  line-height: 1;
}
.ring-label { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

.ring-stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.stat-pill {
  padding: 8px 16px;
  border-radius: 100px;
  background: rgba(255, 252, 247, 0.7);
  border: 1px solid var(--glass-border);
}
.stat-pill.accent { border-color: rgba(122, 175, 160, 0.35); background: rgba(168, 195, 180, 0.15); }
.stat-pill span { display: block; font-size: 1rem; font-weight: 500; }
.stat-pill small { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-pill.warn { border-color: rgba(196, 154, 154, 0.35); }
.stat-pill.warn span { color: var(--danger); }

/* Macro tiles */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.macro-tile {
  padding: 14px 10px;
  border-radius: 22px 18px 24px 16px / 18px 22px 16px 24px;
  background: rgba(255, 252, 247, 0.65);
  border: 1px solid var(--glass-border);
  text-align: center;
}
.macro-ring { width: 36px; height: 36px; margin: 0 auto 8px; }
.macro-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mr-bg { fill: none; stroke: var(--surface-2); stroke-width: 3; }
.mr-fill {
  fill: none; stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 94.25; stroke-dashoffset: 94.25;
  transition: stroke-dashoffset 0.6s ease;
}
.protein .mr-fill { stroke: var(--protein); }
.carbs .mr-fill { stroke: var(--carbs); }
.fat .mr-fill { stroke: var(--fat); }
.macro-label { font-size: 0.65rem; color: var(--muted); display: block; text-transform: uppercase; letter-spacing: 0.06em; }
.macro-val { font-size: 0.8rem; font-weight: 500; }

/* Quick buttons */
.quick-scroll {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.quick-scroll::-webkit-scrollbar { display: none; }
.quick-btn {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 14px 18px;
  border-radius: 20px 24px 18px 22px / 22px 18px 24px 20px;
  background: rgba(255, 252, 247, 0.7);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.25s;
  min-width: 80px;
}
.quick-btn:active { transform: scale(0.95); border-color: var(--sage); background: rgba(168, 195, 180, 0.18); }
.quick-btn .qb-emoji { font-size: 1.6rem; }
.quick-btn .qb-name { font-size: 0.75rem; color: var(--muted); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-btn .qb-kcal { font-size: 0.8rem; font-weight: 500; color: var(--sage-deep); }
.quick-empty { color: var(--muted); font-size: 0.85rem; padding: 12px 0; }

.text-link {
  background: none; border: none;
  color: var(--sage-dim);
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 8px;
  font-family: var(--font-body);
}

/* Water */
.water-card { padding: 18px 20px; margin-bottom: 8px; }
.water-top { display: flex; justify-content: space-between; margin-bottom: 14px; }
.water-title { font-weight: 500; }
.water-count { color: var(--water); font-size: 0.9rem; }
.water-track { display: flex; gap: 8px; flex-wrap: wrap; }
.water-drop {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--glass-border);
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s;
}
.water-drop.filled {
  background: rgba(138, 184, 196, 0.18);
  border-color: var(--water);
  box-shadow: 0 0 10px rgba(138, 184, 196, 0.15);
}

/* Meals */
.meal-section { margin-bottom: 14px; }
.meal-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px; padding: 0 4px;
}
.meal-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
}
.meal-kcal { color: var(--muted); font-size: 0.8rem; }
.meal-items { display: flex; flex-direction: column; gap: 8px; }
.meal-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-radius: 20px 24px 18px 22px / 22px 18px 24px 20px;
  background: rgba(255, 252, 247, 0.72);
  border: 1px solid var(--glass-border);
  transition: border-color 0.2s;
}
.meal-item:active { border-color: var(--sage); }
.meal-item-info { flex: 1; min-width: 0; }
.meal-item-name { font-weight: 400; font-size: 0.95rem; }
.meal-item-meta { color: var(--muted); font-size: 0.72rem; margin-top: 3px; }
.meal-item-kcal { font-weight: 500; color: var(--sage-deep); font-size: 0.9rem; white-space: nowrap; }
.meal-item-actions { display: flex; gap: 2px; }
.meal-action {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none; background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}
.meal-action:hover { background: var(--surface-2); color: var(--text); }
.meal-action.del:hover { color: var(--danger); }
.meal-empty {
  padding: 20px; text-align: center;
  color: var(--muted); font-size: 0.85rem;
  border: 1px dashed var(--glass-border);
  border-radius: 14px;
  font-style: italic;
}
.cache-tag {
  display: inline-block;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--sage-glow);
  color: var(--sage);
  margin-left: 6px;
  vertical-align: middle;
}

/* Scan */
.scan-frame {
  aspect-ratio: 4/3;
  overflow: hidden;
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
}
.scan-frame img { width: 100%; height: 100%; object-fit: cover; }
.scan-placeholder { text-align: center; padding: 24px; }
.scan-orb {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--sage-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin: 0 auto 14px;
  animation: breathe 4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.06); opacity: 1; }
}
.muted { color: var(--muted); font-size: 0.85rem; }

.scan-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 14px;
}
.form-inline {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 14px;
}
.form-inline label { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.form-inline select {
  flex: 1; padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
}

.scan-result { padding: 22px; margin-top: 14px; }
.result-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--sage-glow);
  color: var(--sage);
  font-size: 0.75rem;
  margin-bottom: 14px;
  letter-spacing: 0.04em;
}
.result-desc { color: var(--muted); font-size: 0.85rem; margin: 10px 0; font-style: italic; }

/* Loading */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(240, 235, 227, 0.88);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 200; gap: 20px;
}
.breath-circle {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid var(--sage-dim);
  animation: breathAnim 3s ease-in-out infinite;
}
@keyframes breathAnim {
  0%, 100% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; }
}
.loading-text { color: var(--muted); font-size: 0.9rem; letter-spacing: 0.06em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 0.9rem; font-weight: 400;
  border: none; cursor: pointer;
  transition: all 0.25s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--sage-dim) 0%, #a8c8bc 55%, var(--beige) 120%);
  color: var(--sage-deep);
  font-weight: 500;
  box-shadow: 0 4px 18px rgba(106, 157, 143, 0.22);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-glass {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--glass-border);
}
.btn-glass:active { background: var(--sage-glow); }
.btn-full { width: 100%; }
.camera-btn { cursor: pointer; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 0.78rem;
  color: var(--muted); margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.form-group input, .form-group select {
  width: 100%; padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--sage-dim);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.85rem; color: var(--muted);
  margin: 12px 0 16px; cursor: pointer;
}
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--sage-dim); }

/* Quick manage */
.quick-manage-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-border);
}
.quick-manage-item:last-child { border-bottom: none; }
.qm-emoji { font-size: 1.4rem; }
.qm-info { flex: 1; }
.qm-name { font-weight: 400; }
.qm-meta { color: var(--muted); font-size: 0.75rem; }

.mindful-quote {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--sand);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* FAB */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  right: calc(50% - 220px);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sage-dim) 0%, #b0ccc0 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(106, 157, 143, 0.28);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.25s;
}
.fab:active { transform: scale(0.9); }
@media (max-width: 480px) { .fab { right: 20px; } }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(44, 50, 46, 0.28);
  backdrop-filter: blur(6px);
}
.modal-sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  background: var(--surface);
  border-radius: 32px 32px 0 0;
  border-top: 1px solid var(--glass-border);
  padding: 12px 22px calc(24px + var(--safe-b));
  animation: slideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 90dvh;
  overflow-y: auto;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-handle {
  width: 36px; height: 4px;
  background: var(--glass-border);
  border-radius: 2px;
  margin: 4px auto 16px;
}
.modal-sheet h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 18px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; z-index: 60;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; background: none; border: none;
  color: var(--muted); font-size: 0.68rem;
  font-family: var(--font-body);
  cursor: pointer; transition: color 0.3s;
  letter-spacing: 0.04em;
}
.nav-item.active { color: var(--sage-deep); }
.nav-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: transparent;
  transition: all 0.3s;
}
.nav-item.active .nav-dot {
  background: var(--sage-dim);
  box-shadow: 0 0 8px var(--sage-glow);
}

/* Login */
.login-screen {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  padding: 36px 28px;
  text-align: center;
}
.login-sub { color: var(--muted); margin: 8px 0 24px; font-size: 0.9rem; }
.login-form { text-align: left; }
.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(196, 154, 154, 0.12);
  border-radius: 14px;
}
.modal-forced { z-index: 600; }
.modal-forced .modal-backdrop.forced { cursor: default; }
.modal-forced .modal-sheet { z-index: 2; }

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 28px);
  left: 50%; transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--glass-border);
  padding: 12px 28px;
  border-radius: 100px;
  font-size: 0.85rem;
  z-index: 300;
  animation: rise 0.3s ease;
  white-space: nowrap;
}
