/* ============================================================
   FITTRACKER PRO — iOS OPTIMIZED
   ============================================================ */

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a25;
  --card: #16161f;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --muted: #7070a0;
  --accent: #6c63ff;
  --accent2: #8b83ff;
  --green: #10b981;
  --orange: #f97316;
  --red: #ef4444;
  --pink: #ec4899;
  --yellow: #eab308;
  --d1: #6c63ff;
  --d2: #f97316;
  --d3: #10b981;
  --d4: #ec4899;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,.5);
  --transition: .18s ease;
  --touch-target: 44px; /* Apple HIG minimum */
  --bottom-nav-h: 60px;
  --topbar-h: 52px;
}

/* ── RESET + iOS BASE ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  /* Remove blue flash on tap (iOS) */
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  /* Prevent iOS font size adjustment on orientation change */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Use dynamic viewport on iOS 15.4+ */
  height: -webkit-fill-available;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Prevent rubber-band scroll on body */
  overscroll-behavior: none;
}

/* Remove 300ms tap delay on all interactive elements */
button, a, [role="button"], input, select, label {
  touch-action: manipulation;
}

/* ── LAYOUT ── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: -webkit-fill-available;
  /* Account for status bar (notch area) */
  padding-top: env(safe-area-inset-top);
}

/* ── TOP BAR ── */
.topbar {
  flex-shrink: 0;
  height: var(--topbar-h);
  background: rgba(10,10,15,.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
}
.topbar-brand {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.03em;
}
.topbar-brand span { color: var(--accent); }

.topbar-btn {
  /* Minimum 44×44pt touch target */
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: var(--transition);
}
.topbar-btn:active { background: var(--border); color: var(--text); }

/* ── PAGE TITLE BAR ── */
.page-titlebar {
  flex-shrink: 0;
  height: 40px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Prevents content hiding under bottom nav */
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 16px);
}

.main-content > .page {
  padding: 14px 14px 0;
  max-width: 600px;
  margin: 0 auto;
}

