:root {
  --bg: #f3f5f0;
  --surface: #ffffff;
  --ink: #13211a;
  --muted: #66746c;
  --line: #e1e6dd;
  --brand: #1d6b45;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1e8;
  --accent: #c8f04a;
  --side: #0f1f17;
  --side-ink: #cfdcd3;
  --warn: #b45309;
  --warn-soft: #fdf1e2;
  --danger: #b4321f;
  --danger-soft: #fbe9e6;
  --info-soft: #e6effa;
  --info: #285a9c;
  --c-p: #2f7fd1;
  --c-c: #d8962a;
  --c-f: #c2507a;
  --r: 14px;
  --shadow: 0 1px 2px rgba(16, 33, 24, .05), 0 4px 16px rgba(16, 33, 24, .04);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: 'Outfit', var(--font);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: .8rem; }
h3 { font-size: 1.05rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.center { text-align: center; }
.mt { margin-top: 1rem; }
.pad { padding: 0 1.25rem; }
.eyebrow { margin: 0 0 .2rem; text-transform: uppercase; font-size: .75rem; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.note { background: var(--brand-soft); border-radius: 10px; padding: .7rem .9rem; margin: .6rem 0; white-space: pre-line; }

/* logo */
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--side); font: 700 .85rem var(--display); }
.logo-lg { width: 56px; height: 56px; font-size: 1.3rem; border-radius: 16px; }
.brand { display: flex; align-items: center; gap: .6rem; font: 600 1.1rem var(--display); color: inherit; }
.brand:hover { text-decoration: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .6rem 1rem; border-radius: 10px; border: 1px solid transparent; font: 600 .9rem var(--font); cursor: pointer; background: var(--surface); color: var(--ink); white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: .4rem .7rem; font-size: .82rem; border-radius: 8px; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: none; color: var(--muted); font-size: 1.25rem; line-height: 1; cursor: pointer; padding: .2rem .45rem; border-radius: 6px; }
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }

/* forms */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
input, select, textarea { font: 400 .95rem var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: .55rem .7rem; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
input:disabled { background: var(--bg); }
label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--ink); font-weight: 500; }
label.check input { width: auto; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.stack + .stack, form.card > label + label { margin-top: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.form-grid.four { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.span2 { grid-column: span 2; }
.actions { margin-top: 1.2rem; display: flex; gap: .5rem; }
.toolbar { display: flex; gap: .5rem; margin-bottom: 1rem; max-width: 640px; }
.inline-form { display: flex; gap: .5rem; align-items: center; }
.grow { flex: 1; }
.add-row { display: flex; gap: .5rem; align-items: center; margin-top: .8rem; }
.add-row.wrap { flex-wrap: wrap; }
.w-time { width: 7.5rem; flex: none; }
.w-day { width: 10rem; flex: none; }
.w-num { width: 6.5rem; flex: none; }
.w-notes { width: 11rem; flex: none; }
.strong-input { font-weight: 600; }
.measure-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; align-items: end; margin-bottom: 1rem; }

/* cards & layout */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; }
.card.flush { padding: 1.1rem 0 .4rem; }
.card.flush > h2.pad { margin-bottom: .6rem; }
.card.dashed { background: transparent; box-shadow: none; border: 2px dashed var(--line); }
.card.narrow { max-width: 560px; }
.card.empty { color: var(--muted); text-align: center; padding: 1.6rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head p { margin: .3rem 0 0; }
.back { display: inline-block; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stats.two { grid-template-columns: 1fr 1fr; }
.stat { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 1rem 1.2rem; display: flex; flex-direction: column; color: inherit; }
.stat:hover { text-decoration: none; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat-value { font: 700 1.9rem var(--display); }
.stat-value small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.stat-value.sm { font-size: 1.15rem; margin-top: .4rem; }
.delta { font-size: .8rem; font-weight: 600; }
.delta.down { color: var(--brand); }
.delta.up { color: var(--warn); }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .5rem .75rem; border-bottom: 1px solid var(--line); }
.table td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 1.25rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
.table.compact td, .table.compact th { padding: .4rem .5rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.dim td { opacity: .55; }
.stars { color: #e0a100; letter-spacing: 1px; }

.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--bg); color: var(--muted); vertical-align: middle; }
.badge.ok { background: var(--brand-soft); color: var(--brand); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .85rem; }
.dl dd { margin: 0; }

.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.flash-success { background: var(--brand-soft); color: var(--brand); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

/* macro bar */
.macro-bar { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.macro { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: .7rem .9rem; border-top: 3px solid var(--line); }
.macro span { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.macro strong { font: 700 1.25rem var(--display); }
.macro small { color: var(--muted); margin-left: .2rem; }
.macro.kcal { border-top-color: var(--brand); }
.macro.p { border-top-color: var(--c-p); }
.macro.c { border-top-color: var(--c-c); }
.macro.f { border-top-color: var(--c-f); }
.meter { height: 5px; background: var(--bg); border-radius: 9px; margin-top: .4rem; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 9px; }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.editor-side { position: sticky; top: 1rem; }
.meal-head { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }

/* chart */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--brand); opacity: .08; }
.chart .dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }

/* langs */
.langs { display: inline-flex; gap: 2px; background: rgba(127, 127, 127, .12); padding: 3px; border-radius: 9px; }
.langs a { padding: .2rem .5rem; border-radius: 7px; font-size: .75rem; font-weight: 700; color: inherit; opacity: .7; }
.langs a.on { background: var(--accent); color: var(--side); opacity: 1; }
.langs a:hover { text-decoration: none; opacity: 1; }

/* ---------- admin shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.m-top, .m-tabs, .nav-scrim, .m-close, .sm-only { display: none; }
.side-top { display: flex; align-items: center; justify-content: space-between; }
.sidebar { background: var(--side); color: var(--side-ink); padding: 1.3rem 1rem; display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: #fff; padding: 0 .4rem; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { color: var(--side-ink); padding: .55rem .75rem; border-radius: 9px; font-weight: 500; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.side-nav a.on { background: rgba(200, 240, 74, .14); color: var(--accent); }
.side-foot { display: flex; flex-direction: column; gap: .8rem; }
.whoami { display: flex; flex-direction: column; padding: 0 .3rem; }
.whoami strong { color: #fff; font-weight: 600; }
.whoami small { opacity: .7; }
.sidebar .btn-ghost { color: var(--side-ink); border-color: rgba(255, 255, 255, .15); }
.main { padding: 2rem 2.2rem 3rem; max-width: 1280px; width: 100%; min-width: 0; }

/* ---------- auth ---------- */
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at 20% 0%, #dff2c2 0, transparent 45%), var(--bg); }
.auth-card { background: var(--surface); padding: 2rem; border-radius: 20px; box-shadow: var(--shadow); width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 1.4rem; }
.auth-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.auth-brand p { margin: 0; }
.error-card { text-align: center; max-width: 420px; margin: 3rem auto; }
.error-code { font: 700 3rem var(--display); color: var(--brand); }

/* ---------- client app ---------- */
.area-app { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; padding-top: calc(.7rem + env(safe-area-inset-top)); background: var(--side); color: #fff; }
.app-main { max-width: 640px; margin: 0 auto; padding: 1.2rem 1rem; }
.hero { margin: .4rem 0 1.2rem; }
.section-title { margin: 1.6rem 0 .7rem; font-size: 1.15rem; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .55rem 0 .5rem; color: var(--muted); font-size: .7rem; font-weight: 600; }
.tabbar a:hover { text-decoration: none; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--brand); }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.exercises { margin: 0 0 1rem; padding: 0; list-style: none; counter-reset: ex; }
.exercises li { counter-increment: ex; position: relative; padding: .7rem 0 .7rem 2.3rem; border-bottom: 1px solid var(--line); }
.exercises li:last-child { border-bottom: 0; }
.exercises li::before { content: counter(ex); position: absolute; left: 0; top: .7rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.ex-name { font-weight: 600; }
.ex-meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; color: var(--muted); font-size: .88rem; }
.ex-meta b { color: var(--ink); }
.video { font-size: .8rem; }
details summary { cursor: pointer; }
details.small summary { color: var(--brand); margin-top: .2rem; }
.log-box > summary { list-style: none; }
.log-box > summary::-webkit-details-marker { display: none; }
.log-box[open] > summary { display: none; }
.done-chip { text-align: center; padding: .6rem; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.rating { border: 0; padding: 0; margin: 0; display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: .2rem; }
.rating legend { font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .2rem; width: 100%; }
.rating input { position: absolute; opacity: 0; width: 0; }
.rating label { font-size: 1.9rem; color: var(--line); cursor: pointer; line-height: 1; }
.rating input:checked ~ label, .rating label:hover, .rating label:hover ~ label { color: #e0a100; }
.kcal-line { margin-bottom: .6rem; color: var(--muted); }
.kcal-line strong { color: var(--ink); font: 700 1.3rem var(--display); }
.meal-summary { list-style: none; margin: 0 0 .8rem; padding: 0; }
.meal-summary li { display: grid; grid-template-columns: 3rem 1fr auto; gap: .6rem; align-items: start; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.meal-summary li div { display: flex; flex-direction: column; }
.food-list { list-style: none; margin: 0 0 .6rem; padding: 0; }
.food-list li { display: flex; justify-content: space-between; gap: .5rem; padding: .4rem 0; border-bottom: 1px dashed var(--line); }
.food-list .qty { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
}
@media (max-width: 560px) {
  .macro-bar { grid-template-columns: 1fr 1fr; }
  .add-row { flex-wrap: wrap; }
  .add-row .grow { flex-basis: 100%; }
  .w-notes { flex: 1; width: auto; }
  .span2 { grid-column: auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .meal-head { flex-wrap: wrap; }
  .inline-form { flex-wrap: wrap; }
}

/* ---------- mobile app shell (admin) ---------- */
@media (max-width: 820px) {
  .area-admin { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .shell { display: block; }
  .m-top { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; gap: .6rem; padding: .55rem .8rem; padding-top: calc(.55rem + env(safe-area-inset-top)); background: var(--side); color: #fff; }
  .m-burger { background: none; border: 0; color: #fff; padding: .35rem; margin-left: -.25rem; border-radius: 8px; cursor: pointer; }
  .m-burger svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; display: block; }
  .m-title { flex: 1; font: 600 1.05rem var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-top .logo { width: 30px; height: 30px; font-size: .78rem; }
  .sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); height: 100%; transform: translateX(-102%); transition: transform .25s ease; overflow-y: auto; padding-top: calc(1.2rem + env(safe-area-inset-top)); box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  .nav-open .sidebar { transform: none; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(8, 18, 12, .45); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .nav-open { overflow: hidden; }
  .m-close { display: block; background: none; border: 0; color: var(--side-ink); font-size: 1.8rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }
  .side-nav a { padding: .75rem .8rem; font-size: 1rem; }
  .m-tabs { display: grid; grid-template-columns: repeat(5, 1fr); }
  .main { padding: 1rem .9rem 1.5rem; }
  .page-head { margin-bottom: 1rem; align-items: flex-start; }
  .page-head h1 { font-size: 1.4rem; }
  .page-head > .btn, .page-head > .row { width: 100%; }
  .page-head > .row > * { flex: 1; }
  .page-head > .row .btn { width: 100%; }
}
.tabbar { box-shadow: 0 -4px 20px rgba(16, 33, 24, .06); }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; }
  input, select, textarea { font-size: 16px; padding: .65rem .75rem; } /* no iOS zoom */
  .btn { padding: .7rem 1rem; }
  .btn-sm { padding: .5rem .75rem; }
  .card { padding: 1rem; border-radius: 16px; }
  .card.flush { padding: .9rem 0 .2rem; }
  .pad { padding: 0 1rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat { padding: .8rem .9rem; }
  .stat-value { font-size: 1.55rem; }
  .stat-label { font-size: .72rem; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input, .toolbar select { flex: 1 1 100%; }
  .toolbar .btn { flex: 1; }
  .hide-sm { display: none !important; }
  .sm-only { display: block; }
  .ex-meta.sm-only { display: flex; }
  .card-head { flex-wrap: wrap; }
  .dl { grid-template-columns: 1fr; gap: 0; }
  .dl dt { margin-top: .5rem; font-size: .75rem; }
  .measure-form { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .measure-form .span2, .measure-form .span-all, .measure-form > .btn { grid-column: 1 / -1; }
  .editor-side .card { margin-bottom: .8rem; }
  .table.compact td, .table.compact th { padding: .5rem .35rem; }
  .table.compact td:first-child { padding-left: 0; }
  .meal-head .w-time { width: 6.6rem; }
  .meal-head .inline-form .btn { flex: none; }
  .add-row select.grow { flex-basis: 100%; }
  .add-row .w-num { flex: 1 1 28%; width: auto; }
  .add-row .btn { flex: 1 1 100%; }
  .add-row .w-day { flex: 1 1 100%; width: auto; }
  .add-row input.grow { flex-basis: 100%; }
  .grid-2 { gap: .8rem; margin-bottom: .8rem; }

  /* table -> cards */
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { position: relative; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
  .table.cards tbody tr:last-child { border-bottom: 0; }
  .card:not(.flush) .table.cards tr { padding-left: 0; padding-right: 0; }
  .table.cards td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .18rem 0 !important; border: 0; text-align: right; }
  .table.cards td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 500; text-align: left; }
  .table.cards td.lead { display: block; text-align: left; padding-bottom: .35rem !important; padding-right: 2rem !important; }
  .table.cards td.lead::before { content: none; }
  .table.cards td:empty { display: none; }
  .table.cards td.act { position: absolute; top: .55rem; right: .3rem; width: auto; }
  .card:not(.flush) .table.cards td.act { right: -.4rem; }
  .table.cards td.act::before { content: none; }
}

/* ---------- client app polish ---------- */
.area-app .topbar { box-shadow: 0 1px 0 rgba(255,255,255,.04); }
.hero-card { background: linear-gradient(135deg, #10261b 0%, #1d6b45 100%); color: #fff; border-radius: 20px; padding: 1.2rem 1.2rem 1rem; margin: .2rem 0 1rem; position: relative; overflow: hidden; }
.hero-card::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(200,240,74,.35), transparent 70%); }
.hero-card .eyebrow { color: rgba(255,255,255,.7); }
.hero-card h1 { color: #fff; font-size: 1.6rem; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; position: relative; z-index: 1; }
.hero-stats a { background: rgba(255,255,255,.1); border-radius: 14px; padding: .65rem .8rem; color: #fff; display: flex; flex-direction: column; }
.hero-stats a:hover { text-decoration: none; background: rgba(255,255,255,.16); }
.hero-stats span { font-size: .72rem; opacity: .75; font-weight: 600; }
.hero-stats strong { font: 700 1.5rem var(--display); }
.hero-stats small { font-size: .8rem; opacity: .75; font-weight: 500; }
.hero-stats .delta { font-size: .75rem; }
.hero-stats .delta.down { color: var(--accent); }
.hero-stats .delta.up { color: #ffcf8a; }
.history { padding-top: .3rem; padding-bottom: .3rem; }
.h-row { display: flex; align-items: center; gap: .6rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.h-row:last-child { border-bottom: 0; }
.h-date { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.h-val { text-align: right; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; }
.h-val strong { font: 700 1.15rem var(--display); }
.span-all { grid-column: 1 / -1; }
.install-card { display: flex; align-items: center; gap: .9rem; background: var(--surface); border: 1px solid var(--brand-soft); border-radius: 16px; padding: .85rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.install-card .logo { width: 42px; height: 42px; flex: none; border-radius: 12px; }
.install-card div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.install-card small { color: var(--muted); }
.install-card[hidden] { display: none; }
.ios-steps { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
@media (display-mode: standalone) { .install-card { display: none !important; } }

.nowrap { white-space: nowrap; }
.tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
@media (max-width: 640px) {
  .meal-head { align-items: flex-start; }
  .meal-head .inline-form { flex-wrap: wrap; }
  .meal-head .inline-form .grow { flex: 1 1 100%; order: -1; }
  .meal-head .inline-form .w-time, .meal-head .inline-form .w-day { flex: 1 1 auto; width: auto; }
  .add-row .w-notes { flex: 1 1 55%; }
  .add-row input[name=grams] { flex: 1 1 30%; }
}

/* ---------- Garmin ---------- */
.g-badge { display: inline-block; background: #000; color: #fff; font: 700 .58rem/1 var(--font); letter-spacing: .12em; padding: .28rem .4rem; border-radius: 4px; vertical-align: middle; }
.g-badge.lg { font-size: .7rem; padding: .35rem .5rem; }
.garmin-card h2 { display: flex; align-items: center; gap: .5rem; margin: 0; }
.card-head h2 .g-badge { margin-right: .2rem; }
.g-send { margin: -.3rem 0 .7rem; text-align: center; }
.g-send small { display: block; margin-top: .25rem; }
.g-acts li { align-items: center; }
.g-dot { width: 10px; height: 10px; border-radius: 50%; background: #2f7fd1; flex: none; }
.g-acts .grow { display: flex; flex-direction: column; min-width: 0; }
.g-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .2rem .7rem; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; max-width: 55%; }
.mb { margin-bottom: .8rem; }
.steps { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .8rem; }
.copy-box { margin-top: .45rem; background: var(--bg); border-radius: 9px; padding: .5rem .7rem; display: flex; flex-direction: column; gap: .15rem; }
.copy-box code, .dl code { font: 500 .82rem ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; user-select: all; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.section-row .section-title { margin-bottom: .7rem; }
.g-fit { margin: -.3rem 0 .6rem; }
.g-link { display: inline-flex; align-items: center; gap: .4rem; margin: .1rem 0 .5rem; }
.watch-face { background: #0b0f0d; color: #e9f2ec; border-radius: 18px; padding: .6rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.w-repeat { border: 1px solid rgba(200, 240, 74, .35); border-radius: 12px; padding: .3rem .4rem .4rem; }
.w-repeat-head { color: var(--accent); font: 600 .78rem var(--font); letter-spacing: .03em; padding: .2rem .3rem .35rem; }
.w-step { display: grid; grid-template-columns: 1.2rem 1fr auto; gap: .55rem; align-items: center; padding: .45rem .4rem; border-radius: 9px; background: rgba(255, 255, 255, .05); }
.w-step + .w-step { margin-top: .3rem; }
.w-step strong { display: block; font-weight: 600; }
.w-step small { color: #9fb3a7; font-size: .75rem; }
.w-step.rest { background: transparent; color: #9fb3a7; }
.w-step.rest strong { font-weight: 500; }
.w-ico { color: var(--accent); font-size: .8rem; text-align: center; }
.w-step.rest .w-ico { color: #9fb3a7; }
.w-dur { font: 700 .95rem var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- train together ---------- */
.tg-form { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; align-items: end; }
.tg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: 1rem; }
.tg-person h3 { font-size: .95rem; margin-bottom: .4rem; }
.tg-day { border: 1px solid var(--line); border-radius: 12px; padding: .55rem .65rem; display: flex; flex-direction: column; gap: .1rem; margin-bottom: .4rem; }
.tg-day small { color: var(--muted); font-size: .76rem; }
.tg-day.win { border: 2px solid var(--brand); background: var(--brand-soft); }
.tg-score { font-size: .8rem; color: var(--muted); }
.tg-score b { color: var(--ink); font: 700 1rem var(--display); }
.tg-result { border-top: 1px solid var(--line); padding-top: .9rem; }
.tg-result h3 { margin-bottom: .2rem; }
.tg-ex { margin: .6rem 0 1rem; padding-left: 1.1rem; }
.tg-ex li { padding: .15rem 0; }
.tg-invite { display: flex; align-items: center; gap: .8rem; color: inherit; border: 1px solid var(--brand-soft); }
.tg-invite:hover { text-decoration: none; }
.tg-invite > div { flex: 1; display: flex; flex-direction: column; }
.tg-ico { font-size: 1.5rem; }

/* ---------- recipes & shopping ---------- */
.recipe-row { display: flex; align-items: center; gap: .5rem; padding: .5rem .2rem; border-bottom: 1px solid var(--line); }
.recipe-card { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; margin: .5rem 0; }
.recipe-card summary { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .4rem; list-style: none; }
.recipe-card summary::-webkit-details-marker { display: none; }
.recipe-card summary small { flex-basis: 100%; }
.recipe-card[open] summary { margin-bottom: .4rem; }
.instructions { white-space: pre-line; background: var(--bg); border-radius: 10px; padding: .7rem .8rem; margin: .5rem 0 0; font-size: .92rem; }
.seg { display: inline-flex; background: var(--surface); border-radius: 11px; padding: 3px; box-shadow: var(--shadow); margin-bottom: .6rem; }
.seg a { padding: .4rem .8rem; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .85rem; }
.seg a.on { background: var(--brand); color: #fff; }
.seg a:hover { text-decoration: none; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 1rem; }
.shop-group h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); margin-bottom: .4rem; }
.shop-item { flex-direction: row; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px dashed var(--line); color: var(--ink); font-weight: 500; font-size: .95rem; cursor: pointer; }
.shop-item:last-child { border-bottom: 0; }
.shop-item input { width: 20px; height: 20px; flex: none; accent-color: var(--brand); }
.shop-item .qty { color: var(--muted); font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.shop-item input:checked ~ span { text-decoration: line-through; opacity: .45; }

/* ---------- invites ---------- */
.share-box { display: flex; flex-direction: column; gap: .6rem; }
.share-url { font: 500 .85rem ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); }
.btn-wa { background: #25d366; color: #fff; }
.new-invite { border: 2px solid var(--brand); }

/* ---------- excel import ---------- */
.xl-sheets { padding-left: 1.1rem; margin: .4rem 0 1rem; }
.xl-sheets li { margin: .25rem 0; }
.map-row { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr; gap: .4rem .8rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.map-row:last-child { border-bottom: 0; }
.map-new { grid-column: 1 / -1; background: var(--bg); border-radius: 10px; padding: .6rem .7rem; }
.pv-meal { display: flex; flex-direction: column; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.warn-card { border: 1px solid #f3d3a7; background: var(--warn-soft); }
@media (max-width: 640px) { .map-row { grid-template-columns: 1fr; } }

/* ---------- searchable selects (Tom Select) ---------- */
.ts-wrapper { min-width: 0; }
.ts-wrapper.single .ts-control, .ts-wrapper .ts-control { border: 1px solid var(--line); border-radius: 9px; padding: .55rem 2rem .55rem .7rem; font: 400 .95rem var(--font); color: var(--ink); background: var(--surface); box-shadow: none; min-height: 2.6rem; }
.ts-wrapper.focus .ts-control { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; box-shadow: none; }
.ts-dropdown { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 33, 24, .14); margin-top: 4px; font: 400 .95rem var(--font); color: var(--ink); overflow: hidden; z-index: 60; }
.ts-dropdown .dropdown-input-wrap { padding: .5rem; border-bottom: 1px solid var(--line); }
.ts-dropdown .dropdown-input { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; font-size: 16px; }
.ts-dropdown .option { padding: .55rem .75rem; }
.ts-dropdown .active { background: var(--brand-soft); color: var(--ink); }
.ts-dropdown .option .highlight { background: rgba(200, 240, 74, .55); border-radius: 2px; }
.ts-dropdown-content { max-height: 320px; }
.ts-dropdown .no-results { padding: .7rem .75rem; color: var(--muted); }
.add-row .ts-wrapper.grow { flex: 1 1 220px; }
@media (max-width: 640px) {
  .ts-wrapper .ts-control, .ts-wrapper .ts-control input { font-size: 16px; }
  .add-row .ts-wrapper.grow { flex-basis: 100%; }
  .ts-dropdown-content { max-height: 45vh; }
}
.meal-extra { margin-top: .6rem; border-top: 1px dashed var(--line); padding-top: .5rem; }
.meal-extra > summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--brand); padding: .2rem 0; }
.meal-extra[open] > summary { margin-bottom: .5rem; }
.or-line { margin: .5rem 0 0; text-align: center; }
.meal-prep { margin: .5rem 0; }
.meal-prep strong { font-size: .85rem; }

/* ---------- recipe book ---------- */
.toolbar.wide { max-width: none; flex-wrap: wrap; align-items: center; }
.toolbar.wide input[type=search] { flex: 1 1 220px; }
.toolbar.wide select { width: auto; }
.rb-filter input[type=search] { margin-bottom: .6rem; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; scrollbar-width: none; }
.chip { flex: none; padding: .4rem .8rem; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); font-size: .85rem; font-weight: 600; }
.chip.on { background: var(--brand); color: #fff; }
.chip:hover { text-decoration: none; }
.rb-list { display: grid; gap: .6rem; }
.rb-item { display: flex; align-items: center; gap: .8rem; color: inherit; margin: 0; padding: .9rem 1rem; }
.rb-item:hover { text-decoration: none; }
.rb-item .grow { display: flex; flex-direction: column; min-width: 0; }
.rb-macro { display: grid; grid-template-columns: auto auto; gap: 0 .25rem; align-items: baseline; text-align: right; font-variant-numeric: tabular-nums; }
.rb-macro b { font: 700 1rem var(--display); }
.rb-macro small { color: var(--muted); font-size: .7rem; text-align: left; }
.servings { display: flex; align-items: center; gap: .3rem; font-weight: 600; font-size: .9rem; }
.servings .icon-btn { font-size: 1.3rem; background: var(--bg); width: 32px; height: 32px; border-radius: 50%; }
.servings .icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
.freeze-card { background: #eef5fc; }
.freeze-note { background: #eef5fc; border-radius: 10px; padding: .55rem .7rem; font-size: .88rem; margin: .5rem 0; }

/* ---------- weekly diet ---------- */
.day-tabs { display: grid; grid-template-columns: 1.3fr repeat(7, 1fr); gap: 4px; background: var(--surface); padding: 4px; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: .4rem; }
.day-tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .45rem .2rem; border-radius: 9px; color: var(--ink); font-weight: 600; font-size: .85rem; text-transform: capitalize; }
.day-tabs a small { font-weight: 500; font-size: .68rem; color: var(--muted); }
.day-tabs a.on { background: var(--brand); color: #fff; }
.day-tabs a.on small { color: rgba(255, 255, 255, .8); }
.day-tabs a:hover { text-decoration: none; }
.w-wd { width: 9.5rem; flex: none; }
.everyday-badge { margin-bottom: .4rem; }
.day-checks { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; }
.day-checks .check { text-transform: capitalize; }
@media (max-width: 640px) {
  .day-tabs { grid-template-columns: repeat(4, 1fr); }
  .meal-head .inline-form .w-wd { flex: 1 1 auto; width: auto; }
}
.app-days { grid-template-columns: repeat(7, 1fr) !important; }
.app-days a { padding: .55rem 0; }

/* ---------- dish swaps ---------- */
.food-list li { align-items: center; }
.food-list li > span:first-child { flex: 1; display: flex; flex-direction: column; }
.swap-btn { flex: none; width: 30px; height: 30px; margin-left: .4rem; display: grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--brand); font-weight: 700; }
.swap-btn:hover { background: var(--brand-soft); text-decoration: none; }
.food-list li.swapped > span:first-child { color: var(--brand); }
.swap-info { color: var(--muted); font-size: .76rem; display: block; }
form.inline { display: inline; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
.recipe-actions { margin-top: .5rem; justify-content: space-between; }
.swap-opt { display: flex; align-items: center; gap: .7rem; margin: 0; padding: .8rem 1rem; }
.swap-opt .grow { display: flex; flex-direction: column; min-width: 0; }
.match { display: flex; flex-direction: column; align-items: center; color: var(--brand); flex: none; }
.match b { font: 700 1.05rem var(--display); }
.match small { font-size: .65rem; color: var(--muted); }
@media (max-width: 640px) { .swap-opt { flex-wrap: wrap; } .swap-opt .grow { flex-basis: calc(100% - 70px); } .swap-opt .btn { flex-basis: 100%; } }

/* ---------- generator ---------- */
.gen-clients { display: grid; gap: .4rem; }
.gen-client { flex-direction: row; align-items: center; gap: .7rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-weight: 500; cursor: pointer; }
.gen-client input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.gen-client .grow { display: flex; flex-direction: column; }
.gen-client.nodata { background: var(--warn-soft); }
.gen-calc { margin-top: .6rem; }

/* ---------- meal prep ---------- */
.prep-day.today { border: 2px solid var(--brand); }
.prep-day.cook { background: linear-gradient(180deg, #fbfff0, var(--surface) 120px); }
.prep-block { border-radius: 12px; padding: .6rem .75rem; margin-top: .5rem; }
.prep-block ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.prep-block li { margin: .15rem 0; }
.cook-block { background: #f4fbe3; }
.thaw-block { background: #eef5fc; }
.reheat-block { background: #fff4e8; }
.fresh-block { background: var(--bg); }
.reminders { display: grid; gap: .5rem; margin-bottom: 1rem; }
.reminder { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem .9rem; border-radius: 14px; color: inherit; }
.reminder:hover { text-decoration: none; }
.reminder .r-ico { font-size: 1.4rem; line-height: 1; }
.reminder div { display: flex; flex-direction: column; }
