:root {
  --bg:             #F5F0E8;
  --surface:        #FFFFFF;
  --surface-muted:  #EDE8DF;
  --border:         #E2DAD0;
  --primary:        #C8883A;
  --primary-dark:   #A86E28;
  --primary-10:     rgba(200,136,58,.10);
  --primary-15:     rgba(200,136,58,.15);
  --primary-20:     rgba(200,136,58,.20);
  --primary-40:     rgba(200,136,58,.40);
  --accent:         #8B6A48;
  --text-heading:   #1E1610;
  --text-body:      #3D2E20;
  --text-muted:     #6B5D52;
  --macro-kcal:     #C8883A;
  --macro-protein:  #4A8C6F;
  --macro-fat:      #9B6B8A;
  --macro-carbs:    #4A7A9B;
  --macro-kcal-tint:    rgba(200,136,58,.11);
  --macro-protein-tint: rgba(74,140,111,.11);
  --macro-fat-tint:     rgba(155,107,138,.11);
  --macro-carbs-tint:   rgba(74,122,155,.11);
  --font-display:   'Cormorant Garamond', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text-body); line-height: 1.6; }
/* Focus-visible for keyboard navigation */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-hint {
  0%, 100% { opacity: 1; }
  50%      { opacity: .6; }
}
@keyframes checkPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.page-wrap, .recipes-wrap, .pantry-wrap, .community-wrap, .recipe-page, .page-wrap-narrow { animation: fadeInUp .3s ease forwards; }
.dashboard-main { animation: fadeInUp .4s ease forwards; }
.dashboard-sidebar { animation: fadeInUp .4s ease .1s forwards; opacity: 0; }
.prep-card { animation: fadeInUp .35s ease forwards; opacity: 0; }
.prep-card:nth-child(1) { animation-delay: .05s; }
.prep-card:nth-child(2) { animation-delay: .1s; }
.prep-card:nth-child(3) { animation-delay: .15s; }
.prep-card:nth-child(4) { animation-delay: .2s; }
.prep-card:nth-child(5) { animation-delay: .25s; }
.prep-card:nth-child(6) { animation-delay: .3s; }
.week-col { animation: fadeInUp .35s ease forwards; opacity: 0; }
.week-col:nth-child(1) { animation-delay: .05s; }
.week-col:nth-child(2) { animation-delay: .1s; }
.week-col:nth-child(3) { animation-delay: .15s; }
.week-col:nth-child(4) { animation-delay: .2s; }
.week-col:nth-child(5) { animation-delay: .25s; }
.week-col:nth-child(6) { animation-delay: .3s; }
.week-col:nth-child(7) { animation-delay: .35s; }
h1 { color: var(--text-heading); font-family: var(--font-display); font-size: 2rem; margin-bottom: 8px; font-weight: 600; }
h2 { color: var(--text-body); font-size: 1.3rem; margin-bottom: 24px; font-weight: 400; }
.card { background: var(--surface); border-radius: 16px; padding: 24px;
        box-shadow: 0 2px 16px rgba(30,22,16,.06); border: 1px solid var(--border); }
label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text-heading); font-size: .85rem; }
.options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.option-btn { background: var(--bg); border: 2px solid var(--primary-20); border-radius: 10px;
              padding: 14px 18px; text-align: left; cursor: pointer; transition: .2s;
              font-size: 1rem; color: var(--text-body); }
.option-btn:hover { background: var(--primary-10); border-color: var(--primary); }
.btn { background: var(--primary); color: white; border: none; border-radius: 12px;
       padding: 12px 20px; font-size: .9rem; font-weight: 600; cursor: pointer;
       width: 100%; margin-top: 8px; transition: .2s; display:block; text-align:center;
       box-shadow: 0 2px 8px rgba(200,136,58,.28); }
.btn:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(200,136,58,.35); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-outline { background: var(--surface); color: var(--primary); border: 2px solid var(--primary); box-shadow: none; }
.btn-outline:hover { background: var(--primary-10); }
.btn-ghost { background: transparent; color: var(--primary); border: none; box-shadow: none; padding: 10px 16px; }
.btn-ghost:hover { background: var(--primary-10); box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: .78rem; font-weight: 600; border-radius: 8px;
          background: var(--primary-15); color: var(--accent); border: 1px solid var(--primary-40);
          cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.btn-sm:hover { background: var(--primary-20); }
input[type=email], input[type=password], input[type=text], input[type=number], textarea, select {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--primary-20); border-radius: 10px;
  font-size: .88rem; background: var(--bg); margin-bottom: 12px; outline: none;
  font-family: inherit; color: var(--text-body); }
input:focus, textarea:focus, select:focus { border-color: var(--primary); background: var(--surface); }
.option-radio { display: flex; align-items: center; gap: 10px; background: var(--bg);
                border: 2px solid var(--primary-20); border-radius: 10px; padding: 14px 18px;
                cursor: pointer; font-size: 1rem; color: var(--text-body); transition: .2s; }
