:root {
  --accent: #0f766e;        /* teal calmado, nada de rojos de "alarma" */
  --accent-soft: #14b8a6;
  --accent-ink: #ffffff;
  --pecho: #ec8f5e;         /* naranja cálido */
  --lme: #14b8a6;           /* teal */
  --formula: #6366f1;       /* índigo */
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef1ee;
  --ink: #17211c;
  --ink-soft: #5b6b62;
  --line: #e2e7e2;
  --danger: #b4544a;
  --good: #2f855a;
  --warn: #b7791f;
  --radius: 18px;
  --shadow: 0 1px 3px rgba(16,40,32,.06), 0 8px 24px rgba(16,40,32,.05);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #2dd4bf; --accent-soft: #14b8a6; --accent-ink: #04211d;
    --bg: #0b1220; --surface: #131c2b; --surface-2: #1b2637;
    --ink: #eaf0f0; --ink-soft: #9fb0ad; --line: #24314a;
    --danger: #f0857b; --good: #6ee7a8; --warn: #f0c674;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; line-height: 1.4;
  overscroll-behavior-y: contain;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font: inherit; color: inherit; }
h1,h2,h3,p { margin: 0; }

/* ---------- App shell ---------- */
.screen { padding: calc(var(--safe-t) + 14px) 16px 120px; max-width: 640px; margin: 0 auto; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.topbar h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.topbar .who { font-size: .85rem; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 600; margin-bottom: 10px; }

.muted { color: var(--ink-soft); }
.small { font-size: .82rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: .8rem; font-weight: 600; }

/* ---------- Ahora hero ---------- */
.hero { background: linear-gradient(160deg, var(--accent), var(--accent-soft)); color: var(--accent-ink); }
.hero h3 { color: rgba(255,255,255,.85); }
.hero .big { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.hero .sub { opacity: .92; margin-top: 4px; }
.hero .relevo { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.22); font-size: .92rem; }

.statgrid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; text-align: center; }
.statgrid .n { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.statgrid .l { font-size: .68rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }

.next-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.next-tile { background: var(--surface-2); border-radius: 14px; padding: 12px; }
.next-tile .k { font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.next-tile .v { font-size: 1.15rem; font-weight: 700; margin-top: 2px; }
.next-tile.due .v { color: var(--warn); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2); color: var(--ink); border-radius: 14px; padding: 14px 16px;
  font-weight: 600; min-height: 52px; transition: transform .05s ease, background .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn.lg { min-height: 60px; font-size: 1.05rem; }
.btn.sm { min-height: 40px; padding: 8px 12px; font-size: .9rem; border-radius: 11px; }
.btn.danger { color: var(--danger); }
.quick { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.quick .btn { flex-direction: column; gap: 4px; min-height: 76px; }
.quick .btn .emoji { font-size: 1.5rem; }

/* ---------- Bottom nav ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5,1fr);
  padding-bottom: var(--safe-b); }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 7px; color: var(--ink-soft); font-size: .66rem; font-weight: 600; }
.tabbar button.active { color: var(--accent); }
.tabbar .emoji { font-size: 1.35rem; line-height: 1; }
.tabbar .fab-slot { display: flex; justify-content: center; align-items: flex-start; }
.tabbar .fab-slot .fabbtn { margin-top: -22px; width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 1.7rem; display: grid; place-items: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------- Sheet / modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(4,10,16,.5); z-index: 50; display: flex; align-items: flex-end;
  animation: fade .18s ease; }
@keyframes fade { from { opacity: 0 } }
.sheet { background: var(--surface); width: 100%; max-width: 640px; margin: 0 auto;
  border-radius: 22px 22px 0 0; padding: 8px 16px calc(var(--safe-b) + 20px); max-height: 92vh; overflow-y: auto;
  animation: rise .24s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(100%) } }
.sheet .grab { width: 40px; height: 4px; background: var(--line); border-radius: 999px; margin: 6px auto 12px; }
.sheet h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: .82rem; color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; background: var(--surface-2); border: 1.5px solid transparent; border-radius: 12px;
  padding: 13px 14px; font-size: 1.05rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 64px; resize: vertical; }

/* segmented control */
.seg { display: grid; grid-auto-flow: column; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.seg button { padding: 11px 8px; border-radius: 9px; font-weight: 600; color: var(--ink-soft); font-size: .95rem; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.accent button.on { background: var(--accent); color: var(--accent-ink); }

/* stepper */
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; align-items: center; }
.stepper button { background: var(--surface-2); border-radius: 12px; height: 52px; font-size: 1.5rem; font-weight: 700; }
.stepper .val { text-align: center; font-size: 1.5rem; font-weight: 800; }
.stepper .val small { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }

/* component toggles in the toma sheet */
.comp { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.comp.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.comp .head { display: flex; align-items: center; justify-content: space-between; }
.comp .head .t { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.comp .body { margin-top: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.pecho { background: var(--pecho) } .dot.lme { background: var(--lme) } .dot.formula { background: var(--formula) }

.switch { width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch.on { background: var(--accent); }
.switch::after { content:''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on::after { transform: translateX(18px); }

/* timer */
.timer { text-align: center; }
.timer .clock { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* list items */
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: none; }
.item .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 1.15rem; background: var(--surface-2); flex: none; }
.item .main { flex: 1; min-width: 0; }
.item .main .t { font-weight: 600; }
.item .main .s { font-size: .82rem; color: var(--ink-soft); }
.item .time { font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }

.batch { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.batch:last-child { border-bottom: none; }
.batch .bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--lme); }
.tag { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.tag.soon { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.tag.ok { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.tag.nevera { background: color-mix(in srgb, var(--formula) 18%, transparent); color: var(--formula); }
.tag.congelador { background: color-mix(in srgb, #3b82f6 20%, transparent); color: #3b82f6; }

/* chart */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.bars .seg-b { border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .lab { font-size: .6rem; text-align: center; color: var(--ink-soft); margin-top: 4px; }
.legend { display: flex; gap: 14px; font-size: .78rem; margin-top: 8px; }
.legend .k { display: flex; align-items: center; gap: 5px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .box { width: 100%; max-width: 360px; text-align: center; }
.login .logo { font-size: 3rem; margin-bottom: 6px; }
.pinrow { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.pin { width: 52px; height: 62px; text-align: center; font-size: 1.6rem; font-weight: 800; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); z-index: 80;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow); animation: rise .2s ease; max-width: 90%; }

.empty { text-align: center; color: var(--ink-soft); padding: 30px 10px; }
.empty .big { font-size: 2.4rem; margin-bottom: 8px; }
.banner { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: 14px; padding: 12px 14px; font-size: .88rem; margin-bottom: 14px; }
a { color: var(--accent); }
