:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --hairline: rgba(17, 24, 39, 0.12);
  --primary: #0a84ff;
  --danger: #ff3b30;
  --success: #34c759;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --tap: 44px;
  --safe-top: env(safe-area-inset-top);
  --safe-btm: env(safe-area-inset-bottom);
  --bottomnav-base: 74px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: rgba(245, 245, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}

.topbar__row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
  flex: 1;
}

.badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.06);
  color: var(--muted);
  border: 1px solid var(--hairline);
}
.badge--ok { color: #065f46; background: rgba(52, 199, 89, 0.14); border-color: rgba(52, 199, 89, 0.35); }
.badge--warn { color: #7c2d12; background: rgba(255, 149, 0, 0.14); border-color: rgba(255, 149, 0, 0.35); }
.badge--err { color: #7f1d1d; background: rgba(255, 59, 48, 0.14); border-color: rgba(255, 59, 48, 0.35); }

.content {
  flex: 1;
  padding: 14px 14px calc(14px + var(--bottomnav-base) + var(--safe-btm));
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
  padding: 14px;
}

.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row--wrap { flex-wrap: wrap; justify-content: flex-start; }
.row--wrap .btn { flex: 1 1 140px; }
.muted { color: var(--muted); }

.btn {
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  color: var(--text);
  font-weight: 650;
  letter-spacing: 0.2px;
}
.btn:active { transform: scale(0.99); }
.btn--primary { background: var(--primary); color: white; border-color: rgba(0,0,0,0.08); }
.btn--ghost { background: transparent; }
.btn--danger { background: var(--danger); color: white; border-color: rgba(0,0,0,0.08); }

.swipePages {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.swipePages::-webkit-scrollbar { display: none; }
.swipePage {
  flex: 0 0 100%;
  scroll-snap-align: start;
}
.dietChartWrap { border: 1px solid rgba(17, 24, 39, 0.10); border-radius: 14px; overflow: hidden; background: rgba(17, 24, 39, 0.02); }
.dietChart { display: block; width: 100%; height: 180px; }

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(17, 24, 39, 0.05);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px;
}
.tabs button {
  min-height: 38px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-weight: 700;
  color: var(--muted);
}
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); }

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: rgba(17, 24, 39, 0.05);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px;
}
.seg button {
  min-height: 34px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-weight: 800;
  color: var(--muted);
  font-size: 12px;
}
.seg button[aria-selected="true"] { background: var(--panel); color: var(--text); }

.phyCarousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.phyCarousel::-webkit-scrollbar { display: none; }
.phyCard {
  flex: 0 0 78%;
  height: 360px;
  border-radius: 18px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  position: relative;
  overflow: hidden;
}
.phyCard:active { transform: scale(0.995); }
.phyCard--selected { border-color: rgba(10, 132, 255, 0.35); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10); }
.phyImg { width: 100%; height: 100%; object-fit: cover; display: block; }
.phyPlaceholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.12), rgba(17, 24, 39, 0.06));
  color: rgba(17, 24, 39, 0.55);
  font-weight: 900;
  font-size: 36px;
}
.phyOverlay {
  position: absolute;
  inset: 0;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0.10) 48%, rgba(0,0,0,0));
  pointer-events: none;
}
.phyOverlay__left {
  align-self: flex-end;
  color: rgba(255,255,255,0.96);
  text-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.phyOverlay__metric {
  font-size: 26px;
  font-weight: 950;
  letter-spacing: 0.2px;
}
.phyOverlay__meta {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 750;
  opacity: 0.9;
}
.phyOverlay__right {
  align-self: flex-start;
  display: grid;
  gap: 6px;
  pointer-events: auto;
  width: min(140px, 38%);
}

.fiPhotoCard {
  width: 160px;
  height: 160px;
  border-radius: 18px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.fiPhotoCard:active { transform: scale(0.995); }
.fiPhotoImg { width: 100%; height: 100%; object-fit: cover; display: block; }
.fiPhotoPlaceholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.12), rgba(17, 24, 39, 0.06));
}
.fiPhotoCenter { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.fiPhotoCamBtn {
  pointer-events: auto;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(17, 24, 39, 0.45);
  color: rgba(255,255,255,0.95);
  font-size: 22px;
  font-weight: 900;
  backdrop-filter: blur(10px);
}
.fiPhotoCamBtn:active { transform: scale(0.98); }
.fiPhotoXBtn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(17, 24, 39, 0.45);
  color: rgba(255,255,255,0.95);
  font-size: 20px;
  font-weight: 900;
  backdrop-filter: blur(10px);
}
.fiPhotoXBtn:active { transform: scale(0.98); }
.metricBtn {
  min-height: 30px;
  padding: 7px 9px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.26);
  background: rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.96);
  font-weight: 850;
  font-size: 12px;
  backdrop-filter: blur(10px);
  text-align: left;
}
.metricBtn[aria-pressed="true"] { background: rgba(10, 132, 255, 0.35); border-color: rgba(255,255,255,0.35); }
.metricBtn[disabled] { opacity: 0.55; }
.metricBtn--danger { background: rgba(255, 59, 48, 0.26); border-color: rgba(255,255,255,0.28); }
.metricBtn--link {
  background: transparent;
  border-color: transparent;
  padding-left: 2px;
  padding-right: 2px;
  text-align: right;
}
.metricBtn--link:active { opacity: 0.75; }
.metricBtn--toggle {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
  font-weight: 900;
  font-size: 11px;
  text-align: right;
}
.metricBtn--toggle[aria-pressed="false"] { opacity: 0.75; }