.option-radio:has(input:checked) { background: var(--primary-10); border-color: var(--primary); }
.option-radio input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.onb-section { font-size:.68rem; font-weight:600; text-transform:uppercase; letter-spacing:1.5px;
               color: var(--accent); background: var(--primary-10); border-radius:20px; padding:4px 12px;
               display:inline-block; margin-bottom:16px; }
.onb-question { font-size:1.15rem; font-weight:700; color: var(--text-heading); margin-bottom:6px; line-height:1.3; }
.onb-why { font-size:.83rem; color: var(--text-muted); margin-bottom:18px; line-height:1.55; }
.progress { display: flex; gap: 6px; margin-bottom: 28px; }
.progress-dot { height: 6px; border-radius: 3px; background: var(--primary-20); flex: 1; }
.progress-dot.done { background: var(--primary); }
.brand { font-size: 1.5rem; font-weight: 600; color: var(--primary); letter-spacing: 0;
         font-family: var(--font-display); font-style: italic; }
.brand span { color: var(--text-heading); font-style: normal; }
.alert { background: var(--primary-15); border: 1px solid var(--primary-40); border-radius: 8px;
         padding: 12px 16px; margin-bottom: 16px; font-size: .9rem; }
.generating { text-align: center; padding: 56px 24px; }
.generating h2 { font-size: 1.2rem; color: var(--text-body); margin-top: 12px; }

/* ── Sidebar Navigation ── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px; z-index: 200;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: width .2s ease;
  box-shadow: 1px 0 12px rgba(30,22,16,.05);
}
.sb-header { padding: 20px 16px 12px; }
.sb-logo {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.sb-logo img { height: 20px; flex-shrink: 0; }
.sb-nav { flex: 1; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px;
  text-decoration: none; font-size: .88rem; font-weight: 500; color: var(--text-body);
  transition: background .15s, color .15s; border: none; background: none; cursor: pointer;
  position: relative; white-space: nowrap;
}
.sb-item:hover { background: var(--primary-10); color: var(--primary); }
.sb-item.active {
  background: var(--primary-10); color: var(--primary); font-weight: 600;
}
.sb-item.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--primary);
}
.sb-item svg { flex-shrink: 0; }
.sb-footer {
  padding: 8px 10px 12px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.sb-toggle {
  display: flex; align-items: center; justify-content: center;
  margin: 8px auto 0; padding: 6px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  color: var(--text-muted); transition: .15s;
}
.sb-toggle:hover { background: var(--primary-10); color: var(--primary); }
/* Collapsed state */
.sb-collapsed .sidebar { width: 64px; overflow: hidden; }
.sb-collapsed .sb-header { padding: 20px 0 12px; display: flex; justify-content: center; }
.sb-collapsed .sb-logo { justify-content: center; }
.sb-collapsed .sb-item span { display: none; }
.sb-collapsed .sb-item { justify-content: center; padding: 10px 0; }
.sb-collapsed .sb-item.active::before { top: 8px; bottom: 8px; }
.sb-collapsed .sb-toggle svg { transform: rotate(180deg); }
/* Hamburger for mobile (hidden — replaced by mob-topbar) */
.sb-hamburger { display: none; }
/* Mobile top navbar */
.mob-topbar {
  display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 150;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 16px; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(30,22,16,.06);
}
.mob-topbar-logo img { height: 18px; display: block; }
.mob-topbar-feedback {
  display: flex; align-items: center; gap: 6px; text-decoration: none;
  color: var(--text-muted); font-size: .78rem; font-weight: 600;
}
.sb-overlay {
  display: none; position: fixed; inset: 0; z-index: 190;
  background: rgba(30,22,16,.4); backdrop-filter: blur(2px);
}
/* Page content offset */
body { margin-left: 240px; transition: margin-left .2s ease; }
.sb-collapsed body, body.sb-collapsed { margin-left: 64px; }
.page-wrap { max-width: 100%; margin: 0 auto; padding: 24px 24px 48px; box-sizing: border-box; }

/* Mobile sidebar */
@media (max-width: 768px) {
  body, .sb-collapsed body, body.sb-collapsed { margin-left: 0 !important; }
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sb-open .sidebar { transform: translateX(0); box-shadow: 4px 0 20px rgba(30,22,16,.15); }
  .sb-open .sb-overlay { display: block; }
  .mob-topbar { display: flex; }
  .sb-toggle { display: none; }
  .desktop-only { display: none !important; }
  .sb-collapsed .sidebar { width: 240px; }
  .sb-collapsed .sb-item span { display: inline; }
  .sb-collapsed .sb-item { justify-content: flex-start; padding: 10px 14px; }
  .page-wrap, .page-wrap-narrow, .recipes-wrap, .pantry-wrap, .community-wrap, .recipe-page { padding-top: 56px; padding-bottom: 80px; }
}
/* Mobile bottom navigation */
.mobile-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(30,22,16,.08);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
@media (max-width: 768px) {
  .mobile-bottom-nav { display: flex; justify-content: space-around; align-items: center; }
}
.mob-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--text-muted); font-size: .65rem; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; transition: .15s; min-width: 56px;
}
.mob-nav-item svg { width: 22px; height: 22px; }
.mob-nav-item:hover, .mob-nav-item.active { color: var(--primary); }
.mob-nav-item.active { background: var(--primary-10); }
/* Touch targets: minimum 44px on mobile */
@media (max-width: 768px) {
  .btn, .btn-sm, .btn-outline, .fchip, .toggle-btn { min-height: 44px; }
  .sb-item { min-height: 44px; }
}

