:root {
  --green-dark: #1b4332;
  --green-mid: #2d6a4f;
  --green-light: #95d5b2;
  --green-pale: #d8f3dc;
  --yellow: #f9a825;
  --white: #ffffff;
  --gray: #f5f5f5;
  --gray-mid: #e0e0e0;
  --text: #1a1a1a;
  --text-light: #666;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--gray); color: var(--text); min-height: 100vh; max-width: 480px; margin: 0 auto; position: relative; }

/* ===== SCREENS ===== */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ===== AUTH ===== */
.auth-screen { background: var(--green-dark); }
.auth-hero { padding: 60px 24px 32px; text-align: center; }
.auth-logo { width: 80px; height: 80px; border-radius: 20px; margin: 0 auto 16px; background: var(--green-light); display: flex; align-items: center; justify-content: center; font-size: 40px; }
.auth-hero h1 { color: var(--white); font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.auth-hero p { color: var(--green-light); font-size: 14px; line-height: 1.5; }
.auth-card { background: var(--white); border-radius: 32px 32px 0 0; flex: 1; padding: 32px 24px; }
.auth-tabs { display: flex; background: var(--gray); border-radius: 12px; padding: 4px; margin-bottom: 28px; }
.auth-tab { flex: 1; padding: 10px; text-align: center; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--text-light); transition: all .2s; border: none; background: none; }
.auth-tab.active { background: var(--white); color: var(--green-dark); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

/* ===== FORM ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-light); margin-bottom: 6px; }
.form-group input { width: 100%; padding: 14px 16px; border: 2px solid var(--gray-mid); border-radius: 12px; font-size: 15px; outline: none; transition: border .2s; background: var(--white); }
.form-group input:focus { border-color: var(--green-mid); }
.btn { width: 100%; padding: 16px; border-radius: 14px; font-size: 16px; font-weight: 700; cursor: pointer; border: none; transition: all .2s; }
.btn-primary { background: var(--green-dark); color: var(--white); }
.btn-primary:active { background: var(--green-mid); transform: scale(.98); }
.btn-secondary { background: var(--gray); color: var(--text); margin-top: 12px; }
.btn-google { background: var(--white); border: 2px solid var(--gray-mid); color: var(--text); display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-light); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-mid); }

/* ===== TOP BAR ===== */
.topbar { background: var(--green-dark); padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.topbar-title { color: var(--white); font-size: 18px; font-weight: 700; }
.topbar-subtitle { color: var(--green-light); font-size: 12px; }
.topbar-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--green-light); display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; }

/* ===== BOTTOM NAV ===== */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: var(--white); border-top: 1px solid var(--gray-mid); display: flex; padding: 8px 0 16px; z-index: 200; box-shadow: 0 -4px 20px rgba(0,0,0,0.08); }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 6px 4px; border: none; background: none; }
.nav-icon { font-size: 22px; }
.nav-label { font-size: 10px; font-weight: 600; color: var(--text-light); }
.nav-item.active .nav-icon { filter: none; }
.nav-item.active .nav-label { color: var(--green-dark); }
.nav-item.active { position: relative; }
.nav-item.active::after { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 32px; height: 3px; background: var(--green-dark); border-radius: 0 0 4px 4px; }

/* ===== CONTENT ===== */
.content { flex: 1; padding: 20px 16px 80px; overflow-y: auto; }

/* ===== HOME ===== */
.welcome-banner { background: linear-gradient(135deg, var(--green-dark), var(--green-mid)); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; color: var(--white); }
.welcome-banner h2 { font-size: 20px; margin-bottom: 4px; }
.welcome-banner p { font-size: 13px; opacity: .8; }
.level-badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.2); border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 600; margin-top: 12px; }

.section-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; color: var(--text); display: flex; justify-content: space-between; align-items: center; }
.section-title a { font-size: 13px; color: var(--green-mid); font-weight: 600; text-decoration: none; }

