/* Fitness tab — compact single-page layout */

body.fh-fit-on #dashboard {
  padding-top: var(--dash-pt, 0.2rem) !important;
  padding-bottom: 0 !important;
  height: calc(100vh - var(--dash-height-sub, 5.35rem)) !important;
}
body.fh-fit-on #tab-sidebar { top: 0; }

#fitness.tab-content:not(.hidden) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.3rem 0.45rem 0.3rem 0.2rem !important;
  height: 100%;
  min-height: 0;
}
#fitness.hidden { display: none !important; }
#fitness-root {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fh-fit {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  height: 100%;
  min-height: 0;
  color: var(--fp-text, #e4e4e7);
}
.fh-fit-top {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.fh-fit-top .title {
  font-weight: 650;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.fh-fit-top .title i { color: #fb7185; }
.fh-fit-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.fh-fit-chip {
  font-size: 0.72rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(13,148,136,0.12);
  border: 1px solid rgba(45,212,191,0.2);
  color: #99f6e4;
}
.fh-fit-chip.over { background: rgba(244,63,94,0.14); border-color: rgba(251,113,133,0.3); color: #fda4af; }
.fh-fit-chip.ok { background: rgba(16,185,129,0.14); border-color: rgba(52,211,153,0.3); color: #6ee7b7; }

.fh-fit-page {
  display: grid;
  grid-template-columns: minmax(17rem, 0.92fr) minmax(20rem, 1.15fr);
  gap: 0.55rem;
  flex: 1;
  min-height: 0;
}
@media (max-width: 980px) {
  .fh-fit-page { grid-template-columns: 1fr; overflow: auto; }
}

.fh-fit-col {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  overflow: hidden;
}
.fh-fit-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--fp-border, rgba(255,255,255,0.08));
  border-radius: 0.85rem;
  padding: 0.55rem 0.7rem;
}
.fh-fit-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 600;
}
.fh-fit-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 0.45rem;
}
.fh-fit-fields label {
  display: block;
  font-size: 0.65rem;
  color: #94a3b8;
  margin-bottom: 0.12rem;
}
.fh-fit input, .fh-fit select, .fh-fit textarea {
  width: 100%;
  background: #0a0f1f;
  border: 1px solid rgba(255,255,255,0.12);
  color: inherit;
  border-radius: 0.5rem;
  padding: 0.28rem 0.45rem;
  font-size: 0.82rem;
}
[data-theme="light"] .fh-fit input,
[data-theme="light"] .fh-fit select,
[data-theme="light"] .fh-fit textarea {
  background: #fff;
  color: #0f172a;
}
.fh-fit-btn {
  border: 0;
  border-radius: 0.55rem;
  padding: 0.32rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
}
.fh-fit-btn:hover { background: rgba(244, 63, 94, 0.28); }
.fh-fit-btn.ghost {
  background: rgba(255,255,255,0.06);
  color: #cbd5e1;
}
.fh-fit-goalrow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: end;
}
.fh-fit-slider { width: 100%; accent-color: #fb7185; height: 1.1rem; }
.fh-fit-pace {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: #94a3b8;
  margin-top: 0.05rem;
}
.fh-fit-meta {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-top: 0.25rem;
}
.fh-fit-meta strong { color: #5eead4; }
.fh-fit-warn {
  margin-top: 0.3rem;
  padding: 0.3rem 0.45rem;
  border-radius: 0.5rem;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
  font-size: 0.7rem;
}
#fitness .fh-ksql {
  padding: 0.35rem 0.55rem;
  margin: 0;
  font-size: 0.75rem;
}
#fitness .fh-ksql p { margin: 0 0.5rem 0 0; display: inline; }
#fitness .fh-ksql-actions { display: inline-flex; margin-left: 0.35rem; }

.fh-fit-who {
  display: grid;
  grid-template-columns: 18% 32% 50%;
  height: 0.7rem;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin: 0.25rem 0 0.15rem;
}
.fh-fit-who span:nth-child(1) { background: #38bdf8; }
.fh-fit-who span:nth-child(2) { background: #34d399; }
.fh-fit-who span:nth-child(3) { background: #f43f5e; }
.fh-fit-who-mark {
  position: absolute;
  top: -3px;
  width: 3px;
  height: calc(100% + 6px);
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 2px rgba(12,17,29,0.7);
}
.fh-fit-who-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: #94a3b8;
}
.fh-fit-chart-card {
  flex: 1.05;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.fh-fit-plans-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fh-fit-if {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: #cbd5e1;
  margin-bottom: 0.2rem;
}
.fh-fit-if input { width: auto; accent-color: #fb7185; }
#fit-plans {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin-top: 0.3rem;
}
.fh-fit-plan {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.6rem;
  padding: 0.4rem 0.5rem 0.5rem;
  margin-bottom: 0.4rem;
  background: rgba(255,255,255,0.02);
}
.fh-fit-plan-head {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}
.fh-fit-plan-head span { color: #5eead4; font-weight: 650; }
.fh-fit-plan-meal { margin: 0.2rem 0; }
.fh-fit-plan-meal b {
  display: block;
  font-size: 0.68rem;
  color: #99f6e4;
  font-weight: 600;
  margin-bottom: 0.1rem;
}
.fh-fit-plan-meal ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.fh-fit-plan-meal li {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.72rem;
  padding: 0.08rem 0;
  color: #cbd5e1;
}
.fh-fit-plan-meal em {
  font-style: normal;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}
.fh-fit-plan .fh-fit-btn { margin-top: 0.3rem; font-size: 0.72rem; padding: 0.28rem 0.55rem; }
.fh-fit-chart-wrap {
  flex: 1;
  min-height: 0;
}
.fh-fit-chart { width: 100%; height: 100%; display: block; }
.fh-fit-meals {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.fh-fit-add {
  display: grid;
  grid-template-columns: 1fr 4.2rem auto;
  gap: 0.3rem;
}
.fh-fit-suggest { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.3rem; }
.fh-fit-suggest textarea { min-height: 1.9rem; max-height: 3.2rem; resize: none; }
.fh-fit-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.fh-fit-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  align-items: center;
  padding: 0.22rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.78rem;
}
.fh-fit-list button.x {
  background: none;
  border: 0;
  color: #94a3b8;
  cursor: pointer;
}
.fh-fit-bar {
  height: 0.4rem;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.2rem 0 0.25rem;
}
.fh-fit-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #14b8a6, #fb7185);
  width: 0;
}
.fh-fit-bar.over > i { background: #f43f5e; }
.fh-fit-foods { position: relative; }
.fh-fit-dd {
  position: absolute;
  z-index: 20;
  left: 0; right: 0; top: 100%;
  background: #121826;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.5rem;
  max-height: 8rem;
  overflow: auto;
  display: none;
}
.fh-fit-dd.show { display: block; }
.fh-fit-dd button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  padding: 0.28rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.fh-fit-dd button:hover { background: rgba(13,148,136,0.15); }
.fh-fit-note { font-size: 0.68rem; color: #94a3b8; }
.fh-fit-tips {
  white-space: pre-wrap;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #cbd5e1;
  max-height: 3.5rem;
  overflow: auto;
}
[data-theme="light"] .fh-fit-card { background: #fff; }
[data-theme="light"] .fh-fit-dd { background: #fff; color: #0f172a; }

#fh-phone-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.85rem;
  background: rgba(13, 148, 136, 0.14);
  border-bottom: 1px solid rgba(45, 212, 191, 0.25);
  color: #99f6e4;
  font-size: 0.8rem;
  position: sticky;
  top: 0;
  z-index: 60;
}
#fh-phone-banner.show { display: flex; }
#fh-phone-banner a { color: #5eead4; font-weight: 600; text-decoration: underline; }
#fh-phone-banner button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  cursor: pointer;
}

body.fh-swipe-open { overflow: hidden; }
.fh-swipe {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0c111d;
  color: #e4e4e7;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.fh-swipe[hidden] { display: none !important; }
.fh-swipe-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  flex-shrink: 0;
}
.fh-swipe-bar button {
  background: rgba(255,255,255,0.06);
  border: 0;
  color: #e4e4e7;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-weight: 650;
  font-size: 0.8rem;
  cursor: pointer;
}
.fh-swipe-bar .slots { flex: 1; display: flex; gap: 0.25rem; justify-content: center; flex-wrap: wrap; }
.fh-swipe-bar .slots button { text-transform: capitalize; padding: 0.3rem 0.55rem; }
.fh-swipe-bar .slots button.on { background: rgba(244,63,94,0.25); color: #fda4af; }
.fh-swipe-deck {
  flex: 1;
  position: relative;
  margin: 0 0.9rem;
  min-height: 0;
}
.fh-swipe-card {
  position: absolute;
  inset: 0;
  border-radius: 1.15rem;
  overflow: hidden;
  background: #161d2e;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  touch-action: none;
}
.fh-swipe-card.back { transform: scale(0.96); opacity: 0.55; }
.fh-swipe-card.front { z-index: 2; }
.fh-swipe-card img { width: 100%; height: 52%; object-fit: cover; background: #111827; pointer-events: none; }
.fh-swipe-card .body { padding: 0.7rem 0.85rem; overflow: auto; flex: 1; }
.fh-swipe-card h2 { margin: 0 0 0.2rem; font-size: 1.15rem; }
.fh-swipe-card p { margin: 0 0 0.4rem; color: #94a3b8; font-size: 0.8rem; }
.fh-swipe-card ul { list-style: none; margin: 0; padding: 0; }
.fh-swipe-card li { display: flex; justify-content: space-between; gap: 0.4rem; font-size: 0.8rem; padding: 0.12rem 0; }
.fh-swipe-card em { font-style: normal; color: #94a3b8; }
.fh-swipe-card .cap { padding: 0.6rem; }
.fh-swipe-card .stamp {
  position: absolute;
  top: 1rem;
  padding: 0.2rem 0.55rem;
  border: 3px solid;
  border-radius: 0.4rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: rotate(-12deg);
}
.fh-swipe-card .stamp.like { left: 1rem; color: #34d399; border-color: #34d399; }
.fh-swipe-card .stamp.nope { right: 1rem; color: #fb7185; border-color: #fb7185; transform: rotate(12deg); }
.fh-swipe-card.like .stamp.like, .fh-swipe-card.nope .stamp.nope { opacity: 1; }
.fh-swipe-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.1rem;
  padding: 0.7rem 1rem 0.4rem;
  flex-shrink: 0;
}
.fh-swipe-actions button {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  border: 0;
  font-size: 1.25rem;
  cursor: pointer;
}
.fh-swipe-actions .nope { background: #3f1d2a; color: #fb7185; }
.fh-swipe-actions .like { background: #14332c; color: #34d399; }
.fh-swipe-actions .ghost {
  width: auto;
  height: auto;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: rgba(255,255,255,0.08);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 650;
}
.fh-swipe-empty {
  margin: auto;
  text-align: center;
  color: #94a3b8;
  padding: 2rem 1rem;
  line-height: 1.5;
}
.fh-swipe-empty button {
  margin-top: 0.7rem;
  background: rgba(244,63,94,0.2);
  color: #fda4af;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-weight: 650;
  cursor: pointer;
}
.fh-swipe-grid {
  overflow: auto;
  padding: 0.4rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.fh-swipe-match {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0.65rem;
  background: rgba(255,255,255,0.04);
  border-radius: 0.85rem;
  overflow: hidden;
}
.fh-swipe-match img, .fh-swipe-match .ph { width: 5.2rem; height: 5.2rem; object-fit: cover; background: #1e293b; }
.fh-swipe-match div { padding: 0.45rem 0.55rem 0.55rem 0; }
.fh-swipe-match strong { display: block; font-size: 0.88rem; }
.fh-swipe-match p { margin: 0.15rem 0 0.35rem; font-size: 0.72rem; color: #94a3b8; }
.fh-swipe-match button {
  background: rgba(244,63,94,0.2);
  color: #fda4af;
  border: 0;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
}
.fh-swipe-match button.ghost { background: rgba(255,255,255,0.06); color: #94a3b8; }
.fh-swipe-add {
  overflow: auto;
  padding: 0.75rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.fh-swipe-add label { font-size: 0.75rem; color: #94a3b8; }
.fh-swipe-add input, .fh-swipe-add textarea {
  width: 100%;
  margin-top: 0.2rem;
  background: #111827;
  border: 1px solid rgba(255,255,255,0.12);
  color: #e4e4e7;
  border-radius: 0.6rem;
  padding: 0.5rem 0.6rem;
  font-size: 1rem;
}
.fh-swipe-add button {
  background: rgba(244,63,94,0.25);
  color: #fda4af;
  border: 0;
  border-radius: 0.7rem;
  padding: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}
.fh-swipe-attr {
  text-align: center;
  font-size: 0.62rem;
  color: #64748b;
  padding: 0.2rem 0.6rem 0.55rem;
  flex-shrink: 0;
}
.fh-swipe-attr a { color: #94a3b8; }
.fh-fit-swipe-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
  background: rgba(244,63,94,0.2);
  color: #fda4af;
}

@media (min-width: 900px) {
  .fh-swipe {
    background: rgba(5, 7, 15, 0.78);
    align-items: stretch;
    justify-content: center;
    padding: 1.25rem 1.5rem;
  }
  .fh-swipe-bar {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
  }
  .fh-swipe-deck {
    width: 420px;
    height: 560px;
    max-height: calc(100vh - 11rem);
    margin: 0.6rem auto 0;
    flex: none;
  }
  .fh-swipe-card img { height: 240px; flex: none; }
  .fh-swipe-card .body { flex: 1; }
  .fh-swipe-actions {
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
  }
  .fh-swipe-grid, .fh-swipe-add, .fh-swipe-empty {
    max-width: 720px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  .fh-swipe-attr { max-width: 720px; margin: 0 auto; }
}