/* ── Macro targets bar ── */
.macro-bar { display: flex; gap: 8px; margin-bottom: 20px; }
.macro-pill { flex: 1; background: var(--surface); border-radius: 14px; padding: 12px 6px;
              text-align: center; box-shadow: 0 1px 6px rgba(30,22,16,.06); overflow: hidden;
              display: flex; flex-direction: column; align-items: center; }
.macro-pill .val { font-size: 1.05rem; font-weight: 800; margin-top: 2px; }
.macro-pill .lbl { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; margin-top: 1px; }
/* Macro ring SVG */
.macro-ring { width: 56px; height: 56px; transform: rotate(-90deg); }
.macro-ring-bg { fill: none; stroke: var(--surface-muted); stroke-width: 5; }
.macro-ring-fg { fill: none; stroke-width: 5; stroke-linecap: round;
                 transition: stroke-dashoffset .6s ease; }
.macro-ring-fg.ring-kcal    { stroke: var(--macro-kcal); }
.macro-ring-fg.ring-protein { stroke: var(--macro-protein); }
.macro-ring-fg.ring-fat     { stroke: var(--macro-fat); }
.macro-ring-fg.ring-carbs   { stroke: var(--macro-carbs); }
/* Macro colour classes */
.macro-kcal    { color: var(--macro-kcal); }
.macro-protein { color: var(--macro-protein); }
.macro-fat     { color: var(--macro-fat); }
.macro-carbs   { color: var(--macro-carbs); }
.macro-kcal-bg    { border-top: 3px solid var(--macro-kcal); }
.macro-protein-bg { border-top: 3px solid var(--macro-protein); }
.macro-fat-bg     { border-top: 3px solid var(--macro-fat); }
.macro-carbs-bg   { border-top: 3px solid var(--macro-carbs); }

/* ── View header & toggle ── */
.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.view-toggle { display: inline-flex; background: var(--surface-muted); border-radius: 24px; padding: 3px; gap: 2px;
               border: 1px solid var(--border); }
.toggle-btn { padding: 7px 20px; border: none; border-radius: 20px; font-size: .82rem; font-weight: 600;
              cursor: pointer; transition: .2s; background: transparent; color: var(--text-muted); }
.toggle-btn:hover { color: var(--text-body); }
.toggle-btn.active { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(200,136,58,.3); }
/* Action bar */
.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.action-bar .btn { width: auto; margin-top: 0; padding: 10px 20px; font-size: .85rem; }
.action-bar .btn-outline { box-shadow: none; }
/* Compact macro targets (inline) */
.macro-targets-inline {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px; margin-bottom: 16px;
}
.macro-target-item { display: flex; align-items: baseline; gap: 4px; }
.macro-target-val { font-size: 1rem; font-weight: 700; }
.macro-target-lbl { font-size: .75rem; color: var(--text-muted); }
.macro-target-sep { color: var(--border); font-size: .85rem; }
.macro-target-edit { font-size: .75rem; color: var(--primary); text-decoration: none; font-weight: 600;
                     margin-left: auto; white-space: nowrap; }
.macro-target-edit:hover { text-decoration: underline; }
/* Stats strip */
.stats-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: .78rem; color: var(--text-muted); margin-bottom: 20px;
}
.stats-strip-item strong { color: var(--text-heading); }
.stats-strip-item.stats-zero strong { color: var(--text-muted); }
.stats-strip-sep { color: var(--border); }
.stats-strip-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.stats-strip-link:hover { text-decoration: underline; }

/* ── Calendar view ── */
.cal-grid { background: var(--surface); border-radius: 14px; border: 1px solid var(--border);
            overflow: hidden; box-shadow: 0 2px 12px rgba(30,22,16,.06); }
.cal-header-row { display: grid; grid-template-columns: repeat(7, 1fr);
                  border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.cal-header { text-align: center; padding: 10px 4px; }
.cal-day-name { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
                color: var(--text-muted); }
.cal-day-num { font-size: 1rem; font-weight: 700; color: var(--text-heading); margin-top: 2px; }
.cal-header.cal-today { background: var(--primary-10); }
.cal-header.cal-today .cal-day-num { color: var(--primary); }
.cal-slot-row { border-bottom: 1px solid var(--border); }
.cal-slot-row:last-child { border-bottom: none; }
.cal-slot-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
                  color: var(--text-muted); padding: 8px 12px 4px; }
.cal-slot-cells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-cell { padding: 6px 4px 8px; min-height: 60px; border-right: 1px solid var(--border); }
.cal-cell:last-child { border-right: none; }
.cal-cell.cal-today { background: var(--primary-10); }
.cal-cell-link { display: flex; flex-direction: column; gap: 3px; text-decoration: none;
                 padding: 4px; border-radius: 6px; transition: .15s; }
