/* Kenny's Meals App — brand: cream #FFF6EA, ink #1B140F, orange #FF7A00, deep green #0F3A2A.
   Layout discipline: one spacing scale (4/8/12/16/24), equal-height cards,
   fixed photo aspect, reserved 2-line titles, tags in a fixed slot,
   price/Add pinned to card bottoms, generous bottom padding above the nav. */
:root{
  --bg:#FFF6EA; --cream2:#FCEBD3; --ink:#1B140F; --muted:#7A6A5C;
  --orange:#FF7A00; --orange-d:#E85F00; --green:#22B24C; --deep:#0F3A2A;
  --card:#FFFFFF; --line:#F0DFC8; --radius:18px;
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --nav-h:76px;
}
*{box-sizing:border-box; margin:0; padding:0}
html{-webkit-text-size-adjust:100%}
body{font-family:'Poppins',system-ui,-apple-system,sans-serif; background:var(--bg); color:var(--ink);
  max-width:520px; margin:0 auto; min-height:100vh; position:relative}
button{font-family:inherit; cursor:pointer; border:none; background:none; color:inherit}
input,select{font-family:inherit; font-size:15px}
img{display:block}
h1{font-size:22px; font-weight:700} h2{font-size:18px; font-weight:700} h3{font-size:15px; font-weight:600}
.small{font-size:12px; color:var(--muted)} .tiny{font-size:11px; color:var(--muted)}

/* header */
.app-header{position:sticky; top:0; z-index:40; background:var(--bg); padding:var(--s3) var(--s4) var(--s2);
  display:flex; align-items:center; justify-content:space-between; gap:var(--s3)}
.app-header img.logo{height:40px; width:auto}
.pts-pill{background:var(--deep); color:#fff; border-radius:999px; padding:8px 14px; font-weight:700; font-size:14px;
  display:flex; align-items:center; gap:6px; white-space:nowrap}
.pts-pill svg{width:15px; height:15px; fill:#FFB25E}

main{padding:0 var(--s4) calc(var(--nav-h) + var(--s5)); display:block}
.view{display:flex; flex-direction:column; gap:var(--s4)}
.card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:var(--s4)}
.section-title{display:flex; align-items:baseline; justify-content:space-between; gap:var(--s3); margin-top:var(--s2)}

/* buttons */
.btn{display:inline-flex; align-items:center; justify-content:center; gap:6px; border-radius:999px;
  font-weight:600; font-size:14px; padding:10px 18px; transition:transform .05s}
