/* ============================================
   Calorie Correct — Stylesheet
   ============================================ */

:root {
  --bg: #F5F1EA;
  --bg-soft: #EFEAE0;
  --bg-warm: #FAF6EE;
  --card: #FFFFFF;
  --primary: #5C7A6B;
  --primary-dark: #4A6354;
  --primary-soft: #EAF0EC;
  --primary-softer: #F2F6F3;
  --accent: #B8855E;
  --accent-soft: #F4ECE2;
  --text: #2C2826;
  --text-soft: #4A4540;
  --muted: #8A8278;
  --muted-soft: #B0A89E;
  --border: #ECE5D8;
  --border-soft: #F4EEE3;
  --warning-bg: #F8EEDF;
  --warning-text: #8B5A2B;
  --danger: #B65D4F;
  /* status colors for stat cards / metrics */
  --status-good: #5C7A6B;
  --status-good-bg: #EAF0EC;
  --status-warn: #C9885A;
  --status-warn-bg: #F8EEDF;
  --status-bad: #B65D4F;
  --status-bad-bg: #F8E5E2;
  --status-spike: #8B3F37;
  --status-spike-bg: #F2D8D4;
  --shadow-sm: 0 1px 3px rgba(60, 50, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(60, 50, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(60, 50, 40, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* === Reset === */
* { box-sizing: border-box; margin: 0; padding: 0; }
button { background: none; border: none; cursor: pointer; font-family: inherit; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; color: inherit; outline: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
svg { display: block; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

/* === Top brand bar (full width, above layout) === */
.top-bar {
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
  padding: 26px 32px 22px;
  text-align: center;
}
.top-bar-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  line-height: 1;
}
.top-bar .brand-logo {
  height: 64px;
  width: auto;
  display: block;
  max-width: 100%;
  object-fit: contain;
}
/* Legacy text-brand styles kept in case other places still reference them */
.top-bar .brand-name {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.7px;
  line-height: 1;
}
.top-bar .brand-sep {
  color: var(--accent);
  font-weight: 400;
  margin: 0 0.32em;
  display: inline-block;
  transform: translateY(-0.05em);
}
.top-bar .brand-tag {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.6px;
  margin-top: 6px;
  font-weight: 600;
}

/* === Layout === */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 100px);
}

/* === Sidebar === */
.sidebar {
  background: var(--bg-warm);
  border-right: 1px solid var(--border);
  padding: 32px 22px 28px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 0 10px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.brand-name {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.6px;
  line-height: 1;
}
.brand-dot { color: var(--accent); }
.brand-tag {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 6px;
  font-weight: 600;
}

/* === Nav === */
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  transition: background 0.15s;
}
.nav-item:hover { background: var(--bg-soft); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.nav-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* === Profile button (top of sidebar) === */
.profile-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 12px;
}
.profile-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.profile-btn:hover .profile-arrow { color: var(--primary-dark); transform: translateX(2px); }
.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.profile-info { flex: 1; min-width: 0; overflow: hidden; }
.profile-name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-sublabel {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.profile-arrow {
  width: 16px;
  height: 16px;
  color: var(--muted);
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: all 0.15s;
}

/* === Weigh in button (now below profile) === */
.weighin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  margin-bottom: 0;
}
.weighin-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(74, 99, 84, 0.18); }
.weighin-icon {
  width: 22px; height: 22px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
}

/* === Divider between actions and nav === */
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* === Main === */
.main {
  padding: 44px 72px 96px;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}
.view-container { animation: viewFadeIn 0.25s ease; }

/* Constrain text-heavy views for readability */
.view-narrow { max-width: 820px; margin: 0 auto; }
@keyframes viewFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* === Mobile tabs === */
.mobile-tabs { display: none; }

/* === Common headings === */
.view-header { margin-bottom: 36px; }
.view-eyebrow {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-weight: 700;
  margin-bottom: 10px;
}
.view-title {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1.2px;
  line-height: 1.05;
}
.view-sub {
  font-size: 16px;
  color: var(--muted);
  margin-top: 12px;
  max-width: 620px;
  line-height: 1.55;
}

/* === Cards === */
.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 28px 32px;
}
.card-soft {
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
}

/* Section helpers */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.section { margin-bottom: 28px; }
.section-h {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 700;
  margin-bottom: 12px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-soft); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 12.5px; }

/* === Inputs === */
.input {
  width: 100%;
  padding: 13px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--primary); }
.input::placeholder { color: var(--muted-soft); }
.input-lg { padding: 16px 18px; font-size: 16px; }
.label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* ============================================
   TODAY VIEW
   ============================================ */
.today-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 32px;
  align-items: start;
}

