:root {
  --bg: #f4f1ea; --card: #fffdf8; --ink: #1f2a26; --muted: #6b756f; --line: #e2dccf;
  --accent: #1f6f5c; --accent-ink: #fff; --warn: #b4541a; --ok: #1f6f5c; --info: #3a5a7a;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141917; --card: #1c2320; --ink: #e8ece9; --muted: #98a39d; --line: #2c3632;
          --accent: #4fb89c; --accent-ink: #0d1512; --warn: #e89a5e; --ok: #4fb89c; --info: #8fb3d6; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
       padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
nav { display: flex; gap: 1rem; align-items: center; }
nav a { text-decoration: none; }
main { max-width: 860px; margin: 0 auto; padding: 1.2rem; }
footer { max-width: 860px; margin: 0 auto; padding: 1.5rem 1.2rem 3rem; color: var(--muted); font-size: .85rem; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: .4rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .3rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem; margin-bottom: 1rem; }
.narrow { max-width: 520px; }
.muted { color: var(--muted); font-size: .9rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .8rem; }
input, select { display: block; width: 100%; margin-top: .25rem; padding: .6rem .7rem; font: inherit;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; }
.check input { width: auto; margin-top: .3rem; }
button, .button { font: inherit; cursor: pointer; border-radius: 9px; padding: .6rem 1rem;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); text-decoration: none; display: inline-block; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.danger-btn { border-color: var(--warn); color: var(--warn); }
.link { border: 0; background: none; padding: 0; color: var(--accent); }
.link.danger { color: var(--warn); }
.inline { display: inline; margin-left: .6rem; }
.weigh { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.weigh label { margin: 0; width: 9rem; }
.weigh .grow { flex: 1; min-width: 10rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .9rem; }
.stat span, .stat small { display: block; color: var(--muted); font-size: .8rem; }
.stat b { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 6px; accent-color: var(--accent); }
.tip { border-left: 4px solid var(--info); padding: .5rem .9rem; margin-bottom: .7rem; background: var(--bg); border-radius: 0 9px 9px 0; }
.tip.ok { border-color: var(--ok); } .tip.warn { border-color: var(--warn); }
.tip p { margin: .2rem 0 0; font-size: .93rem; }
.flash { padding: .7rem 1rem; border-radius: 9px; border: 1px solid var(--line); background: var(--card); overflow-wrap: anywhere; }
.flash.error { border-color: var(--warn); color: var(--warn); }
.flash.ok { border-color: var(--ok); }
.chart { width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .goal { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 6 5; }
.chart .raw { fill: none; stroke: var(--muted); stroke-width: 1; opacity: .6; }
.chart .trend { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--card); stroke: var(--muted); stroke-width: 1.5; }
.legend { color: var(--muted); font-size: .82rem; margin: .4rem 0 0; }
.k { display: inline-block; width: 18px; height: 0; border-top: 3px solid var(--accent); vertical-align: middle; margin: 0 .3rem 0 .8rem; }
.k.raw { border-top: 1px solid var(--muted); margin-left: 0; } .k.goal { border-top: 2px dashed var(--warn); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; margin-top: .6rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: .8rem; }
td.right { text-align: right; white-space: nowrap; }
code { font-size: .82rem; overflow-wrap: anywhere; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } .weigh label { width: 100%; } }

/* ---- v2: cabecera, foto, logros ---- */
:root { --c1: #1f6f5c; --c2: #c2622d; --c3: #3a5a7a; --c4: #8a5fa8; --hero-a: #1f6f5c; --hero-b: #2f9079; }
@media (prefers-color-scheme: dark) { :root { --c1: #4fb89c; --c2: #e89a5e; --c3: #8fb3d6; --c4: #c19be0; --hero-a: #17574a; --hero-b: #257a66; } }
main, footer { max-width: 960px; }
.top { position: sticky; top: 0; background: var(--bg); z-index: 2; }
.brand::before { content: ""; display: inline-block; width: .7em; height: .7em; border-radius: 50%;
  background: var(--accent); margin-right: .4em; }
.me { display: inline-flex; align-items: center; gap: .4rem; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: inline-block; }
.avatar.big { width: 84px; height: 84px; border: 3px solid rgba(255,255,255,.75); flex: none; }
.initials { background: var(--accent); color: var(--accent-ink); font-weight: 700; text-align: center;
  line-height: 28px; font-size: .85rem; text-decoration: none; }
.initials.big { line-height: 78px; font-size: 2rem; background: rgba(255,255,255,.2); color: #fff; }
.photo-row .initials.big { background: var(--accent); color: var(--accent-ink); }
.hero { display: flex; align-items: center; gap: 1.2rem; padding: 1.4rem; margin-bottom: 1rem; border-radius: 18px;
  color: #fff; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); flex-wrap: wrap; }
.hero h1 { margin: 0; font-size: 1.7rem; }
.hero p { margin: .2rem 0 .6rem; opacity: .95; }
.hero-text { flex: 1; min-width: 14rem; }
.hero-bar { height: 10px; accent-color: #fff; }
.streak { display: flex; align-items: center; gap: .6rem; background: rgba(0,0,0,.18); border-radius: 14px; padding: .7rem 1rem; }
.streak b { font-size: 2.2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.streak span { font-size: .78rem; line-height: 1.2; opacity: .9; }
.stat { border-top: 4px solid var(--line); }
.stat.c1 { border-top-color: var(--c1); } .stat.c2 { border-top-color: var(--c2); }
.stat.c3 { border-top-color: var(--c3); } .stat.c4 { border-top-color: var(--c4); }
.stat b { font-size: 1.7rem; } .stat b i { font-style: normal; font-size: .9rem; color: var(--muted); font-weight: 500; }
.two { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; align-items: start; }
.mt { margin-top: 1.2rem; }
.bmi-num { margin: 0 0 .3rem; color: var(--muted); } .bmi-num b { font-size: 1.8rem; color: var(--ink); margin-right: .3rem; }
.bmi { width: 100%; height: auto; }
.bmi .s1 { fill: var(--c3); } .bmi .s2 { fill: var(--c1); } .bmi .s3 { fill: #d9a441; } .bmi .s4 { fill: var(--c2); }
.bmi .mark { fill: var(--ink); } .bmi .axis { fill: var(--muted); font-size: 9px; }
.badges { display: flex; flex-wrap: wrap; gap: .45rem; }
.badge { font-size: .82rem; padding: .3rem .65rem; border-radius: 999px; border: 1px solid var(--line); }
.badge.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.badge.off { opacity: .45; filter: grayscale(1); }
.pill { font-size: .82rem; padding: .1rem .5rem; border-radius: 999px; background: var(--bg); font-variant-numeric: tabular-nums; }
.pill.down { color: var(--c1); } .pill.up { color: var(--c2); }
.photo-row { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.photo-row .grow { flex: 1; min-width: 12rem; }
@media (max-width: 720px) { .two { grid-template-columns: 1fr; } }
