/* Estilo inspirado en iOS. Tema claro/oscuro automático o forzado con html[data-theme]. */
:root {
  --bg: #f2f2f7;
  --bg2: #ffffff;
  --bg3: #f2f2f7;
  --fill: rgba(120, 120, 128, 0.12);
  --fill2: rgba(120, 120, 128, 0.2);
  --label: #000000;
  --label2: rgba(60, 60, 67, 0.6);
  --label3: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.18);
  --blue: #007aff;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #af52de;
  --teal: #30b0c7;
  --yellow: #ffcc00;
  --bar-bg: rgba(249, 249, 249, 0.82);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  --protein: #ff375f;
  --carbs: #0a84ff;
  --fat: #ff9f0a;
  color-scheme: light;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #000000; --bg2: #1c1c1e; --bg3: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24); --fill2: rgba(118, 118, 128, 0.36);
    --label: #ffffff; --label2: rgba(235, 235, 245, 0.6); --label3: rgba(235, 235, 245, 0.3);
    --sep: rgba(84, 84, 88, 0.6);
    --blue: #0a84ff; --green: #30d158; --orange: #ff9f0a; --red: #ff453a; --purple: #bf5af2; --teal: #40c8e0; --yellow: #ffd60a;
    --bar-bg: rgba(22, 22, 24, 0.82);
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #000000; --bg2: #1c1c1e; --bg3: #2c2c2e;
  --fill: rgba(118, 118, 128, 0.24); --fill2: rgba(118, 118, 128, 0.36);
  --label: #ffffff; --label2: rgba(235, 235, 245, 0.6); --label3: rgba(235, 235, 245, 0.3);
  --sep: rgba(84, 84, 88, 0.6);
  --blue: #0a84ff; --green: #30d158; --orange: #ff9f0a; --red: #ff453a; --purple: #bf5af2; --teal: #40c8e0; --yellow: #ffd60a;
  --bar-bg: rgba(22, 22, 24, 0.82);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--label); }
body {
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea { border: 0; outline: none; background: transparent; }
input[type='number'] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
#app { max-width: 720px; margin: 0 auto; }
main {
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 160px);
}
.large-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin: 8px 4px 12px; }
.large-title h1 { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: 0.01em; margin: 0; }
.large-title .sub { color: var(--label2); font-size: 15px; margin-top: 2px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 4px);
  background: var(--bar-bg);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
}
.tabbar button { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 500; color: var(--label2); padding: 2px 0; }
.tabbar button svg { width: 26px; height: 26px; }
.tabbar button.active { color: var(--blue); }