/* Calorie ring card */
.ring-card {
  background: linear-gradient(160deg, var(--primary-soft) 0%, var(--bg-warm) 100%);
  border-radius: var(--radius-lg);
  padding: 40px 28px 32px;
  text-align: center;
  border: 1px solid var(--primary-softer);
}
.ring-svg-wrap {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto 14px;
}
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-num {
  font-family: var(--serif);
  font-size: 60px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -2.5px;
  line-height: 1;
}
.ring-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-weight: 700;
  margin-top: 8px;
}
.ring-budget {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-soft);
}
.ring-budget strong { color: var(--text); font-weight: 700; }
.ring-target-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* Mini stats */
.mini-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 24px;
}
.mini {
  padding: 20px 22px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
}
.mini-label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; }
.mini-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
  line-height: 1;
  letter-spacing: -0.8px;
}
.mini-trend { font-size: 12px; color: var(--primary); margin-top: 6px; font-weight: 600; }

/* Meal timeline */
.meal-list { display: flex; flex-direction: column; }
.meal-item {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 16px;
}
.meal-item:last-child { border-bottom: none; }
.meal-time {
  width: 72px;
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 700;
}
.meal-body { flex: 1; min-width: 0; }
.meal-name { font-size: 15px; color: var(--text); font-weight: 500; }
.meal-detail { font-size: 12px; color: var(--muted); margin-top: 3px; }
.meal-cal { font-size: 16px; color: var(--text); font-weight: 700; font-family: var(--serif); }
.meal-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--bg-warm);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.meal-empty:hover { background: var(--bg-soft); color: var(--primary); }

.quick-log-card {
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-top: 24px;
}
.quick-log-card .label { margin-bottom: 10px; }

/* In-card logger (lives inside Today's meals card) */
.today-logger {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}
.today-logger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.today-logger-header .log-mode-tabs { margin-bottom: 0; }
.today-logger .log-mode-tab { padding: 6px 14px; font-size: 11.5px; }

/* Recent foods strip — one-tap chips for frequently-logged items */
.recent-foods-strip {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border-soft);
}
.recent-foods-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
}
.recent-foods-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--primary-softer);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
  cursor: pointer;
  max-width: 100%;
}
.recent-chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary-soft);
}
.recent-chip:active {
  transform: scale(0.97);
}
.recent-chip-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.recent-chip-cal {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: var(--card);
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}

/* Search-as-you-type dropdown attached to the meal parser input */
.today-log-input-wrap {
  position: relative;
}
.food-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.food-search-dropdown[hidden] { display: none; }
.food-search-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: background 0.08s ease;
}
.food-search-item:hover,
.food-search-item.active {
  background: var(--primary-softer);
}
.food-search-name {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
}
.food-search-cal {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* "Same as yesterday" button — shows when today is empty and yesterday has data */
.copy-yesterday-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: var(--bg-warm);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}
.copy-yesterday-btn:hover {
  background: var(--accent-soft);
}
.copy-yesterday-btn:active {
  transform: scale(0.99);
}
.copy-yesterday-icon {
  font-size: 22px;
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1;
}
.copy-yesterday-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.copy-yesterday-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.copy-yesterday-detail {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

/* Saved meals strip — user-defined meal templates */
.saved-meals-strip {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border-soft);
}
.saved-meals-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
}
.saved-meals-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.saved-meal-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}
.saved-meal-chip::before {
  content: '★';
  color: var(--accent);
  font-size: 11px;
  margin-right: -2px;
}
.saved-meal-chip:hover {
  background: var(--primary-soft);
}
.saved-meal-chip:active {
  transform: scale(0.97);
}
.saved-meal-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.saved-meal-cal {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: var(--card);
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}

/* Exercise preset tiles in the "Log activity" modal */
.exercise-preset-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.exercise-preset-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 6px;
  background: var(--bg-soft);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}
.exercise-preset-tile:hover {
  background: var(--primary-softer);
}
.exercise-preset-tile.active {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.exercise-preset-tile:active {
  transform: scale(0.97);
}
.exercise-preset-emoji {
  font-size: 24px;
  line-height: 1;
}
.exercise-preset-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
}
@media (max-width: 480px) {
  .exercise-preset-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .exercise-preset-tile:nth-child(4),
  .exercise-preset-tile:nth-child(5) {
    /* On 3-col grid, tiles 4 and 5 wrap to a second row naturally */
  }
}

/* Saved-meals management list (in Settings) */
.saved-meals-manage {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.saved-meal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
}
.saved-meal-row-info {
  flex: 1;
  min-width: 0;
}
.saved-meal-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.saved-meal-row-cal {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}
.saved-meal-row-detail {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   TREND VIEW
   ============================================ */
.trend-headline {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.trend-bignum {
  font-family: var(--serif);
  font-size: 80px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -3.5px;
  line-height: 1;
}
.trend-bignum.gain { color: var(--accent); }
.trend-bignum-label { font-size: 16px; color: var(--muted); }

.chart-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 28px 32px 22px;
  margin-bottom: 24px;
}
.chart-legend {
  display: flex;
  gap: 22px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 18px;
  font-weight: 600;
}
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }
.legend-actual { background: var(--primary); }
.legend-predicted { background: var(--accent); }
.chart-canvas-wrap { position: relative; height: 400px; }