.phyChartCard {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 12px;
}
.phyChartTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.phyChartTitle__label { font-weight: 850; }
.phyChartTitle__sub { font-size: 12px; color: var(--muted); font-weight: 700; }
.phyChartVal {
  font-size: 11px;
  font-weight: 900;
  fill: var(--text);
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.formGrid {
  display: grid;
  gap: 10px;
}
.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(17,24,39,0.12);
  background: rgba(17,24,39,0.02);
  font-weight: 800;
  font-size: 16px; /* iOS Safari: prevent focus zoom */
}
.input--small { min-height: 46px; }
.photoGuideWrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: rgba(17,24,39,0.02);
}
.photoGuideImg { width: 100%; height: 260px; object-fit: cover; display: block; }
.photoGuideOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.photoGuideFrame {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 10%;
  bottom: 10%;
  border: 2px dashed rgba(255,255,255,0.85);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}
.photoGuideText {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.95);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--panel);
}
.pill__icon { font-size: 20px; width: 28px; text-align: center; }
.pill__text { font-weight: 750; }
.pill__sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 600; }
.pill:active { transform: scale(0.99); }

.list {
  display: grid;
  gap: 8px;
}
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--panel);
  min-height: var(--tap);
  text-align: left;
}
.item__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* Icon/thumbnail should be visually large (≈80% of row height). */
.item__icon { width: 44px; text-align: center; font-size: 24px; }
.item__icon .thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
}
.item__title { font-weight: 750; }
.item__titleBtn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 750;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.item__titleBtn:active { opacity: 0.72; }
.item__titleBtn:focus { outline: none; text-decoration: underline; }
.item__meta { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.chev { color: var(--muted); font-weight: 900; }

.trainTodayItem {
  align-items: stretch;
  padding: 12px 14px;
  border-width: 1px;
}
.trainTodayItem--todo {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.03), rgba(17, 24, 39, 0.015));
}
.trainTodayItem--done {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.08));
}
.trainTodayItem__right {
  display: grid;
  grid-template-rows: auto auto 1fr;
  justify-items: end;
  gap: 2px;
  min-width: 84px;
}
.trainTodayItem__ratio {
  font-size: 22px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
  color: rgba(17, 24, 39, 0.92);
}
.trainTodayItem__ratioSub {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.trainTodayItem--done .trainTodayItem__ratio {
  color: rgba(4, 120, 87, 1);
}

.linkPlain {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 850;
  color: rgba(10, 132, 255, 1);
  cursor: pointer;
}
.linkPlain:active { opacity: 0.72; }
.linkPlain:focus { outline: none; text-decoration: underline; }

.segTabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--hairline);
}
.segTab {
  flex: 1 1 0;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 10px 8px;
  font-weight: 850;
  color: rgba(17, 24, 39, 0.55);
}
.segTab.is-active {
  color: rgba(17, 24, 39, 1);
  border-bottom: 3px solid rgba(10, 132, 255, 1);
}

.set {
  border: 1px solid var(--hairline);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px;
}
.set__hdr { display: flex; align-items: center; justify-content: space-between; }
.set__title { font-weight: 800; }
.set__grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.field {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 10px 10px;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(17, 24, 39, 0.02);
}
.field__label { font-size: 11px; color: var(--muted); font-weight: 700; }
.field__value { font-variant-numeric: tabular-nums; font-weight: 850; }
.field__unit { color: var(--muted); font-weight: 700; }
.set__actions { display: flex; gap: 10px; margin-top: 10px; }

.bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px calc(10px + var(--safe-btm));
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--hairline);
}
.bottomnav__inner {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
}
.navbtn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  display: grid;
  place-items: center;
  gap: 2px;
  color: var(--muted);
  font-weight: 700;
}
.navbtn[aria-current="page"] { background: rgba(10, 132, 255, 0.12); color: var(--primary); border-color: rgba(10, 132, 255, 0.25); }
.navbtn__icon { font-size: 16px; line-height: 1; }
.navbtn__label { font-size: 10px; line-height: 1.1; white-space: nowrap; }

@media (max-width: 360px) {
  :root { --bottomnav-base: 66px; }
  .bottomnav { padding: 8px 10px calc(8px + var(--safe-btm)); }
  .navbtn { min-height: 44px; }
  .navbtn__icon { font-size: 15px; }
  .navbtn__label { font-size: 9px; }
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}
.modal.is-open { display: block; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
}
.modal__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--panel);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: var(--shadow);
  max-height: 78vh;
  overflow: hidden;
}
.modal__header {
  display: grid;
  grid-template-columns: 90px 1fr 90px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}
.modal__title {
  text-align: center;
  font-weight: 800;
}
.modal__body {
  padding: 12px;
  overflow: auto;
  max-height: calc(78vh - 58px);
  -webkit-overflow-scrolling: touch;
}

.trainSessItem--scheduled { border-left: 4px solid rgba(10,132,255,0.95); background: rgba(10,132,255,0.06); }
.trainSessItem--extra { border-left: 4px solid rgba(255,149,0,0.95); background: rgba(255,149,0,0.06); }

.pickerGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.dualPicker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dualPicker__label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin: 2px 2px 10px;
}

.trainSetTable {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.02);
  font-variant-numeric: tabular-nums;
}
.trainSetTable__head,
.trainSetTable__cell {
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.trainSetTable__head {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
  text-align: left;
  background: rgba(17, 24, 39, 0.03);
}
.trainSetTable__head--num { text-align: right; }
.trainSetTable__head--set { width: 42px; }
.trainSetTable__cell--num { text-align: right; }
.trainSetTable__cell--set { font-weight: 900; width: 42px; }
.trainSetTable tbody tr:last-child .trainSetTable__cell { border-bottom: 0; }
.pick {
  min-height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: rgba(17, 24, 39, 0.02);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.pick[aria-pressed="true"] { background: rgba(10, 132, 255, 0.14); border-color: rgba(10, 132, 255, 0.35); color: var(--primary); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-btm));
  transform: translateX(-50%);
  padding: 10px 14px;
  background: rgba(17, 24, 39, 0.92);
  color: white;
  border-radius: 999px;
  font-weight: 750;
  font-size: 13px;
  display: none;
  z-index: 60;
}
.toast.is-open { display: block; }

/* Diet (Meals) */
.dietDateNav {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  gap: 10px;
}
.dietDateNav__label { text-align: center; font-weight: 900; letter-spacing: 0.2px; }

.mealSection {
  background: rgba(17, 24, 39, 0.05);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}
.mealSectionHdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  background: rgba(255,255,255,0.85);
}
.mealSectionHdr__left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mealSectionHdr__icon { width: 26px; text-align: center; font-size: 18px; }
.mealSectionHdr__title { font-weight: 950; }
.mealSectionHdr__meta { font-size: 12px; color: var(--muted); font-weight: 750; margin-top: 2px; }