/* ---------- Grouped lists ---------- */
.section-title { display: flex; justify-content: space-between; align-items: center; font-size: 13px; text-transform: uppercase; color: var(--label2); margin: 22px 16px 7px; letter-spacing: 0.02em; }
.section-title b { font-weight: 400; text-transform: none; font-size: 13px; }
.section-title .link { text-transform: none; font-size: 15px; color: var(--blue); }
.group { background: var(--bg2); border-radius: 12px; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 44px;
  padding: 10px 16px; position: relative; width: 100%; text-align: left;
}
.row + .row::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep); }
.row.tappable:active { background: var(--fill); }
.row .main { flex: 1; min-width: 0; }
.row .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .detail { font-size: 13px; color: var(--label2); margin-top: 1px; }
.row .value { color: var(--label2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .chev { color: var(--label3); font-size: 20px; line-height: 1; }
.row input.inline { text-align: right; width: 110px; color: var(--label2); font-variant-numeric: tabular-nums; }
.row input.inline:focus { color: var(--label); }
.row.empty { color: var(--label2); font-size: 15px; }
.row .emoji { font-size: 22px; width: 28px; text-align: center; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; vertical-align: 1px; }
.badge.est { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.badge.ai { background: color-mix(in srgb, var(--purple) 18%, transparent); color: var(--purple); }
.badge.mine { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }

/* ---------- Summary card ---------- */
.summary { background: var(--bg2); border-radius: 16px; padding: 16px; display: flex; gap: 18px; align-items: center; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring .big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.ring .small { font-size: 12px; color: var(--label2); margin-top: 3px; }
.macros { flex: 1; display: grid; gap: 12px; min-width: 0; }
.macro .top { display: flex; justify-content: space-between; font-size: 13px; }
.macro .top span:last-child { color: var(--label2); font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 4px; background: var(--fill); overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; border-radius: 4px; transition: width 0.8s var(--ease-out); }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 14px -16px 0; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; background: var(--bg2); border-radius: 18px; padding: 7px 13px; font-size: 15px; white-space: nowrap; }
.chip:active { background: var(--fill2); }
.chip small { color: var(--label2); }

/* ---------- Composer ---------- */
.composer {
  position: fixed; left: 0; right: 0; z-index: 19;
  bottom: calc(env(safe-area-inset-bottom) + 58px);
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 6px;
  max-width: 720px; margin: 0 auto;
}
.composer .box {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--bg2); border-radius: 22px; padding: 5px 5px 5px 6px;
  box-shadow: var(--shadow); border: 0.5px solid var(--sep);
}
.composer textarea { flex: 1; resize: none; min-height: 34px; max-height: 120px; padding: 7px 4px; font-size: 17px; line-height: 1.2; }
.composer textarea::placeholder { color: var(--label3); }
.iconbtn { width: 34px; height: 34px; border-radius: 17px; display: grid; place-items: center; color: var(--blue); flex: none; }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn.fill { background: var(--blue); color: #fff; }
.iconbtn.fill:disabled { background: var(--fill2); color: var(--label3); }
.iconbtn.rec { background: var(--red); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
.attach { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); align-self: flex-start; font-size: 14px; color: var(--label2); }
.attach img { width: 44px; height: 44px; object-fit: cover; border-radius: 9px; }

/* ---------- Buttons ---------- */
.btn { display: block; width: 100%; padding: 14px; border-radius: 12px; background: var(--blue); color: #fff; font-weight: 600; text-align: center; }
.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.4; }
.btn.secondary { background: var(--fill); color: var(--blue); }
.btn.danger { background: var(--fill); color: var(--red); }
.btn.small { display: inline-block; width: auto; padding: 7px 14px; font-size: 15px; border-radius: 16px; }
.textbtn { color: var(--blue); font-size: 17px; }
.textbtn.bold { font-weight: 600; }
.textbtn.red { color: var(--red); }
.textbtn:disabled { color: var(--label3); }

.segmented { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
.segmented button { flex: 1; padding: 6px 4px; border-radius: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.segmented button.on { background: var(--bg2); box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
:root[data-theme='dark'] .segmented button.on { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .segmented button.on { background: #636366; } }

.search { display: flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 10px; padding: 7px 10px; color: var(--label2); }
.search input { flex: 1; color: var(--label); font-size: 17px; }
.search svg { width: 17px; height: 17px; flex: none; }

/* ---------- Sheets ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 40; opacity: 0; transition: opacity 0.35s ease; }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; will-change: transform; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 720px; margin: 0 auto;
  max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
  background: var(--bg); border-radius: 14px 14px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.5s var(--spring);
}
.sheet.show { transform: none; }
.sheet .grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--label3); margin: 6px auto 0; flex: none; }
.sheet header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 16px; flex: none; }
.sheet header h2 { font-size: 17px; font-weight: 600; margin: 0; text-align: center; }
.sheet header > :first-child { justify-self: start; }
.sheet header > :last-child { justify-self: end; }
.sheet .body { overflow-y: auto; padding: 4px 16px calc(env(safe-area-inset-bottom) + 20px); -webkit-overflow-scrolling: touch; }
.sheet .footer { padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px); flex: none; border-top: 0.5px solid var(--sep); background: var(--bg); }

.item-card { background: var(--bg2); border-radius: 12px; margin-top: 12px; overflow: hidden; }
.item-card.est { box-shadow: inset 3px 0 0 var(--orange); }
.item-card .head { display: flex; gap: 8px; align-items: center; padding: 12px 16px 4px; }
.item-card .head input { flex: 1; font-weight: 600; font-size: 17px; min-width: 0; }
.item-card .kcal-total { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-card .macro-line { padding: 0 16px 8px; font-size: 13px; color: var(--label2); }
.grams-row { display: flex; align-items: center; gap: 8px; padding: 6px 16px 10px; }
.stepper { display: flex; align-items: center; background: var(--fill); border-radius: 9px; }
.stepper button { width: 38px; height: 32px; font-size: 20px; color: var(--label); }
.stepper input { width: 70px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.est-note { font-size: 12px; color: var(--orange); }
.per100 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--sep); border-top: 0.5px solid var(--sep); }
.per100 label { background: var(--bg2); padding: 7px 8px; display: flex; flex-direction: column; font-size: 11px; color: var(--label2); }
.per100 input { font-size: 16px; color: var(--label); font-variant-numeric: tabular-nums; width: 100%; margin-top: 2px; }
.item-card .foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-top: 0.5px solid var(--sep); font-size: 14px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--label2); }
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill2); position: relative; transition: background 0.2s; flex: none; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.15); transition: transform 0.2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.switch.sm { transform: scale(0.8); transform-origin: right center; }

/* ---------- Charts ---------- */
.chart-card { background: var(--bg2); border-radius: 12px; padding: 14px 12px 8px; }
.chart-card .head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 6px; }
.chart-card .head .big { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-card .head .lbl { font-size: 13px; color: var(--label2); }
.chart { width: 100%; display: block; }
.chart text { fill: var(--label2); font-size: 10px; font-family: inherit; }
.chart .grid { stroke: var(--sep); stroke-width: 0.5; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--bg2); border-radius: 12px; padding: 12px; }
.stat .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--label2); }

/* ---------- Misc ---------- */
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); transform: translate(-50%, -150%);
  background: var(--bg3); color: var(--label); padding: 10px 16px; border-radius: 22px; box-shadow: var(--shadow);
  z-index: 60; font-size: 15px; transition: transform 0.45s var(--spring), opacity 0.3s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--fill2); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-over { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 0; color: var(--label2); }
.sync-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--label2); background: var(--bg2); padding: 5px 10px; border-radius: 14px; }
.sync-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.sync-dot.syncing i { background: var(--blue); animation: pulse 1s infinite; }
.sync-dot.offline i, .sync-dot.pending i { background: var(--orange); }
.sync-dot.error i { background: var(--red); }
.datenav { display: flex; align-items: center; gap: 2px; }
.datenav button { color: var(--blue); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 17px; }
.datenav button:active { background: var(--fill); }
.datenav svg { width: 20px; height: 20px; }
.muted { color: var(--label2); }
.center { text-align: center; }
.mt { margin-top: 16px; }
.hint { font-size: 13px; color: var(--label2); margin: 8px 16px; }

.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; gap: 16px; }
.login .logo { width: 84px; height: 84px; border-radius: 20px; margin: 0 auto; display: block; box-shadow: var(--shadow); }
.login h1 { text-align: center; margin: 0; font-size: 28px; }
.login p { text-align: center; color: var(--label2); margin: 0; }
.login input { background: var(--bg2); border-radius: 12px; padding: 14px 16px; font-size: 17px; }

