/* ══════════════════════════════════════════════════════════
   FitTracker — Main Stylesheet
   ══════════════════════════════════════════════════════════ */

/* ── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #f1f5f9;
  --card:       #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-w:  240px;
  --primary:    #6366f1;
  --primary-dk: #4f46e5;
  --green:      #22c55e;
  --orange:     #f97316;
  --red:        #ef4444;
  --yellow:     #eab308;
  --text:       #0f172a;
  --text-sub:   #64748b;
  --border:     #e2e8f0;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08);
  --radius:     12px;
  --radius-sm:  8px;
  --transition: .2s ease;
}

html { font-size: 15px; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg); color: var(--text); line-height: 1.6; }
a    { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }

/* ── Auth Pages — Split-screen layout ───────────────────────── */
.auth-body { margin: 0; padding: 0; background: #0f172a;
             min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }

/* Left hero panel */
.auth-hero { position: relative; overflow: hidden; min-height: 100vh; }
.auth-hero-img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.auth-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(99,102,241,.75) 0%, rgba(15,23,42,.85) 100%);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 48px;
}
.auth-hero-logo { width: 64px; height: 64px; object-fit: contain; border-radius: 12px;
                  margin-bottom: 24px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.auth-hero-title { color: #fff; font-size: 36px; font-weight: 700; line-height: 1.2;
                   margin-bottom: 12px; }
.auth-hero-title span { color: #a5b4fc; }
.auth-hero-bullets { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.auth-hero-bullets li { color: rgba(255,255,255,.8); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.auth-hero-bullets li::before { content: "✓"; color: #22c55e; font-weight: 700; }

/* Right form panel */
.auth-form-side { display: flex; align-items: center; justify-content: center;
                  padding: 48px 40px; background: #fff; overflow-y: auto; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card-wide { max-width: 480px; }

.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo-img  { width: 56px; height: 56px; object-fit: contain; border-radius: 10px;
                  margin: 0 auto 10px; display: block; }
.auth-logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.auth-logo-text { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.auth-logo-sub  { color: var(--text-sub); font-size: 14px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-switch { text-align: center; font-size: 14px; color: var(--text-sub); margin-top: 16px; }

/* ── Google / OAuth button ──────────────────────────────────── */
.oauth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px;
                 color: var(--text-sub); font-size: 13px; }
.oauth-divider::before, .oauth-divider::after { content: ''; flex: 1;
  height: 1px; background: var(--border); }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: #fff;
  font-size: 14px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; font-family: inherit;
}
.btn-google:hover { border-color: #4285F4; background: #f8f9ff;
                    box-shadow: 0 2px 8px rgba(66,133,244,.15); text-decoration: none; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group       { display: flex; flex-direction: column; gap: 6px; }
.form-group-grow  { flex: 1; }
.form-group-btn   { flex-shrink: 0; }
.form-label       { font-size: 13px; font-weight: 500; color: var(--text-sub); }
.required         { color: var(--red); }

.form-input, .form-select {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; color: var(--text); background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
textarea.form-input { resize: vertical; min-height: 80px; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-row-between { display: flex; justify-content: space-between; align-items: center; }
.form-inline-row  { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.form-actions     { display: flex; gap: 12px; margin-top: 8px; }

.otp-input { font-size: 28px; letter-spacing: 12px; text-align: center; font-weight: 600; }

.input-with-toggle { position: relative; }
.input-with-toggle .form-input { padding-right: 40px; }
.toggle-password { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
                   background: none; border: none; cursor: pointer; font-size: 16px; padding: 0; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  border: 1.5px solid transparent; cursor: pointer; transition: all var(--transition);
  font-family: inherit; line-height: 1.4; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); }
.btn-outline  { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: rgba(99,102,241,.06); }
.btn-ghost    { background: transparent; color: var(--text-sub); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-full     { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.btn-sm       { padding: 6px 12px; font-size: 13px; }
.btn.disabled, .btn[disabled] { opacity: .45; pointer-events: none; }
.btn-icon-del { background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px 6px;
                opacity: .6; transition: opacity var(--transition); }
.btn-icon-del:hover { opacity: 1; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ── Links ───────────────────────────────────────────────────── */
.link-primary { color: var(--primary); font-weight: 500; }
.link-muted   { color: var(--text-sub); font-size: 13px; }
.link-muted:hover { color: var(--text); }

/* ─────────────────────────────────────────────────────────────
   APP LAYOUT
   ───────────────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh; background: var(--sidebar-bg);
  display: flex; flex-direction: column; position: fixed; left: 0; top: 0; z-index: 200;
  transition: transform var(--transition);
}

.sidebar-header { display: flex; align-items: center; justify-content: space-between;
                  padding: 20px 20px 12px; border-bottom: 1px solid rgba(255,255,255,.06); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 24px; }
.logo-img  { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; flex-shrink: 0; }
.logo-text { font-size: 17px; font-weight: 700; color: #fff; }
.sidebar-close { display: none; background: none; border: none; color: rgba(255,255,255,.5);
                 font-size: 18px; cursor: pointer; padding: 4px; }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
            border-radius: 8px; color: rgba(255,255,255,.65); font-size: 14px; font-weight: 500;
            transition: all var(--transition); text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon  { font-size: 18px; width: 24px; text-align: center; }
.nav-divider { height: 1px; background: rgba(255,255,255,.08); margin: 8px 4px; }
.nav-logout { color: rgba(255,100,100,.7); }
.nav-logout:hover { background: rgba(239,68,68,.15); color: #fca5a5; }

.sidebar-user { padding: 16px; border-top: 1px solid rgba(255,255,255,.06);
                display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary);
               display: flex; align-items: center; justify-content: center;
               color: #fff; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.user-name  { font-size: 13px; font-weight: 600; color: #fff; }
.user-email { font-size: 11px; color: rgba(255,255,255,.45); overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }

/* ── Main area ───────────────────────────────────────────────── */
.main-area { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column;
             min-height: 100vh; }

.top-bar { height: 60px; background: #fff; border-bottom: 1px solid var(--border);
           display: flex; align-items: center; padding: 0 24px; gap: 16px;
           position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.menu-toggle { display: none; background: none; border: none; font-size: 22px;
               cursor: pointer; color: var(--text-sub); padding: 4px; }
.page-title  { font-weight: 600; font-size: 16px; flex: 1; }
.top-bar-date { font-size: 13px; color: var(--text-sub); }

.content-area { padding: 24px; flex: 1; }

/* ── Sidebar overlay (mobile) ───────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
                   z-index: 150; }

/* ── Mobile bottom nav ──────────────────────────────────────── */
.mobile-bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0;
                     background: var(--sidebar-bg); border-top: 1px solid rgba(255,255,255,.1);
                     z-index: 200; }
.mob-nav { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
           padding: 8px 4px 10px; color: rgba(255,255,255,.5); font-size: 10px;
           text-decoration: none; transition: color var(--transition); }
.mob-nav:hover, .mob-nav.active { color: var(--primary); text-decoration: none; }
.mob-nav span:first-child { font-size: 20px; }

/* ─────────────────────────────────────────────────────────────
   COMPONENTS
   ───────────────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius); padding: 20px;
        box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 16px; }
.card-header .card-title { margin: 0; }
.card-link { font-size: 13px; color: var(--primary); }
.empty-card { text-align: center; color: var(--text-sub); padding: 20px; }

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px;
             box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 12px;
             position: relative; overflow: hidden; }
.stat-card-sm { background: var(--card); border-radius: var(--radius); padding: 20px;
                box-shadow: var(--shadow); }
.stat-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dk)); color: #fff; }
.stat-primary .stat-label, .stat-primary .stat-sub { color: rgba(255,255,255,.75); }
.stat-icon { font-size: 28px; }
.stat-body { flex: 1; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--text-sub); margin-top: 2px; }
.stat-sub   { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.stat-sm-label { font-size: 12px; font-weight: 500; color: var(--text-sub); margin-bottom: 4px; }
.stat-sm-value { font-size: 24px; font-weight: 700; margin-bottom: 2px; }
.stat-sm-sub   { font-size: 12px; color: var(--text-sub); }

.stat-ring { position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
             width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
.ring-svg { width: 56px; height: 56px; position: absolute; }
.stat-ring span { font-size: 12px; font-weight: 600; color: #fff; position: relative; z-index: 1; }

.stat-progress { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.progress-bar  { flex: 1; height: 6px; background: rgba(0,0,0,.06); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }
.progress-fill.protein { background: var(--green); }
.progress-fill.fat      { background: var(--orange); }
.progress-fill.carbs    { background: var(--primary); }
.stat-progress span { font-size: 12px; color: var(--text-sub); width: 32px; text-align: right; }

/* ── Quick Actions ──────────────────────────────────────────── */
.quick-actions { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.quick-btn { display: inline-flex; align-items: center; gap: 8px;
             padding: 12px 20px; background: var(--card); border-radius: var(--radius-sm);
             font-weight: 500; font-size: 14px; box-shadow: var(--shadow); color: var(--text);
             transition: all var(--transition); text-decoration: none; }
.quick-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--primary);
                   text-decoration: none; }

/* ── Dashboard Grid ─────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── Meals ───────────────────────────────────────────────────── */
.meal-section { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.meal-section:last-child { border-bottom: none; margin-bottom: 0; }
.meal-header  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.meal-label   { font-size: 13px; font-weight: 600; color: var(--text-sub); }
.meal-cal     { font-size: 13px; font-weight: 600; color: var(--primary); }
.meal-empty   { font-size: 12px; color: var(--text-sub); font-style: italic; }
.meal-item    { display: flex; justify-content: space-between; align-items: center;
                padding: 3px 0; font-size: 13px; }
.meal-item-name { color: var(--text); }
.meal-item-meta { color: var(--text-sub); font-size: 12px; }
.day-remaining { text-align: center; padding: 10px; border-radius: var(--radius-sm);
                 background: #f0fdf4; color: #166534; font-size: 13px; font-weight: 500; margin-top: 12px; }
.day-remaining.over-budget { background: #fef2f2; color: #991b1b; }

/* ── Workout items ──────────────────────────────────────────── */
.workout-list  { display: flex; flex-direction: column; gap: 8px; }
.workout-item  { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius-sm);
                 background: var(--bg); }
.workout-icon  { font-size: 22px; }
.workout-name  { font-size: 14px; font-weight: 500; }
.workout-meta  { font-size: 12px; color: var(--text-sub); }
.workout-card  { padding: 16px 20px; }
.workout-card-header { display: flex; justify-content: space-between; align-items: center;
                       margin-bottom: 12px; }
.workout-card-meta { display: flex; align-items: center; gap: 8px; }
.workout-notes { font-size: 13px; color: var(--text-sub); margin-top: 8px; }
.workout-type-badge { margin-right: 6px; font-size: 16px; }
.badge { font-size: 12px; background: var(--bg); color: var(--text-sub);
         padding: 3px 8px; border-radius: 20px; border: 1px solid var(--border); }

/* ── Weight ─────────────────────────────────────────────────── */
.weight-display { text-align: center; padding: 12px; }
.weight-value   { font-size: 48px; font-weight: 700; color: var(--primary); }
.weight-unit    { font-size: 20px; font-weight: 400; color: var(--text-sub); }
.weight-date    { font-size: 13px; color: var(--text-sub); margin-top: 4px; }
.weight-goal-diff { display: inline-block; margin-top: 8px; padding: 4px 12px; border-radius: 20px;
                    font-size: 13px; font-weight: 500; background: #fef2f2; color: #991b1b; }
.weight-goal-diff.at-goal { background: #f0fdf4; color: #166534; }

/* ── Date Nav ───────────────────────────────────────────────── */
.date-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.date-input { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
              font-family: inherit; font-size: 14px; color: var(--text); cursor: pointer; background: #fff; }
.date-input:focus { outline: none; border-color: var(--primary); }

/* ── Macro bars ─────────────────────────────────────────────── */
.macro-bar-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.macro-bar-item { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.macro-label    { font-size: 12px; font-weight: 600; color: var(--text-sub); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; }
.macro-bar-track { height: 8px; background: rgba(0,0,0,.06); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.macro-bar-fill  { height: 100%; border-radius: 4px; transition: width .4s ease; }
.macro-bar-fill.cal     { background: linear-gradient(90deg, var(--primary), var(--primary-dk)); }
.macro-bar-fill.protein { background: var(--green); }
.macro-bar-fill.fat     { background: var(--orange); }
.macro-bar-fill.carbs   { background: var(--primary); }
.macro-nums { font-size: 13px; color: var(--text-sub); }
.macro-nums strong { color: var(--text); }

/* ── Food Table ─────────────────────────────────────────────── */
.food-table, .exercise-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.food-table th, .exercise-table th { text-align: left; padding: 8px 10px; font-size: 11px;
  font-weight: 600; color: var(--text-sub); text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border); }
.food-table td, .exercise-table td { padding: 8px 10px; border-bottom: 1px solid rgba(226,232,240,.5); }
.food-table tr:last-child td, .exercise-table tr:last-child td { border-bottom: none; }
.food-table tr:hover td { background: var(--bg); }
.food-name-cell { font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.meal-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.meal-title      { font-size: 15px; font-weight: 600; }
.meal-cal-badge  { background: rgba(99,102,241,.1); color: var(--primary); font-size: 13px;
                   font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.meal-empty-card { font-size: 13px; color: var(--text-sub); font-style: italic; padding: 8px 0; }
.meal-add-btn    { font-size: 12px; margin-top: 8px; }

.section-actions { margin-bottom: 20px; display: flex; gap: 12px; flex-wrap: wrap; }
.section-title   { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text); }

/* ── Exercises ──────────────────────────────────────────────── */
.exercises-section { margin: 16px 0; }
.exercises-header  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.exercises-header h3 { font-size: 14px; font-weight: 600; }
.exercise-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.ex-name  { flex: 1; min-width: 140px; }
.ex-small { width: 70px; flex-shrink: 0; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300;
                  display: flex; align-items: center; justify-content: center; padding: 20px;
                  backdrop-filter: blur(2px); }
.modal { background: var(--card); border-radius: var(--radius); width: 100%; max-width: 560px;
         max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center;
                padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer;
               color: var(--text-sub); padding: 4px; transition: color var(--transition); }
.modal-close:hover { color: var(--text); }
.modal-body   { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px;
                padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Food Search ────────────────────────────────────────────── */
.search-row { display: flex; gap: 8px; }
.search-row .form-input { flex: 1; }
.search-results { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
                  background: #fff; max-height: 220px; overflow-y: auto; display: none; }
.search-results.visible { display: block; }
.search-result-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid rgba(226,232,240,.5);
                      transition: background var(--transition); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg); }
.search-result-name   { font-size: 14px; font-weight: 500; }
.search-result-macros { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

/* ── Camera ─────────────────────────────────────────────────── */
.camera-controls { display: flex; gap: 10px; margin-top: 12px; }
.scan-results    { margin-top: 12px; }
.scanning-msg    { text-align: center; color: var(--text-sub); font-size: 14px; padding: 12px; }
.scan-item       { display: flex; align-items: center; gap: 12px; padding: 10px 0;
                   border-bottom: 1px solid var(--border); }
.scan-item:last-child { border-bottom: none; }
.scan-item-name  { flex: 1; font-weight: 500; font-size: 14px; }
.scan-item-meta  { font-size: 12px; color: var(--text-sub); }
.scan-add-btn    { font-size: 12px; }

/* ── Progress Page ──────────────────────────────────────────── */
.period-toggle { display: flex; gap: 8px; margin-bottom: 24px; }
.period-btn { padding: 7px 16px; border-radius: 20px; font-size: 13px; font-weight: 500;
              border: 1.5px solid var(--border); color: var(--text-sub); background: var(--card);
              transition: all var(--transition); cursor: pointer; text-decoration: none; }
.period-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.period-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-container { position: relative; height: 220px; }

/* ── Profile Page ───────────────────────────────────────────── */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.macro-preview { margin: 12px 0 16px; }
.macro-pv-title { font-size: 12px; font-weight: 500; color: var(--text-sub); margin-bottom: 6px; }
.macro-pv-bar   { display: flex; height: 28px; border-radius: 6px; overflow: hidden; }
.mpv { display: flex; align-items: center; justify-content: center;
       font-size: 11px; font-weight: 600; color: #fff; transition: width .3s ease; min-width: 40px; }
.mpv.protein { background: var(--green); }
.mpv.fat     { background: var(--orange); }
.mpv.carbs   { background: var(--primary); }

/* ── Misc ────────────────────────────────────────────────────── */
.text-muted   { color: var(--text-sub); }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-warning { color: var(--yellow); }
.mb-3 { margin-bottom: 12px; }
.empty-state { color: var(--text-sub); font-size: 14px; padding: 12px 0; }
.empty-state a { color: var(--primary); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .dash-grid     { grid-template-columns: 1fr; }
  .charts-grid   { grid-template-columns: 1fr; }
  .profile-grid  { grid-template-columns: 1fr; }
  .macro-bar-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  /* Auth — stack vertically on mobile: hero banner on top, form below */
  .auth-body      { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }

  .auth-hero      { display: block; min-height: 220px; height: 220px; }
  .auth-hero-img  { height: 220px; object-fit: cover; }
  .auth-hero-overlay { padding: 20px 24px; justify-content: flex-end; }
  .auth-hero-logo { width: 44px; height: 44px; margin-bottom: 10px; }
  .auth-hero-title { font-size: 22px; margin-bottom: 6px; }
  .auth-hero-bullets { display: none; }   /* hide bullet list on small screens */

  .auth-form-side { padding: 28px 24px; background: #f8fafc; }
  .auth-card      { background: transparent; padding: 0; box-shadow: none; }

  :root { --sidebar-w: 0px; }

  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-overlay.visible { display: block; }
  .mobile-bottom-nav { display: flex; }
  .main-area { margin-left: 0; padding-bottom: 70px; }
  .menu-toggle { display: block; }
  .content-area { padding: 16px; }
  .top-bar { padding: 0 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 22px; }
  .stats-grid-4 { grid-template-columns: 1fr 1fr; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .modal { max-height: 100vh; border-radius: var(--radius) var(--radius) 0 0;
           position: fixed; bottom: 0; width: 100%; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .quick-actions { gap: 8px; }
  .quick-btn { padding: 10px 14px; font-size: 13px; }
  .macro-bar-row { grid-template-columns: 1fr 1fr; }
  .exercise-row { flex-wrap: wrap; }
  .ex-small { width: calc(33% - 8px); }
  .form-inline-row { flex-direction: column; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .macro-bar-row { grid-template-columns: 1fr; }
  .stats-grid-4 { grid-template-columns: 1fr 1fr; }
}
