:root { --bg:#F6F8F6; --card:#FFF; --text:#1D1D1F; --text2:#6E6E73; --accent:#34C759; --accent-soft:#E8F8EC; --blue:#0A84FF; --pink:#FF375F; --orange:#FF9F0A; --radius:18px; --shadow:0 1px 2px rgba(0,0,0,.03), 0 6px 16px rgba(0,0,0,.035); --tabbar-h:58px; --ctrl:#F5F5F7; --ctrlbtn:#FFF; --mealcontent:#FAFAFA; --line:rgba(0,0,0,.06); --sheet:#FFF; --sumry:rgba(255,255,255,.88); --tabbarbg:rgba(255,255,255,.92); --slider:#E5E5EA; --spring:cubic-bezier(.34,1.56,.64,1);
  --tint-today:#EAF9EE; --tint-water:#E8F5FC; --tint-weight:#F2EDFC; --tint-micros:#E8FBF6;
  --c-fruta:#FF3B30; --c-vegetal:#34C759; --c-carb:#FF9500; --c-protm:#0A84FF; --c-protM:#5E5CE6; --c-grasa:#D4A017; --c-nuez:#A2703A; --c-lacteo:#0091C2; }
:root[data-theme="dark"] { --bg:#000; --card:#1C1C1E; --text:#F5F5F7; --text2:#98989D; --accent-soft:rgba(48,209,88,.18); --ctrl:#2C2C2E; --ctrlbtn:#3A3A3C; --mealcontent:#111; --line:rgba(255,255,255,.07); --sheet:#1C1C1E; --sumry:rgba(28,28,30,.88); --tabbarbg:rgba(22,22,24,.92); --slider:#3A3A3C;
  --tint-today:rgba(52,199,89,.14); --tint-water:rgba(10,132,255,.14); --tint-weight:rgba(175,82,222,.14); --tint-micros:rgba(48,209,192,.14); }
@media (prefers-color-scheme: dark){ :root[data-theme="auto"] { --bg:#000; --card:#1C1C1E; --text:#F5F5F7; --text2:#98989D; --accent-soft:rgba(48,209,88,.18); --ctrl:#2C2C2E; --ctrlbtn:#3A3A3C; --mealcontent:#111; --line:rgba(255,255,255,.07); --sheet:#1C1C1E; --sumry:rgba(28,28,30,.88); --tabbarbg:rgba(22,22,24,.92); --slider:#3A3A3C;
  --tint-today:rgba(52,199,89,.14); --tint-water:rgba(10,132,255,.14); --tint-weight:rgba(175,82,222,.14); --tint-micros:rgba(48,209,192,.14); } }
* { box-sizing:border-box; margin:0; padding:0; font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,sans-serif; -webkit-tap-highlight-color:transparent; touch-action:manipulation; }
body { background:var(--bg); color:var(--text); padding-bottom:90px; font-variant-numeric:tabular-nums; }
button { font-family:inherit; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:6px; }
.app-top { padding:26px 20px 22px; }
.top-date { font-size:13px; font-weight:600; color:var(--text2); text-transform:capitalize; margin-bottom:2px; }
.top-header-row { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.brand-row { display:flex; align-items:center; gap:10px; }
.app-mark { width:36px; height:36px; border-radius:10px; box-shadow:0 2px 8px rgba(0,0,0,.12); flex-shrink:0; }
.top-stat-pill { display:inline-flex; align-items:center; gap:6px; background:var(--accent-soft); color:var(--accent); font-weight:700; font-size:13px; padding:6px 12px; border-radius:100px; white-space:nowrap; flex-shrink:0; }
.top-greeting { font-size:14px; font-weight:500; color:var(--text2); margin-top:8px; }
.big-title { font-size:32px; font-weight:800; letter-spacing:-0.8px; }
.day-nav { display:flex; justify-content:center; align-items:center; gap:14px; margin:6px 0 14px; padding:0 20px; }
.day-nav button { background:var(--card); color:var(--text); border:none; width:38px; height:38px; border-radius:50%; font-size:18px; font-weight:700; cursor:pointer; box-shadow:var(--shadow); transition:transform .2s var(--spring); }
.day-nav button:active { transform:scale(.88); }
.day-nav input[type="date"] { border:none; background:var(--card); font-size:15px; font-weight:600; padding:9px 14px; border-radius:12px; box-shadow:var(--shadow); color:var(--text); }
.quick-actions { display:flex; justify-content:center; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.pill { background:var(--card); border:none; border-radius:100px; padding:9px 16px; font-size:13px; font-weight:600; color:var(--text); box-shadow:var(--shadow); cursor:pointer; transition:transform .2s var(--spring); min-height:34px; }
.pill:active { transform:scale(.94); }
.pill.pending, .pill.on { background:var(--accent); color:#fff; }
.meal { background:var(--card); margin:0 16px 14px; border-radius:var(--radius); box-shadow:var(--shadow); border:1px solid var(--line); overflow:hidden; }
.meal-header { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:16px 20px; cursor:pointer; font-weight:600; font-size:17px; min-height:44px; }
.meal-left { flex:1; }
.meal-right { text-align:right; }
.meal-kcal { color:var(--accent); font-weight:700; font-size:16px; }
.meal-macros { font-size:12px; color:var(--text2); margin-top:3px; }
.chevron { color:var(--text2); transition:transform .3s var(--spring); flex-shrink:0; }
.meal.active .chevron { transform:rotate(90deg); }
.meal-content { max-height:0; overflow:hidden; transition:max-height .35s ease; background:var(--mealcontent); }
.meal.active .meal-content { max-height:1200px; overflow-y:auto; }
.meal-modes { padding:10px 20px; border-top:1px solid var(--line); }
.seg-track { position:relative; display:flex; background:var(--ctrl); border-radius:10px; padding:3px; }
.seg-thumb { position:absolute; top:3px; bottom:3px; left:3px; border-radius:8px; background:var(--card); box-shadow:0 1px 3px rgba(0,0,0,.14); transition:left .25s var(--spring), width .25s var(--spring); z-index:0; }
.mchip { position:relative; z-index:1; flex:1; border:none; border-radius:8px; padding:7px 4px; font-size:12px; font-weight:600; background:transparent; color:var(--text2); cursor:pointer; text-align:center; transition:color .2s; }
.mchip.on { color:var(--text); }
.food-row { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:12px 20px; border-top:1px solid var(--line); min-height:44px; }
.food-name { font-size:15px; font-weight:500; cursor:pointer; display:inline-flex; align-items:center; gap:10px; }
.food-name .info { color:var(--text2); font-size:12px; margin-left:4px; }
.controls { display:flex; align-items:center; gap:10px; background:var(--ctrl); padding:3px; border-radius:10px; }
.controls button { width:32px; height:32px; border:none; border-radius:8px; background:var(--ctrlbtn); color:var(--text); font-size:18px; font-weight:700; cursor:pointer; box-shadow:0 1px 3px rgba(0,0,0,.08); display:flex; align-items:center; justify-content:center; transition:transform .15s var(--spring); }
.controls button:active { transform:scale(.82); }
.qty { min-width:22px; text-align:center; font-weight:600; font-size:15px; }
.del-btn { border:none; background:none; color:var(--pink); font-size:18px; font-weight:700; cursor:pointer; padding:6px; min-width:32px; min-height:32px; }
.row-action { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:13px 20px; border-top:1px solid var(--line); font-size:14px; font-weight:600; color:var(--text); cursor:pointer; min-height:44px; }
.grams-input { width:64px; background:var(--ctrl); border:none; border-radius:8px; padding:4px; text-align:center; font-size:14px; font-weight:600; color:var(--text); }
.card { background:var(--card); margin:0 16px 14px; border-radius:var(--radius); box-shadow:var(--shadow); border:1px solid var(--line); padding:16px 20px; }
.card-title { font-size:12px; font-weight:700; margin-bottom:12px; color:var(--text2); text-transform:uppercase; letter-spacing:.06em; display:flex; align-items:center; gap:6px; }
.card-title::before { content:""; width:6px; height:6px; border-radius:50%; background:var(--accent); flex-shrink:0; }
.card-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; gap:8px; flex-wrap:wrap; }
.card-head .card-title { margin:0; }
.stats-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.stats-grid.four { grid-template-columns:repeat(4,1fr); }
.stat { background:var(--ctrl); border-radius:12px; padding:10px 4px; text-align:center; }
.stat .big { font-size:18px; font-weight:700; }
.stat .lbl { font-size:11px; color:var(--text2); margin-top:2px; }
.stat.streak-stat { background:rgba(255,159,10,.16); }
.stat.streak-stat .big { font-size:24px; color:#FF9500; }
.stat.streak-stat .lbl { color:#B36200; }
.groups-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.chip { background:var(--ctrl); border-radius:12px; padding:8px 4px; text-align:center; font-size:12px; font-weight:600; color:var(--text2); }
.chip .ico { display:block; margin:0 auto 4px; }
.chip.done { background:var(--accent-soft); color:var(--accent); }
.grp-badge { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:50%; background:var(--ic-bg); flex-shrink:0; vertical-align:middle; font-size:15px; line-height:1; }
.grp-badge.sm { width:22px; height:22px; font-size:12px; }
.water-row { display:flex; gap:8px; flex-wrap:wrap; }
.drop { display:inline-flex; align-items:center; justify-content:center; color:var(--blue); cursor:pointer; filter:grayscale(1) opacity(.28); transition:transform .2s var(--spring), filter .2s; min-width:32px; min-height:32px; }
.drop svg { width:22px; height:22px; }
.drop.on { filter:none; }
.drop:active { transform:scale(1.25); }
.empty { text-align:center; padding:14px 0 6px; }
.empty .e-ico { display:flex; align-items:center; justify-content:center; margin:0 auto 8px; color:var(--text2); opacity:.55; }
.empty .e-ico svg { width:34px; height:34px; }
.empty p { font-size:13px; color:var(--text2); }
.weight-row { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:12px; flex-wrap:wrap; }
.weight-now { font-size:26px; font-weight:700; }
.weight-delta { font-size:12px; color:var(--text2); font-weight:600; margin-left:6px; }
.weight-input-wrap { display:flex; gap:8px; align-items:center; }
.weight-input-wrap input { width:90px; background:var(--ctrl); border:none; border-radius:10px; padding:8px 10px; font-size:16px; font-weight:600; color:var(--text); }
.weight-chart { height:130px; }
.hist-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.hist-nav { display:flex; gap:8px; }
.hist-nav button { background:var(--ctrl); color:var(--text); border:none; width:32px; height:32px; border-radius:50%; font-size:16px; font-weight:700; cursor:pointer; }
.hist-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.hist-dow { font-size:10px; color:var(--text2); text-align:center; }
.hd { aspect-ratio:1; border-radius:9px; background:var(--ctrl); cursor:pointer; transition:transform .15s var(--spring); }
.hd:active { transform:scale(.85); }
.hd.d1 { background:rgba(52,199,89,.22); }
.hd.d2 { background:rgba(52,199,89,.48); }
.hd.d3 { background:#34C759; }
.hd.d4 { background:var(--orange); }
.hd.emptycell { background:transparent; cursor:default; }
.hd.future { opacity:.35; }
.chart-card { background:var(--card); margin:0 16px 14px; padding:16px 20px; border-radius:var(--radius); box-shadow:var(--shadow); border:1px solid var(--line); }
.chart-body { height:170px; }
.off-row { display:flex; gap:8px; margin-bottom:10px; }
.off-row input { flex:1; background:var(--ctrl); border:none; border-radius:10px; padding:10px 12px; font-size:15px; color:var(--text); }
.flist-item { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:12px 4px; border-top:1px solid var(--line); cursor:pointer; font-size:15px; font-weight:500; min-height:44px; }
.flist-item .m { color:var(--text2); font-size:12px; white-space:nowrap; }
.add-view-macros { background:var(--ctrl); border-radius:12px; padding:12px; font-size:13px; color:var(--text2); margin:12px 0; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.form-grid input { background:var(--ctrl); border:none; border-radius:10px; padding:10px; font-size:15px; font-weight:600; color:var(--text); width:100%; }
.field { margin-bottom:14px; }
.field label { font-size:13px; color:var(--text2); display:block; margin-bottom:6px; font-weight:500; }
.field input[type="number"], .field input[type="text"] { width:100%; background:var(--ctrl); border:none; border-radius:10px; padding:10px 12px; font-size:16px; font-weight:600; color:var(--text); }
.goals-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.field-row { display:flex; justify-content:space-between; align-items:center; }
.field-row label { margin:0; }
.switch { position:relative; width:51px; height:31px; flex-shrink:0; }
.switch input { opacity:0; width:0; height:0; }
.slider { position:absolute; inset:0; background:var(--slider); border-radius:100px; transition:.3s; cursor:pointer; }
.slider:before { content:""; position:absolute; width:27px; height:27px; left:2px; top:2px; background:#fff; border-radius:50%; transition:.3s; box-shadow:0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .slider { background:var(--accent); }
.switch input:checked + .slider:before { transform:translateX(20px); }
.meal-edit-row { display:flex; gap:8px; align-items:center; margin-bottom:8px; background:var(--ctrl); border-radius:12px; padding:6px 8px; }
.meal-edit-row input { flex:1; background:transparent; border:none; padding:8px 4px; font-size:15px; font-weight:600; color:var(--text); }
.drag-handle { cursor:grab; color:var(--text2); font-size:18px; padding:4px 6px; touch-action:none; user-select:none; }
.backup-row { display:flex; gap:10px; flex-wrap:wrap; }
.hint { font-size:12px; color:var(--text2); margin-top:8px; }
.me-label { font-size:15px; font-weight:600; margin:10px 0 4px; }
#scanRegion { width:100%; min-height:220px; background:#000; border-radius:12px; overflow:hidden; }
.snack { position:fixed; top:14px; left:50%; transform:translate(-50%,-90px); background:var(--text); color:var(--bg); border-radius:100px; padding:10px 18px; display:flex; gap:12px; align-items:center; font-size:13px; font-weight:600; box-shadow:0 6px 24px rgba(0,0,0,.25); z-index:400; transition:transform .35s var(--spring); max-width:92vw; }
.snack.show { transform:translate(-50%,0); }
.snack-act { border:none; background:none; color:var(--text2); font-weight:700; font-size:13px; cursor:pointer; display:none; white-space:nowrap; }
.today-card { background:var(--tint-today); margin:0 16px 14px; border-radius:var(--radius); box-shadow:var(--shadow); border:1px solid var(--line); padding:28px 20px; display:flex; flex-direction:column; align-items:center; gap:18px; }
.card-water { background:var(--tint-water); }
.card-weight { background:var(--tint-weight); }
.card-micros { background:var(--tint-micros); }
@keyframes goalPulse { 0%{ transform:scale(1); } 35%{ transform:scale(1.06); } 65%{ transform:scale(.97); } 100%{ transform:scale(1); } }
.today-card.goal-hit .big-ring { animation:goalPulse .6s var(--spring); }
.big-ring { position:relative; width:150px; height:150px; }
.big-ring::before { content:""; position:absolute; inset:-24px; border-radius:50%; background:radial-gradient(circle, rgba(52,199,89,.22) 0%, rgba(52,199,89,0) 72%); z-index:-1; }
.big-ring .num { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
#totalKcalBig { font-size:40px; font-weight:800; letter-spacing:-1px; line-height:1; }
.goal-lbl { font-size:12px; color:var(--text2); margin-top:4px; }
.macro-bars { display:flex; flex-direction:column; gap:14px; width:100%; }
.macro-bar-row { display:flex; flex-direction:column; gap:6px; }
.macro-bar-head { display:flex; justify-content:space-between; font-size:13px; }
.mb-lbl { color:var(--text2); font-weight:600; }
.mb-val { font-weight:700; }
.macro-bar-track { height:9px; border-radius:100px; background:var(--ctrl); overflow:hidden; }
.macro-bar-fill { height:100%; width:0%; border-radius:100px; transition:width .7s var(--spring); }
#barC { background:linear-gradient(90deg,#5AC8FA,#0A84FF); }
#barP { background:linear-gradient(90deg,#FF7A9C,#FF375F); }
#barF { background:linear-gradient(90deg,#FFC15E,#FF9F0A); }
.tabbar { position:fixed; bottom:0; left:0; right:0; height:calc(var(--tabbar-h) + env(safe-area-inset-bottom,0px)); padding-bottom:env(safe-area-inset-bottom,0px); background:var(--tabbarbg); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); border-top:1px solid var(--line); display:flex; z-index:150; }
.tbtn { flex:1; border:none; background:none; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; color:var(--text2); font-size:10px; font-weight:600; cursor:pointer; min-height:44px; transition:color .2s, transform .2s var(--spring); }
.tbtn:active { transform:scale(.92); }
.tbtn svg { width:22px; height:22px; }
.tbtn.on { color:var(--accent); }
.onb { position:fixed; inset:0; background:var(--bg); z-index:500; display:none; flex-direction:column; }
.onb.show { display:flex; }
.onb-slides { flex:1; position:relative; }
.onb-slide { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:30px; text-align:center; opacity:0; transition:opacity .3s; pointer-events:none; }
.onb-slide.on { opacity:1; pointer-events:auto; }
.onb-slide .o-ico { font-size:72px; margin-bottom:18px; }
.onb-slide h2 { font-size:26px; font-weight:800; letter-spacing:-0.5px; margin-bottom:10px; }
.onb-slide p { font-size:15px; color:var(--text2); max-width:300px; }
.onb-bar { padding:16px 20px calc(20px + env(safe-area-inset-bottom,0px)); display:flex; align-items:center; justify-content:space-between; }
.onb-dots { display:flex; gap:6px; }
.onb-dots span { width:8px; height:8px; border-radius:50%; background:var(--slider); transition:background .3s; }
.onb-dots span.on { background:var(--accent); }
.backdrop { position:fixed; inset:0; background:rgba(0,0,0,.35); opacity:0; pointer-events:none; transition:opacity .3s; z-index:200; }
.backdrop.open { opacity:1; pointer-events:auto; }
.sheet { position:fixed; left:0; right:0; bottom:0; background:var(--sheet); border-radius:24px 24px 0 0; padding:20px 24px 40px; transform:translateY(100%); transition:transform .4s var(--spring); z-index:201; max-height:85vh; overflow-y:auto; }
.sheet.open { transform:translateY(0); }
.sheet-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.sheet-title { font-size:17px; font-weight:700; }
.done-btn { border:none; background:none; color:var(--text); font-size:16px; font-weight:600; cursor:pointer; min-height:32px; }
.guide-search { width:100%; background:var(--ctrl); border:none; border-radius:10px; padding:10px 12px; font-size:15px; color:var(--text); margin-bottom:12px; }
.guide-chips { display:flex; gap:8px; overflow-x:auto; padding-bottom:8px; margin-bottom:8px; }
.gchip { flex-shrink:0; border:none; border-radius:100px; padding:7px 12px; font-size:12px; font-weight:600; background:var(--ctrl); color:var(--text2); cursor:pointer; }
.gchip.on { background:var(--accent); color:#fff; }
.gsub { font-size:12px; color:var(--text2); font-weight:600; margin:12px 0 4px; }
.gitem { display:flex; justify-content:space-between; gap:10px; padding:8px 0; border-top:1px solid var(--line); font-size:14px; }
.gitem .m { color:var(--text2); font-size:12px; text-align:right; }
.ios-step { display:flex; gap:10px; align-items:center; margin-bottom:12px; font-size:15px; }
@media (min-width: 900px){
  #viewRegistro, #viewProgreso, #viewGestion, #viewAjustes { max-width:1000px; margin:0 auto; }
  #meals { display:grid; grid-template-columns:repeat(auto-fill,minmax(360px,1fr)); gap:14px; }
  #meals .meal { margin:0; }
  .app-top { max-width:1000px; margin:0 auto; }
}
