/* Раздел «Тело»: тренировки, вес, замеры */

.only-sm { display: none !important; }

.fit-kpis { grid-template-columns: repeat(3, 1fr); }
.kpi .value.fit-small { font-size: 18px; line-height: 1.6; }

.fit-sub { padding: 10px 16px 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fit-next .card-foot .btn { width: 100%; justify-content: center; }

.stack > form.stack, form.stack { display: flex; flex-direction: column; gap: 16px; }
form.stack > .actions { display: flex; justify-content: flex-end; }

.fit-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.fit-plates-form { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); margin-top: 6px; }
.fit-form input { width: 100%; }

.note.ok { background: var(--ok-weak); color: var(--ok); }

/* Экран тренировки */
.fit-workout .card.fit-ex { margin-top: 0; }
.fit-ex.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.fit-ex.done .card-head h2::after { content: ' ✓'; color: var(--ok); }

.fit-weight { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.fit-kg { display: flex; align-items: baseline; gap: 6px; }
.fit-kg input { width: 76px; text-align: center; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fit-kg span { color: var(--muted); font-size: 13px; }
.fit-weight .icon-btn { font-size: 18px; border: 1px solid var(--border-strong); }
.fit-plates { flex: 1 1 200px; font-size: 13px; color: var(--muted); }

.fit-sets { list-style: none; margin: 0; padding: 4px 16px 12px; }
.fit-sets li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.fit-sets li + li { border-top: 1px dashed var(--border); }
.fit-n { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.fit-sets .icon-btn { font-size: 18px; border: 1px solid var(--border-strong); }
.fit-reps { min-width: 92px; text-align: center; font-size: 20px; font-weight: 600; }
.fit-reps small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.fit-check {
  margin-left: auto; width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--faint);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.fit-check svg { width: 20px; height: 20px; }
.fit-sets li.done .fit-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.fit-sets li.done .fit-reps { color: var(--ok); }

.fit-finish { justify-content: flex-end; padding-bottom: 72px; }

.rest-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  background: var(--text); color: var(--bg); border-radius: 14px; padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow-lg); font-size: 14px;
}
.rest-bar b { font-size: 22px; min-width: 56px; }
.rest-bar .btn { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 40%, transparent); }

/* Вес */
.fit-weigh { margin-bottom: 12px; }
.fit-weigh input[name=kg] { flex: 1 1 140px; font-size: 16px; }
.fit-chart { width: 100%; height: auto; display: block; }
.fit-chart text { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.fit-chart .grid-line { stroke: var(--border); stroke-width: 1; }
.fit-chart .dot { fill: var(--faint); opacity: .7; }
.fit-chart .trend { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }

.fit-measure { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 0 10px; align-items: end; }
.fit-measure input { width: 100%; }
.fit-measure .btn { margin-bottom: 12px; }

@media (max-width: 899px) {
  .only-sm { display: inline-flex !important; }
  .fit-kpis { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .fit-kpis .kpi { padding: 12px; }
  .fit-kpis .kpi .value { font-size: 20px; }
  .kpi .value.fit-small { font-size: 15px; }
  .fit-measure { grid-template-columns: repeat(2, 1fr); }
  .fit-weigh { flex-wrap: nowrap; }
  .fit-weigh input[name=kg] { flex: 1 1 0; min-width: 0; }
  .fit-weigh input[name=date] { flex: 0 0 132px; min-width: 0; }
  .fit-measure .btn { grid-column: 1 / -1; height: 48px; }
  .fit-reps { min-width: 84px; }
  .fit-check { width: 48px; height: 48px; }
  .rest-bar { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .tabbar svg { padding: 4px 14px; }
}

/* Питание */
.food-day { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.food-day b { min-width: 110px; text-align: center; font-size: 15px; }
.food-sum { margin-bottom: 16px; }
.food-line { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.food-line > span:first-child { min-width: 64px; color: var(--muted); font-size: 13px; }
.food-line b { font-size: 20px; }
.food-line b small { font-size: 13px; color: var(--muted); font-weight: 500; }
.food-line > span:last-child { margin-left: auto; }
.food-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 6px 0 10px; }
.food-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.food-bar.protein i { background: var(--ok); }
.food-bar.over i { background: var(--warn); }
.food-fc { margin-top: -2px; }
.food-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.danger-text { color: var(--danger); }

.food-modal #food-q { width: 100%; margin-top: 12px; }
.food-results { max-height: min(52vh, 420px); overflow-y: auto; margin: 8px -16px 0; padding: 0 16px; }
.food-results .fit-sub { padding: 10px 0 4px; }
.food-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  padding: 9px 4px; background: none; border: 0; border-bottom: 1px solid var(--border);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.food-item:hover { background: var(--surface-2); }
.food-item small { color: var(--muted); font-size: 12.5px; }
.food-actions { flex-wrap: wrap; }
.food-units { margin: -4px 0 12px; }
.food-macros { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

@media (max-width: 899px) {
  .food-item { padding: 12px 4px; font-size: 15px; }
  .food-results { max-height: 46vh; }
  .modal .food-actions .btn { flex: 1 1 40%; height: 46px; font-size: 15px; }
}

/* Штрихкод */
.food-shot { width: 100%; justify-content: center; height: 44px; margin-top: 4px; cursor: pointer; }
.food-code { display: flex; gap: 8px; margin-top: 12px; }
.food-code input { flex: 1; min-width: 0; }
.food-bc-msg { min-height: 20px; margin-top: 10px; }
@media (max-width: 899px) {
  .food-shot { height: 52px; font-size: 16px; }
  .food-code .btn { height: 48px; }
}
.food-cam { position: relative; margin: 4px 0 10px; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.food-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.food-cam i { position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: #ff4d4d; box-shadow: 0 0 8px #ff4d4d; }
.food-cam + .food-shot { display: none; }
.food-cam[hidden] + .food-shot { display: inline-flex; }
.food-shot + .food-shot { margin-top: 8px; }