.page { display: none; }
.page.active { display: block; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  flex-shrink: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(10,10,15,.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
  z-index: 50;
}

.bnav-item {
  flex: 1;
  height: var(--bottom-nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--muted);
  transition: color var(--transition);
  /* Ensure touch target */
  min-height: var(--touch-target);
  position: relative;
}

/* Active indicator pill above icon */
.bnav-item::before {
  content: '';
  position: absolute;
  top: 0;
  width: 32px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform .2s ease;
}
.bnav-item.active::before { transform: scaleX(1); }

.bnav-icon {
  width: 22px; height: 22px;
  transition: var(--transition);
}
.bnav-label {
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.bnav-item.active { color: var(--accent2); }
.bnav-item:active { opacity: .7; }

/* ── MORE DRAWER (bottom sheet) ── */
.more-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
}
.more-overlay.show { opacity: 1; pointer-events: auto; }

.more-drawer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 201;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px 0;
  /* Account for home indicator */
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.more-drawer.open { transform: translateY(0); }

.more-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin: 0 auto 18px;
}
.more-title {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 14px;
}
.more-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.more-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px;
  cursor: pointer;
  transition: var(--transition);
  min-height: var(--touch-target);
}
.more-item:active { background: var(--border); transform: scale(.95); }
.more-item-icon { font-size: 1.6rem; }
.more-item-label { font-size: .7rem; font-weight: 600; color: var(--muted); text-align: center; }

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title { font-size: 1rem; font-weight: 600; }
.card-subtitle { font-size: .78rem; color: var(--muted); margin-top: 2px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: var(--transition);
  min-height: var(--touch-target);
}
.btn:active { transform: scale(.97); opacity: .9; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:active { background: var(--bg3); color: var(--text); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 9px 14px; font-size: .82rem; min-height: 38px; }
.btn-full { width: 100%; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-new { background: rgba(108,99,255,.2); color: var(--accent2); }
.badge-key { background: rgba(16,185,129,.2); color: var(--green); }
.badge-posture { background: rgba(234,179,8,.2); color: var(--yellow); }

/* ── PROGRESS BARS ── */
.progress-bar-bg {
  height: 8px; background: var(--bg3);
  border-radius: 99px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 99px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.fill-accent { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.fill-green { background: linear-gradient(90deg, #059669, var(--green)); }
.fill-orange { background: linear-gradient(90deg, #ea580c, var(--orange)); }
.fill-pink { background: linear-gradient(90deg, #db2777, var(--pink)); }

/* ── DASHBOARD ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.stat-card:active { transform: scale(.97); }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .72rem; color: var(--muted); margin-top: 4px; }
.stat-sub { font-size: .68rem; color: var(--muted); margin-top: 2px; }

.today-workout-card {
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
}
.today-workout-card::before {
  content: '';
  position: absolute; inset: 0;
  opacity: .06;
  background: var(--day-color, var(--accent));
}
.today-badge {
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--day-color, var(--accent)); margin-bottom: 5px;
}
.today-day-name { font-size: 1.35rem; font-weight: 800; margin-bottom: 2px; }
.today-day-focus { font-size: .82rem; color: var(--muted); margin-bottom: 14px; }

/* ── WORKOUT TRACKER ── */
.workout-day-selector {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-bottom: 16px;
}
.day-btn {
  padding: 12px 4px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 2px solid var(--border);
  font-size: .78rem; font-weight: 700;
  cursor: pointer; text-align: center;
  transition: var(--transition);
  color: var(--muted);
  min-height: var(--touch-target);
}
.day-btn:active { transform: scale(.95); }
.day-btn.active { color: #fff; border-color: transparent; }
.day-btn.d1.active { background: var(--d1); }
.day-btn.d2.active { background: var(--d2); }
.day-btn.d3.active { background: var(--d3); }
.day-btn.d4.active { background: var(--d4); }
.day-btn .day-num { font-size: .62rem; opacity: .75; margin-top: 2px; }

.exercise-list { display: flex; flex-direction: column; gap: 10px; }

.exercise-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: border-color var(--transition);
}
.exercise-item.completed {
  border-color: var(--green);
  background: rgba(16,185,129,.05);
}

.exercise-header { display: flex; align-items: flex-start; gap: 10px; }

/* Touch target 44×44 for checkboxes */
.exercise-check {
  width: var(--touch-target);
  height: var(--touch-target);
  min-width: var(--touch-target);
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  /* Negative margin so visual size stays 28px but hit area is 44px */
  margin: -8px -10px -8px -8px;
}
.exercise-check.checked { background: var(--green); border-color: var(--green); }
.exercise-check svg { width: 16px; height: 16px; pointer-events: none; }

.exercise-info { flex: 1; padding-left: 4px; }
.exercise-name { font-size: .92rem; font-weight: 700; margin-bottom: 4px; line-height: 1.3; }
.exercise-meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: .77rem; color: var(--muted);
}
.exercise-meta span { display: flex; align-items: center; gap: 3px; }
.exercise-note {
  font-size: .76rem; color: var(--muted);
  margin-top: 5px; font-style: italic; line-height: 1.4;
}
.exercise-badges { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }

/* Set logger */
.set-logger { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }

.set-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 44px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.set-num {
  font-size: .75rem; color: var(--muted);
  font-weight: 700; text-align: center;
}
.set-input-label {
  font-size: .65rem; color: var(--muted);
  text-align: center; margin-bottom: 3px; display: block;
}

/* CRITICAL: font-size 16px prevents iOS auto-zoom */
.set-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 8px;
  font-size: 16px; /* DO NOT change below 16px on iOS */
  font-family: inherit;
  width: 100%;
  text-align: center;
  transition: border-color var(--transition);
  min-height: var(--touch-target);
  -webkit-appearance: none;
  appearance: none;
}
.set-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* 44×44 set done button */
.set-done-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: var(--transition);
}
.set-done-btn:active { transform: scale(.9); }
.set-done-btn.done { background: var(--green); border-color: var(--green); color: #fff; }

/* Rest timer */
.rest-timer {
  background: rgba(108,99,255,.08);
  border: 1px solid rgba(108,99,255,.25);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 10px;
  display: none;
  align-items: center; gap: 14px;
}
.rest-timer.active { display: flex; }
.rest-time-display {
  font-size: 2.2rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent); min-width: 72px;
}
.rest-bar { flex: 1; height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.rest-bar-fill {
  height: 100%; background: var(--accent);
  transition: width 1s linear; border-radius: 99px;
}
.rest-skip-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  transition: var(--transition);
}
.rest-skip-btn:active { background: var(--border); }

/* PO banner */
.po-banner {
  background: rgba(234,179,8,.1);
  border: 1px solid rgba(234,179,8,.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .82rem;
  margin-top: 8px;
  display: flex; align-items: center; gap: 8px;
}
.po-banner-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── NUTRITION ── */
.macro-ring-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 12px;
}
.macro-ring-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px; text-align: center;
}
.macro-circle {
  position: relative;
  width: 76px; height: 76px;
  margin: 0 auto 8px;
}
.macro-circle svg { transform: rotate(-90deg); }
.macro-circle-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 800;
}
.macro-circle-val { font-size: 1.05rem; line-height: 1; }
.macro-circle-unit { font-size: .62rem; color: var(--muted); }
.macro-name { font-size: .78rem; font-weight: 600; }
.macro-target { font-size: .68rem; color: var(--muted); }

.meal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  transition: border-color var(--transition);
}
.meal-card.done { border-color: var(--green); }
.meal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.meal-icon { font-size: 1.6rem; flex-shrink: 0; }
.meal-info { flex: 1; }
.meal-name { font-weight: 700; font-size: .95rem; }
.meal-kcal { font-size: .78rem; color: var(--muted); }
.meal-items { font-size: .8rem; color: var(--muted); line-height: 1.7; }

.meal-check-btn {
  padding: 10px 16px;
  border-radius: 99px;
  border: 2px solid var(--border);
  background: transparent; color: var(--muted);
  font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: var(--transition);
  min-height: var(--touch-target);
  white-space: nowrap;
}
.meal-check-btn:active { transform: scale(.95); }
.meal-check-btn.done { background: var(--green); border-color: var(--green); color: #fff; }

/* ── HYDRATION ── */
.hydration-visual {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0 20px;
}
.water-bottle {
  width: 90px; height: 180px;
  border: 3px solid var(--border);
  border-radius: 10px 10px 18px 18px;
  overflow: hidden; position: relative;
  background: var(--bg3);
  margin-bottom: 14px;
}
.water-fill {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, rgba(59,130,246,.55), rgba(37,99,235,.8));
  transition: height .8s cubic-bezier(.4,0,.2,1);
  border-radius: 0 0 14px 14px;
}
.water-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.water-glasses {
  display: flex; gap: 8px; flex-wrap: wrap;
  justify-content: center; max-width: 320px;
}
.glass-btn {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg3); cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: .6rem; color: var(--muted);
  transition: var(--transition);
  line-height: 1.2;
}
.glass-btn:active { transform: scale(.92); }
.glass-btn.filled { background: rgba(59,130,246,.2); border-color: #3b82f6; color: #93c5fd; }
.glass-emoji { font-size: 1.4rem; }

.water-btns { display: flex; gap: 10px; margin-top: 16px; }

/* ── SUPPLEMENTS ── */
.supp-grid { display: flex; flex-direction: column; gap: 8px; }
.supp-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: border-color var(--transition);
  min-height: 68px;
}
.supp-item.done { border-color: var(--green); background: rgba(16,185,129,.05); }
.supp-icon { font-size: 1.6rem; flex-shrink: 0; }
.supp-info { flex: 1; min-width: 0; }
.supp-name { font-weight: 700; font-size: .9rem; }
.supp-timing { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.supp-note { font-size: .72rem; color: var(--muted); margin-top: 2px; }

/* 44×44 supp check */
.supp-check {
  width: var(--touch-target);
  height: var(--touch-target);
  min-width: var(--touch-target);
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: var(--transition);
}
.supp-check:active { transform: scale(.9); }
.supp-check.done { background: var(--green); border-color: var(--green); color: #fff; }

/* ── POSTURE ── */
.posture-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color var(--transition);
  cursor: pointer;
  min-height: 68px;
}
.posture-item:active { opacity: .8; }
.posture-item.done { border-color: var(--yellow); background: rgba(234,179,8,.05); }

/* 44×44 posture check */
.posture-check {
  width: var(--touch-target);
  height: var(--touch-target);
  min-width: var(--touch-target);
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent; cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.posture-check.done { background: var(--yellow); border-color: var(--yellow); color: #1a1a00; }
.posture-info { flex: 1; }
.posture-name { font-weight: 700; font-size: .9rem; }
.posture-detail { font-size: .76rem; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.posture-sets { font-size: .75rem; color: var(--accent2); font-weight: 700; margin-top: 3px; }

/* ── PROGRESS ── */
.weight-log { display: flex; flex-direction: column; gap: 8px; }
.weight-entry {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.weight-date { font-size: .78rem; color: var(--muted); }
.weight-val { font-size: 1.15rem; font-weight: 800; }
.weight-diff { font-size: .82rem; font-weight: 700; }
.weight-diff.up { color: var(--green); }
.weight-diff.down { color: var(--red); }

.chart-container { height: 180px; position: relative; margin: 10px 0; }
canvas#weightChart { width: 100% !important; height: 100% !important; }

/* ── CHECKLIST ── */
.checklist-section { margin-bottom: 20px; }
.checklist-section-title {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 8px; padding: 0 2px;
}
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer; transition: border-color var(--transition);
  min-height: var(--touch-target);
}
.check-item:active { opacity: .75; }
.check-item.done { border-color: var(--green); background: rgba(16,185,129,.05); }
.check-box {
  width: 26px; height: 26px; min-width: 26px;
  border-radius: 7px;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  background: transparent;
}
.check-item.done .check-box { background: var(--green); border-color: var(--green); }
.check-label { font-size: .88rem; font-weight: 500; flex: 1; line-height: 1.3; }

/* ── FORM ELEMENTS ── */
.input-group { margin-bottom: 14px; }
.input-label {
  font-size: .8rem; color: var(--muted);
  margin-bottom: 7px; display: block; font-weight: 600;
}
/* 16px minimum to prevent iOS auto-zoom */
.input-field {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
  min-height: var(--touch-target);
}
.input-field:focus { outline: none; border-color: var(--accent); }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  /* Account for home indicator on iPhone */
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 360px;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 18px;
  font-size: .875rem; font-weight: 600;
  animation: slideUp .25s ease, fadeOut .3s ease 2.7s forwards;
  pointer-events: auto;
  box-shadow: var(--shadow);
  text-align: center;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.info { border-color: var(--accent); color: var(--accent2); }
@keyframes slideUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeOut { from { opacity:1; } to { opacity:0; } }

/* ── MISC UTILS ── */
.sep { height: 1px; background: var(--border); margin: 14px 0; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .8rem; }
.text-xs { font-size: .72rem; }
.fw-700 { font-weight: 700; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 8px; }

/* ── RESPONSIVE FINE-TUNING ── */
@media (max-width: 375px) {
  /* iPhone SE / small phones */
  .macro-ring-grid { gap: 6px; }
  .macro-ring-card { padding: 10px 4px; }
  .macro-circle { width: 68px; height: 68px; }
  .more-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
}

@media (min-width: 600px) {
  /* Tablets / desktop preview */
  .app-shell { max-width: 430px; margin: 0 auto; }
  .more-drawer { max-width: 430px; left: 50%; transform: translateX(-50%) translateY(100%); }
  .more-drawer.open { transform: translateX(-50%) translateY(0); }
  .toast-container { bottom: calc(var(--bottom-nav-h) + 20px); }
}
