:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --ink: #171b26;
  --muted: #687083;
  --line: #e1e5ee;
  --surface: #f0f3f8;
  --surface-2: #e9edf5;
  --tamara: #6fc7a7;
  --tamara-ink: #145a43;
  --tamara-soft: #e8f7f1;
  --oriol: #e24b5a;
  --oriol-soft: #ffedf0;
  --accent: #2c6bed;
  --accent-soft: #e9f0ff;
  --macro-total: #315f9d;
  --macro-protein: #17825c;
  --macro-carbs: #b66b08;
  --macro-fat: #b04473;
  --shadow: 0 1px 2px rgba(19, 26, 42, 0.06), 0 8px 22px rgba(19, 26, 42, 0.06);
  --shadow-strong: 0 14px 34px rgba(19, 26, 42, 0.14);
  --radius: 8px;
}

* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; }
button, a, input, select, textarea { touch-action: manipulation; }
input, select, textarea {
  color: var(--ink);
  caret-color: var(--ink);
  color-scheme: light;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
html, body { margin: 0; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(54px + env(safe-area-inset-bottom));
}

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 22px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand[role="button"] { cursor: pointer; border-radius: var(--radius); }
.brand[role="button"]:focus-visible { outline: 3px solid rgba(52,178,123,.28); outline-offset: 3px; }
.logo { font-size: 26px; }
.brand h1 { font-size: 19px; margin: 0; letter-spacing: -0.2px; }
.brand .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.weeknav { display: flex; align-items: center; gap: 10px; }
.weeklabel { text-align: center; min-width: 168px; position: relative; border-radius: var(--radius); }
.weeklabel:hover { background: var(--surface); }
.weeklabel:focus-within { outline: 3px solid rgba(52,178,123,.28); outline-offset: 3px; }
.weeklabel strong { display: block; font-size: 15px; }
.weeklabel small { color: var(--muted); }
.date-jump-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; opacity: 0; cursor: pointer; font-size: 16px;
}
.iconbtn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  width: 38px; height: 38px; border-radius: var(--radius); font-size: 20px; cursor: pointer;
  display: grid; place-items: center; transition: .15s;
}
.iconbtn:hover { background: var(--surface); }
.ghostbtn {
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius);
  padding: 0 14px; height: 38px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.ghostbtn:hover { color: var(--ink); }
