/* ── RESET + VARIABLES ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0a0b10;
  --surface: #13151e;
  --surface2: #1c1f2e;
  --border: #252836;
  --text: #e8eaf6;
  --muted: #7b7f9e;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-dim: rgba(124,58,237,0.15);
  --green: #10b981;
  --green-dim: rgba(16,185,129,0.15);
  --red: #ef4444;
  --orange: #f59e0b;
  --blue: #3b82f6;
  --radius: 14px;
  --radius-sm: 8px;
  --nav-h: 64px;
  --header-h: 56px;
}
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.5; overflow-x: hidden; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }
a { color: var(--accent-light); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ── AUTH SCREEN ─────────────────────────────────────────────────── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0%, rgba(124,58,237,0.18) 0%, transparent 70%), var(--bg);
}
.auth-box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 32px;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.auth-logo h1 { font-size: 28px; font-weight: 800; background: linear-gradient(135deg, #a78bfa, #7c3aed); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-logo p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.auth-tabs { display: flex; background: var(--surface2); border-radius: 10px; padding: 4px; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 8px; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; transition: .2s; }
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 16px;
  color: var(--text);
  transition: border-color .2s;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-form input::placeholder { color: var(--muted); }
.auth-error { color: var(--red); font-size: 13px; text-align: center; padding: 8px; background: rgba(239,68,68,0.1); border-radius: 8px; margin-top: 4px; }
.auth-divider { display:flex; align-items:center; gap:10px; margin: 12px 0; color: var(--muted); font-size:13px; }
.auth-divider::before, .auth-divider::after { content:''; flex:1; height:1px; background: var(--border); }
.btn-google { width:100%; display:flex; align-items:center; justify-content:center; gap:10px; padding:12px; background:var(--card); color:var(--text); border:1px solid var(--border); border-radius:10px; font-size:15px; font-weight:500; cursor:pointer; transition:background .2s; }
.btn-google:hover { background:var(--border); }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  padding: 13px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  transition: opacity .2s, transform .1s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.small { padding: 8px 16px; font-size: 13px; border-radius: 8px; }
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  transition: border-color .2s;
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent-light); font-weight: 600; font-size: 14px; padding: 6px 0; }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.3); padding: 12px 20px; border-radius: 12px; font-weight: 600; width: 100%; margin-top: 8px; }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

/* ── APP LAYOUT ──────────────────────────────────────────────────── */
#app-screen { display: flex; flex-direction: column; min-height: 100vh; }
#top-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(10,11,16,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 12px;
}
.header-logo { font-size: 20px; font-weight: 800; background: linear-gradient(135deg, #a78bfa, #7c3aed); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; flex: 1; }
.desktop-nav { display: none; gap: 4px; }
.desktop-nav-btn {
  padding: 7px 14px; border-radius: 8px; background: transparent;
  color: var(--muted); font-weight: 600; font-size: 14px;
  transition: .2s; display: flex; align-items: center; gap: 6px;
}
.desktop-nav-btn:hover { background: var(--surface2); color: var(--text); }
.desktop-nav-btn.active { background: var(--accent-dim); color: var(--accent-light); }
.header-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; cursor: pointer;
}

#main-content {
  flex: 1;
  margin-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + 16px);
}
.view { display: none; }
.view.active { display: block; }
.view-inner { max-width: 680px; margin: 0 auto; padding: 20px 16px; }

/* ── BOTTOM NAV ──────────────────────────────────────────────────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(19,21,30,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
}
.bnav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: transparent; color: var(--muted); padding: 6px 0;
  transition: color .2s;
}
.bnav-btn.active { color: var(--accent-light); }
.bnav-icon { font-size: 22px; line-height: 1; }
.bnav-label { font-size: 11px; font-weight: 600; }

/* ── CARDS ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.section-title { font-size: 16px; font-weight: 700; margin: 20px 0 12px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header h2 { font-size: 20px; font-weight: 800; }
.section-header h3 { font-size: 17px; font-weight: 700; }

/* ── HOME VIEW ───────────────────────────────────────────────────── */
.greeting-card {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(91,33,182,0.1));
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.greeting-card h2 { font-size: 22px; font-weight: 800; }
.greeting-card p { color: var(--muted); margin-top: 4px; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-num { font-size: 26px; font-weight: 800; color: var(--accent-light); }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.week-row { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 16px; }
.week-day {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border);
}
.week-day.today { border-color: var(--accent); background: var(--accent-dim); }
.week-day.attended { background: var(--green-dim); border-color: var(--green); }
.week-day.rest { opacity: 0.5; }
.week-day-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.week-day-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.week-day.attended .week-day-dot { background: var(--green); }
.week-day.today .week-day-dot { background: var(--accent); }