/* ===== RECIPE CARDS ===== */
.recipes-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.recipes-scroll::-webkit-scrollbar { display: none; }
.recipe-card { min-width: 160px; background: var(--white); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; flex-shrink: 0; }
.recipe-card-img { height: 110px; background: var(--green-pale); display: flex; align-items: center; justify-content: center; font-size: 48px; }
.recipe-card-body { padding: 12px; }
.recipe-card-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; line-height: 1.3; }
.recipe-card-meta { font-size: 11px; color: var(--text-light); }
.recipe-card-price { font-size: 12px; font-weight: 700; color: var(--green-mid); margin-top: 4px; }

.recipes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recipe-card-grid { background: var(--white); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; }
.recipe-card-grid .recipe-card-img { height: 120px; }

/* ===== STATS ===== */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: center; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--green-dark); }
.stat-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ===== RECIPE DETAIL ===== */
.recipe-hero { height: 220px; background: var(--green-pale); display: flex; align-items: center; justify-content: center; font-size: 80px; position: relative; }
.back-btn { position: absolute; top: 16px; left: 16px; width: 40px; height: 40px; background: var(--white); border-radius: 50%; display: flex; align-items: center; justify-content: center; border: none; font-size: 20px; cursor: pointer; box-shadow: var(--shadow); }
.recipe-detail-body { padding: 20px 16px 100px; }
.recipe-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.recipe-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tag { background: var(--green-pale); color: var(--green-dark); border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 600; }
.recipe-section { margin-bottom: 20px; }
.recipe-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--green-dark); }
.ingredient-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--gray); font-size: 14px; }
.ingredient-item::before { content: '✓'; color: var(--green-mid); font-weight: 700; }
.step-item { display: flex; gap: 12px; margin-bottom: 12px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--green-dark); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.step-text { font-size: 14px; line-height: 1.6; color: var(--text); }
.btn-done { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 448px; background: var(--green-dark); color: var(--white); padding: 18px; border-radius: 16px; font-size: 16px; font-weight: 700; border: none; cursor: pointer; box-shadow: 0 8px 24px rgba(27,67,50,0.4); }

/* ===== PLANNER ===== */
.week-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.week-tab { flex-shrink: 0; padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; border: 2px solid var(--gray-mid); background: var(--white); cursor: pointer; color: var(--text-light); }
.week-tab.active { background: var(--green-dark); border-color: var(--green-dark); color: var(--white); }
.planner-card { background: var(--white); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.planner-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--green-dark); }
.meal-slot { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray); cursor: pointer; }
.meal-slot:last-child { border-bottom: none; }
.meal-icon { font-size: 24px; }
.meal-info { flex: 1; }
.meal-name { font-size: 13px; font-weight: 600; }
.meal-cal { font-size: 12px; color: var(--text-light); }
.meal-add { color: var(--green-mid); font-size: 22px; }
.economy-card { background: linear-gradient(135deg, var(--green-dark), var(--green-mid)); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; color: var(--white); }
.economy-card h3 { font-size: 14px; opacity: .8; margin-bottom: 8px; }
.economy-value { font-size: 32px; font-weight: 800; }
.economy-sub { font-size: 12px; opacity: .7; margin-top: 4px; }
.economy-row { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13px; }
.economy-row span:last-child { font-weight: 700; }

/* ===== PROFILE ===== */
.profile-header { background: linear-gradient(135deg, var(--green-dark), var(--green-mid)); padding: 40px 20px 60px; text-align: center; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--green-light); margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; font-size: 36px; border: 3px solid rgba(255,255,255,0.3); }
.profile-name { color: var(--white); font-size: 20px; font-weight: 700; }
.profile-email { color: var(--green-light); font-size: 13px; margin-top: 4px; }
.profile-body { padding: 0 16px 80px; margin-top: -32px; }
.level-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.level-title { font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.level-name { font-size: 20px; font-weight: 800; color: var(--green-dark); margin-bottom: 12px; }
.progress-bar { height: 10px; background: var(--gray); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--green-mid), var(--green-light)); border-radius: 10px; transition: width .5s; }
.progress-text { font-size: 12px; color: var(--text-light); margin-top: 6px; text-align: right; }
.achievements-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.achievement { background: var(--white); border-radius: 16px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow); }
.achievement.locked { opacity: .4; filter: grayscale(1); }
.achievement-icon { font-size: 32px; margin-bottom: 6px; }
.achievement-name { font-size: 11px; font-weight: 700; color: var(--text); }
.achievement-desc { font-size: 10px; color: var(--text-light); margin-top: 2px; }
.logout-btn { width: 100%; padding: 16px; background: #fee2e2; color: #dc2626; border-radius: 14px; font-size: 15px; font-weight: 700; border: none; cursor: pointer; margin-top: 16px; }

/* ===== ADMIN ===== */
.admin-card { background: var(--white); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.admin-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--green-dark); }
.admin-stat { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--gray); font-size: 14px; }
.admin-stat:last-child { border-bottom: none; }
.admin-stat strong { color: var(--green-dark); font-size: 18px; }