video.scanner { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 4/3; object-fit: cover; }

/* ---------- Movimiento ---------- */
.ring-progress { transition: stroke-dashoffset 0.9s var(--ease-out), stroke 0.4s; }

/* Respuesta al pulsar */
.btn, .chip, .iconbtn, .row.tappable, .tabbar button, .textbtn, .datenav button, .segmented button, .stepper button, .sync-dot, .link {
  transition: transform 0.2s var(--spring), opacity 0.2s, background-color 0.25s, color 0.25s, box-shadow 0.25s;
}
.btn:active, .chip:active, .iconbtn:active, .datenav button:active, .stepper button:active { transform: scale(0.94); }
.row.tappable:active { transform: scale(0.985); }
.tabbar button:active svg { transform: scale(0.85); }
.tabbar button svg { transition: transform 0.25s var(--spring); }
.tabbar button.active svg { animation: tab-pop 0.45s var(--spring); }
@keyframes tab-pop { 40% { transform: scale(1.15); } }
.segmented button { transition: background-color 0.3s var(--ease-out), box-shadow 0.3s, color 0.2s; }
.chart-card { transition: transform 0.2s var(--spring); }
button.chart-card:active { transform: scale(0.98); }

/* Entrada de pantallas: los bloques suben en cascada */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes from-right { from { opacity: 0; transform: translateX(28px); } }
@keyframes from-left { from { opacity: 0; transform: translateX(-28px); } }
main.anim-in > * { animation: rise 0.5s var(--ease-out) both; }
main.anim-fade > * { animation: fade 0.35s ease both; }
main.anim-left > * { animation: from-right 0.4s var(--ease-out) both; }
main.anim-right > * { animation: from-left 0.4s var(--ease-out) both; }
main.anim-left > .large-title, main.anim-right > .large-title { animation-name: fade; }
main[class*='anim-'] > :nth-child(2) { animation-delay: 0.03s; }
main[class*='anim-'] > :nth-child(3) { animation-delay: 0.06s; }
main[class*='anim-'] > :nth-child(4) { animation-delay: 0.09s; }
main[class*='anim-'] > :nth-child(5) { animation-delay: 0.12s; }
main[class*='anim-'] > :nth-child(6) { animation-delay: 0.15s; }
main[class*='anim-'] > :nth-child(n+7) { animation-delay: 0.18s; }