.cal-cell-link:hover { background: var(--primary-10); }
.cal-cell-link.cal-done { opacity: .6; }
.cal-cell-link.cal-done .cal-cell-name { text-decoration: line-through; }
.cal-cell-img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.cal-cell-name { font-size: .7rem; font-weight: 600; color: var(--text-heading); line-height: 1.2;
                 overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-cell-kcal { font-size: .62rem; color: var(--macro-kcal); font-weight: 600; }
.cal-cell-empty { font-size: .78rem; color: var(--text-muted); text-align: center; display: block; padding-top: 16px; }
@media (max-width: 900px) {
  .cal-grid { overflow-x: auto; }
  .cal-header-row, .cal-slot-cells { min-width: 600px; }
}

/* ── Week view ── */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; padding-bottom: 8px; }
.week-col { background: var(--surface); border-radius: 14px;
            box-shadow: 0 2px 12px rgba(30,22,16,.07); border: 1px solid var(--border); overflow: hidden;
            transition: transform .15s, box-shadow .15s; }
.week-col:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(200,136,58,.15); }
@media (max-width: 1199px) {
  .week-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; }
  .week-col { min-width: 220px; scroll-snap-align: start; }
}
.week-col.day-locked { opacity: .45; filter: grayscale(.5); pointer-events: none; }
.week-col.day-locked .week-col-header { background: #b0a89a; }
.day-panel.day-locked { opacity: .45; filter: grayscale(.5); pointer-events: none; }
.week-col-header { background: linear-gradient(135deg, var(--primary) 0%, #D4994A 100%);
                   color: white; padding: 10px 10px; text-align: center; position: relative; overflow: hidden; }
.week-col-header::after { content: ''; position: absolute; bottom: 0; left: 0; height: 3px;
                           background: rgba(255,255,255,.35); width: var(--pct, 0%); transition: width .4s ease; }
.week-col-day-name { font-size: .82rem; font-weight: 700; }
.week-col-date { font-size: .65rem; opacity: .85; margin-top: 1px; }
.week-col-kcal { font-size: .72rem; font-weight: 600; margin-top: 3px; opacity: .9; }
.week-col-meals { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.week-meal-chip { background: var(--surface); border-radius: 12px; overflow: hidden;
                  border: 1px solid var(--border); transition: box-shadow .15s; }
.week-meal-chip:hover { box-shadow: 0 2px 8px rgba(30,22,16,.08); }
.week-meal-macros-detail { display: block; font-size: .6rem; margin-top: 1px; }
.week-meal-thumb { width: 100%; height: 110px; object-fit: cover; display: block; }
.week-meal-thumb-ph { width: 100%; height: 110px; background: var(--surface-muted); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.week-meal-body { padding: 6px 8px 8px; }
.week-meal-slot { font-size: .58rem; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.week-meal-name { font-size: .78rem; font-weight: 600; color: var(--text-heading);
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.week-meal-macros { font-size: .65rem; color: var(--text-muted); margin-top: 2px; }
.time-page-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: .72rem; color: var(--text-muted); }
.week-meal-actions { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.week-btn-swap { font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 7px;
                 background: var(--primary-10); color: var(--accent); border: 1px solid var(--border);
                 text-decoration: none; white-space: nowrap; line-height: 1.4; }
.week-btn-swap:hover { background: var(--primary); color: white; }
.week-btn-check { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #ddd;
                  background: white; cursor: pointer; font-size: .85rem; display: flex;
                  align-items: center; justify-content: center; color: #aaa; flex-shrink: 0; transition: .15s; }
.week-btn-check:hover { border-color: #4CAF50; color: #4CAF50; }
.week-btn-check.done { border-color: #4CAF50; background: #4CAF50; color: white; }
.week-btn-remove { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #ddd;
                   background: white; cursor: pointer; font-size: .8rem; display: flex;
                   align-items: center; justify-content: center; color: #aaa; flex-shrink: 0; transition: .15s; }
.week-btn-remove:hover { border-color: #e57373; color: #e57373; }
/* Fast CSS tooltips — replaces slow native title= tooltips */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 5px); left: 50%;
  transform: translateX(-50%); background: rgba(0,0,0,.72); color: white; padding: 3px 8px;
  border-radius: 5px; font-size: .67rem; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .08s; z-index: 99; font-weight: 500; }
[data-tip]:hover::after { opacity: 1; }
.week-meal-chip.meal-done { opacity: .55; }
.week-meal-chip.meal-done .week-meal-thumb, .week-meal-chip.meal-done .week-meal-thumb-ph { filter: grayscale(.5); }
/* Column toggle — mobile only */
.col-toggle { display:none; gap:2px; background:var(--surface-muted); border-radius:8px; padding:2px; margin-left:auto; }
@media (max-width: 900px) { .col-toggle { display:inline-flex; } }
.col-toggle-btn { border:none; background:none; cursor:pointer; padding:5px 9px; border-radius:6px; font-size:.72rem;
                  color:var(--text-muted); font-weight:600; transition:.15s; line-height:1; }
.col-toggle-btn.active { background:white; color:var(--primary); box-shadow:0 1px 3px rgba(0,0,0,.1); }
/* Recipes of the week section */
.prep-section { margin-top: 28px; margin-bottom: 28px; }
.prep-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; max-width: 50%; }
@media (max-width: 900px) { .prep-grid { max-width: 100%; grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .prep-grid { grid-template-columns: 1fr; } }
.prep-card { background: white; border-radius: 14px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.06);
             display: flex; flex-direction: column; color: inherit; transition: .15s;
             border: 1px solid var(--border); }
.prep-card:hover { box-shadow: 0 4px 20px rgba(200,136,58,.2); transform: translateY(-2px); }
.prep-card-link { text-decoration: none; color: inherit; display: flex; flex-direction: column; flex: 1; }
.prep-card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--surface-muted); }
.prep-card-img-ph { width: 100%; aspect-ratio: 4/3; background: var(--surface-muted); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.prep-card-body { padding: 10px 10px 10px; }
.prep-card-cat { font-size: .6rem; color: #C8883A; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.prep-card-name { font-size: .85rem; font-weight: 700; color: var(--text-heading); line-height: 1.25;
                  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prep-card-macros { font-size: .68rem; color: #888; margin-top: 4px; line-height: 1.5; }
/* P/G/C inline in 1-col view */
.prep-grid[data-cols="1"] .prep-card-macros > div:not(:first-child) { display: inline; margin-right: 6px; }
@media (max-width: 500px) {
  .prep-grid:not([data-cols]) .prep-card-macros > div:not(:first-child) { display: inline; margin-right: 6px; }
}
.prep-card-actions { display: flex; align-items: center; gap: 6px; padding: 0 10px 8px; margin-top: auto; }
.week-add-snack { width: 100%; padding: 6px 0; background: var(--bg); border: 1.5px dashed var(--border);
                  border-radius: 10px; color: var(--primary); font-size: .72rem; font-weight: 600;
                  cursor: pointer; margin-top: 2px; transition: .15s; }
.week-add-snack:hover { border-color: var(--primary); background: var(--primary-10); }

/* ── Day view ── */
.day-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.day-nav-btn { background: var(--surface); border: 1.5px solid var(--primary-40); border-radius: 8px;
               padding: 8px 16px; font-size: .85rem; font-weight: 700; color: var(--primary);
               cursor: pointer; transition: .15s; }
.day-nav-btn:hover { background: var(--primary-10); }
.day-nav-btn:disabled { opacity: .35; cursor: default; background: var(--surface); }
.day-nav-label { font-size: 1.15rem; font-weight: 700; color: var(--text-heading); text-align: center; }
.day-kcal-bar { background: var(--surface-muted); border-radius: 6px; height: 6px; overflow: hidden; }
.day-kcal-fill { height: 100%; background: var(--macro-kcal); border-radius: 6px; transition: width .3s; }
.day-meals-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
@media (min-width: 900px) {
  .day-meals-grid { flex-direction: row; flex-wrap: wrap; }
  .day-meals-grid > .day-meal-card { flex: 1 1 0; min-width: 0; }
  .day-meals-grid > .day-meal-card .day-meal-top { flex-direction: column; align-items: stretch; gap: 8px; }
  .day-meals-grid > .day-meal-card .day-meal-thumb,
  .day-meals-grid > .day-meal-card .day-meal-thumb-ph { width: 100%; height: 100px; }
  .day-meals-grid > .day-meal-card .day-meal-name { white-space: normal; font-size: .9rem; }
  .day-meals-grid > .day-meal-card .check-btn { align-self: flex-end; }
  .day-meals-grid > .day-meal-card .day-meal-actions { flex-wrap: wrap; }
  .day-meals-grid > .day-meal-card .day-meal-portions { margin-left: 0; }
}
.day-meal-card { background: var(--surface); border-radius: 14px; padding: 16px 18px;
                 box-shadow: 0 2px 10px rgba(30,22,16,.05); border: 1px solid var(--border);
                 display: flex; flex-direction: column; gap: 10px;
                 transition: transform .15s, box-shadow .15s; }
.day-meal-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(30,22,16,.1); }
.day-meal-top { display: flex; align-items: center; gap: 14px; }
.day-meal-actions { display: flex; align-items: center; justify-content: space-between;
                    gap: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.day-meal-actions-left { display: flex; align-items: center; gap: 6px; }
.day-meal-portions { display: flex; align-items: center; gap: 8px; font-size: .85rem;
                     font-weight: 400; color: #555; margin-left: auto; }
.portion-btn { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid #C8883A40;
               background: #F5F0E8; cursor: pointer; font-size: 1rem; color: #C8883A;
               display: flex; align-items: center; justify-content: center; }
.portion-val { color: #C8883A; min-width: 24px; text-align: center; }
.day-meal-photo-row { display: flex; align-items: center; gap: 8px; padding-top: 8px;
                      border-top: 1px solid var(--border); }
.day-meal-thumb { width: 88px; height: 66px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--bg); }
.day-meal-thumb-ph { width: 88px; height: 66px; border-radius: 10px; flex-shrink: 0;
                     background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.day-meal-body { flex: 1; min-width: 0; }
.day-meal-slot { font-size: .65rem; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.day-meal-name { font-size: 1rem; font-weight: 700; color: var(--text-heading);
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.day-meal-macros { font-size: .78rem; color: var(--text-muted); margin-top: 3px; }
/* Meal completion */
.day-meal-card.meal-done { opacity: .7; border-left: 3px solid #4CAF50; }
.day-meal-card.meal-done .day-meal-thumb, .day-meal-card.meal-done .day-meal-thumb-ph { filter: grayscale(.3); }
.check-btn { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #ddd;
             background: white; cursor: pointer; font-size: 1.1rem; display: flex;
             align-items: center; justify-content: center; flex-shrink: 0; transition: .15s;
             color: #aaa; }
.check-btn:hover { border-color: #4CAF50; color: #4CAF50; }
.check-btn.done { border-color: #4CAF50; background: #4CAF50; color: white; }
/* Streak badge (navbar) */
.streak-badge { background: linear-gradient(135deg, #FF6B35, #C8883A);
                color: white; border-radius: 20px; padding: 4px 12px;
                font-size: .78rem; font-weight: 700; white-space: nowrap; }
/* Streak stats bar */
.streak-stats-bar { display:flex; flex-direction:column; gap:0; background:white;
                    border-radius:14px; padding:14px 18px; margin-bottom:16px;
                    box-shadow:0 1px 6px rgba(30,22,16,.06); }
.streak-stat-item { display:flex; align-items:center; gap:8px; }
.streak-stat-item.streak-zero .streak-stat-icon { opacity:.35; }
.streak-stat-item.streak-zero .streak-stat-val { color:#ccc; }
.streak-stat-icon { font-size:1.3rem; }
.streak-stat-val { font-size:1.4rem; font-weight:800; color:#C8883A; line-height:1; font-variant-numeric: tabular-nums; }
.streak-stat-lbl { font-size:.7rem; color:#aaa; font-weight:600; text-transform:uppercase; letter-spacing:.5px; white-space:nowrap; }
.streak-stat-item { padding-bottom:10px; }
.streak-stat-item + .streak-stat-item { border-top:1px solid #F0EAE2; padding-top:10px; padding-bottom:0; }
/* How it works card */
.how-it-works { background:white; border-radius:14px; margin-bottom:16px;
                box-shadow:0 1px 6px rgba(30,22,16,.06); overflow:hidden; }
.how-it-works summary { padding:14px 18px; cursor:pointer; font-size:.88rem; font-weight:700;
                         color:#555; list-style:none; display:flex; align-items:center; gap:6px; }
.how-it-works summary::-webkit-details-marker { display:none; }
.how-it-works { transition: box-shadow .2s; }
.how-it-works[open] { box-shadow: 0 2px 16px rgba(30,22,16,.08); }
.how-it-works[open] summary { border-bottom:1px solid #F0EAE2; color:#C8883A; }
.how-it-works-body { padding:14px 18px; display:flex; flex-direction:column; gap:12px; }
.how-row { display:flex; gap:12px; align-items:flex-start; font-size:.84rem; color:#555; line-height:1.5; }
.how-icon { font-size:1.2rem; flex-shrink:0; margin-top:1px; }
/* Week view photo */
.week-btn-photo { display:inline-flex; align-items:center; justify-content:center; cursor:pointer;
                  padding:3px 7px; border-radius:8px; font-size:.75rem; background:#FFF8F0;
                  border:1.5px solid #E8D5C4; color:#C8883A; font-weight:600; white-space:nowrap; }
.week-btn-photo:hover { background:#C8883A; color:white; border-color:#C8883A; }
.week-meal-photo-wrap { padding:4px 8px 6px; border-top:1px solid #F0EAE2; }
.week-meal-photo-thumb { width:100%; height:60px; object-fit:cover; border-radius:8px; display:block; }
/* Day view photo button */
.day-photo-btn { display:flex; align-items:center; justify-content:center; cursor:pointer;
                 padding:6px 10px; border-radius:10px; font-size:.78rem; font-weight:700;
                 background:#FFF3E8; border:2px dashed #C8883A; color:#C8883A;
                 white-space:nowrap; gap:4px; margin-top:2px; }
.day-photo-btn:hover { background:#C8883A; color:white; border-style:solid; }
.day-photo-btn-has { border-style:solid; background:#FFF8F0; padding:4px; }
.day-photo-preview { width:48px; height:48px; object-fit:cover; border-radius:7px; }
.day-photo-overlay { font-size:.7rem; color:#C8883A; font-weight:700; }
/* Leaderboard widget (dashboard) */
.lb-widget { background:white; border-radius:14px; margin-bottom:16px;
             box-shadow:0 1px 6px rgba(30,22,16,.06); overflow:hidden; }
.lb-widget-header { display:flex; justify-content:space-between; align-items:center;
                    padding:12px 16px; border-bottom:1px solid #F0EAE2; }
.lb-widget-link { font-size:.78rem; color:#C8883A; font-weight:600; text-decoration:none; }
.lb-widget-link:hover { text-decoration:underline; }
.lb-widget-row { display:flex; align-items:center; gap:10px; padding:8px 16px;
                 border-bottom:1px solid #F8F3EE; }
.lb-widget-row:last-child { border-bottom:none; }
.lb-widget-rank { font-size:.9rem; font-weight:800; color:#ccc; min-width:22px; text-align:center; }
.lb-widget-rank.top1 { color:#FFD700; }
.lb-widget-rank.top2 { color:#B0BEC5; }
.lb-widget-rank.top3 { color:#CD7F32; }
.lb-widget-name { flex:1; font-size:.84rem; font-weight:600; color:var(--text-heading);
                  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lb-widget-score { font-size:.8rem; font-weight:700; color:#C8883A; white-space:nowrap; }
/* Logged kcal bar */
.day-kcal-bar-wrap { margin-bottom: 4px; }
.day-kcal-bar { background: var(--surface-muted); border-radius: 10px; height: 10px; overflow: hidden; position: relative; }
.day-kcal-fill { height: 100%; background: var(--macro-kcal); border-radius: 10px; transition: width .5s ease; }
.day-kcal-fill-logged { height: 100%; background: #4CAF50; border-radius: 10px; transition: width .5s ease; position: absolute; top:0; left:0; }

/* ── Shopping list ── */
.shop-card { max-width: 50%; }
@media (max-width: 600px) { .shop-card { max-width: 100%; } }
.shop-section { margin-bottom: 18px; }
.shop-section-title { font-size: .78rem; font-weight: 700; text-transform: uppercase;
                      letter-spacing: 1px; color: var(--accent); margin-bottom: 8px;
                      padding-bottom: 6px; border-bottom: 1px solid var(--border);
                      display: flex; align-items: center; gap: 8px; }
.shop-section-title::before { content: ''; width: 8px; height: 8px; border-radius: 50%;
                               background: var(--primary); flex-shrink: 0; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.shop-item { font-size: .85rem; color: var(--text-body); padding: 8px 6px; display: flex; align-items: center; gap: 8px;
             cursor: pointer; user-select: none; border-radius: 8px; transition: background .15s; }
.shop-item:hover { background: var(--primary-10); }
.shop-item::before { content: ''; display: inline-block; width: 18px; height: 18px; min-width: 18px;
                     border: 1.5px solid var(--primary-40); border-radius: 5px; flex-shrink: 0;
                     transition: all .15s; background: white; }
.shop-item.checked::before { background: var(--accent); border-color: var(--accent);
                              content: '✓'; color: white; font-size: 11px; font-weight: 700;
                              display: flex; align-items: center; justify-content: center;
                              line-height: 18px; text-align: center;
                              animation: checkPop .25s ease; }
.shop-item.checked .shop-item-text { text-decoration: line-through; color: #aaa; }
/* Shopping progress bar */
.shop-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: .78rem; color: var(--text-muted); }
.shop-progress-bar { flex: 1; height: 6px; background: var(--surface-muted); border-radius: 6px; overflow: hidden; }
.shop-progress-fill { height: 100%; background: var(--primary); border-radius: 6px; transition: width .3s ease; }

.week-title { font-size: 1.05rem; font-weight: 700; color: var(--text-heading);
              display: flex; align-items: center; gap: 8px; }
.week-title svg { color: var(--primary); flex-shrink: 0; }
.week-title span { background: var(--primary); color: white; font-size: .7rem; font-weight: 700;
                   padding: 3px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: .5px; }
/* Week history picker */
.week-picker { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
               scrollbar-width: none; margin-bottom: 16px; }
.week-picker::-webkit-scrollbar { display: none; }
.week-chip { flex-shrink: 0; background: white; border: 1.5px solid var(--border);
             border-radius: 20px; padding: 6px 14px; font-size: .8rem;
             font-weight: 600; color: #888; text-decoration: none; white-space: nowrap;
             transition: border-color .15s, color .15s; }
.week-chip:hover { border-color: #C8883A; color: #C8883A; }
.week-chip.active { background: #C8883A; border-color: #C8883A; color: white;
                    box-shadow: 0 2px 10px rgba(200,136,58,.35); }
.past-week-notice { background: #FFF8F0; border: 1px solid #F0D9B5; border-radius: 12px;
                    padding: 10px 16px; font-size: .85rem; color: #9B6A2A; margin-bottom: 14px;
                    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.past-week-notice a { color: #C8883A; font-weight: 700; text-decoration: none; }
.past-week-notice a:hover { text-decoration: underline; }
.section-title { font-size: 1.05rem; font-weight: 700; color: var(--text-heading); margin: 20px 0 10px;
                 display: flex; align-items: center; gap: 8px; }
.section-title svg { color: var(--primary); flex-shrink: 0; }
.page-badge { display: none; }

/* ── Responsive ── */
@media (max-width: 480px) {
  #view-week { display: none !important; }
  #view-day { display: block !important; }
  .toggle-btn[data-view="week"] { pointer-events: none; opacity: .4; }
}

/* ── Dashboard sidebar layout ── */
.dashboard-layout { display: flex; align-items: flex-start; gap: 20px; width: 100%; padding: 0 24px; box-sizing: border-box; }
.dashboard-main { flex: 1 1 0; min-width: 0; }
.dashboard-sidebar { flex: 0 0 280px; width: 280px; position: sticky; top: 24px;
  display: flex; flex-direction: column; gap: 14px; align-self: flex-start; }
@media (max-width: 900px) {
  .dashboard-layout { flex-direction: column; padding: 0 12px; }
  .dashboard-sidebar { width: 100%; flex: 0 0 auto; position: static; }
}
/* Totals vs Targets */
.totals-card { background: var(--surface); border-radius: 14px; border: 1px solid var(--border); padding: 16px; }
.totals-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.totals-table th { text-align: right; font-size: .7rem; font-weight: 600; text-transform: uppercase;
                   letter-spacing: .5px; padding: 2px 0 6px; }
.totals-table th:first-child { text-align: left; }
.totals-table td { padding: 5px 0; border-top: 1px solid var(--border); }
.totals-table td:first-child { font-size: .78rem; }
.totals-table td:nth-child(2), .totals-table td:nth-child(3) { text-align: right; font-weight: 600; font-size: .85rem; }
.totals-table td:nth-child(3) { color: var(--text-muted); }

.sidebar-community-card { background: #fff; border-radius: 14px; border: 1px solid #F0E8D8;
  overflow: hidden; display: flex; flex-direction: column; }
.sidebar-community-banner { width: 100%; display: block; line-height: 0; }
.sidebar-community-banner svg { width: 100%; height: auto; display: block; }
.sidebar-community-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-community-logo { height: 28px; display: block; }
.sidebar-community-title { font-size: .95rem; font-weight: 700; color: var(--text-heading); }
.sidebar-community-desc { font-size: .78rem; color: #666; line-height: 1.5; margin: 0; }
.sidebar-community-stats { display: flex; gap: 10px; font-size: .75rem; color: #888; }
.sidebar-invite-btn { background: #F5F0E8; border: 1.5px dashed #C8883A60; color: #C8883A80;
  border-radius: 8px; padding: 7px 10px; font-size: .78rem; font-weight: 600;
  cursor: not-allowed; width: 100%; }
.dashboard-sidebar .streak-stats-bar { margin: 0; }
.dashboard-sidebar .lb-widget { margin: 0; }
.sidebar-feedback-card { background: #fff; border-radius: 14px; border: 1px solid #F0E8D8; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-feedback-header { font-size: .88rem; font-weight: 700; color: var(--text-heading); }
.sidebar-feedback-desc { font-size: .76rem; color: #777; line-height: 1.5; margin: 0; }
.sidebar-feedback-btn { display: block; text-align: center; background: var(--primary); color: #fff; border-radius: 9px; padding: 9px 14px; font-size: .82rem; font-weight: 700; text-decoration: none; transition: .15s; }
.sidebar-feedback-btn:hover { background: #b57a32; }

/* ── Onboarding-style components (shared with settings) ── */
.onb-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.onb-card { background: var(--surface); border: 2px solid var(--primary-20); border-radius: 14px;
            padding: 24px 16px; text-align: center; cursor: pointer; transition: .2s;
            display: flex; flex-direction: column; align-items: center; gap: 8px; }
.onb-card:hover { border-color: var(--primary); background: var(--primary-10); transform: translateY(-2px);
                  box-shadow: 0 4px 16px rgba(200,136,58,.15); }
.onb-card.selected { border-color: var(--primary); background: var(--primary-15); }
.onb-card .icon { font-size: 2rem; line-height: 1; }
.onb-card .title { font-size: .95rem; font-weight: 700; color: var(--text-heading); }
.onb-card .desc { font-size: .78rem; color: var(--text-muted); line-height: 1.4; }
.onb-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.onb-chip { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 24px;
            border: 2px solid var(--primary-20); background: var(--surface); cursor: pointer;
            font-size: .88rem; font-weight: 500; color: var(--text-body); transition: .2s; user-select: none; }
.onb-chip:hover { border-color: var(--primary); background: var(--primary-10); }
.onb-chip.selected { border-color: var(--primary); background: var(--primary-15); color: var(--primary); font-weight: 600; }
.onb-chip input { display: none; }
.onb-gender-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.onb-gender-card { background: var(--surface); border: 2px solid var(--primary-20); border-radius: 10px;
                   padding: 14px 10px; text-align: center; cursor: pointer; transition: .2s; font-size: .9rem; font-weight: 600; }
.onb-gender-card:hover { border-color: var(--primary); background: var(--primary-10); }
.onb-gender-card.selected { border-color: var(--primary); background: var(--primary-15); color: var(--primary); }

/* ── Dialog modal ── */
#regen-dialog { margin: auto; }
#regen-dialog::backdrop { background: rgba(0,0,0,.45); }