/* ===== ONBOARDING ===== */
.onboarding-screen { background: var(--white); }
.onboarding-progress { height: 4px; background: var(--gray); }
.onboarding-fill { height: 100%; background: var(--green-mid); transition: width .4s; }
.onboarding-content { padding: 32px 20px; flex: 1; }
.onboarding-content h2 { font-size: 22px; font-weight: 800; color: var(--green-dark); margin-bottom: 8px; }
.onboarding-content p { font-size: 14px; color: var(--text-light); margin-bottom: 28px; }
.option-btn { width: 100%; padding: 16px 20px; background: var(--gray); border-radius: 14px; font-size: 15px; font-weight: 600; border: 2px solid transparent; cursor: pointer; text-align: left; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; transition: all .2s; color: var(--text); }
.option-btn:hover, .option-btn.selected { background: var(--green-pale); border-color: var(--green-mid); color: var(--green-dark); }
.option-icon { font-size: 24px; }
.onboarding-next { margin: 20px; }

/* ===== TOAST ===== */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--green-dark); color: var(--white); padding: 12px 24px; border-radius: 30px; font-size: 14px; font-weight: 600; z-index: 9999; opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; }

/* ===== LOADING ===== */
.loading { display: flex; align-items: center; justify-content: center; min-height: 200px; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--green-pale); border-top-color: var(--green-dark); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EMPTY STATE ===== */
.empty { text-align: center; padding: 40px 20px; color: var(--text-light); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty h3 { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty p { font-size: 14px; line-height: 1.5; }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 500; align-items: flex-end; }
.modal-overlay.show { display: flex; }
.modal { background: var(--white); border-radius: 24px 24px 0 0; padding: 24px 20px 40px; width: 100%; max-height: 80vh; overflow-y: auto; }
.modal h3 { font-size: 18px; font-weight: 800; margin-bottom: 16px; }

/* ===== SEARCH ===== */
.search-bar { display: flex; align-items: center; gap: 10px; background: var(--white); border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.search-bar input { flex: 1; border: none; outline: none; font-size: 15px; background: none; }
.search-icon { font-size: 18px; color: var(--text-light); }

/* ===== FILTER CHIPS ===== */
.filter-chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; scrollbar-width: none; padding-bottom: 4px; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; border: 2px solid var(--gray-mid); background: var(--white); cursor: pointer; color: var(--text-light); }
.chip.active { background: var(--green-dark); border-color: var(--green-dark); color: var(--white); }

/* ===== SUBSCRIPTION WALL ===== */
.sub-wall { background: linear-gradient(135deg, var(--green-dark), var(--green-mid)); min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; text-align: center; color: var(--white); }
.sub-wall h2 { font-size: 26px; font-weight: 800; margin-bottom: 12px; }
.sub-wall p { font-size: 15px; opacity: .85; margin-bottom: 32px; line-height: 1.6; }
.plan-cards { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.plan-card { background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.2); border-radius: 16px; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.plan-card.highlight { background: var(--yellow); border-color: var(--yellow); color: var(--text); }
.plan-name { font-size: 15px; font-weight: 700; }
.plan-price { font-size: 20px; font-weight: 800; }
.plan-period { font-size: 12px; opacity: .7; }