.calibration-card {
  background: var(--warning-bg);
  border-radius: var(--radius-md);
  padding: 32px 36px;
  border-left: 3px solid var(--accent);
  margin-bottom: 24px;
}
.calibration-eyebrow {
  font-size: 12px;
  color: var(--warning-text);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 700;
  margin-bottom: 14px;
}
.calibration-body {
  font-size: 17px;
  color: var(--text);
  line-height: 1.65;
}
.calibration-body strong { font-weight: 700; }
.calibration-footer {
  font-size: 13px;
  color: var(--muted);
  margin-top: 18px;
  font-style: italic;
}

.tdee-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.tdee-stat {
  padding: 26px 24px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  text-align: center;
}
.tdee-stat .num {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1.2px;
}
.tdee-stat .lbl {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-weight: 700;
  margin-top: 10px;
}

/* ============================================
   LOG VIEW
   ============================================ */
.log-shell {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 36px 40px;
  max-width: 820px;
}
.log-input-area {
  position: relative;
}
.log-textarea {
  width: 100%;
  min-height: 130px;
  padding: 20px 22px;
  background: var(--bg-warm);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 17px;
  color: var(--text);
  resize: vertical;
  line-height: 1.5;
  font-family: inherit;
  transition: border-color 0.15s;
}
.log-textarea:focus { border-color: var(--primary); }
.log-textarea::placeholder { color: var(--muted-soft); }

.log-action-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.log-meta-select {
  flex: 1;
  min-width: 140px;
  display: flex;
  gap: 8px;
}
.log-action-row select {
  padding: 11px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.log-parsing {
  margin-top: 22px;
  padding: 18px 20px;
  background: var(--primary-softer);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
}
.log-parsing-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.log-parsing-text { font-size: 13px; color: var(--primary-dark); font-weight: 600; }

.parsed-result {
  margin-top: 22px;
}
.parsed-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.ai-pill {
  font-size: 10px;
  background: var(--primary);
  color: white;
  padding: 3px 8px;
  border-radius: 100px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.parsed-label { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.parsed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-warm);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  gap: 12px;
}
.parsed-item-name { font-size: 14px; color: var(--text); font-weight: 500; }
.parsed-item-detail { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.parsed-item-cal {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--text);
  font-weight: 700;
  flex-shrink: 0;
}
.parsed-item-cal input {
  width: 60px;
  padding: 4px 6px;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: right;
}
.parsed-item-remove {
  width: 22px; height: 22px;
  background: var(--bg-soft);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.parsed-item-remove:hover { background: var(--danger); color: white; }

.parsed-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.parsed-total-label { font-size: 14px; color: var(--primary-dark); font-weight: 700; }
.parsed-total-cal {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--primary-dark);
  font-weight: 700;
}

.parsed-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.parsed-reassurance {
  margin-top: 18px;
  padding: 14px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
  line-height: 1.5;
}

/* Recent meals card */
.recent-meals {
  margin-top: 32px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 28px 32px;
  max-width: 820px;
}

/* ============================================
   INSIGHTS VIEW
   ============================================ */
.insight-card-lg {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 44px 52px;
  margin-bottom: 22px;
  max-width: 820px;
}
.insight-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 24px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.3px;
}
.insight-prose {
  font-size: 17px;
  color: var(--text);
  line-height: 1.7;
}
.insight-prose p { margin-bottom: 16px; }
.insight-prose strong { color: var(--primary-dark); font-weight: 700; }
.insight-divider { height: 1px; background: var(--border-soft); margin: 28px 0; }
.insight-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.insight-archive { margin-top: 16px; max-width: 820px; }
.archive-item {
  padding: 16px 20px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.archive-item:hover { background: var(--primary-soft); }
.archive-week { font-size: 13.5px; color: var(--text); font-weight: 700; }
.archive-loss { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.archive-arrow { color: var(--muted); }

/* ============================================
   COACH VIEW
   ============================================ */
.coach-shell {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  height: calc(100vh - 220px);
  min-height: 540px;
  max-width: 880px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.coach-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-soft);
}
.coach-avatar-lg {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 18px; font-weight: 700;
}
.coach-name-lg { font-size: 15px; color: var(--text); font-weight: 700; }
.coach-status-lg { font-size: 12px; color: var(--muted); margin-top: 2px; }
.coach-status-lg .dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.coach-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
}
.bubble.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bubble.coach {
  background: var(--bg-soft);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bubble.coach p { margin-bottom: 8px; }
.bubble.coach p:last-child { margin-bottom: 0; }

.coach-suggestions {
  padding: 12px 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-soft);
}
.suggestion-chip {
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: 100px;
  font-size: 12.5px;
  color: var(--text-soft);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.suggestion-chip:hover { background: var(--primary-soft); color: var(--primary-dark); }

.coach-input-bar {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  gap: 10px;
  background: var(--card);
}
.coach-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 100px;
  font-size: 14px;
  color: var(--text);
  transition: all 0.15s;
}
.coach-input:focus { background: white; border-color: var(--primary); }
.coach-send {
  width: 42px; height: 42px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  flex-shrink: 0;
}
.coach-send svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.coach-send:hover { background: var(--primary-dark); }
.coach-send:disabled { background: var(--muted-soft); cursor: not-allowed; }