/* Entradas nuevas en el diario */
@keyframes appear { from { opacity: 0; transform: translateY(-6px) scale(0.98); background: color-mix(in srgb, var(--green) 18%, var(--bg2)); } 60% { background: color-mix(in srgb, var(--green) 10%, var(--bg2)); } }
.row.appear { animation: appear 0.9s var(--ease-out) both; }

/* Tarjetas de la hoja de revisión */
.intro > .item-card { animation: rise 0.5s var(--ease-out) both; animation-delay: 0.12s; }
.intro > .item-card:nth-child(2) { animation-delay: 0.17s; }
.intro > .item-card:nth-child(3) { animation-delay: 0.22s; }
.intro > .item-card:nth-child(n+4) { animation-delay: 0.27s; }
.leaving { overflow: hidden; opacity: 0; transform: scale(0.96); margin-top: 0 !important; transition: height 0.26s var(--ease-out), opacity 0.2s, transform 0.26s var(--ease-out), margin 0.26s; }
.fade-swap { animation: fade 0.3s ease both; }

/* Cambio de tema suave */
.theme-anim, .theme-anim * { transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease, box-shadow 0.45s ease !important; }

/* Toast con resorte y hoja de carga */
.loading-over { animation: fade 0.3s ease both; }
.composer .box { transition: box-shadow 0.3s, transform 0.3s var(--spring); }
.composer .box:focus-within { box-shadow: 0 10px 34px rgba(0, 0, 0, 0.18), 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }
.attach:not(.hidden) { animation: rise 0.35s var(--ease-out) both; }
main.anim-in .chips .chip { animation: rise 0.45s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* Grabación de voz y avisos de la revisión */
.rec-label { flex: 1; align-self: center; padding: 7px 4px; font-size: 15px; color: var(--red); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: fade 0.25s ease both; }
.transcript { margin: 12px 4px 0; font-size: 15px; color: var(--label2); font-style: italic; }
.notice { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, transparent); word-break: break-word; }

.meal-pill { margin-left: auto; appearance: none; -webkit-appearance: none; background: var(--fill); color: var(--blue); font-size: 13px; font-weight: 500; padding: 5px 10px; border-radius: 14px; cursor: pointer; transition: background-color 0.25s; }
.meal-pill:active { background: var(--fill2); }

.empty-day { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 16px; border-radius: 16px; background: color-mix(in srgb, var(--blue) 10%, var(--bg2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 25%, transparent); }
.empty-day .empty-title { font-size: 15px; font-weight: 600; }
.empty-day .muted { font-size: 13px; }
.empty-day .emoji-big { font-size: 28px; }

/* Deslizar para borrar */
.swipe { position: relative; overflow: hidden; }
.swipe + .swipe::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep); z-index: 2; }
.swipe > .row { background: var(--bg2); touch-action: pan-y; position: relative; z-index: 1; will-change: transform; }
.swipe > .row::before { display: none; }
.swipe-del { position: absolute; top: 0; right: 0; bottom: 0; width: 88px; background: var(--red); color: #fff; font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: flex-end; padding-right: 16px; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast-action { color: var(--blue); font-weight: 600; font-size: 15px; white-space: nowrap; }

/* Detalle de comida */
.meal-title { color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left; }
.meal-title b { font-weight: 400; }
.chev-sm { color: var(--label3); }
.detail-hero { text-align: center; padding: 8px 0 14px; }
.detail-hero .big { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-hero small { font-size: 17px; font-weight: 500; color: var(--label2); }
.stack-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--fill); gap: 2px; }
.stack-bar i { display: block; height: 100%; animation: grow-x 0.8s var(--ease-out) both; transform-origin: left; }
@keyframes grow-x { from { transform: scaleX(0); } }
.share { height: 4px; border-radius: 2px; background: var(--fill); margin-top: 6px; overflow: hidden; }
.share i { display: block; height: 100%; background: var(--green); border-radius: 2px; animation: grow-x 0.8s var(--ease-out) both; transform-origin: left; }

