/* Marca «Cursor amable»: verde terminal suavizado, melocotón y crema. Los nombres de las variables
   se mantienen (--olive = color principal, --saffron = acento) para no tocar el resto del código. */
:root {
  --olive: #2E7D5F; --olive-d: #24413A; --olive-l: #E2F2EA; --saffron: #EE9F6F; --saffron-l: #FCEBDD;
  --mint: #7FD6A8; --term: #24413A;
  --cream: #F6F4EE; --card: #ffffff; --ink: #24302C; --muted: #6B736E; --line: #E4E5DE; --sky: #5B8FA8;
  --plum: #8a5a7c; --shadow: 0 1px 2px rgba(36,48,44,.06), 0 4px 16px rgba(36,48,44,.06);
  --r: 16px; --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --head: 'Nunito', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cream: #131917; --card: #1B2320; --ink: #E6EEE9; --muted: #98A59E; --line: #2B3632; --olive-l: #1E3A2F; --saffron-l: #3A2A20;
    --term: #A8E6C6; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] { --cream: #131917; --card: #1B2320; --ink: #E6EEE9; --muted: #98A59E; --line: #2B3632; --olive-l: #1E3A2F; --saffron-l: #3A2A20; --term: #A8E6C6; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--head); font-weight: 800; margin: 0 0 .4em; letter-spacing: -.015em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--olive); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.row { display: flex; align-items: center; gap: .5rem; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .center { text-align: center; } .hidden { display: none !important; }
.stack > * + * { margin-top: .75rem; }

#app { max-width: 560px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 16px calc(96px + var(--safe-b)); }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
/* Nombre en letra de terminal con un cursor que parpadea (quieto si el móvil pide menos movimiento) */
.brand { font-family: var(--mono); font-weight: 500; font-size: 1.2rem; color: var(--term); display: flex; align-items: center; gap: 8px; letter-spacing: -.02em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand > span { white-space: nowrap; display: inline-flex; align-items: center; }
.topbar .brand { font-size: 1.05rem; gap: 6px; min-width: 0; }
@media (max-width: 400px) { .topbar .brand { font-size: .95rem; } .topbar .brand svg { width: 24px; height: 24px; } }
.cursor { display: inline-block; width: .5em; height: 1.05em; margin-left: 2px; vertical-align: -.15em; background: var(--olive); border-radius: 1px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
/* Glitch amable: un pequeño temblor de color al aparecer el logo, una sola vez */
.glitch { animation: glitch .5s steps(2) 1 .3s; }
@keyframes glitch { 0% { text-shadow: -2px 0 var(--mint), 2px 0 var(--saffron); transform: translateX(1px); } 50% { text-shadow: 2px 0 var(--mint), -2px 0 var(--saffron); transform: translateX(-1px); } 100% { text-shadow: none; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cursor, .glitch { animation: none; } }
/* Números con letra de máquina: discreto guiño «hack» */
.num, .ring .big, .price-card .pz, .entry .kc { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.card.tight { padding: 10px 14px; }
.card h3 { margin-bottom: .3em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 12px 18px;
  background: var(--olive); color: #fff; font-weight: 700; cursor: pointer; min-height: 44px; text-decoration: none; }
.btn:active { transform: scale(.98); } .btn[disabled] { opacity: .5; }
.btn.block { width: 100%; } .btn.ghost { background: transparent; color: var(--olive); border: 1.5px solid var(--olive); }
.btn.soft { background: var(--olive-l); color: var(--olive-d); } .btn.saffron { background: var(--saffron); color: #4A2A16; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .9rem; } .btn.link { background: none; color: var(--olive); padding: 6px; min-height: 0; }
.icon-btn { border: 0; background: var(--olive-l); color: var(--olive-d); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg, .btn svg { width: 20px; height: 20px; }
:root[data-theme="dark"] .btn.soft, :root[data-theme="dark"] .icon-btn, :root[data-theme="dark"] .quickadd { color: #A8E6C6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.soft, :root:not([data-theme="light"]) .icon-btn, :root:not([data-theme="light"]) .quickadd { color: #A8E6C6; } }
:root[data-theme="dark"] .btn.ghost, :root[data-theme="dark"] .btn.link, :root[data-theme="dark"] a { color: var(--mint); border-color: var(--mint); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.ghost, :root:not([data-theme="light"]) .btn.link, :root:not([data-theme="light"]) a { color: var(--mint); border-color: var(--mint); } }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line);
  cursor: pointer; font-size: .9rem; white-space: nowrap; }
.chip.on { background: var(--olive); color: #fff; border-color: var(--olive); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--olive-l); color: var(--olive-d); }
.badge.est { background: var(--saffron-l); color: #8A4B23; } .badge.ai { background: #e7eef0; color: #2f5561; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { color: #A8E6C6; } :root:not([data-theme="light"]) .badge.est { color: #F6C9A8; } :root:not([data-theme="light"]) .badge.ai { background: #1F3340; color: #B6D3DC; } }

label.field { display: block; margin-bottom: 12px; } label.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], input[type=time], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); min-height: 46px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--olive); outline-offset: 1px; border-color: transparent; }
input[type=range] { width: 100%; accent-color: var(--olive); }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; } .switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--olive); } .switch input:checked + span::after { transform: translateX(20px); }

/* Navegación inferior */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center;
  padding: 6px 4px calc(6px + var(--safe-b)); z-index: 20; }
nav.tabs .inner { display: flex; max-width: 560px; width: 100%; justify-content: space-around; }
nav.tabs button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; color: var(--muted); padding: 4px 8px; cursor: pointer; min-width: 58px; font-weight: 700; }
nav.tabs button svg { width: 24px; height: 24px; } nav.tabs button.on { color: var(--olive); }
nav.tabs .add { background: var(--olive); color: #fff !important; border-radius: 50%; width: 52px; height: 52px; margin-top: -18px; box-shadow: 0 4px 14px rgba(46,125,95,.35); justify-content: center; min-width: 0; }
nav.tabs .add svg { width: 28px; height: 28px; }

/* Resumen del día */
.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daynav .d { font-weight: 800; text-transform: capitalize; }
.summary { display: grid; grid-template-columns: 128px 1fr; gap: 14px; align-items: center; }
.ring { position: relative; width: 128px; height: 128px; }
.ring svg { transform: rotate(-90deg); } .ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring .big { font-size: 1.6rem; font-weight: 800; font-family: var(--head); } .ring .cap { font-size: .72rem; color: var(--muted); }
.eq { font-size: .82rem; color: var(--muted); display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; }
.eq b { color: var(--ink); text-align: right; }
.macro { margin-top: 8px; } .macro .top { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 3px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--olive); }
.bar.p > i { background: var(--olive); } .bar.c > i { background: var(--saffron); } .bar.f > i { background: var(--sky); } .bar.w > i { background: #6aa6c9; }
.bar.over > i { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 4px, transparent 4px 8px); }