.coach-disclaimer {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 14px;
  padding: 0 24px 8px;
  font-style: italic;
  max-width: 880px;
}

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 40, 38, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: modalFade 0.2s ease;
}
.modal-backdrop.open { display: flex; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalRise 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.modal.modal-wide { max-width: 560px; }
.modal.modal-xwide { max-width: 720px; }
@keyframes modalRise { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-h {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}
.modal-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* Day detail modal */
.day-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.day-detail-stat {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 14px 14px;
  text-align: center;
}
.day-detail-stat.editable { cursor: pointer; transition: all 0.15s; }
.day-detail-stat.editable:hover { background: var(--primary-soft); }
.day-detail-stat.editable:hover .day-detail-stat-value::after {
  content: ' ✎'; color: var(--muted); font-size: 12px;
}
.day-detail-stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.day-detail-stat-value {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
  line-height: 1;
  letter-spacing: -0.5px;
}
.day-detail-stat.muted .day-detail-stat-value { color: var(--muted); }
.day-detail-section {
  margin-bottom: 22px;
}
.day-detail-section-h {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  margin-bottom: 10px;
}
.day-detail-empty {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  padding: 12px 0;
}

/* Weight modal specific */
.weight-input-big {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  padding: 24px 0;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.weight-input-big input {
  font-family: var(--serif);
  font-size: 52px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  width: 180px;
  background: transparent;
  border: none;
  letter-spacing: -1.5px;
}
.weight-input-big .unit {
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
}

/* ============================================
   TOASTS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.25s ease, toastOut 0.25s ease 2.5s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ============================================
   ONBOARDING (in-app)
   ============================================ */
.onboarding-fullscreen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 80;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.ob-topbar {
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
  padding: 22px 32px;
  text-align: center;
  flex-shrink: 0;
}
.ob-topbar .ob-logo {
  height: 56px;
  width: auto;
  display: inline-block;
  max-width: 100%;
  object-fit: contain;
}
.ob-topbar .ob-tag {
  margin-top: 6px;
}
.ob-topbar .brand-name {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
  line-height: 1;
}
.ob-topbar .brand-sep {
  color: var(--accent);
  font-weight: 400;
  margin: 0 0.32em;
  display: inline-block;
  transform: translateY(-0.05em);
}
.ob-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 32px;
}
.ob-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 36px;
}
.ob-dot {
  width: 8px;
  height: 8px;
  background: var(--border);
  border-radius: 50%;
  transition: all 0.2s;
}
.ob-dot.done { background: var(--primary); }
.ob-dot.current { background: var(--primary); width: 24px; border-radius: 100px; }

.ob-step {
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}
.ob-step.left { text-align: left; }

.ob-eyebrow {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-weight: 700;
  margin-bottom: 12px;
}
.ob-h1 {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1.2px;
  line-height: 1.1;
  margin-bottom: 14px;
}
.ob-sub {
  font-size: 17px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 36px;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

/* Welcome screen specific */
.ob-welcome-mark {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -1.5px;
  margin-bottom: 12px;
  line-height: 1;
}
.ob-welcome-tagline {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.6px;
  margin-bottom: 18px;
  margin-top: 24px;
}
.ob-welcome-sub {
  font-size: 17px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 440px;
  margin: 0 auto 40px;
}

/* Weight cards */
.ob-weight-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 14px;
  text-align: left;
  transition: border-color 0.15s;
}
.ob-weight-card:focus-within { border-color: var(--primary); }
.ob-weight-card.goal { background: var(--primary-soft); border-color: var(--primary-soft); }
.ob-weight-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  margin-bottom: 12px;
}
.ob-weight-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.ob-weight-input {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  width: 180px;
  letter-spacing: -1px;
  padding: 0;
  -moz-appearance: textfield;
}
.ob-weight-input::-webkit-outer-spin-button,
.ob-weight-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ob-weight-card.goal .ob-weight-input { color: var(--primary-dark); }
.ob-weight-unit {
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
}
.ob-delta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