.mealList { display: grid; gap: 10px; padding: 12px; }
.mealEmpty { padding: 14px 12px; color: var(--muted); font-weight: 700; }
.mealItem {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 12px;
}
.mealItemTop { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mealItemLeft { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.mealThumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  flex: 0 0 auto;
  border: 1px solid rgba(0,0,0,0.06);
}
.bodySimCardThumb {
  width: 100%;
  height: 170px;
  border-radius: 16px;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(0,0,0,0.06);
}
.bodySimThumb {
  width: 110px;
  height: 150px;
  border-radius: 16px;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(0,0,0,0.06);
}
.hScroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.hScroll > * { scroll-snap-align: start; }
.simCard {
  border: 1px solid var(--hairline);
  background: var(--panel);
  border-radius: 18px;
  padding: 0;
  text-align: left;
  min-width: 260px;
  max-width: 260px;
  overflow: hidden;
}
.simCard:active { transform: none; }
.simCard__img {
  width: 100%;
  height: 160px;
  display: block;
  object-fit: cover;
  background: rgba(17, 24, 39, 0.05);
}
.simCard__img--ph {
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  color: rgba(17, 24, 39, 0.75);
}
.simCard__body {
  padding: 12px;
  display: grid;
  gap: 6px;
}

.busy {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 18px;
}
.busy__card {
  width: min(340px, calc(100vw - 36px));
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 18px;
  padding: 16px 14px;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.busy__spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid rgba(17, 24, 39, 0.16);
  border-top-color: rgba(10, 132, 255, 0.95);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.mealItemTitle { font-weight: 900; line-height: 1.15; }
.mealItemTap {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font-weight: 900;
  line-height: 1.15;
  min-height: 0;
}
.mealItemTap:active { transform: none; }
.mealItemRight { display: grid; justify-items: end; gap: 6px; }
.mealItemKcal { font-weight: 900; color: rgba(17, 24, 39, 0.88); }

.mealNutrients {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  border-top: 1px solid rgba(17, 24, 39, 0.10);
  padding-top: 10px;
}
.mealNutRow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mealNutLabel { color: var(--muted); font-weight: 800; font-size: 12px; }
.mealNutVal { font-weight: 900; font-variant-numeric: tabular-nums; }

.bars { display: grid; gap: 10px; }
.barRow { display: grid; gap: 6px; }
.barTop { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.barLabel { font-weight: 900; }
.barNums { font-variant-numeric: tabular-nums; font-weight: 900; color: rgba(17, 24, 39, 0.86); }
.barTrack {
  height: 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
  overflow: hidden;
}
.barFill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.9);
}
.barFill--warn { background: rgba(255, 149, 0, 0.92); }
.barFill--danger { background: rgba(255, 59, 48, 0.92); }
.barSub { font-size: 12px; color: var(--muted); font-weight: 800; }

.nutRow {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
  align-items: center;
  padding: 8px 2px;
  border-top: 1px solid rgba(17, 24, 39, 0.10);
}
.nutLabel { font-weight: 850; }
.nutRight { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.nutUnit { color: var(--muted); font-weight: 850; }
.nutRight .input { min-height: 44px; padding: 10px 12px; }

@media (max-width: 360px) {
  .nutRow { grid-template-columns: 1fr 132px; }
}
/* AI stacked sheets */
.ai-stack {
  position: relative;
  min-height: 120px;
}

.ai-sheet {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 12px;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
  transform: translateY(calc(var(--ai-i, 0) * -10px)) scale(calc(1 - var(--ai-i, 0) * 0.02));
  margin-top: 10px;
}

/* Exercise meta pills */
.metaPills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.metaPill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(17,24,39,0.03);
  font-weight: 850;
  min-height: 36px;
}
.metaPill__icon { width: 22px; text-align: center; font-size: 16px; }
.metaPill__text { font-size: 13px; }

/* AI: readable summary/feedback boxes */
.aiBox {
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 10px 12px;
}
.aiBox--summary { background: rgba(10,132,255,0.06); }
.aiBox--fb { background: rgba(52,199,89,0.07); }
.aiBox--note { background: rgba(255,149,0,0.07); }
.aiBox__title {
  font-weight: 950;
  margin-bottom: 6px;
}
.aiList {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-weight: 750;
}

/* TEMP: global blue theme override (revert later) */
:root {
  --bg: #eaf3ff;
  --panel: #f5f9ff;
  --text: #102a4a;
  --muted: #3f618a;
  --hairline: rgba(25, 92, 189, 0.22);
  --primary: #1f6feb;
  --shadow: 0 10px 28px rgba(19, 79, 160, 0.14);
}

body {
  background:
    radial-gradient(1200px 420px at 50% -180px, rgba(46, 128, 255, 0.30), rgba(46, 128, 255, 0)),
    var(--bg);
}

.topbar {
  background: rgba(233, 243, 255, 0.92);
}

.card {
  box-shadow:
    0 2px 0 rgba(12, 58, 124, 0.05),
    0 10px 24px rgba(33, 97, 194, 0.08);
}

.btn--ghost {
  background: rgba(31, 111, 235, 0.08);
}

.tabs,
.seg {
  background: rgba(35, 112, 225, 0.10);
}

.dietChartWrap {
  background: rgba(35, 112, 225, 0.06);
}