.meal { padding: 0; overflow: hidden; }
.meal header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; }
.meal header h3 { margin: 0; } .meal header .k { color: var(--muted); font-size: .9rem; font-weight: 700; }
.entry { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.entry .n { font-weight: 600; } .entry .s { font-size: .8rem; color: var(--muted); } .entry .kc { font-weight: 800; white-space: nowrap; }
.compact .entry { padding: 6px 14px; } .compact .entry .s { display: none; }
.meal .addrow { display: flex; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.micros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.micros .bar { height: 6px; }

/* Listas de alimentos */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:last-child { border-bottom: 0; }
.list .nm { font-weight: 650; } .list .meta { font-size: .8rem; color: var(--muted); }
.quickadd { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--olive-l); color: var(--olive-d); font-size: 1.3rem; font-weight: 800; cursor: pointer; flex: none; }
.quickadd.done { background: var(--olive); color: #fff; }

/* Hojas (modales) */
.sheet-bg { position: fixed; inset: 0; background: rgba(20,18,15,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--cream); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + var(--safe-b)); animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; position: sticky; top: -8px; background: var(--cream); padding: 6px 0; z-index: 2; }
@keyframes up { from { transform: translateY(40px); opacity: .5 } to { transform: none; opacity: 1 } }
@keyframes fade { from { opacity: 0 } }

.toast { position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; bottom: calc(88px + var(--safe-b)); background: var(--ink); color: var(--cream); padding: 10px 14px; border-radius: 14px;
  display: flex; gap: 12px; align-items: center; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 528px; animation: up .2s; }
.toast button { background: none; border: 0; color: var(--mint); font-weight: 800; cursor: pointer; padding: 4px; }
.status-pill { font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--olive-l); color: var(--olive-d); }
.status-pill.off { background: var(--line); color: var(--muted); } .status-pill.warn { background: var(--saffron-l); color: #8A4B23; }
.offline-bar { background: var(--saffron-l); color: #8A4B23; font-size: .82rem; padding: 6px 12px; border-radius: 10px; margin-bottom: 10px; }

.hero { padding: 28px 4px 8px; }
.hero h1 { font-size: 2.2rem; line-height: 1.1; }
.hero .brand { font-size: 1.5rem; } .hero .brand svg { width: 36px; height: 36px; }
.hero .lead { font-size: 1.1rem; color: var(--muted); }
.steps-dots { display: flex; gap: 4px; margin: 4px 0 16px; } .steps-dots i { flex: 1; height: 4px; border-radius: 9px; background: var(--line); } .steps-dots i.on { background: var(--olive); }
.choice { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); cursor: pointer; margin-bottom: 8px; width: 100%; text-align: left; }
.choice.on { border-color: var(--olive); background: var(--olive-l); } .choice .e { font-size: 1.5rem; }
.price-card { border: 2px solid var(--line); border-radius: 16px; padding: 14px; background: var(--card); cursor: pointer; margin-bottom: 8px; }
.price-card.on { border-color: var(--olive); } .price-card .pz { font-family: var(--head); font-size: 1.5rem; font-weight: 700; }
.price-card.launch { border-color: var(--saffron); background: var(--saffron-l); }
ul.ticks { list-style: none; padding: 0; margin: 6px 0; } ul.ticks li { padding: 3px 0 3px 26px; position: relative; }
ul.ticks li::before { content: '✓'; position: absolute; left: 4px; color: var(--olive); font-weight: 900; }

.conf { height: 6px; border-radius: 9px; background: var(--line); overflow: hidden; width: 80px; display: inline-block; vertical-align: middle; }
.conf i { display: block; height: 100%; background: var(--sky); }
.chart { width: 100%; height: auto; display: block; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 10px 12px; border-radius: 14px; max-width: 88%; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--olive); color: #fff; } .msg.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); }
.grid7 { display: grid; grid-template-columns: 74px 1fr 1fr; gap: 6px; font-size: .85rem; }
.grid7 .slot { background: var(--card); border: 1.5px dashed var(--line); border-radius: 10px; padding: 6px; min-height: 44px; cursor: pointer; }
.grid7 .slot.full { border-style: solid; }
video.scan { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 4/3; object-fit: cover; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--olive-l); border-top-color: var(--olive); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg) } }
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; overflow-x: auto; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 10px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .9rem; } .kv b { text-align: right; }
@media (max-width: 380px) { .summary { grid-template-columns: 1fr; justify-items: center; } }

/* Resultados con datos dudosos: se ven, pero apagados */
.list li.odd { opacity: .65; }