/* ── TODAY CARD ──────────────────────────────────────────────────── */
.today-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.today-card.rest-day { border-color: rgba(123,127,158,0.3); }
.today-card.training-day { border-color: rgba(124,58,237,0.4); }
.today-card.attended-day { border-color: var(--green); background: var(--green-dim); }
.today-card.skipped-day  { border-color: var(--orange); background: rgba(245,158,11,0.07); }
.checkin-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 14px;
  transition: opacity .2s, transform .1s;
  box-shadow: 0 4px 24px rgba(124,58,237,0.3);
}
.checkin-btn:active { transform: scale(0.98); }
.checkin-btn.checked { background: linear-gradient(135deg, #059669, #047857); box-shadow: 0 4px 24px rgba(16,185,129,0.3); }
.checkin-btn.skip-btn { background: var(--surface2); }
.checkin-btn.skip-btn.skipped { background: linear-gradient(135deg, #b45309, #92400e); box-shadow: 0 4px 24px rgba(245,158,11,0.3); }
.checkin-icon { font-size: 22px; }

/* ── GYM SETUP ───────────────────────────────────────────────────── */
.steps-row { display: flex; align-items: center; gap: 0; margin-bottom: 28px; }
.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--muted);
  flex-shrink: 0;
}
.step-circle.active { border-color: var(--accent); color: var(--accent-light); background: var(--accent-dim); }
.step-circle.done { border-color: var(--green); background: var(--green-dim); color: var(--green); }
.step-line { flex: 1; height: 2px; background: var(--border); }
.step-line.done { background: var(--green); }
.setup-step { display: none; }
.setup-step.active { display: block; }
.setup-step h3 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.days-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.day-option-btn {
  padding: 14px; border-radius: 12px;
  background: var(--surface2); border: 2px solid var(--border);
  color: var(--text); font-weight: 700; font-size: 15px;
  transition: .2s;
}
.day-option-btn.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent-light); }
.weekday-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.weekday-btn {
  padding: 12px 6px; border-radius: 10px;
  background: var(--surface2); border: 2px solid var(--border);
  color: var(--text); font-weight: 700; font-size: 13px;
  transition: .2s; text-align: center;
}
.weekday-btn.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent-light); }
.muscle-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.muscle-btn {
  padding: 11px 14px; border-radius: 10px;
  background: var(--surface2); border: 2px solid var(--border);
  color: var(--text); font-weight: 600; font-size: 14px;
  transition: .2s; text-align: left;
}
.muscle-btn.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent-light); }
.day-exercises-block { background: var(--surface2); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.day-exercises-block h4 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.exercise-input-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.exercise-input-row .ex-name { flex: 1; }
.exercise-input-row .ex-sets, .exercise-input-row .ex-reps { width: 64px; }
.ex-saved { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 8px; padding: 9px 12px; margin-bottom: 6px; font-size: 14px; }
.ex-saved .ex-info { display: flex; flex-direction: column; }
.ex-saved .ex-sets-reps { font-size: 12px; color: var(--muted); }
.ex-remove { color: var(--red); font-size: 18px; background: none; border: none; padding: 0 4px; }
.add-exercise-btn { color: var(--accent-light); font-weight: 600; font-size: 14px; background: none; border: 1px dashed rgba(124,58,237,0.4); border-radius: 8px; width: 100%; padding: 9px; margin-top: 6px; }
.form-row { display: flex; gap: 10px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.form-actions .btn-primary, .form-actions .btn-secondary { flex: 1; }

/* Rating display */
.rating-display { text-align: center; padding: 28px 20px; }
.rating-score { font-size: 72px; font-weight: 900; line-height: 1; }
.rating-grade { font-size: 18px; font-weight: 700; margin-top: 4px; }
.rating-bar-wrap { background: var(--surface2); border-radius: 100px; height: 8px; margin: 16px 0 20px; overflow: hidden; }
.rating-bar { height: 100%; border-radius: 100px; transition: width .6s ease; }
.rating-feedback { text-align: left; }
.feedback-item { display: flex; gap: 8px; padding: 9px 12px; background: var(--surface2); border-radius: 10px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.freq-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 20px; }
.freq-item { background: var(--surface2); border-radius: 8px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.freq-badge { background: var(--accent-dim); color: var(--accent-light); border-radius: 6px; padding: 2px 8px; font-weight: 700; font-size: 12px; }
.freq-badge.good { background: var(--green-dim); color: var(--green); }

/* ── GYM VIEW (today + history) ──────────────────────────────────── */
.workout-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.day-badge { background: var(--accent-dim); color: var(--accent-light); border-radius: 8px; padding: 4px 12px; font-size: 13px; font-weight: 700; }
.rest-card { text-align: center; padding: 40px 20px; color: var(--muted); }
.rest-card .rest-emoji { font-size: 48px; margin-bottom: 12px; }
.exercise-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.exercise-card { background: var(--surface2); border-radius: 12px; padding: 14px; }
.exercise-card h4 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.sets-row { display: flex; gap: 8px; flex-wrap: wrap; }
.set-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.history-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.history-date { font-size: 14px; font-weight: 700; }
.history-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.history-badge { font-size: 20px; }

/* ── PR VIEW ─────────────────────────────────────────────────────── */
.pr-form { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.pr-form select, .pr-form input { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text); width: 100%; }
.pr-input-row { display: grid; grid-template-columns: 1fr 80px 1fr; gap: 10px; }
.pr-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 10px; }
.pr-card-header { display: flex; align-items: center; justify-content: space-between; }
.pr-exercise-name { font-weight: 700; font-size: 15px; }
.pr-weight-display { font-size: 22px; font-weight: 800; color: var(--accent-light); }
.pr-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.pr-level { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-top: 8px; }
.pr-level.beginner { background: rgba(107,114,128,0.2); color: #9ca3af; }
.pr-level.intermediate { background: rgba(59,130,246,0.2); color: var(--blue); }
.pr-level.advanced { background: rgba(124,58,237,0.2); color: var(--accent-light); }
.pr-level.elite { background: rgba(245,158,11,0.2); color: var(--orange); }
.pr-caption { color: var(--muted); font-size: 12px; margin-top: 4px; font-style: italic; }
.pr-ratio { background: rgba(124,58,237,0.15); color: var(--accent-light); padding: 1px 7px; border-radius: 5px; font-size: 11px; margin-left: 6px; }
.leaderboard-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.lb-rank { font-size: 20px; font-weight: 900; min-width: 32px; }
.lb-rank.gold { color: #fbbf24; }
.lb-rank.silver { color: #9ca3af; }
.lb-rank.bronze { color: #cd7f32; }
.lb-name { flex: 1; font-weight: 700; }
.lb-weight { font-weight: 800; color: var(--accent-light); }
.lb-est { font-size: 12px; color: var(--muted); }
.me-badge { font-size: 11px; background: var(--accent-dim); color: var(--accent-light); border-radius: 6px; padding: 1px 7px; margin-left: 6px; }

/* ── CALORIES VIEW ───────────────────────────────────────────────── */
.cal-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 16px; }
.cal-nav h2 { font-size: 18px; font-weight: 800; min-width: 140px; text-align: center; }
.cal-nav-btn { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; color: var(--text); font-size: 18px; }
.macro-overview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.macro-cals { text-align: center; margin-bottom: 14px; }
.macro-cals .cal-num { font-size: 40px; font-weight: 900; color: var(--accent-light); }
.macro-cals .cal-goal { font-size: 13px; color: var(--muted); }
.macro-bars { display: flex; flex-direction: column; gap: 10px; }
.macro-bar-row { display: flex; align-items: center; gap: 10px; }
.macro-bar-label { width: 70px; font-size: 13px; font-weight: 600; }
.macro-bar-track { flex: 1; height: 8px; background: var(--surface2); border-radius: 100px; overflow: hidden; }
.macro-bar-fill { height: 100%; border-radius: 100px; transition: width .4s ease; }
.macro-bar-val { font-size: 13px; font-weight: 700; min-width: 50px; text-align: right; }
.bar-protein { background: var(--blue); }
.bar-carbs { background: var(--orange); }
.bar-fat { background: var(--red); }
.cal-history-row { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px; margin-bottom:10px; cursor:pointer; transition:border-color .15s; }
.cal-history-row:hover { border-color:var(--accent); }
.meal-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.meal-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.meal-header h3 { font-size: 16px; font-weight: 700; flex: 1; }
.meal-cals { font-size: 13px; color: var(--muted); font-weight: 600; }
.add-food-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent-dim); color: var(--accent-light);
  font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.meal-items { padding: 0 16px 12px; }
.food-log-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.food-log-info { flex: 1; }
.food-log-name { font-size: 14px; font-weight: 600; }
.food-log-macros { font-size: 12px; color: var(--muted); }
.food-log-cal { font-weight: 700; font-size: 14px; color: var(--accent-light); }
.food-remove-btn { background: none; color: var(--muted); font-size: 18px; padding: 2px 4px; }
.food-remove-btn:hover { color: var(--red); }

/* ── FOOD MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-sheet {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-drag { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 12px auto 0; flex-shrink: 0; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 10px; flex-shrink: 0; }
.modal-header h3 { font-size: 18px; font-weight: 800; }
.modal-close { background: var(--surface2); border-radius: 50%; width: 30px; height: 30px; font-size: 16px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.modal-tabs { display: flex; padding: 0 16px 12px; gap: 8px; flex-shrink: 0; }
.modal-tab {
  flex: 1; padding: 9px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); font-weight: 600; font-size: 13px;
  transition: .2s;
}
.modal-tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-light); }
.modal-body { flex: 1; overflow-y: auto; padding: 0 16px 24px; }
.food-tab-panel { display: none; }
.food-tab-panel.active { display: block; }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px;
  margin-bottom: 12px;
}
.search-bar input { flex: 1; background: transparent; border: none; color: var(--text); font-size: 15px; }
.search-bar input::placeholder { color: var(--muted); }
.food-result-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: .15s;
}
.food-result-item:hover { padding-left: 4px; }
.food-result-item:active { opacity: 0.7; }
.fr-name { font-weight: 600; font-size: 14px; }
.fr-serving { font-size: 12px; color: var(--muted); }
.fr-cal { font-weight: 700; color: var(--accent-light); font-size: 14px; }
.selected-food-box { background: var(--accent-dim); border: 1px solid rgba(124,58,237,0.3); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.sf-name { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.sf-macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; margin-bottom: 12px; }
.sf-macro { background: var(--surface2); border-radius: 8px; padding: 8px; }
.sf-macro-val { font-weight: 800; font-size: 16px; }
.sf-macro-label { font-size: 11px; color: var(--muted); }
.size-btn { flex:1; padding:9px 6px; background:var(--surface2); border:1px solid var(--border); border-radius:8px; color:var(--muted); font-size:13px; font-weight:600; cursor:pointer; transition:all .15s; }
.size-btn.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.serving-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.serving-row label { font-size: 14px; color: var(--muted); }
.serving-row input { width: 80px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; color: var(--text); }
.serving-row .unit-label { font-size: 14px; color: var(--muted); }
.photo-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.photo-btn-label {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px 16px; border-radius: 14px;
  background: var(--surface2); border: 2px dashed var(--border);
  cursor: pointer; transition: border-color .2s;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.photo-btn-label:hover { border-color: var(--accent); color: var(--accent-light); }
.photo-btn-label .photo-icon { font-size: 32px; }
.photo-preview-box { border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.photo-preview-box img { width: 100%; max-height: 200px; object-fit: cover; }
.analyzing-box { text-align: center; padding: 28px; color: var(--muted); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.photo-result-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.photo-totals { background: var(--surface2); border-radius: 10px; padding: 12px 16px; margin: 12px 0; }
.custom-form { display: flex; flex-direction: column; gap: 12px; }
.custom-form input { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text); }
.custom-form input::placeholder { color: var(--muted); }
.macro-inputs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.macro-input label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.save-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }

/* ── PROFILE VIEW ────────────────────────────────────────────────── */
.profile-hero { text-align: center; padding: 24px 0 20px; }
.profile-avatar-big { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, #7c3aed, #5b21b6); display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 800; margin: 0 auto 12px; }
.profile-name-big { font-size: 22px; font-weight: 800; }
.profile-email-text { color: var(--muted); font-size: 14px; margin-top: 4px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.profile-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.profile-stat-num { font-size: 28px; font-weight: 800; color: var(--accent-light); }
.profile-stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-row label { font-size: 14px; }
.setting-row select, .setting-row input { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; color: var(--text); width: 110px; }

/* ── TOAST ───────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 22px;
  font-size: 14px; font-weight: 600; z-index: 300;
  animation: fadeInUp .2s ease, fadeOut .3s ease 2s forwards;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }
@keyframes fadeInUp { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ── MISC ────────────────────────────────────────────────────────── */
.form-input {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; color: var(--text); width: 100%;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
select.form-input { appearance: none; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }
.back-btn { background: none; color: var(--muted); font-size: 15px; padding: 4px 0; display: flex; align-items: center; gap: 4px; }

/* ── DESKTOP ─────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .desktop-nav { display: flex; }
  #bottom-nav { display: none; }
  #main-content { padding-bottom: 24px; }
  .modal-overlay { align-items: center; }
  .modal-sheet { border-radius: 24px; max-height: 85vh; }
  .view-inner { padding: 28px 20px; }
  .days-grid { grid-template-columns: repeat(4, 1fr); }
  .weekday-grid { grid-template-columns: repeat(7, 1fr); }
}
@media (min-width: 1024px) {
  .view-inner { max-width: 760px; }
}