.pick-week { display: flex; align-items: center; gap: 8px; padding: 4px 20px 0; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.pick-week input { width: 17px; height: 17px; }
.picker-target {
  margin: 8px 20px 0; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fbfcfe; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.picker-target-label { color: var(--muted); font-size: 12px; font-weight: 850; }
.picker-target-mac { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.picker-target-mac b { color: var(--ink); }
.picker-target-empty { color: var(--muted); font-size: 12px; font-weight: 700; }

/* calendar (week overview) */
.cal-stats { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.cal-stat { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; border-left-width: 3px; }
.cal-stat.tamara { border-left-color: var(--tamara); }
.cal-stat.oriol { border-left-color: var(--oriol); }
.cal-stat-name { font-weight: 700; color: var(--ink); margin-right: 4px; }
.cal-stat b { color: var(--ink); }
.calendar { padding: 12px 22px 44px; overflow-x: auto; }
.calendar.hidden { display: none; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.cal-copy-prev { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.cal-mode { display: inline-flex; background: var(--surface); border-radius: var(--radius); padding: 3px; }
.cal-mode-btn, .prog-mode-btn {
  border: none; background: none; border-radius: var(--radius); padding: 7px 14px;
  color: var(--muted); font-weight: 800; cursor: pointer; font-size: 13px;
}
.cal-mode-btn.active, .prog-mode-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.cal-grid { display: grid; gap: 6px; min-width: 760px; }
.cal-corner { }
.cal-dh { text-align: center; padding: 6px 0; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.cal-dh small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.cal-dh strong { font-size: 16px; }
.cal-dh.today { background: var(--ink); color: #fff; border-color: var(--ink); }
.cal-dh.today small { color: rgba(255,255,255,.7); }
.cal-ml { display: flex; align-items: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.cal-cell { display: flex; flex-direction: column; gap: 4px; }
.cal-meal { display: grid; grid-template-columns: 1fr; gap: 4px; }
.cal-meal.has-recipe { grid-template-columns: minmax(0, 1fr) 28px; }
.cal-pick {
  text-align: left; border: 1px solid var(--line); border-left: 3px solid var(--line); background: #fff;
  border-radius: 8px; padding: 6px 8px; font-size: 12px; line-height: 1.2; cursor: pointer;
  box-shadow: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-pick:hover { background: var(--surface); }
.cal-recipe {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; box-shadow: none;
  cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1;
}
.cal-recipe:hover { color: var(--ink); background: var(--surface); }
.cal-pick.tamara { border-left-color: var(--tamara); }
.cal-pick.oriol { border-left-color: var(--oriol); }
.cal-pick.done { background: #f1faf6; }
.cal-pick.done::before { content: "✓ "; color: #1f7a55; font-weight: 800; }
.cal-pick.blank { color: var(--muted); background: #fbfcfe; border-left-style: dashed; }
.cal-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; font-size: 13px; color: var(--muted); }
.ical-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 14px; font-weight: 700; cursor: pointer; }
.ical-btn.tamara { border-left: 3px solid var(--tamara); }
.ical-btn.oriol { border-left: 3px solid var(--oriol); }
.ical-btn:hover { background: var(--surface); }
.ical-out { font-size: 12px; }
.ical-out code { background: #f1f2f7; padding: 2px 6px; border-radius: 6px; user-select: all; }
.cal-day-view { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; overflow: visible; }
.cal-day-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: none;
}
.cal-day-card.tamara { border-left: 4px solid var(--tamara); }
.cal-day-card.oriol { border-left: 4px solid var(--oriol); }
.cal-day-head { margin-bottom: 10px; }
.cal-day-head h2 { margin: 0; font-size: 17px; }
.cal-day-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.cal-day-list { display: flex; flex-direction: column; gap: 8px; }
.cal-day-row {
  display: grid; grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px; align-items: center;
}
.cal-day-meta span { display: block; font-size: 12px; font-weight: 800; color: var(--ink); }
.cal-day-meta small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); font-weight: 700; line-height: 1.25; }
.cal-month-view { overflow: visible; }
.cal-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-month-h {
  text-align: center; color: var(--muted); font-size: 11px; font-weight: 800;
  text-transform: uppercase; padding: 0 0 2px;
}
.cal-month-cell {
  min-height: 86px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius);
  padding: 8px; cursor: pointer; text-align: left; display: flex; flex-direction: column;
  justify-content: space-between; color: var(--ink);
}
.cal-month-cell:hover { background: #f8f9fc; }
.cal-month-cell.outside { opacity: .45; }
.cal-month-cell.today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cal-month-cell.selected { background: #f1faf6; border-color: #bfe6d4; }
.cal-month-date { font-size: 15px; font-weight: 850; }
.cal-month-counts { display: flex; gap: 4px; flex-wrap: wrap; }
.cal-month-counts span {
  border-radius: 999px; padding: 2px 6px; font-size: 11px; font-weight: 800;
  background: #f1f2f7; color: var(--muted); line-height: 1.2;
}
.cal-month-counts .tamara { background: var(--tamara-soft); color: var(--tamara-ink); }
.cal-month-counts .oriol { background: var(--oriol-soft); color: var(--oriol); }
.cal-loading { margin-top: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }

/* view switcher */
.viewswitch { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; }
.seg {
  border: none; background: none; padding: 7px 13px; border-radius: 6px;
  font-weight: 700; color: var(--muted); cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; line-height: 1;
}
.seg-icon { font-size: 17px; line-height: 1; }
.seg-label { line-height: 1; }
.seg.active { background: var(--ink); color: #fff; box-shadow: none; }
.person-select-wrap {
  margin-left: auto; display: grid; flex-shrink: 0;
}
.person-select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: var(--radius); padding: 8px 30px 8px 12px; font: inherit;
  font-size: 13px; font-weight: 850; min-height: 38px;
  box-shadow: 0 1px 2px rgba(19,26,42,.04);
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.settings-icon { font-size: 17px; flex-shrink: 0; }
.settings-icon.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.settings-mobile-seg { display: none; }

/* ---- recipes browser ---- */
.recipes { max-width: 1100px; margin: 0 auto; padding: 8px 22px 40px; }
.recipes.hidden, .workouts.hidden, .board.hidden, .days.hidden { display: none; }
.rtools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#recipeSearch {
  flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; font-size: 15px; background: #fff; outline: none;
}
#recipeSearch:focus { border-color: #c9ccda; }
#vegOnly.active { background: #e6f7ee; border-color: #bfe6d4; color: #1f7a55; }
.tagfilter { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.tagchip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-weight: 700;
}
.tagchip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.rcount { color: var(--muted); font-size: 13px; margin: 12px 2px; }
.recipe-pager { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.recipe-pager.hidden { display: none; }
.recipe-page-nums { display: flex; align-items: center; gap: 5px; }
.recipe-page-btn, .recipe-page-num {
  min-width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink); font-weight: 800; cursor: pointer;
}
.recipe-page-btn:disabled { color: #c9ccda; cursor: default; background: #f6f7fb; }
.recipe-page-num.active { background: var(--ink); border-color: var(--ink); color: #fff; }
#recipePageStatus { color: var(--muted); font-size: 12px; font-weight: 800; }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.rcard {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none;
  overflow: hidden; cursor: pointer; position: relative; transition: transform .12s, box-shadow .12s, border-color .12s;
}
.rcard:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: #cad1dd; }
.rcard .rphoto { height: 150px; background: #eef0f6 center/cover no-repeat; }
.rcard .rinfo { padding: 12px 14px 14px; }
.rcard .rname { font-weight: 650; font-size: 15px; line-height: 1.25; margin-bottom: 6px; }
.rcard .rtags { display: flex; gap: 6px; flex-wrap: wrap; }
.rcard .rtags span { background: #f1f2f7; color: var(--muted); border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.rcard .rmac { font-size: 12px; color: var(--muted); margin-top: 8px; }
.rcard .rmac b { color: var(--ink); }
.rcorner { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.rcorner .recipe-card-action { position: static; }
.recipe-card-action {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.92); box-shadow: 0 2px 8px rgba(0,0,0,.18);
  cursor: pointer; font-size: 16px; line-height: 1; display: grid; place-items: center; color: #6b7180;
  transition: transform .1s;
}
.recipe-card-action:hover { transform: scale(1.1); color: var(--ink); }

/* ---- day tabs ---- */
.days {
  display: flex; gap: 8px; padding: 14px 22px; overflow-x: auto;
  position: sticky; top: 70px; z-index: 15; background: var(--bg);
}
.day {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff;
  border-radius: var(--radius); padding: 8px 14px; cursor: pointer; text-align: center;
  min-width: 64px; transition: .15s;
}
.day small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.day strong { font-size: 17px; }
.day.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.day.active small { color: rgba(255,255,255,.7); }

/* ---- board ---- */
.board {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  padding: 10px 22px 0; max-width: 1120px; margin: 0 auto;
}
.home-board { display: block; padding-top: 12px; }
@media (max-width: 760px) { .board { grid-template-columns: 1fr; } }

.dash-person { margin-bottom: 22px; }
.dash-grid {
  display: grid; grid-template-columns: minmax(260px, 1.05fr) minmax(0, 1fr) minmax(230px, .85fr);
  gap: 12px; align-items: stretch;
}
.dash-grid > .meal { margin-bottom: 0; height: 100%; box-sizing: border-box; }
.dash-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none;
  padding: 14px; min-width: 0; height: 100%; box-sizing: border-box;
}
.dash-panel-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 12px; }
.dash-panel-head h3 { margin: 0; font-size: 14px; }
.dash-panel-head span { color: var(--muted); font-size: 12px; font-weight: 700; }
.dash-panel-meta { display: flex; align-items: center; gap: 8px; }
.dash-add-meal { width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0; }
.dash-cycle { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.dash-cycle .meal-action { width: 28px; height: 28px; border-radius: 9px; }
.dash-cycle .meal-action:disabled {
  color: #c9ccda; background: #f6f7fb; cursor: default;
}
.dash-cycle-current {
  min-width: 74px; max-width: 160px; height: 28px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font-size: 12px; font-weight: 850; cursor: pointer;
  padding: 0 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-cycle-current:disabled { color: var(--muted); background: #f7f8fc; cursor: default; }
.macro-chart { display: grid; gap: 9px; }
.macro-bar { --macro-color: var(--macro-total); }
.macro-bar.macro-total { --macro-color: var(--macro-total); }
.macro-bar.macro-protein { --macro-color: var(--macro-protein); }
.macro-bar.macro-carbs { --macro-color: var(--macro-carbs); }
.macro-bar.macro-fat { --macro-color: var(--macro-fat); }
.macro-bar-head { display: grid; grid-template-columns: 46px 44px 1fr; gap: 7px; align-items: baseline; font-size: 12px; }
.macro-bar-head span { color: var(--macro-color); font-weight: 850; }
.macro-bar-head strong { font-size: 14px; }
.macro-bar.warn .macro-bar-head strong { color: #a86400; }
.macro-bar.off .macro-bar-head strong { color: #c90024; }
.macro-bar-head small { color: var(--muted); text-align: right; }
.macro-track { position: relative; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.macro-track span { display: block; position: absolute; top: 0; height: 100%; background: var(--macro-color); }
.macro-track .actual { left: 0; border-radius: 999px; }
.macro-track .projected { opacity: .32; border-radius: 0 999px 999px 0; }
.macro-track .projected.solo { border-radius: 999px; }
.macro-legend { display: flex; justify-content: flex-end; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 800; }
.macro-legend span { display: inline-flex; align-items: center; gap: 5px; }
.macro-dot { width: 14px; height: 7px; border-radius: 999px; background: var(--ink); }
.macro-dot.projected { opacity: .32; }
.quick-list { display: grid; gap: 8px; }
.quick-meal {
  border: 1px solid var(--line); background: #fbfcfe; border-radius: var(--radius);
  padding: 9px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px; color: var(--ink); cursor: pointer; font-weight: 750; text-align: left; min-width: 0;
}
.quick-meal span, .quick-meal small { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.quick-title, .quick-kcal { white-space: nowrap; }
.quick-kcal { color: var(--muted); font-size: 12px; font-weight: 850; font-variant-numeric: tabular-nums; }
.quick-meal small { grid-column: 1 / -1; color: var(--muted); font-weight: 800; white-space: nowrap; }
.quick-meal:hover { background: var(--surface); }
.quick-meal.done { background: #f1faf6; border-color: #cdebdc; }
.quick-meal.done span { color: #1f7a55; }
.quick-meal.extra { border-style: dashed; }
.dash-empty { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }

.person { background: transparent; }
.person-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 4px 12px;
}
.who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #fff; flex-shrink: 0;
}
.person.tamara .avatar { background: var(--tamara); color: var(--tamara-ink); }
.person.oriol .avatar { background: var(--oriol); color: #fff; }
.who h2 { margin: 0; font-size: 17px; }
.who p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }

/* totals */
.totals { display: grid; grid-template-columns: repeat(3, max-content); gap: 6px; justify-content: end; }
.chip {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 600;
}
.kcal-chip { grid-column: 1 / -1; justify-self: end; }
.total-actions { grid-column: 1 / -1; justify-self: end; display: flex; align-items: center; gap: 6px; }
.chip .lbl { color: var(--muted); font-weight: 600; margin-right: 3px; }
/* deviation status (vs goal): ok within ±10%, warn ±10–20%, off beyond */
.chip.ok   { border-color: #bfe6d4; color: #1f7a55; background: #f1faf6; }
.chip.warn { border-color: #f3d9a5; color: #9a6700; background: #fdf6e9; }
.chip.off  { border-color: #f5b5c0; color: #c1001f; background: #fff0f3; }
.kcalbar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 8px 4px 4px; }
.kcalbar > span { display: block; height: 100%; border-radius: 999px; background: #2a9d6f; transition: width .2s; }
.kcalbar.warn > span { background: #e4a11b; }
.kcalbar.off  > span { background: #e4002b; }

/* meal card */
.meal {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none;
  margin-bottom: 14px; overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s;
  display: flex; align-items: stretch;
}
.meal:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: #cad1dd; }
.meal .thumb {
  width: 96px; flex: 0 0 96px; background: #eef0f6 center/cover no-repeat;
  display: grid; place-items: center;
}
.meal .thumb span { font-size: 30px; }
.meal .body { padding: 12px 14px; flex: 1; min-width: 0; }
.meal .mealname {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700;
}
.meal .recipe {
  font-size: 15px; font-weight: 650; margin: 3px 0 7px; line-height: 1.25;
  /* always reserve two lines (clamp longer names) so 1- and 2-line titles take
     the same height and meal rows stay aligned across the Tamara/Oriol columns */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; min-height: 2.5em;
}
.meal .macros { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.meal .macros b { color: var(--ink); }
.meal-actions { display: flex; gap: 8px; align-items: center; margin-top: 9px; }
.meal-action {
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.meal-action:hover { background: var(--surface); color: var(--ink); }
.meal-action.done { color: #1f7a55; background: #f1faf6; }
.person.tamara .meal { border-left: 4px solid var(--tamara); }
.person.oriol .meal { border-left: 4px solid var(--oriol); }
.blank-meal .thumb { background: #fbfcfe; color: var(--muted); }
.blank-meal .recipe { color: var(--muted); }

/* ---- workouts ---- */
.workouts { max-width: 1100px; margin: 0 auto; padding: 8px 22px 44px; }
.workout-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 2px 0 14px; }
.workout-head h2 { margin: 0; font-size: 20px; }
.workout-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.workout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.workout-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none;
  padding: 14px; min-width: 0;
}
.workout-card.tamara { border-top: 4px solid var(--tamara); }
.workout-card.oriol { border-top: 4px solid var(--oriol); }
.workout-day-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.workout-day-tabs button {
  border: 1px solid var(--line); background: #fbfcfe; border-radius: var(--radius);
  padding: 9px 10px; text-align: left; cursor: pointer; min-width: 0;
}
.workout-day-tabs button.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.workout-day-tabs span { display: block; font-size: 11px; font-weight: 850; color: inherit; opacity: .78; }
.workout-day-tabs strong {
  display: block; font-size: 13px; line-height: 1.2; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.workout-next {
  border: 1px solid #cdebdc; background: #f3fbf7; border-radius: var(--radius);
  padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 12px;
}
.workout-next.done { border-color: var(--line); background: #fbfcfe; }
.workout-next span { color: #1f7a55; font-size: 11px; font-weight: 850; text-transform: uppercase; }
.workout-next strong { display: block; font-size: 16px; line-height: 1.25; }
.workout-next small { color: var(--muted); font-weight: 750; }
.workout-log-row { display: grid; grid-template-columns: 88px 88px minmax(96px, auto); gap: 8px; align-items: end; }
.workout-start { width: 100%; min-height: 44px; margin: 0 0 12px; }
.fld.compact span { font-size: 11px; }
.fld.compact input, .fld.compact select { padding: 8px 10px; border-radius: var(--radius); }
.workout-exercises { display: grid; gap: 8px; }
.workout-superset {
  margin: 5px 0 -2px; color: #5a4a00; background: #fff6d6;
  border: 1px solid #f1df98; border-radius: 999px; width: max-content; max-width: 100%;
  padding: 3px 9px; font-size: 11px; font-weight: 850;
}
.workout-exercise {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 10px;
}
.workout-exercise.grouped { background: #fffdf5; }
.workout-exercise strong {
  display: block; font-size: 14px; line-height: 1.25;
  overflow-wrap: anywhere;
}
.workout-exercise small { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin-top: 2px; }
.workout-dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.workout-dot {
  width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid var(--line);
  background: #fbfcfe; color: var(--muted); font-size: 12px; font-weight: 850; cursor: pointer;
}
.workout-dot.done { background: #1f7a55; border-color: #1f7a55; color: #fff; }
.workout-rest {
  min-height: 140px; display: grid; place-items: center; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius); background: #fbfcfe; color: var(--muted);
}
.workout-rest strong { display: block; color: var(--ink); font-size: 18px; }
.workout-rest span { display: block; margin-top: 4px; font-size: 13px; font-weight: 750; }
.workout-session {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; max-width: 720px; margin: 0 auto;
}
.workout-session-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 12px;
}
.workout-session-head h2 { margin: 0; font-size: 20px; }
.workout-session-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-weight: 750; }
.workout-current {
  border: 1px solid #cdebdc; background: #f3fbf7; border-radius: var(--radius);
  padding: 16px; display: grid; gap: 8px; margin-bottom: 12px;
}
.workout-current span, .workout-rest-screen span {
  color: #1f7a55; font-size: 11px; font-weight: 900; text-transform: uppercase;
}
.workout-current strong { font-size: 28px; line-height: 1.08; overflow-wrap: anywhere; }
.workout-current small, .workout-current em { color: var(--muted); font-size: 13px; font-weight: 800; font-style: normal; }
.workout-upcoming { overflow-wrap: anywhere; }
.workout-session-log { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; margin-top: 8px; }
.workout-session-log .primarybtn { grid-column: 1 / -1; min-height: 52px; font-size: 16px; }
.workout-rest-screen, .workout-complete {
  min-height: 280px; border-radius: var(--radius); border: 1px solid #cdebdc; background: #f3fbf7;
  display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; padding: 18px; margin-bottom: 12px;
}
.workout-rest-screen.ending { border-color: #f0c36a; background: #fff9e8; }
.workout-rest-screen strong, .workout-complete strong { font-size: 48px; line-height: 1; color: var(--ink); }
.workout-rest-screen p, .workout-complete span { margin: 0; color: var(--muted); font-weight: 800; }
.compact-list .workout-pick { display: none; }

.cal-workout {
  display: grid; gap: 4px; min-width: 0;
}
.cal-workout span {
  color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase;
}
.cal-workout select, .cal-workout-time {
  width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink); padding: 8px 9px; font-size: 12px; font-weight: 800;
}
.cal-workout.tamara select, .cal-workout.tamara .cal-workout-time {
  border-color: color-mix(in srgb, var(--tamara) 70%, var(--line));
  box-shadow: inset 4px 0 0 var(--tamara);
}
.cal-workout.oriol select, .cal-workout.oriol .cal-workout-time {
  border-color: color-mix(in srgb, var(--oriol) 70%, var(--line));
  box-shadow: inset 4px 0 0 var(--oriol);
}
.cal-workout.cycle-blocked select { background: #f4f5f8; color: var(--muted); }
.cal-workout optgroup { color: var(--ink); font-weight: 850; }
.cal-workout-time:disabled { background: #f4f5f8; color: var(--muted); }
.cal-workout.compact select, .cal-workout.compact .cal-workout-time { font-size: 11px; padding: 6px 7px; }
.cal-workout-cell { display: grid; gap: 6px; }
.cal-day-row.workout-row { align-items: center; }

/* ---- modal ---- */
.modal {
  position: fixed; inset: 0; background: rgba(20,24,40,.45); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 50; padding: 16px;
}
.modal.hidden { display: none; }
#feedback { z-index: 130; }
.modal-card {
  background: #fff; border-radius: var(--radius); width: min(680px, 100%);
  max-height: 88vh; overflow: auto; box-shadow: var(--shadow-strong);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px 8px; position: sticky; top: 0; z-index: 2; background: #fff;
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head-actions { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.picker-search { padding: 4px 20px 0; }
#pickerSearch {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 14px; font-size: 15px; background: #fbfcfe; outline: none;
}
#pickerSearch:focus { border-color: #c9ccda; background: #fff; }
.pickerhint { padding: 0 20px; margin: 10px 0 0; }
.opveg { font-size: 12px; }
.optgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 20px 22px; }
@media (max-width: 520px) { .optgrid { grid-template-columns: 1fr; } }
.opt {
  border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: #fff; transition: .12s; text-align: left;
}
.opt:hover { border-color: #cfd2e0; }
.opt.selected { border-color: var(--ink); }
.opt .ophoto { height: 116px; background: #eef0f6 center/cover no-repeat; }
.blank-opt { border-style: dashed; }
.blank-opt .opbody { min-height: 104px; display: flex; flex-direction: column; justify-content: center; }
.opt .opbody { padding: 10px 12px 12px; }
.opt .opname { font-weight: 650; font-size: 14px; line-height: 1.25; }
.opt .opmac { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.opt .opmac b { color: var(--ink); }

/* meal-card tracking row */
.trackrow.untracked { color: var(--muted); }

/* tracking modal */
.track-card { width: min(620px, 100%); }
#recipeForm {
  background: #fff; backdrop-filter: none; padding: 0; place-items: stretch; overflow: auto;
}
#recipeForm .modal-card {
  width: 100%; max-width: none; min-height: 100vh; max-height: none; border-radius: 0;
  box-shadow: none; overflow: visible; background: #fff;
}
#recipeForm .modal-head {
  z-index: 3; border-bottom: 1px solid var(--line); padding: 16px max(20px, calc((100vw - 1120px) / 2)) 12px; background: #fff;
}
#recipeForm .track-body {
  width: min(1120px, calc(100vw - 32px)); margin: 0 auto; padding: 18px 0 92px; background: #fff;
}
#recipeForm .ing-addform {
  background: #fff; border: 1px solid var(--line);
}
#recipeForm .track-actions {
  position: sticky; bottom: 0; z-index: 2; background: rgba(255,255,255,.94);
  border-top: 1px solid var(--line); padding: 12px 0 14px; backdrop-filter: blur(8px);
}
.track-body { display: grid; gap: 12px; padding: 6px 20px 22px; }
.track-section { border-top: 1px solid var(--line); padding-top: 12px; }
.track-section:first-child { border-top: none; padding-top: 0; }
.track-section.hidden { display: none; }
.track-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.track-section-head h3 { margin: 0; font-size: 12px; font-weight: 850; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.fld > span { font-size: 12px; font-weight: 700; color: var(--muted); }
.fld input {
  width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; font-size: 15px; outline: none;
}
.fld input:focus { border-color: #c9ccda; }
/* style selects to match inputs (#35) */
.fld select, #tMeal, .track-body select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
  font-size: 15px; background: #fff; outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%237a8194' stroke-width='1.6' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px;
}
.fld select:focus { border-color: #c9ccda; }
#trackAdhoc { grid-template-columns: minmax(190px, 1.25fr) minmax(130px, .75fr); }
#trackAdhoc.adhoc-extra { grid-template-columns: 1fr; }
/* feedback list (#36/#37) */
#feedback .track-card { isolation: isolate; }
#feedback .modal-head {
  z-index: 6; border-bottom: 1px solid var(--line); box-shadow: 0 4px 14px rgba(35,40,70,.06);
}
#feedbackClose { position: relative; z-index: 7; flex-shrink: 0; }
.fb-list { display: flex; flex-direction: column; gap: 8px; }
.fb-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.fb-item.solved { opacity: .6; }
.fb-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; }
.fb-badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.fb-badge.pending { background: #fdf6e9; color: #9a6700; }
.fb-badge.solved { background: #e6f7ee; color: #1f7a55; }
.fb-text { font-size: 14px; color: #2c3142; margin: 6px 0; white-space: pre-wrap; }
.fb-attach-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.fb-attach-btn {
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 14px; font-size: 13px; line-height: 1;
}
.fb-images { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-images img {
  width: 58px; height: 58px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); background: #f4f5f8; display: block;
}
.fb-img-chip { position: relative; width: 58px; height: 58px; }
.fb-img-chip button {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: var(--ink); font-size: 12px; font-weight: 900; cursor: pointer;
}
.fb-actions { display: flex; gap: 12px; }
.fb-actions button { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; padding: 0; }
.fb-actions button:hover { color: var(--ink); }
.fb-del:hover { color: #c1001f !important; }
.fld-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 480px) { .fld-row { grid-template-columns: repeat(2, 1fr); } }
.fld textarea {
  width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; font-size: 15px; outline: none; font-family: inherit; resize: vertical;
}
.fld textarea:focus { border-color: #c9ccda; }
.fld-check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 4px 0 2px; cursor: pointer; }
.fld-check input { width: 18px; height: 18px; }
.ing-head { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 6px; }
.ing-head > span:first-child { font-size: 12px; font-weight: 700; color: var(--muted); }
.ing-total { font-size: 13px; font-weight: 750; }
.track-items { display: flex; flex-direction: column; }
/* fixed fractional columns (no `auto`) so the grams column lines up across rows (#32) */
.ing-row { display: grid; grid-template-columns: 1fr auto 1.3fr 26px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.g-step { border: 1px solid var(--line); background: #fff; border-radius: 7px; width: 28px; height: 30px; flex-shrink: 0; cursor: pointer; font-size: 16px; line-height: 1; color: var(--ink); }
.g-step:active { background: #eceef5; }
.ing-row .ing-name { border: none; background: none; font-size: 14px; color: var(--ink); padding: 2px 0; min-width: 0; outline: none; overflow-wrap: anywhere; }
.ing-row input.ing-name { width: 100%; font-family: inherit; }
.ing-g { display: flex; align-items: center; gap: 3px; }
.ing-g input { width: 56px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 7px; font-size: 14px; text-align: right; outline: none; }
.ing-g span { font-size: 12px; color: var(--muted); }
.ing-per { font-size: 11px; color: var(--muted); white-space: nowrap; text-align: right; }
.ing-mac { font-size: 11px; color: var(--muted); text-align: right; white-space: nowrap; }
.rf-section-actions { display: flex; justify-content: flex-end; margin: 4px 0 8px; }
.rf-section-actions button {
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
  padding: 7px 10px; font: inherit; font-size: 12px; font-weight: 750; cursor: pointer;
}
.rf-section-actions button:hover { border-color: #c9ccda; background: #fbfcfe; }
.rf-ing-section {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px;
  margin-bottom: 8px; background: #fff;
}
.rf-ing-section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 32px; }
.rf-ing-section-head span { font-size: 12px; font-weight: 750; color: var(--muted); }
.rf-ing-section-title {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px;
  font: inherit; font-size: 13px; font-weight: 700; outline: none; background: #fff;
}
.rf-ing-section-title:focus { border-color: #9fd8bd; box-shadow: 0 0 0 3px rgba(52,178,123,.12); }
.rf-ing-section-del { border: none; background: none; color: #c9ccda; cursor: pointer; width: 30px; height: 30px; font-size: 14px; }
.rf-ing-section-del:hover { color: #c1001f; }
.rf-ing-drop { min-height: 38px; border-radius: 8px; }
.rf-ing-drop.over { outline: 2px dashed #9fd8bd; outline-offset: 2px; background: #f3fbf7; }
.ing-drag { grid-area: drag; cursor: grab; color: var(--muted); font-size: 14px; text-align: center; user-select: none; }
.ing-row.dragging { opacity: .5; }
#rfMain .ing-row {
  grid-template-columns: 22px 1fr auto auto 1.3fr 26px;
  grid-template-areas: "drag name grams per mac del";
}
#rfMain .ing-name { grid-area: name; }
#rfMain .ing-g { grid-area: grams; }
#rfMain .ing-per { grid-area: per; }
#rfMain .ing-mac { grid-area: mac; }
#rfMain .ing-del { grid-area: del; }
.track-goal { margin: 1px 0 6px; }
.track-compare { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.track-chip {
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 7px;
  font-size: 11px; color: var(--muted); background: #fff;
}
.track-chip b { display: block; color: var(--ink); font-size: 11px; margin-bottom: 2px; }
.track-chip span { font-variant-numeric: tabular-nums; white-space: nowrap; }
.track-chip.ok { border-color: #bfe7d2; background: #f1faf6; }
.track-chip.warn { border-color: #f1d08a; background: #fff9ed; }
.track-chip.off { border-color: #f0b8c0; background: #fff5f6; }
.ing-total.ok { color: #1f7a52; }
.ing-total.warn { color: #b7791f; }
.ing-total.off { color: #c1001f; }
.ing-del { border: none; background: none; color: #c9ccda; cursor: pointer; font-size: 14px; padding: 2px; }
.ing-del:hover { color: #c1001f; }
.ing-addform { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; padding: 10px; background: #f8f9fc; border-radius: var(--radius); }
.ing-addform.hidden { display: none; }
.ing-addform input { border: 1px solid var(--line); border-radius: 8px; padding: 7px; font-size: 13px; min-width: 0; outline: none; }
.track-copy-row { display: grid; gap: 8px; margin: 0 0 10px; }
.track-copy-row.hidden { display: none; }
.track-copy-controls {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: end;
}
.track-copy-controls .fld { flex: 0 0 164px; max-width: 164px; min-width: 148px; margin: 0; }
.track-copy-controls .ghostbtn { flex: 0 0 auto; min-height: 38px; padding-inline: 12px; }
.track-copy-preview {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fbfcfe;
  padding: 10px 11px; font-size: 12px; color: var(--muted);
}
.track-copy-preview.hidden { display: none; }
.track-copy-preview.loading { color: var(--muted); }
.track-copy-preview.empty { background: #fff; }
.track-copy-preview strong { display: block; color: var(--ink); font-size: 13px; line-height: 1.25; }
.track-copy-preview .copy-meta { display: block; margin-top: 2px; font-size: 11px; font-weight: 750; color: var(--muted); }
.track-copy-preview ul { list-style: none; display: grid; gap: 4px; margin: 8px 0 0; padding: 0; }
.track-copy-preview li { display: flex; justify-content: space-between; gap: 10px; min-width: 0; }
.track-copy-preview li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.track-copy-preview li small { flex: 0 0 auto; color: var(--muted); font-weight: 750; white-space: nowrap; }
.ing-addrow { display: grid; grid-template-columns: 64px repeat(4, 48px) auto; gap: 6px; align-items: center; }
.rf-main-add { grid-template-columns: 84px repeat(4, minmax(74px, 1fr)) minmax(150px, auto) auto; align-items: end; }
.food-search { position: relative; }
.food-search > input { width: 100%; }
.food-scan-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.food-scan-row .ghostbtn { min-height: 38px; }
.barcode-card { max-width: 460px; }
.barcode-body { display: grid; gap: 10px; }
#barcodeVideo {
  width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius);
  background: #0f1720; object-fit: cover;
}
.food-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; }
.food-results.hidden { display: none; }
.food-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: none; background: none; padding: 8px 11px; cursor: pointer; text-align: left; border-bottom: 1px solid var(--line); }
.food-item:last-child { border-bottom: none; }
.food-item:hover { background: var(--surface); }
.food-item span { font-size: 13px; font-weight: 600; }
.food-item small { color: var(--muted); font-size: 11px; }
.food-loading { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--muted); font-size: 13px; font-weight: 700; }
.food-loading::before {
  content: ""; width: 12px; height: 12px; flex: 0 0 12px;
  border: 2px solid #d9dce7; border-top-color: var(--ink); border-radius: 50%;
  animation: food-spin .8s linear infinite;
}
.food-warning { padding: 10px 12px; color: #a66500; background: #fff8e8; border-top: 1px solid #f3dfb7; font-size: 12px; font-weight: 800; line-height: 1.3; }
@keyframes food-spin { to { transform: rotate(360deg); } }
/* recipe variants (swaps) editor */
.rf-variant { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; background: #fff; }
.rf-variant-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.rf-vlabel { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 14px; font-weight: 600; outline: none; }
.rf-vdel { border: none; background: none; color: #c9ccda; cursor: pointer; font-size: 14px; }
.rf-vdel:hover { color: #c1001f; }
.rf-swap { display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 8px; align-items: center; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rf-swap span, .rf-swap strong, .rf-swap small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rf-swap span { color: var(--muted); font-size: 12px; font-weight: 700; }
.rf-swap strong { color: var(--ink); font-size: 14px; line-height: 1.25; }
.rf-swap strong::before { content: "→ "; color: var(--muted); font-weight: 800; }
.rf-swap.removed strong::before { content: ""; }
.rf-swap.removed strong { color: #c1001f; }
.rf-swap.added strong::before { content: "+ "; color: #1f7a55; font-weight: 900; }
.rf-swap small { color: var(--muted); font-size: 12px; font-weight: 750; }
.rf-sdel, .rf-adel { border: none; background: none; color: #c9ccda; cursor: pointer; }
.rf-sdel:hover, .rf-adel:hover { color: #c1001f; }
.rf-swap-add {
  display: grid; grid-template-columns: minmax(190px, .9fr) minmax(280px, 1.35fr);
  gap: 10px 12px; align-items: end; margin-top: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.rf-sselect, .rf-sreplace, .rf-sfield { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rf-sselect > span, .rf-sreplace > span, .rf-sfield span {
  display: block; color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap;
}
.rf-swap-add select, .rf-swap-add input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 9px; font-size: 13px; min-width: 0; outline: none; background: #fff;
}
.rf-swap-add .food-search { position: relative; }
.rf-variant-add .rf-sreplace { grid-column: 1 / -1; }
.rf-smetrics { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(78px, 1fr)); gap: 8px; }
.rf-sactions {
  grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center;
  gap: 12px; min-width: 0;
}
.rf-spreview { color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; align-self: center; }
.primarybtn.small { padding: 7px 12px; font-size: 13px; }
.adding { border: 1px dashed var(--line); background: none; border-radius: var(--radius); padding: 8px 12px; color: var(--muted); font-weight: 700; cursor: pointer; font-size: 13px; margin-top: 4px; }
.adding:hover { color: var(--ink); border-color: #c9ccda; }
.track-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.track-note.warn { color: #c1001f; font-weight: 800; }
.track-actions {
  display: flex; align-items: center; gap: 10px; margin-top: 4px; padding-top: 12px;
  border-top: 1px solid var(--line); flex-wrap: wrap;
}
.track-actions .fld-check { margin: 0; }
.track-actions .spacer { flex: 1; }
.primarybtn {
  border: none; background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 10px 20px; font-weight: 700; cursor: pointer; font-size: 14px;
}
.primarybtn:hover { opacity: .9; }
.ghostbtn.danger { color: #c1001f; }
.ghostbtn.danger.hidden { display: none; }

/* progress view */
.progress { max-width: 1100px; margin: 0 auto; padding: 8px 22px 44px; }
.progress.hidden { display: none; }
.prog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .prog-grid { grid-template-columns: 1fr; } }
.prog-card { }
.prog-day {
  display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.prog-day:last-child { border-bottom: none; }
.prog-day .pd-day { font-weight: 700; font-size: 13px; }
.prog-day .pd-day small { display: block; color: var(--muted); font-weight: 600; }
.prog-bar { height: 9px; border-radius: 999px; background: var(--line); overflow: hidden; }
.prog-bar > span { display: block; height: 100%; border-radius: 999px; background: #2a9d6f; }
.prog-bar.warn > span { background: #e4a11b; } .prog-bar.off > span { background: #e4002b; }
.prog-bar.none { background: repeating-linear-gradient(45deg,var(--surface),var(--surface) 6px,#e9eaf0 6px,#e9eaf0 12px); }
.pd-val { font-size: 13px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pd-macros, .pd-workout {
  grid-column: 2 / -1; color: var(--muted); font-size: 12px; font-weight: 650;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prog-day.clickable { cursor: pointer; }
.prog-day.clickable:hover { background: #faf9ff; }
.pd-caret { display: inline-block; width: 13px; color: var(--muted); }
.prog-day-wrap:last-child .prog-day { border-bottom: none; }
.prog-day-wrap.open .prog-day { border-bottom: none; }
.pd-entries {
  margin: 0 0 12px 54px; padding: 8px; display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  box-shadow: 0 4px 14px rgba(35,40,70,.06);
}
.pd-entry {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 36px 36px;
  align-items: center; gap: 8px; font-size: 12px;
}
.pde-meal { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pde-mac { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pd-workout-block { display: grid; gap: 6px; padding-top: 4px; border-top: 1px solid var(--line); }
.pd-workout-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.pd-workout-head span { font-weight: 800; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-workout-head strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pd-workout-entry { grid-template-columns: minmax(0, 1fr) auto; }
.pd-edit, .pd-del {
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius);
  color: var(--muted); cursor: pointer; font-size: 16px; padding: 0;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.pd-edit:hover { color: var(--ink); background: #f8f9fc; }
.pd-del:hover { color: #c1001f; background: #fff5f6; }
.prog-day-card .macro-chart { margin: 4px 0 12px; }
.prog-day-view .pd-entries { margin-left: 0; }
.prog-empty {
  margin: 10px 0 0; color: var(--muted); font-size: 13px; font-weight: 650;
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px; background: #fbfcfe;
}
.prog-month-view .cal-month-counts span { font-variant-numeric: tabular-nums; }
.fb-response { font-size: 13px; color: #1f7a52; background: #f0faf5; border-radius: 8px; padding: 6px 9px; margin: 4px 0 2px; white-space: pre-wrap; }
.food-known span { color: #1f6bd6; }

/* settings / imported plans */
.settings { max-width: 1100px; margin: 0 auto; padding: 14px 22px 44px; }
.settings-shell { min-width: 0; }
.settings-head { display: flex; justify-content: space-between; align-items: end; margin: 2px 0 12px; }
.settings-head h2 { margin: 0; font-size: 20px; }
.settings-head p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.settings-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.settings-head.subhead { margin-top: 18px; align-items: center; }
.settings-head.subhead h2 { font-size: 16px; }
.settings-head.subhead input {
  width: min(320px, 100%); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 11px; font: inherit; font-size: 13px; outline: none; background: #fff;
}
.settings-head.subhead input:focus { border-color: #9fd8bd; box-shadow: 0 0 0 3px rgba(52,178,123,.12); }
.settings-tabs {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 3px; margin: 2px 0 8px; max-width: 100%;
  flex-wrap: wrap;
}
.settings-subnav { display: flex; width: max-content; margin: 0 auto 12px; }
.settings-tabs button {
  border: none; background: none; padding: 7px 14px; border-radius: var(--radius);
  color: var(--muted); font-weight: 800; cursor: pointer; font-size: 13px;
}
.settings-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.settings-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.settings-card-head h3 { margin: 0; font-size: 16px; }
.settings-card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.avatar.mini { width: 30px; height: 30px; font-size: 13px; }
.settings-row-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-size: 12px; font-weight: 800; color: var(--muted); }
.goal-config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.goal-config-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.goal-config-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 10px; }
.cfg-split-grid { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 8px; align-items: end; margin-top: 10px; }
.cfg-macro-grid { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 8px; align-items: end; margin-top: 10px; }
.cfg-macro-note { grid-column: 1 / -1; margin: 0; }
.goal-config-form label span, .cfg-split-grid label span, .cfg-macro-grid label span {
  display: block; color: var(--muted); font-size: 10px; font-weight: 800; margin-bottom: 3px;
}
.goal-config-form input, .cfg-split-grid input, .cfg-macro-grid input {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 8px; font: inherit; font-size: 12px; outline: none; background: #fff;
}
.goal-config-form input:focus, .cfg-split-grid input:focus, .cfg-macro-grid input:focus { border-color: #9fd8bd; box-shadow: 0 0 0 3px rgba(52,178,123,.12); }
.workout-manage-grid { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.workout-manage-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.workout-manage-card.tamara { border-top: 4px solid var(--tamara); }
.workout-manage-card.oriol { border-top: 4px solid var(--oriol); }
.wm-title span {
  display: block; color: var(--muted); font-size: 10px; font-weight: 850;
  margin-bottom: 4px; text-transform: uppercase;
}
.wm-title input, .wm-day-title, .wm-ex input, .wm-ex select, .wm-cycle-time, .wm-rest-row input, .exercise-new input, .exercise-new select, .exercise-row input, .exercise-row select {
  width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 9px; font: inherit; font-size: 13px; outline: none; background: #fff; color: var(--ink);
}
.wm-title input:focus, .wm-day-title:focus, .wm-ex input:focus, .wm-ex select:focus, .wm-cycle-time:focus, .wm-rest-row input:focus, .exercise-new input:focus, .exercise-new select:focus, .exercise-row input:focus, .exercise-row select:focus { border-color: #9fd8bd; box-shadow: 0 0 0 3px rgba(52,178,123,.12); }
.wm-active-row { margin-top: 9px; }
.wm-cycle {
  margin-top: 10px; padding: 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fbfcfe; display: grid; gap: 8px;
}
.wm-cycle-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.wm-cycle-head strong { font-size: 13px; }
.wm-cycle-head span { color: var(--muted); font-size: 12px; font-weight: 800; }
.wm-cycle-fields { display: grid; grid-template-columns: minmax(120px, 160px) minmax(0, 1fr); gap: 8px; align-items: end; }
.wm-cycle-date { min-width: 0; }
.wm-cycle-date span, .wm-cycle-days-label {
  display: block; color: var(--muted); font-size: 10px; font-weight: 850;
  margin-bottom: 4px; text-transform: uppercase;
}
.wm-cycle-date input {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 9px; font: inherit; font-size: 13px;
  outline: none; background: #fff;
}
.wm-cycle-date input:focus { border-color: #9fd8bd; box-shadow: 0 0 0 3px rgba(52,178,123,.12); }
.wm-cycle-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.wm-cycle-days label {
  border: 1px solid var(--line); border-radius: 8px; min-height: 34px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  background: #fff; color: var(--ink); font-size: 11px; font-weight: 850;
}
.wm-cycle-days input { width: 14px; height: 14px; accent-color: var(--ink); }
.wm-cycle-times { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wm-cycle-times label {
  min-width: 0; display: grid; gap: 3px; color: var(--muted);
  font-size: 10px; font-weight: 850; text-transform: uppercase;
}
.wm-cycle-times label.is-disabled { opacity: .5; }
.wm-cycle-time { min-height: 34px; padding-left: 5px; padding-right: 5px; font-size: 11px; }
.wm-cycle-time:disabled { background: #f4f5f8; color: var(--muted); }
.wm-cycle-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.wm-days { display: grid; gap: 10px; margin-top: 12px; }
.wm-day {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fbfcfe; padding: 10px;
}
.wm-day-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center; gap: 8px; margin-bottom: 8px;
}
.wm-ex-head, .wm-ex { display: grid; align-items: center; gap: 6px; }
.wm-ex {
  grid-template-columns: minmax(170px, 1fr) minmax(96px, 120px) minmax(54px, 72px) minmax(160px, 1.2fr) minmax(68px, 84px) minmax(104px, 124px) 34px;
  min-width: 0;
}
.wm-ex-head {
  display: none; color: var(--muted); font-size: 10px; font-weight: 850;
  margin: 2px 0 5px; text-transform: uppercase;
}
.wm-ex-list { display: grid; gap: 6px; min-width: 0; }
.wm-ex-wrap { display: grid; gap: 6px; min-width: 0; }
.wm-ex-search, .wm-ex-title { min-width: 0; }
.wm-ex-search .food-results { z-index: 20; }
.wm-ex.linked, .wm-ex-wrap.linked .wm-rest-row {
  background: #fffdf5; border-radius: 10px;
}
.wm-ex-wrap.group-start { padding-top: 4px; border-top: 1px dashed #eadfbd; }
.wm-ex-wrap.group-start:first-child { padding-top: 0; border-top: 0; }
.wm-reps { display: grid; grid-template-columns: minmax(94px, 112px) minmax(0, 1fr); gap: 6px; align-items: center; min-width: 0; }
.wm-reps.per-set { grid-template-columns: 112px minmax(0, 1fr); }
.wm-reps-sets {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 5px; min-width: 0;
}
.wm-reps-sets.hidden { display: none; }
.wm-reps-sets label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 3px; }
.wm-reps-sets span { color: var(--muted); font-size: 10px; font-weight: 900; }
.wm-rest-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 96px) 34px;
  align-items: center; gap: 6px; margin-left: 24px; padding: 6px;
  border: 1px dashed #d9dee8; border-radius: 10px; background: #fff;
}
.wm-rest-row span { color: var(--muted); font-size: 12px; font-weight: 850; }
.wm-rest-del {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: #c1001f; cursor: pointer; font-weight: 900;
}
.wm-rest-add { justify-self: start; margin-left: 24px; }
.wm-ex-link-row, .wm-ex-link-mode {
  min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 0 8px;
  color: var(--ink); font-size: 11px; font-weight: 850; cursor: pointer; white-space: nowrap;
}
.wm-ex-link-mode {
  display: block; width: 100%; appearance: none; text-align: center;
}
.wm-ex-link-row input {
  width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0; accent-color: var(--ink);
}
.wm-ex-link-row.disabled, .wm-ex-link-mode.disabled {
  color: var(--muted); background: #f4f5f8; cursor: default;
}
.wm-ex-del {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: #c1001f; cursor: pointer; font-weight: 900;
}
.wm-ex-add { margin-top: 8px; }
.wm-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wm-actions .spacer { flex: 1; min-width: 12px; }
.meal-config-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.meal-config-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.meal-config-card.tamara { border-top: 4px solid var(--tamara); }
.meal-config-card.oriol { border-top: 4px solid var(--oriol); }
.meal-config-date { display: block; max-width: 190px; margin-bottom: 10px; }
.meal-config-date span, .meal-config-grid label span {
  display: block; color: var(--muted); font-size: 10px; font-weight: 850;
  margin-bottom: 4px; text-transform: uppercase;
}
.meal-config-date input, .meal-config-grid input {
  width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 9px; font: inherit; font-size: 13px;
  outline: none; background: #fff;
}
.meal-config-date input:focus, .meal-config-grid input:focus { border-color: #9fd8bd; box-shadow: 0 0 0 3px rgba(52,178,123,.12); }
.meal-config-inline { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.meal-config-grid { display: grid; gap: 8px; }
.meal-config-row {
  display: grid; grid-template-columns: minmax(120px, 1fr) minmax(90px, 120px) minmax(76px, 92px) auto;
  gap: 8px; align-items: end;
}
.meal-name-field { min-width: 0; }
.cfg-meal-note { margin: 8px 0 10px; }
.meal-config-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.meal-times-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.meal-times-person { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #fff; }
.meal-times-person h3 { margin: 0 0 8px; font-size: 14px; }
.meal-times-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; }
.meal-times-grid label span {
  display: block; color: var(--muted); font-size: 10px; font-weight: 800; margin-bottom: 3px;
}
.meal-times-grid input {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 8px; font: inherit; font-size: 12px; outline: none; background: #fff;
}
.meal-times-grid input:focus { border-color: #9fd8bd; box-shadow: 0 0 0 3px rgba(52,178,123,.12); }
.meal-times-actions { margin-top: 10px; display: flex; justify-content: flex-start; }
.cfg-history { margin-top: 12px; }
.cfg-history-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center;
  border-top: 1px solid var(--line); padding: 7px 0; font-size: 12px;
}
.cfg-history-row span { color: var(--muted); font-weight: 700; }
.cfg-history-row button { border: none; background: none; color: #c1001f; cursor: pointer; font-size: 12px; font-weight: 800; }
.ingredient-tools {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap; margin: 0 0 10px;
}
.ingredient-merge, .ingredient-pager { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ingredient-merge span, .ingredient-pager span { color: var(--muted); font-size: 12px; font-weight: 800; }
.primarybtn:disabled, .ghostbtn:disabled {
  opacity: .42; cursor: default; pointer-events: none;
}
.ingredient-merge-card { max-width: 660px; }
.ingredient-merge-selected {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.ingredient-merge-selected span {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 8px; color: var(--muted); font-size: 12px; font-weight: 800;
}
.ingredient-merge-macros {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
  background: #fff; display: grid; gap: 10px;
}
.ingredient-merge-macro-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.ingredient-merge-macro-grid label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 800; }
.ingredient-merge-macro-grid input, #ingredientMergeMacroSource {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 9px; font: inherit; font-size: 13px; outline: none; background: #fff;
}
.ingredient-merge-macro-grid input:focus, #ingredientMergeMacroSource:focus {
  border-color: #9fd8bd; box-shadow: 0 0 0 3px rgba(52,178,123,.12);
}
.ingredient-list { display: flex; flex-direction: column; gap: 8px; }
.exercise-list { display: flex; flex-direction: column; gap: 8px; }
.exercise-new {
  display: grid; grid-template-columns: minmax(180px, 1fr) minmax(120px, 170px) auto;
  align-items: center; gap: 8px; margin-bottom: 10px;
}
.exercise-row {
  display: grid; grid-template-columns: minmax(180px, 1fr) minmax(120px, 170px) minmax(70px, 90px) auto;
  align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
}
.exercise-usage { color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.exercise-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ingredient-row {
  display: grid; grid-template-columns: 24px minmax(170px, 1.2fr) minmax(260px, 1.4fr) auto;
  align-items: end; gap: 10px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
}
.ingredient-select { align-self: center; display: grid; place-items: center; }
.ingredient-select input { width: 17px; height: 17px; accent-color: #2a9d6f; }
.ingredient-meta { min-width: 0; }
.ingredient-meta strong {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; color: var(--ink);
}
.ingredient-meta small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 700; }
.ingredient-macros label span {
  display: block; color: var(--muted); font-size: 10px; font-weight: 800; margin-bottom: 3px;
}
.ingredient-macros input {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 8px; font: inherit; font-size: 12px; outline: none; background: #fff;
}
.ingredient-macros input:focus {
  border-color: #9fd8bd; box-shadow: 0 0 0 3px rgba(52,178,123,.12);
}
.ingredient-macros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.ingredient-actions { display: flex; gap: 6px; flex-wrap: wrap; align-self: end; justify-content: flex-end; }
.ingredient-swap-card { max-width: 520px; }

.install-card { width: min(460px, 100%); }
.install-steps { display: grid; gap: 10px; padding-bottom: 4px; }
.install-steps > div {
  display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fbfcfe;
}
.install-steps span {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-weight: 800;
}
.install-steps p { margin: 0; font-size: 14px; font-weight: 650; }
.ingredient-save { align-self: end; }

/* per-meal calorie split (Objectiu modal) */
.split-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 480px) { .split-grid { grid-template-columns: repeat(2, 1fr); } }
.pd-val small { color: var(--muted); font-weight: 600; }
.pd-macros { grid-column: 2 / -1; font-size: 11px; color: var(--muted); margin-top: 2px; }
.prog-day.clickable { cursor: pointer; }
.prog-day.clickable:hover { background: #f8f9fc; }
.prog-day.open { background: #f4f5fa; }
.pd-detail { padding: 6px 0 10px 54px; border-bottom: 1px solid var(--line); }
.pd-detail .pd-entry { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.pd-entry.muted { color: var(--muted); }
.pd-em { font-weight: 700; min-width: 70px; }
.pd-el { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-ek { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pd-add { border: 1px dashed var(--line); background: none; border-radius: 8px; padding: 5px 10px; color: var(--muted); font-weight: 700; cursor: pointer; font-size: 12px; margin-top: 4px; }
.pd-add:hover { color: var(--ink); }

/* body / measurements view */
.body-view { max-width: 1100px; margin: 0 auto; padding: 8px 22px 44px; }
.body-view.hidden { display: none; }
.body-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .body-grid { grid-template-columns: 1fr; } }
.body-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.body-card.tamara { border-top: 4px solid var(--tamara); }
.body-card.oriol { border-top: 4px solid var(--oriol); }
.body-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.body-head .who h2 { margin: 0; font-size: 17px; }
.body-head .who p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.metric-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 480px) { .metric-tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: #f8f9fc; border-radius: var(--radius); padding: 12px; text-align: center; }
.tile .tval { font-size: 20px; font-weight: 750; letter-spacing: -.3px; }
.tile .tval small { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile .tlbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; margin-top: 3px; }
.tile .tdelta { font-size: 11px; font-weight: 700; margin-top: 2px; }
.tdelta.down { color: #1f7a55; } .tdelta.up { color: #c1001f; } .tdelta.flat { color: var(--muted); }
.trend { width: 100%; height: 90px; margin: 4px 0 14px; }
.body-card.tamara svg.trend { color: var(--tamara-ink); }
.body-card.oriol svg.trend { color: var(--oriol); }
.mhist .mh-row { cursor: pointer; }
.mhist .mh-row:hover { color: var(--ink); }
.trend-empty { color: var(--muted); font-size: 13px; font-style: italic; padding: 18px 0; text-align: center; }
.body-actions { display: flex; justify-content: flex-end; }
.mhist { margin-top: 14px; }
.mhist .mh-row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); color: var(--muted); }
.mhist .mh-row b { color: var(--ink); font-weight: 700; }

/* "view recipe" links */
.reclink {
  margin-top: 8px; border: none; background: none; padding: 0; cursor: pointer;
  color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .2px;
}
.reclink:hover { color: var(--ink); text-decoration: underline; }
.meal .reclink { display: inline-block; }

/* recipe modal body */
.recipe-body { padding: 4px 20px 24px; }
.recipe-body img {
  width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius); margin-bottom: 12px;
}
.recipe-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 14px; }
.recipe-tags span {
  background: #f1f2f7; color: var(--muted); border-radius: 999px;
  padding: 3px 10px; font-size: 12px; font-weight: 600;
}
.recipe-last-tracking {
  align-items: center; background: #fbfcfe; border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; gap: 12px; justify-content: space-between;
  margin: 4px 0 14px; padding: 10px 12px;
}
.recipe-last-tracking > div { display: grid; gap: 2px; }
.recipe-last-tracking-label { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.recipe-last-tracking strong { color: var(--ink); font-size: 13px; }
.recipe-last-tracking-link { margin: 0; white-space: nowrap; }
.recipe-meal-goal, .recipe-portion-macros {
  margin: 4px 0 14px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fbfcfe; display: grid; gap: 5px;
}
.recipe-meal-goal strong { font-size: 13px; color: var(--ink); }
.recipe-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 18px 0 8px; }
.recipe-body h4.prep-title { font-size: 14px; margin: 12px 0 4px; }
/* image carousel */
.carousel { position: relative; margin-bottom: 12px; }
.carousel img { width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius); display: block; }
.car-nav { position: absolute; top: 50%; transform: translateY(-50%); border: none; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 2px 8px rgba(0,0,0,.2); cursor: pointer; font-size: 20px; line-height: 1; }
.car-prev { left: 8px; } .car-next { right: 8px; }
.car-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; gap: 5px; justify-content: center; }
.car-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.6); }
.car-dot.on { background: #fff; }
/* video */
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; border-radius: var(--radius); overflow: hidden; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.video-link { color: #1f6bd6; text-decoration: underline; }
/* custom-recipe preparation editor */
.rf-prep { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin-bottom: 8px; }
.rf-prep-head { display: flex; gap: 8px; margin-bottom: 6px; }
.rf-ptitle { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 13px; font-weight: 600; outline: none; }
.rf-pdel { border: none; background: none; color: #c9ccda; cursor: pointer; }
.rf-pdel:hover { color: #c1001f; }
.rf-ptext { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; font-family: inherit; resize: vertical; outline: none; }
.variant-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 6px; }
.variant-pill { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 650; cursor: pointer; }
.variant-pill:hover { border-color: #c9ccda; }
.variant-pill.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.recipe-text { white-space: pre-wrap; line-height: 1.55; font-size: 15px; color: #2c3142; }
.recipe-text a { color: #1f6bd6; text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.recipe-text a:hover { color: #14489a; }
.recipe-empty { color: var(--muted); font-style: italic; }
.ingredients ul { list-style: none; margin: 0; padding: 0; overflow-x: auto; }
.ingredients li {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.ingredients li:last-child { border-bottom: none; }
.ing-name { color: var(--ink); }
.ing-qty { color: var(--muted); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* macro ingredient rows; contextual meals add original vs manual quantity columns */
.ingredients li.ing-li-macro {
  display: grid; grid-template-columns: minmax(130px, 1fr) 72px 54px 42px 42px 42px;
  gap: 10px; align-items: baseline; min-width: 480px;
}
.ingredients li.ing-li-macro.ing-li-2 {
  grid-template-columns: minmax(130px, 1fr) 68px 68px 54px 42px 42px 42px;
  min-width: 550px;
}
.ingredients li.ing-section-row {
  display: block; min-width: 480px; padding: 11px 2px 5px;
  color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase;
  letter-spacing: .04em; border-bottom: none;
}
.ing-li-2 .ing-qty { text-align: right; }
.ing-orig { text-decoration: line-through; opacity: .8; }
.ing-adj { color: #1f7a52 !important; }
.ing-macro { color: var(--muted); font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ing-kcal { color: var(--ink); }
.ing-total-row { font-weight: 800; background: #fbfcfe; }
.ing-total-row .ing-name { font-weight: 800; }
.ing-cols-head { font-size: 11px; color: var(--muted); font-weight: 700; }
.ing-cols-head span { text-align: right; }
.rcard .rtags .vegtag { background: #e6f7ee; color: #1f7a55; font-weight: 700; }

/* feedback FAB */
.fab {
  position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); right: calc(18px + env(safe-area-inset-right)); z-index: 80; width: 50px; height: 50px;
  border-radius: 50%; border: none; background: var(--ink); color: #fff; font-size: 22px;
  cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25);
  display: grid; place-items: center; line-height: 1; padding: 0;
}
.fab:hover { transform: scale(1.05); }
.rf-image-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.rf-image-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 34px; align-items: center; gap: 6px; margin-bottom: 6px; }
.rf-image-row img, .rf-image-empty { width: 52px; height: 42px; border: 1px solid var(--line); border-radius: 8px; background: #f4f5f8; object-fit: cover; }
.rf-image-row input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 13px; outline: none; min-width: 0; }
.rf-image-row button { border: none; background: none; color: #c9ccda; cursor: pointer; }
.rf-image-row button:hover { color: #c1001f; }

/* toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.update-banner {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 90;
  background: var(--ink); color: #fff; border-radius: var(--radius); padding: 10px 12px;
  box-shadow: 0 12px 32px rgba(20,24,40,.24); font-size: 13px;
}
.update-banner.hidden { display: none; }
.update-banner button {
  border: none; border-radius: 8px; background: #fff; color: var(--ink);
  font-weight: 800; padding: 6px 10px; cursor: pointer;
}

/* ---- mobile (#20) ---- */
@media (max-width: 600px) {
  body { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 14px; gap: 10px; align-items: flex-start; backdrop-filter: none; }
  input, select, textarea { font-size: 16px !important; }
  .brand { order: 1; flex: 1 1 auto; min-width: 0; }
  .brand h1 { font-size: 17px; }
  .brand .sub { display: none; }
  .logo { font-size: 24px; }
  .viewswitch {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    order: initial; width: 100%; max-width: none; display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0; padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    overflow: visible; border-radius: 0; border: none; border-top: 1px solid var(--line);
    background: rgba(255,255,255,.96); backdrop-filter: blur(16px); box-shadow: 0 -8px 24px rgba(19,26,42,.08);
  }
  .seg {
    min-width: 0; padding: 6px 2px; height: 50px; font-size: 10px;
    flex-direction: column; gap: 4px; white-space: nowrap; border-radius: var(--radius);
  }
  .seg-icon { font-size: 20px; }
  .seg-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .seg.active { background: var(--surface); color: var(--ink); }
  .settings-mobile-seg { display: inline-flex; }
  .person-select-wrap {
    order: 2; margin-left: auto; margin-right: 46px; max-width: calc(100vw - 168px);
  }
  .person-select { max-width: 124px; padding-top: 7px; padding-bottom: 7px; }
  .settings-icon { display: none; }
  .weeknav {
    order: 3; width: 100%; justify-content: space-between;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 5px;
  }
  .weeklabel { min-width: 0; }
  .weeklabel strong { font-size: 14px; }
  .weeklabel small { font-size: 11px; }
  .weeknav .iconbtn { width: 36px; height: 34px; background: #fff; }
  .fab {
    top: calc(8px + env(safe-area-inset-top)); bottom: auto;
    right: calc(14px + env(safe-area-inset-right));
    width: 36px; height: 36px; font-size: 17px; box-shadow: none;
  }
  .board, .recipes, .progress, .body-view, .calendar, .settings, .workouts { padding-left: 14px; padding-right: 14px; }
  .cal-toolbar { flex-direction: column; align-items: stretch; justify-content: stretch; }
  .cal-copy-prev { width: 100%; }
  .cal-mode { width: 100%; }
  .cal-mode-btn { flex: 1; padding-left: 8px; padding-right: 8px; }
  .cal-day-view { grid-template-columns: 1fr; }
  .cal-day-row { grid-template-columns: 88px minmax(0, 1fr); gap: 8px; }
  .cal-month-grid { gap: 4px; }
  .cal-month-cell { min-height: 66px; border-radius: 9px; padding: 5px; }
  .cal-month-date { font-size: 13px; }
  .cal-month-counts { gap: 2px; }
  .cal-month-counts span { font-size: 9px; padding: 1px 4px; }
  .days { padding: 12px 14px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-panel { padding: 12px; }
  .quick-list { grid-template-columns: 1fr 1fr; }
  .workout-grid { grid-template-columns: 1fr; }
  .workout-card { padding: 12px; }
  .workout-log-row { grid-template-columns: 1fr 1fr; }
  .workout-log-row .primarybtn { grid-column: 1 / -1; min-height: 44px; }
  .workout-session { padding: 12px; }
  .workout-session-head { grid-template-columns: 1fr; }
  .workout-session-head .ghostbtn { width: 100%; min-height: 42px; }
  .workout-current strong { font-size: 24px; }
  .workout-rest-screen, .workout-complete { min-height: 220px; }
  .workout-rest-screen strong, .workout-complete strong { font-size: 42px; }
  .workout-exercise { grid-template-columns: minmax(0, 1fr) auto; }
  .workout-exercise .ghostbtn { grid-column: 1 / -1; width: 100%; min-height: 42px; }
  .workout-dots { justify-content: flex-end; }
  .person-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .prog-day { grid-template-columns: 46px minmax(72px, 1fr) auto; gap: 8px; }
  .pd-macros { grid-column: 1 / -1; padding-left: 54px; }
  .pd-entries { margin-left: 0; padding: 8px; }
  .pd-entry {
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    grid-template-areas: "meal edit del" "mac edit del";
    gap: 4px 8px; padding: 8px 0;
  }
  .pde-meal { grid-area: meal; font-size: 13px; line-height: 1.25; }
  .pde-mac { grid-area: mac; font-size: 12px; white-space: normal; line-height: 1.3; }
  .pd-edit, .pd-del { width: 44px; height: 44px; font-size: 18px; border-radius: var(--radius); }
  .pd-edit { grid-area: edit; }
  .pd-del { grid-area: del; }
  .totals { grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; }
  .chip { text-align: center; white-space: nowrap; }
  .kcal-chip, .total-actions { justify-self: stretch; }
  .total-actions { justify-content: stretch; }
  .total-actions .kcal-chip { flex: 1; }
  .meal { min-height: 112px; }
  .meal .thumb { width: 76px; flex-basis: 76px; }
  .meal .body { padding: 10px 10px; }
  .meal .recipe { font-size: 14px; margin-bottom: 6px; }
  .meal .macros { gap: 6px; }
  .meal .macros span { white-space: nowrap; }
  .rgrid { grid-template-columns: 1fr 1fr; }
  .modal { padding: 8px; }
  .modal-card { max-height: 92vh; }
  /* dynamic add rows: let them wrap instead of overflowing */
  .ing-addrow { grid-template-columns: 60px repeat(4, 1fr); }
  .ing-addrow .primarybtn { grid-column: 1 / -1; }
  .rf-main-add { grid-template-columns: 1fr 1fr; }
  .rf-main-add .rf-spreview { grid-column: 1 / -1; }
  #recipeForm .track-body { width: min(100%, calc(100vw - 24px)); }
  #recipeForm .modal-head { padding-left: 12px; padding-right: 12px; }
  .rf-swap-add { grid-template-columns: 1fr; padding: 10px; }
  .rf-smetrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rf-sactions { align-items: stretch; flex-direction: column; gap: 8px; }
  .rf-sactions .primarybtn, .rf-sactions .ghostbtn { width: 100%; }
  .rf-spreview { align-self: flex-start; white-space: normal; }
  .fld-row { grid-template-columns: repeat(2, 1fr); }
  #trackAdhoc { grid-template-columns: 1fr; }
  .track-copy-controls .fld { flex-basis: min(100%, 164px); }
  .track-copy-controls .ghostbtn { flex: 1 1 112px; min-width: 0; padding-inline: 10px; }
  .totals { justify-content: start; }
  .total-actions { justify-self: start; }
  .shop-head { flex-direction: column; }
  .shop-actions { justify-content: flex-start; }
  .goal-config-grid, .workout-manage-grid, .meal-config-people { grid-template-columns: 1fr; }
  .settings-head { align-items: flex-start; flex-direction: column; }
  .settings-head-actions { justify-content: flex-start; }
  .settings-head.subhead { align-items: stretch; flex-direction: column; }
  .settings-tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto; width: 100%;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tabs button { flex: 0 0 auto; min-height: 38px; padding-left: 12px; padding-right: 12px; }
  .goal-config-card, .workout-manage-card { padding: 12px; box-shadow: none; }
  .settings-card-head { align-items: flex-start; }
  .goal-config-form, .cfg-split-grid, .cfg-macro-grid, .meal-times-grid { grid-template-columns: 1fr 1fr; }
  .meal-config-row { grid-template-columns: minmax(0, 1.4fr) minmax(82px, .8fr) minmax(64px, .6fr) 38px; }
  .meal-config-row .cfg-meal-remove { padding-left: 0; padding-right: 0; }
  .meal-config-card { padding: 12px; box-shadow: none; }
  .meal-times-people { grid-template-columns: 1fr; }
  .goal-config-form .primarybtn, .cfg-split-grid .primarybtn, .cfg-macro-grid .primarybtn { grid-column: 1 / -1; justify-self: start; }
  .wm-day-head { grid-template-columns: 1fr; }
  .wm-day-head .ghostbtn { width: 100%; min-height: 42px; }
  .wm-cycle-head { align-items: flex-start; flex-direction: column; }
  .wm-cycle-fields { grid-template-columns: 1fr; }
  .wm-cycle-date input { min-height: 42px; }
  .wm-cycle-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wm-cycle-times { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wm-cycle-time { min-height: 42px; font-size: 13px; }
  .wm-cycle-actions .small { flex: 1; min-height: 40px; }
  .wm-ex-head { display: none; }
  .wm-ex { grid-template-columns: 1fr 1fr; gap: 7px; }
  .wm-ex-search, .wm-ex-title, .wm-ex-muscle, .wm-reps { grid-column: 1 / -1; }
  .wm-reps, .wm-reps.per-set { grid-template-columns: 1fr; }
  .wm-reps-sets { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wm-rest-row { margin-left: 0; grid-template-columns: 1fr minmax(70px, 92px) 34px; }
  .wm-rest-add { margin-left: 0; width: 100%; min-height: 40px; }
  .wm-ex-link-row { justify-content: flex-start; min-height: 40px; }
  .wm-ex-del { width: 100%; min-height: 40px; }
  .rf-image-actions { grid-template-columns: 1fr; }
  .wm-actions .primarybtn, .wm-actions .ghostbtn { flex: 1 1 140px; min-height: 42px; }
  .ingredient-tools { align-items: stretch; flex-direction: column; }
  .ingredient-merge-macro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ingredient-row { grid-template-columns: 24px 1fr; align-items: stretch; }
  .ingredient-select { align-self: start; padding-top: 18px; }
  .ingredient-meta, .ingredient-macros, .ingredient-actions { grid-column: 2; }
  .ingredient-actions { justify-content: flex-start; }
  .exercise-new, .exercise-row { grid-template-columns: 1fr; align-items: stretch; }
  .exercise-actions { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .rgrid { grid-template-columns: 1fr; }
  .quick-list { grid-template-columns: 1fr; }
  .workout-day-tabs { grid-template-columns: 1fr; }
  .workout-log-row { grid-template-columns: 1fr; }
  .workout-dots { justify-content: flex-start; }
  /* ingredient rows (track + recipe form): name + delete on line 1, grams +
     macros on line 2 — instead of cramming 4 columns into a phone width */
  .ing-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "name name del" "grams mac mac";
    gap: 4px 10px;
  }
  #rfMain .ing-row {
    grid-template-columns: 22px auto 1fr auto;
    grid-template-areas: "drag name name del" "drag grams per mac";
  }
  .ing-row .ing-name { grid-area: name; font-size: 15px; }
  .ing-row .ing-del { grid-area: del; justify-self: end; font-size: 17px; }
  .ing-row .ing-g { grid-area: grams; }
  .ing-row .ing-per { grid-area: per; text-align: left; align-self: center; }
  .ing-row .ing-mac { grid-area: mac; text-align: left; }
}