/* Basics — sex/age/height row */
.ob-basics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.ob-basics-grid > * { min-width: 0; }
.ob-field {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: left;
  transition: border-color 0.15s;
}
.ob-field:focus-within { border-color: var(--primary); }
.ob-field-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  margin-bottom: 10px;
}
.ob-input {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  padding: 0;
  letter-spacing: -0.6px;
  -moz-appearance: textfield;
}
.ob-input::-webkit-outer-spin-button,
.ob-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ob-select {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  padding: 0;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%238A8278' stroke-width='2'><polyline points='2 2 6 6 10 2'/></svg>");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 12px;
}
.ob-height-row { display: flex; gap: 8px; align-items: baseline; }
.ob-height-field { flex: 1; }
.ob-height-unit { font-size: 15px; color: var(--muted); font-weight: 600; }

/* Options (scale preference) */
.ob-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.ob-option:hover { border-color: var(--muted-soft); }
.ob-option.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.ob-radio {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 50%;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ob-option.selected .ob-radio { border-color: var(--primary); }
.ob-radio-inner {
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  display: none;
}
.ob-option.selected .ob-radio-inner { display: block; }
.ob-option-h {
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 4px;
}
.ob-option-body {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* Expectations timeline */
.ob-timeline {
  text-align: left;
  margin-bottom: 24px;
}
.ob-timeline-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
}
.ob-timeline-item:last-child { border-bottom: none; }
.ob-timeline-week {
  flex-shrink: 0;
  width: 80px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  padding-top: 1px;
}
.ob-timeline-body { flex: 1; }
.ob-timeline-title {
  font-size: 14.5px;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 4px;
}
.ob-timeline-desc {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}
.ob-quote {
  margin-top: 20px;
  padding: 18px 22px;
  background: var(--bg-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 12px 12px 0;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--text);
  line-height: 1.55;
  font-style: italic;
  text-align: left;
}

/* Done screen */
.ob-check {
  width: 80px;
  height: 80px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.ob-check svg { width: 36px; height: 36px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.ob-summary {
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 18px 22px;
  margin: 24px 0 12px;
  text-align: left;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}
.ob-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13.5px;
}
.ob-summary-row .lbl { color: var(--muted); }
.ob-summary-row .val { color: var(--text); font-weight: 700; font-family: var(--serif); }

/* Buttons */
.ob-buttons {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}
.ob-btn-primary {
  flex: 1;
  padding: 16px 24px;
  background: var(--primary);
  color: white;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  transition: background 0.15s;
}
.ob-btn-primary:hover { background: var(--primary-dark); }
.ob-btn-primary:disabled {
  background: var(--muted-soft);
  cursor: not-allowed;
}
.ob-btn-secondary {
  padding: 16px 24px;
  background: transparent;
  color: var(--text-soft);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.15s;
}
.ob-btn-secondary:hover { border-color: var(--muted-soft); }
.ob-btn-ghost {
  flex: 1;
  padding: 14px 24px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.ob-btn-ghost:hover { color: var(--primary); }

@media (max-width: 600px) {
  .ob-content { padding: 32px 20px; }
  .ob-h1 { font-size: 32px; letter-spacing: -0.8px; }
  .ob-welcome-mark { font-size: 40px; }
  .ob-welcome-tagline { font-size: 22px; }
  .ob-weight-input { font-size: 36px; width: 140px; }
  .ob-input { font-size: 24px; }
  .ob-buttons { flex-direction: column; }
  .ob-btn-secondary { order: 2; }
  .ob-basics-grid { grid-template-columns: 1fr; }
}

/* ============================================
   SETTINGS PANEL
   ============================================ */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 14px; color: var(--text); font-weight: 600; }
.settings-row-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ============================================
   CYCLE 1 — STAT CARDS, PROGRESS, RANGE SELECTOR
   ============================================ */

/* Top metrics row — colored stat cards, auto-wrap */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border);
}
.stat-card.good::before { background: var(--status-good); }
.stat-card.warn::before { background: var(--status-warn); }
.stat-card.bad::before { background: var(--status-bad); }
.stat-card.spike::before { background: var(--status-spike); }
.stat-card.dark { background: var(--text); border-color: var(--text); }
.stat-card.dark::before { background: var(--accent); }