.btn:active{transform:scale(.98)}
.btn-orange{background:var(--orange); color:#fff}
.btn-deep{background:var(--deep); color:#fff}
.btn-ghost{background:var(--cream2); color:var(--deep)}
.btn[disabled]{background:#E8DCC8; color:#A08F78; cursor:not-allowed}
.btn-block{width:100%; padding:14px; font-size:15px}

/* macro ring + bars */
.ring-wrap{display:flex; align-items:center; gap:var(--s4)}
.ring{position:relative; width:118px; height:118px; flex:0 0 auto}
.ring svg{transform:rotate(-90deg)}
.ring .ring-center{position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center}
.ring .ring-center b{font-size:20px} .ring .ring-center span{font-size:11px; color:var(--muted)}
.bars{flex:1; display:flex; flex-direction:column; gap:var(--s2); min-width:0}
.bar-row{display:grid; grid-template-columns:58px 1fr 64px; align-items:center; gap:var(--s2); font-size:12px}
.bar-track{height:8px; background:var(--cream2); border-radius:99px; overflow:hidden}
.bar-fill{height:100%; border-radius:99px; background:var(--orange)}
.bar-fill.g{background:var(--green)} .bar-fill.d{background:var(--deep)}
.bar-row .val{text-align:right; color:var(--muted); white-space:nowrap}

/* water / streak */
.chip-row{display:flex; gap:var(--s2); flex-wrap:wrap}
.water-drops{display:flex; gap:6px; align-items:center}
.drop{width:26px; height:26px; border-radius:50%; border:2px solid #BFD9EA; display:grid; place-items:center; color:#7FB2D9; font-size:13px}
.drop.full{background:#DCEFFB; border-color:#7FB2D9}

/* deals */
.deal-row{display:grid; grid-template-columns:1fr auto; gap:2px var(--s3); align-items:center; padding:6px 0}
.deal-row .bar-track{grid-column:1 / -1}

/* store picker — even 2-column grid, no ragged pills */
.store-grid{display:grid; grid-template-columns:1fr 1fr; gap:var(--s2)}
.store-btn{background:var(--card); border:2px solid var(--line); border-radius:14px; padding:var(--s3);
  text-align:left; min-height:64px; display:flex; flex-direction:column; justify-content:center; gap:2px}
.store-btn b{font-size:14px} .store-btn span{font-size:11px; color:var(--muted)}
.store-btn.sel{border-color:var(--deep); background:#EFF7F1}
.store-btn.wide{grid-column:1 / -1}

/* category chips — one tidy scroll row with fade edge */
.chips-wrap{position:relative}
.chips{display:flex; gap:var(--s2); overflow-x:auto; padding:2px 2px 6px; scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip{flex:0 0 auto; border-radius:999px; padding:8px 14px; font-size:13px; font-weight:600;
  background:var(--card); border:1.5px solid var(--line); white-space:nowrap}
.chip.sel{background:var(--deep); color:#fff; border-color:var(--deep)}
.chips-wrap::after{content:""; position:absolute; top:0; right:0; bottom:0; width:28px;
  background:linear-gradient(to right, rgba(255,246,234,0), var(--bg)); pointer-events:none}

/* meal grid + cards — equal height, aligned */
.meal-grid{display:grid; grid-template-columns:1fr 1fr; gap:var(--s3)}
.meal-card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  overflow:hidden; display:flex; flex-direction:column; height:100%}
.meal-card .photo{aspect-ratio:4/3; background:var(--cream2); position:relative; flex:0 0 auto}
.meal-card .photo img{width:100%; height:100%; object-fit:cover}
.meal-card.soldout .photo img{filter:grayscale(1); opacity:.55}
.stock-badge{position:absolute; left:8px; bottom:8px; background:rgba(15,58,42,.92); color:#fff;
  font-size:11px; font-weight:600; padding:4px 9px; border-radius:99px}
.stock-badge.low{background:#B3540A} .stock-badge.out{background:#6B5D4F}
.meal-body{padding:var(--s3); display:flex; flex-direction:column; gap:6px; flex:1}
.meal-title{font-size:13.5px; font-weight:600; line-height:1.3; height:2.6em; overflow:hidden;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical}
.tag-slot{min-height:22px; display:flex; gap:4px; flex-wrap:nowrap; overflow:hidden}
.tag{font-size:10px; font-weight:700; letter-spacing:.02em; padding:3px 7px; border-radius:99px;
  background:#EAF5EE; color:var(--deep); white-space:nowrap}
.tag.spicy{background:#FDEBDD; color:#9A4A00}
.macro-line{font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.meal-foot{margin-top:auto; display:flex; align-items:center; justify-content:space-between; gap:var(--s2); padding-top:4px}
.price{font-weight:700; font-size:15px}
.add-btn{background:var(--orange); color:#fff; font-weight:700; font-size:13px; border-radius:999px; padding:8px 16px}
.add-btn[disabled]{background:#E8DCC8; color:#A08F78}
.log-link{font-size:12px; font-weight:600; color:var(--deep); text-align:center; padding:2px 0 0}

/* favorites rail */
.fav-rail{display:flex; gap:var(--s3); overflow-x:auto; padding-bottom:6px; scrollbar-width:none}
.fav-rail::-webkit-scrollbar{display:none}
.fav-card{flex:0 0 148px; background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  overflow:hidden; display:flex; flex-direction:column}
.fav-card .photo{aspect-ratio:4/3; background:var(--cream2)} .fav-card .photo img{width:100%; height:100%; object-fit:cover}
.fav-card .meal-body{padding:10px}
.fav-card .add-btn{width:100%; margin-top:auto}

/* instagram */
.ig-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:var(--s2)}
.ig-card{border-radius:14px; overflow:hidden; position:relative; aspect-ratio:1; background:var(--cream2); text-decoration:none}
.ig-card img{width:100%; height:100%; object-fit:cover}
.ig-card span{position:absolute; left:0; right:0; bottom:0; padding:14px 8px 6px; font-size:10.5px; font-weight:600; color:#fff;
  background:linear-gradient(transparent, rgba(27,20,15,.75))}

/* wellness hub + body — aligned 2-col grid of equal-height cards */
.well-grid{display:grid; grid-template-columns:1fr 1fr; gap:var(--s3)}
.well-card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:var(--s3) var(--s4); display:flex; flex-direction:column; gap:2px; text-align:left; height:100%}
button.well-card{cursor:pointer}
.well-ic{width:34px; height:34px; border-radius:10px; background:#EAF5EE; color:var(--deep);
  display:grid; place-items:center; flex:0 0 auto; margin-bottom:var(--s1)}
.well-label{font-size:11px; font-weight:700; letter-spacing:.04em; color:var(--muted); text-transform:uppercase}
.well-value{font-size:19px; font-weight:800; line-height:1.15}
.well-value small{font-size:12px; font-weight:600; color:var(--muted)}
.well-sub{font-size:11.5px; color:var(--muted); margin-top:auto; padding-top:2px}
.delta{font-weight:700; font-size:11px; white-space:nowrap}
.delta.good{color:var(--green)} .delta.bad{color:var(--orange-d)} .delta.flat{color:var(--muted)}
.stat-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:var(--s3)}
.stat-card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:var(--s3); display:flex; flex-direction:column; align-items:center; gap:0; text-align:center}
.stat-card b{font-size:21px; font-weight:800} .stat-card span{font-size:11px; color:var(--muted); font-weight:600}
.code-display{font-size:27px; font-weight:800; letter-spacing:.14em; color:var(--deep);
  background:var(--cream2); border:1.5px dashed #D8C39A; border-radius:14px; padding:12px 8px; margin:12px 0 14px}
.pill-status{font-size:10.5px; font-weight:700; padding:4px 9px; border-radius:99px; white-space:nowrap}
.pill-status.joined{background:var(--cream2); color:var(--muted)}
.pill-status.ordered{background:#FFF1E2; color:#9A4A00}
.pill-status.rewarded{background:#EAF5EE; color:var(--deep)}
.icon-btn{width:30px; height:30px; border-radius:50%; background:var(--cream2); color:var(--orange-d);
  display:grid; place-items:center; flex:0 0 auto}
.form-2col{display:grid; grid-template-columns:1fr 1fr; gap:0 var(--s3)}
.trend-svg{width:100%; height:auto; display:block}
.trend-val{font-size:10px; font-weight:700; fill:var(--ink)}
.trend-date{font-size:9px; fill:var(--muted)}

/* scan */
.scan-modes{display:grid; grid-template-columns:1fr 1fr; gap:var(--s2)}
.scan-mode{background:var(--card); border:2px solid var(--line); border-radius:14px; padding:var(--s3) var(--s2);
  display:flex; flex-direction:column; align-items:center; gap:6px; font-size:12px; font-weight:600; text-align:center}
.scan-mode.sel{border-color:var(--orange)}
.scan-mode svg{width:22px; height:22px; stroke:var(--deep)}
.scan-box{border:2px dashed #D8C39A; border-radius:var(--radius); background:#FFFDF8; min-height:180px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:var(--s3); padding:var(--s4); text-align:center}

/* train */
.plan-strip{display:grid; grid-template-columns:repeat(7,1fr); gap:6px}
.plan-day{background:var(--card); border:1.5px solid var(--line); border-radius:12px; padding:8px 2px; text-align:center;
  font-family:inherit; color:inherit; cursor:pointer; display:flex; flex-direction:column; align-items:center}
.plan-day b{display:block; font-size:11px} .plan-day span{font-size:9.5px; color:var(--muted); display:block; line-height:1.25; min-height:2.5em}
.plan-day.today{border-color:var(--orange); background:#FFF1E2}
.plan-day.sel{border-color:var(--deep); box-shadow:0 0 0 1.5px var(--deep) inset}
.plan-day .plan-state{min-height:1.4em; font-size:9.5px; font-weight:700; color:var(--deep);
  display:flex; align-items:center; gap:2px; justify-content:center}
.plan-day .plan-check{display:inline-grid; place-items:center; width:13px; height:13px; border-radius:50%;
  background:var(--deep); color:#fff; min-height:0; flex:0 0 auto}
.plan-day .plan-check svg{stroke:#fff}
.workout-card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); overflow:hidden}
.workout-card .photo{aspect-ratio:16/9} .workout-card .photo img{width:100%; height:100%; object-fit:cover}
.workout-card .meal-body{padding:var(--s3) var(--s4) var(--s4)}
.done-pill{background:#EAF5EE; color:var(--deep); font-size:11px; font-weight:700; padding:4px 10px; border-radius:99px; white-space:nowrap}

/* weekly plan — day header + exercise cards (aligned grid, fixed slots) */
.day-head{display:flex; gap:var(--s3); align-items:center}
.day-head img{width:64px; height:64px; border-radius:12px; object-fit:cover; flex:0 0 auto; background:var(--cream2)}
.ex-list{display:flex; flex-direction:column; gap:var(--s3)}
.ex-card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:var(--s3) var(--s4) var(--s4);
  transition:border-color .15s, box-shadow .15s}
.ex-card.done{border-color:var(--green)}
.ex-card.saved{box-shadow:0 0 0 2px rgba(34,178,76,.35)}
.ex-head{display:flex; gap:var(--s3); align-items:center}
.ex-img{width:72px; height:72px; border-radius:12px; object-fit:cover; flex:0 0 auto; background:var(--cream2)}
.ex-meta{flex:1; min-width:0}
.ex-meta h3{line-height:1.25}
.ex-check{width:38px; height:38px; border-radius:50%; border:2px solid var(--line); background:#fff; color:transparent;
  display:grid; place-items:center; flex:0 0 auto; transition:background .15s, border-color .15s}
.ex-check svg{stroke:currentColor}
.ex-check.on{background:var(--deep); border-color:var(--deep); color:#fff}
.ex-how{font-size:12.5px; color:var(--muted); line-height:1.45; margin-top:10px}
.set-grid{margin-top:var(--s3); display:flex; flex-direction:column; gap:6px}
.set-row{display:grid; grid-template-columns:52px 1fr 1fr; gap:var(--s2); align-items:center}
.set-row.set-head span{font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; text-align:center}
.set-no{font-size:12.5px; font-weight:600; color:var(--muted); white-space:nowrap}
.set-input{width:100%; height:40px; border:1.5px solid var(--line); border-radius:10px; background:#FFFDF8;
  text-align:center; font-size:14px; font-weight:600; color:var(--ink); padding:0 6px}
.set-input:focus{outline:none; border-color:var(--orange)}

/* rewards */
.tier-row{display:flex; align-items:center; gap:var(--s3); padding:var(--s3) 0; border-bottom:1px solid var(--line)}
.tier-row:last-child{border-bottom:none}
.tier-pts{background:var(--cream2); color:var(--deep); font-weight:800; border-radius:12px; width:56px; height:48px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; font-size:15px; flex:0 0 auto}
.tier-pts span{font-size:9px; font-weight:600; color:var(--muted)}
.hist-row{display:flex; justify-content:space-between; gap:var(--s3); padding:8px 0; border-bottom:1px solid var(--line); font-size:13px}
.hist-row:last-child{border-bottom:none}
.hist-pts{font-weight:700; white-space:nowrap} .hist-pts.plus{color:var(--green)} .hist-pts.minus{color:var(--orange-d)}

/* forms / checkout */
.field{display:flex; flex-direction:column; gap:6px; margin-bottom:var(--s3)}
.field label{font-size:12px; font-weight:600; color:var(--muted)}
.field input,.field select{border:1.5px solid var(--line); border-radius:12px; padding:11px 12px; background:#fff; width:100%}
.seg{display:grid; grid-template-columns:1fr 1fr; gap:var(--s2)}
.seg button{border:2px solid var(--line); background:#fff; border-radius:12px; padding:11px; font-weight:600; font-size:14px}
.seg button.sel{border-color:var(--deep); background:#EFF7F1}
.cart-row{display:flex; gap:var(--s3); align-items:center; padding:var(--s2) 0; border-bottom:1px solid var(--line)}
.cart-row:last-child{border-bottom:none}
.cart-row img{width:52px; height:52px; border-radius:10px; object-fit:cover; flex:0 0 auto}
.stepper{display:flex; align-items:center; gap:8px}
.stepper button{width:28px; height:28px; border-radius:50%; background:var(--cream2); font-weight:700; font-size:15px; display:grid; place-items:center}
.sum-row{display:flex; justify-content:space-between; font-size:14px; padding:5px 0}
.sum-row.disc{color:var(--green); font-weight:600}
.sum-row.total{font-size:17px; font-weight:800; border-top:1px solid var(--line); margin-top:6px; padding-top:10px}
.badge-sandbox{background:#FFF1E2; border:1px solid #F5C98F; color:#9A4A00; font-size:12px; font-weight:600;
  border-radius:10px; padding:8px 10px; text-align:center}
.sticky-cta{position:sticky; bottom:calc(var(--nav-h) + 10px); z-index:30}

/* manage */
.manage-row{border-bottom:1px solid var(--line); padding:var(--s3) 0}
.manage-row:last-child{border-bottom:none}
.manage-head{display:flex; gap:var(--s3); align-items:center}
.manage-head img{width:46px; height:46px; border-radius:10px; object-fit:cover}
.switch-row{display:flex; gap:var(--s2); flex-wrap:wrap; margin-top:var(--s2)}
.toggle{border:1.5px solid var(--line); background:#fff; border-radius:999px; padding:6px 12px; font-size:12px; font-weight:600}
.toggle.on{background:var(--deep); color:#fff; border-color:var(--deep)}

/* bottom nav */
.bottom-nav{position:fixed; left:50%; transform:translateX(-50%); bottom:0; width:100%; max-width:520px; height:var(--nav-h);
  background:#fff; border-top:1px solid var(--line); display:grid; grid-template-columns:repeat(5,1fr); z-index:50; padding-bottom:env(safe-area-inset-bottom)}
.nav-btn{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; font-size:11px; font-weight:600; color:var(--muted)}
.nav-btn svg{width:22px; height:22px; stroke:currentColor; fill:none; stroke-width:1.8}
.nav-btn.sel{color:var(--orange-d)}
.nav-btn.scan-btn{color:#fff}
.nav-btn .scan-circle{background:var(--orange); width:52px; height:52px; border-radius:50%; display:grid; place-items:center;
  margin-top:-26px; border:4px solid var(--bg); box-shadow:0 4px 14px rgba(232,95,0,.35)}
.nav-btn .scan-circle svg{stroke:#fff}
.cart-fab{position:fixed; right:16px; bottom:calc(var(--nav-h) + 14px); z-index:45; background:var(--deep); color:#fff;
  border-radius:999px; padding:12px 18px; font-weight:700; font-size:14px; box-shadow:0 6px 18px rgba(15,58,42,.35)}

/* modal */
.modal-back{position:fixed; inset:0; background:rgba(27,20,15,.5); z-index:60; display:flex; align-items:flex-end; justify-content:center}
.modal{background:var(--bg); width:100%; max-width:520px; max-height:88vh; overflow-y:auto; border-radius:22px 22px 0 0; padding:var(--s4) var(--s4) var(--s5)}
.modal .photo{aspect-ratio:16/10; border-radius:14px; overflow:hidden; background:var(--cream2); margin-bottom:var(--s3)}
.modal .photo img{width:100%; height:100%; object-fit:cover}
.nut-table{width:100%; border-collapse:collapse; font-size:13px}
.nut-table td{padding:5px 0; border-bottom:1px solid var(--line)}
.nut-table td:last-child{text-align:right; font-weight:600}
.nut-table tr.thick td{border-bottom:3px solid var(--ink); font-weight:700}
.toast{position:fixed; left:50%; transform:translateX(-50%); bottom:calc(var(--nav-h) + 18px); z-index:80;
  background:var(--deep); color:#fff; padding:11px 18px; border-radius:999px; font-size:13.5px; font-weight:600;
  box-shadow:0 8px 22px rgba(15,58,42,.35); max-width:92%; text-align:center}
.hidden{display:none !important}