/* Anillos por macro */
.summary.rings-mode { gap: 12px; }
.summary.rings-mode .ring { width: 118px; height: 118px; }
.mini-rings { flex: 1; display: flex; justify-content: space-around; gap: 4px; min-width: 0; }
.mini-ring { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.mini-ring-svg { position: relative; width: 60px; height: 60px; }
.mini-ring-svg svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mini-ring-val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-ring-label { font-size: 12px; margin-top: 4px; }
.mini-ring-goal { font-size: 11px; color: var(--label2); }

/* Racha */
.streak { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 10px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); vertical-align: 1px; }
.streak.pending { background: var(--fill); color: var(--label2); }

/* Agua */
.water { background: var(--bg2); border-radius: 16px; padding: 12px 16px 12px; margin-top: 12px; }
.water-head { display: flex; justify-content: space-between; width: 100%; font-size: 15px; font-weight: 600; }
.water-total { font-weight: 400; color: var(--label2); font-variant-numeric: tabular-nums; }
.water-total b { color: var(--teal); font-weight: 700; }
.water-bar { margin-top: 8px; height: 8px; }
.water-bar > i { background: linear-gradient(90deg, var(--teal), var(--blue)); }
.water-btns { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px; scrollbar-width: none; }
.water-btns::-webkit-scrollbar { display: none; }
.water-btns .chip { background: var(--fill); font-size: 14px; padding: 6px 11px; }
.chip.on { background: color-mix(in srgb, var(--blue) 22%, var(--bg2)); box-shadow: inset 0 0 0 1.5px var(--blue); }

main[class*='anim-'] .chart path.draw, .sheet .chart path.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-line 1.1s var(--ease-out) forwards; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
.chart rect { transform-box: fill-box; transform-origin: bottom; }
main[class*='anim-'] .chart rect { animation: grow-y 0.7s var(--ease-out) both; }
@keyframes grow-y { from { transform: scaleY(0); } }

/* Resumen semanal */
.week { background: var(--bg2); border-radius: 16px; padding: 10px 12px 14px; }
.week-head { display: flex; align-items: center; justify-content: space-between; }
.week-title { font-weight: 700; font-size: 17px; }
.wk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.wk-tile { background: var(--bg3); border-radius: 12px; padding: 10px; min-width: 0; }
:root:not([data-theme='dark']) .wk-tile { background: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .wk-tile { background: var(--bg3); } }
.wk-v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-l { font-size: 12px; color: var(--label2); }
.wk-s, .cmp { font-size: 11px; color: var(--label2); margin-top: 2px; }

/* Calendario */
.cal { background: var(--bg2); border-radius: 16px; padding: 8px 10px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; margin-top: 4px; }
.cal-wd { font-size: 11px; color: var(--label2); padding: 4px 0; }
.cal-day { aspect-ratio: 1; border-radius: 50%; font-size: 14px; font-variant-numeric: tabular-nums; display: grid; place-items: center; max-width: 40px; margin: 0 auto; width: 100%; }
main[class*='anim-'] .cal-day { animation: pop-in 0.35s var(--ease-out) both; }
.cal-day.on { background: var(--green); color: #fff; font-weight: 600; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--blue); }
.cal-day.today.on { box-shadow: 0 0 0 2px var(--bg2), 0 0 0 4px var(--blue); }
.cal-day.future { color: var(--label3); }
.cal-day:active { transform: scale(0.88); }
@keyframes pop-in { from { opacity: 0; transform: scale(0.6); } }
.label-thumb { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; box-shadow: var(--shadow); }
.time-input { color: var(--blue); font-variant-numeric: tabular-nums; margin-right: 6px; }
.sync-dot { white-space: nowrap; }
.row > .main { overflow-wrap: anywhere; }
.time-input { flex: none; }
.rem-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swipe-del { opacity: 0; }
.swipe.dragging .swipe-del, .swipe.open .swipe-del, .swipe.deleting .swipe-del { opacity: 1; }

/* Temporizador de ayuno */
.fast { width: 100%; text-align: left; background: var(--bg2); border-radius: 16px; padding: 12px 16px; margin-top: 12px; display: grid; gap: 8px; font-size: 13px; }
.fast-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; font-weight: 600; }
.fast-head b { white-space: nowrap; font-size: 17px; font-variant-numeric: tabular-nums; color: var(--purple); }
.fast-bar { height: 8px; margin: 0; }
.fast-bar > i { background: linear-gradient(90deg, var(--purple), var(--blue)); transition: width 1s var(--ease-out); }
.fast.done .fast-head b { color: var(--green); }
.fast.done .fast-bar > i { background: var(--green); }
.sheet .body { overscroll-behavior: contain; }