.stat-label {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.stat-card.dark .stat-label { color: rgba(255,255,255,0.55); }

.stat-value {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
  margin-top: 4px;
}
.stat-value .unit {
  font-size: 14px;
  color: var(--muted);
  font-family: var(--sans);
  font-weight: 600;
  margin-left: 4px;
  letter-spacing: 0;
}
.stat-card.good .stat-value { color: var(--status-good); }
.stat-card.warn .stat-value { color: var(--status-warn); }
.stat-card.bad .stat-value { color: var(--status-bad); }
.stat-card.spike .stat-value { color: var(--status-spike); }
.stat-card.dark .stat-value { color: white; }
.stat-card.dark .stat-value .unit { color: rgba(255,255,255,0.55); }

.stat-detail {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}
.stat-card.dark .stat-detail { color: rgba(255,255,255,0.7); }

/* Goal progress bar */
.progress-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 22px 24px 20px;
  margin-bottom: 24px;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
}
.progress-title {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-weight: 700;
}
.progress-value {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.5px;
}
.progress-value .pct {
  color: var(--status-good);
  margin-right: 8px;
}
.progress-detail {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}
.progress-bar-track {
  background: var(--bg-soft);
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #7AA68F 100%);
  border-radius: 5px;
  transition: width 0.6s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

/* Date range selector for charts */
.date-range-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.date-range-tabs {
  display: inline-flex;
  background: var(--bg-soft);
  border-radius: 100px;
  padding: 3px;
  gap: 0;
}
.date-range-tab {
  padding: 7px 14px;
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.4px;
}
.date-range-tab:hover { color: var(--text-soft); }
.date-range-tab.active {
  background: var(--card);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

/* Bar chart container (Insights) */
.bar-chart-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 22px 24px 18px;
  margin-bottom: 24px;
}
.bar-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.bar-chart-title {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-weight: 700;
}
.bar-chart-legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.bar-chart-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.bar-chart-canvas-wrap {
  position: relative;
  height: 280px;
}

/* === Form fields inside modals === */
.form-row {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  margin-bottom: 6px;
}
.form-input,
.form-select {
  width: 100%;
  padding: 11px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s;
}
.form-input:focus,
.form-select:focus { border-color: var(--primary); outline: none; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.edit-items-list {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 12px;
}
.edit-item-row {
  display: grid;
  grid-template-columns: 1fr 80px 28px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
}
.edit-item-row input {
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}
.edit-item-row input:focus { border-color: var(--primary); outline: none; }
.edit-item-row .cal-input { font-family: var(--serif); font-weight: 700; text-align: right; }
.edit-item-remove {
  width: 28px; height: 28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.edit-item-remove:hover { background: var(--danger); border-color: var(--danger); color: white; }
.edit-add-item-btn {
  width: 100%;
  padding: 10px;
  background: white;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.edit-add-item-btn:hover { color: var(--primary); border-color: var(--primary); }

.edit-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.edit-total-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.edit-total-value {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
}

.modal-actions-3 { display: grid; grid-template-columns: auto 1fr 1fr; gap: 10px; }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--border);
}
.btn-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* === Clickable meal item affordance === */
.meal-item.clickable {
  cursor: pointer;
  transition: background 0.12s;
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 8px;
}
.meal-item.clickable:hover { background: var(--bg-soft); }
.meal-item.clickable:hover .meal-cal::after {
  content: '✎';
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}

/* === Weight log table on Trend === */
.weight-log-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-top: 24px;
}
.weight-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.weight-log-title {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-weight: 700;
}
.weight-log-toggle {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 8px;
}
.weight-log-toggle:hover { color: var(--primary-dark); }
.weight-log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.weight-log-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.weight-log-table th.right { text-align: right; }
.weight-log-table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
}
.weight-log-table td.right { text-align: right; font-family: var(--serif); font-weight: 700; }
.weight-log-table tr.clickable { cursor: pointer; transition: background 0.12s; }
.weight-log-table tr.clickable:hover { background: var(--bg-soft); }
.weight-log-table tr.clickable:hover .delta { color: var(--primary); }
.weight-log-table .delta {
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
  font-family: var(--sans);
  font-weight: 600;
}
.weight-log-table .delta.up { color: var(--accent); }
.weight-log-table .delta.down { color: var(--primary); }

/* === Direct calorie entry on Log === */
.log-mode-tabs {
  display: inline-flex;
  background: var(--bg-soft);
  border-radius: 100px;
  padding: 3px;
  margin-bottom: 16px;
}
.log-mode-tab {
  padding: 8px 18px;
  background: transparent;
  border: none;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.4px;
}
.log-mode-tab:hover { color: var(--text-soft); }
.log-mode-tab.active {
  background: var(--card);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}
.numeric-entry-wrap {
  background: var(--bg-warm);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 28px;
}
.numeric-entry-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.numeric-entry-input {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  width: 100%;
  letter-spacing: -1px;
}
.numeric-entry-input:focus { border-color: var(--primary); outline: none; }
.numeric-entry-select {
  font-size: 16px;
  color: var(--text);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  width: 100%;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%238A8278' stroke-width='2'><polyline points='2 2 6 6 10 2'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
}

/* === Exercise items === */
.exercise-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 14px;
}
.exercise-item:last-child { border-bottom: none; }
.exercise-emoji {
  width: 36px;
  height: 36px;
  background: var(--accent-soft);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.exercise-body { flex: 1; min-width: 0; }
.exercise-name { font-size: 14px; color: var(--text); font-weight: 600; }
.exercise-detail { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.exercise-burn {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--warning-text);
  font-weight: 700;
  white-space: nowrap;
}
.exercise-item.clickable {
  cursor: pointer;
  transition: background 0.12s;
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 8px;
}
.exercise-item.clickable:hover { background: var(--bg-soft); }
.exercise-item.clickable:hover .exercise-burn::after {
  content: '✎';
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
}

.activity-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-top: 20px;
}

.ring-exercise-line {
  margin-top: 8px;
  font-size: 12px;
  color: var(--warning-text);
  font-weight: 600;
}

/* === Cycle 4: Goal projection, plateau banner, weekday patterns === */

.projection-line {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
}
.projection-line strong { color: var(--primary-dark); font-weight: 700; }
.projection-line .proj-emph {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
}

.plateau-banner {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 18px 22px;
  margin-bottom: 24px;
}
.plateau-eyebrow {
  font-size: 11px;
  color: var(--warning-text);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-weight: 700;
  margin-bottom: 8px;
}
.plateau-body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
}
.plateau-body strong { font-weight: 700; }

.weekday-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.weekday-headline {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  line-height: 1.3;
}
.weekday-headline em { color: var(--accent); font-style: italic; font-weight: 700; }
.weekday-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 18px;
}
.weekday-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.weekday-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.weekday-bar-track {
  width: 100%;
  height: 80px;
  background: var(--bg-soft);
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.weekday-bar-fill {
  width: 100%;
  background: var(--primary);
  transition: height 0.4s ease;
  border-radius: 4px 4px 0 0;
}
.weekday-bar-fill.weekend { background: var(--accent); }
.weekday-bar-fill.empty { background: var(--border); }
.weekday-bar-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.weekday-bar-value {
  font-size: 10px;
  color: var(--text-soft);
  font-weight: 600;
  font-family: var(--serif);
  margin-top: 2px;
}

/* === Range slider (tracker accuracy etc) === */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: background 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { background: var(--primary-dark); }
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* === Toast with undo === */
.toast-undo {
  margin-left: 16px;
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.15s;
}
.toast-undo:hover { background: rgba(255,255,255,0.3); }

@media (max-width: 1100px) and (min-width: 901px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px 16px 12px; }
  .stat-value { font-size: 26px; }
  .progress-card { padding: 18px 20px 16px; }
  .date-range-tab { padding: 6px 10px; font-size: 11px; }

  /* Day detail modal */
  .modal { padding: 22px 20px; max-height: 92vh; }
  .day-detail-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .day-detail-stat { padding: 12px 10px; }
  .day-detail-stat-value { font-size: 18px; }
  .modal-actions-3 { grid-template-columns: 1fr; gap: 8px; }
  .modal-actions-3 .btn { width: 100%; }

  /* Day log table — make horizontally scrollable */
  .weight-log-card { padding: 18px 16px; overflow-x: auto; }
  .weight-log-table { min-width: 460px; font-size: 12px; }
  .weight-log-table th, .weight-log-table td { padding: 8px 6px; }

  /* Settings sliders */
  .settings-row select.form-select,
  .settings-row .form-input { font-size: 14px; }

  /* Methodology math blocks */
  .insight-prose p[style*="background"] { font-size: 13px; padding: 12px 14px !important; line-height: 1.6 !important; word-wrap: break-word; }
  .insight-prose h3 { font-size: 18px !important; }

  /* Day-of-week bars */
  .weekday-bars { gap: 4px; }
  .weekday-bar-track { height: 60px; }
  .weekday-bar-label { font-size: 9px; }
  .weekday-bar-value { font-size: 9px; }

  /* TDEE row */
  .tdee-row { grid-template-columns: 1fr 1fr; }
  .tdee-stat { padding: 14px 12px; }
  .tdee-stat .num { font-size: 22px; }

  /* Plateau banner */
  .plateau-banner { padding: 14px 16px; }
  .plateau-body { font-size: 13px; }

  /* Calorie / exercise bar charts */
  .bar-chart-card { padding: 16px 18px; }
  .bar-chart-canvas-wrap { height: 220px; }
  .bar-chart-legend { font-size: 10px; gap: 8px; flex-wrap: wrap; }
  .bar-chart-header { flex-direction: column; align-items: flex-start; }

  /* Trend big number — tighter on mobile */
  .trend-headline { gap: 8px; }

  /* Weekly insight card padding */
  .insight-card-lg { padding: 24px 20px; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Medium desktop — keep desktop layout but tighten padding */
@media (max-width: 1200px) and (min-width: 901px) {
  .main { padding: 40px 44px 80px; }
  .today-grid { grid-template-columns: 340px 1fr; gap: 24px; }
  .ring-svg-wrap { width: 220px; height: 220px; }
  .ring-num { font-size: 50px; }
  .ring-card { padding: 32px 22px 26px; }
  .view-title { font-size: 36px; }
  .trend-bignum { font-size: 64px; }
  .chart-canvas-wrap { height: 340px; }
  .calibration-card { padding: 24px 28px; }
  .calibration-body { font-size: 16px; }
  .insight-card-lg { padding: 36px 40px; }
  .insight-prose { font-size: 16px; }
  .tdee-stat .num { font-size: 32px; }
  .log-shell { padding: 28px 32px; }
  .top-bar { padding: 22px 32px 18px; }
  .top-bar .brand-name { font-size: 30px; }
  .top-bar .brand-logo { height: 56px; }
}

/* Large desktop polish — give it more breathing room */
@media (min-width: 1500px) {
  .main { padding: 64px 88px 96px; }
  .today-grid { gap: 40px; }
  .view-title { font-size: 46px; }
  .trend-bignum { font-size: 88px; }
  .top-bar { padding: 32px 32px 26px; }
  .top-bar .brand-name { font-size: 38px; }
  .top-bar .brand-logo { height: 72px; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 18px;
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }
  .nav { display: none; }
  .sidebar-divider { display: none; }
  .profile-btn {
    flex: 1;
    margin-bottom: 0;
    padding: 10px 12px;
    gap: 10px;
  }
  .profile-avatar { width: 36px; height: 36px; font-size: 16px; }
  .profile-name { font-size: 14px; }
  .profile-sublabel { display: none; }
  .profile-arrow { display: none; }
  .weighin-btn {
    width: auto;
    padding: 10px 16px;
    font-size: 13px;
    flex-shrink: 0;
  }
  .weighin-icon { width: 18px; height: 18px; font-size: 14px; }

  .main { padding: 24px 20px 100px; max-width: 100%; }

  .mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    z-index: 50;
    padding: 8px 4px 12px;
    box-shadow: 0 -4px 12px rgba(60, 50, 40, 0.04);
  }
  .m-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
  }
  .m-tab svg {
    width: 22px; height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .m-tab.active { color: var(--primary); }

  /* Adjustments for small screens */
  .today-grid { grid-template-columns: 1fr; gap: 20px; }
  .view-title { font-size: 30px; letter-spacing: -0.7px; }
  .view-sub { font-size: 14px; }
  .trend-bignum { font-size: 56px; letter-spacing: -2px; }
  .top-bar { padding: 18px 18px 14px; }
  .top-bar .brand-name { font-size: 26px; }
  .top-bar .brand-tag { font-size: 10px; margin-top: 4px; }
  .top-bar .brand-logo { height: 48px; }
  .ob-topbar .ob-logo { height: 44px; }
  .layout { min-height: auto; }
  .tdee-row { grid-template-columns: 1fr; }
  .insight-stat-row { grid-template-columns: 1fr; gap: 8px; }
  .coach-shell { height: calc(100vh - 260px); min-height: 460px; max-width: 100%; }
  .insight-card-lg { padding: 28px 24px; max-width: 100%; }
  .insight-archive { max-width: 100%; }
  .log-shell { padding: 24px 22px; max-width: 100%; }
  .recent-meals { padding: 22px 20px; max-width: 100%; }
  .ring-svg-wrap { width: 220px; height: 220px; }
  .ring-num { font-size: 48px; letter-spacing: -1.8px; }
  .ring-card { padding: 28px 20px 22px; }
  .chart-canvas-wrap { height: 260px; }
  .chart-card { padding: 20px 22px 16px; }
  .calibration-card { padding: 22px 22px; }
  .calibration-body { font-size: 15px; }
  .tdee-stat { padding: 18px; }
  .tdee-stat .num { font-size: 28px; }
  .mini { padding: 16px 18px; }
  .mini-value { font-size: 24px; }
}

@media (max-width: 480px) {
  .main { padding: 20px 16px 100px; }
  .ring-svg-wrap { width: 180px; height: 180px; }
  .ring-num { font-size: 40px; }
  .view-title { font-size: 26px; }
  .trend-bignum { font-size: 44px; }
  .view-header { margin-bottom: 24px; }
  .top-bar { padding: 14px 14px 12px; }
  .top-bar .brand-name { font-size: 22px; }
  .top-bar .brand-logo { height: 40px; }
  .ob-topbar .ob-logo { height: 36px; }
  .insight-card-lg { padding: 22px 20px; }
  .insight-prose { font-size: 15px; line-height: 1.6; }
  .log-shell { padding: 20px 18px; }
  .log-textarea { font-size: 16px; padding: 16px 18px; }
}
