/* ═══════════════════════════════════════════════════════════════════
   FITNESS MODULE · scoped under #page-fitness (+ body-level #fit-modal,
   #fit-timer). Driven entirely by the HR theme tokens so dark/light and
   the shipped mobile safe-area work apply for free. Mobile-first.
   ═══════════════════════════════════════════════════════════════════ */

#page-fitness {
  --fit-accent: var(--green);
  --fit-accent-soft: var(--green-soft);
  --fit-r: 16px;
  --fit-r-sm: 11px;
  --fit-gap: 14px;
}

.fit { max-width: 760px; margin: 0 auto; padding-bottom: 120px; }

/* ── Header ─────────────────────────────────────────────────────── */
.fit-top { margin-bottom: 18px; }
.fit-top-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.fit-title {
  font-size: 26px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--text); line-height: 1.1;
}
.fit-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.fit-admin { display: flex; flex-direction: column; gap: 4px; }
.fit-admin-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}
.fit-select {
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); border-radius: 10px; padding: 9px 12px;
  font-size: 13px; font-family: inherit; min-height: 40px; max-width: 220px;
}
.fit-select:focus { outline: none; border-color: var(--accent); }

/* ── View tabs (segmented) ──────────────────────────────────────── */
.fit-tabs {
  display: flex; gap: 4px; margin-top: 16px; padding: 4px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 13px; overflow-x: auto; scrollbar-width: none;
}
.fit-tabs::-webkit-scrollbar { display: none; }
.fit-tab {
  flex: 1 0 auto; min-width: 84px; min-height: 40px; padding: 8px 14px;
  border: none; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 700; font-family: inherit;
  border-radius: 10px; cursor: pointer; transition: .15s; white-space: nowrap;
}
.fit-tab:hover { color: var(--text-secondary); }
.fit-tab.is-active {
  background: var(--surface-elev); color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ── Generic blocks ─────────────────────────────────────────────── */
.fit-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--fit-r); padding: 16px; margin-bottom: var(--fit-gap);
  box-shadow: var(--shadow-xs);
}
.fit-card-h {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--muted); margin-bottom: 12px;
}
.fit-row { display: flex; align-items: center; gap: 10px; }
.fit-spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fit-muted { color: var(--muted); font-size: 13px; }
.fit-mono { font-family: 'DM Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

.fit-btn {
  appearance: none; border: 1px solid var(--border2);
  background: var(--surface2); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 16px; border-radius: 11px; cursor: pointer;
  min-height: 44px; transition: .15s; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px;
}
.fit-btn:hover { border-color: var(--border-strong); }
.fit-btn.is-primary {
  background: var(--accent); border-color: var(--accent);
  color: #fff;
}
.fit-btn.is-primary:hover { background: var(--accent-strong); }
.fit-btn.is-accent {
  background: var(--fit-accent); border-color: var(--fit-accent); color: #04140d;
}
.fit-btn.is-ghost { background: transparent; }
.fit-btn.is-danger { color: var(--red); border-color: var(--red-soft); background: transparent; }
.fit-btn.is-sm { min-height: 38px; padding: 8px 12px; font-size: 13px; }
.fit-btn[disabled] { opacity: .5; pointer-events: none; }
.fit-btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.fit-input, .fit-textarea {
  width: 100%; background: var(--bg-elev); border: 1px solid var(--border2);
  color: var(--text); border-radius: 10px; padding: 11px 13px;
  font-size: 15px; font-family: inherit; min-height: 44px;
}
.fit-textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.fit-input:focus, .fit-textarea:focus, .fit-select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Day header + day pills ─────────────────────────────────────── */
.fit-dayhead { margin-bottom: 14px; }
.fit-dayhead h2 {
  font-size: 22px; font-weight: 800; letter-spacing: -0.01em;
  color: var(--text);
}
.fit-dayhead .fit-tag {
  display: inline-block; margin-top: 6px; font-size: 12px;
  font-weight: 700; color: var(--fit-accent);
  background: var(--fit-accent-soft); padding: 4px 10px; border-radius: 999px;
}
.fit-pills {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px;
  margin-bottom: 6px; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.fit-pills::-webkit-scrollbar { display: none; }
.fit-pill {
  flex: 0 0 auto; scroll-snap-align: start;
  min-height: 44px; padding: 9px 16px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 13px; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: .15s;
}
.fit-pill .fit-pill-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--fit-accent); margin-left: 7px; vertical-align: middle;
}
.fit-pill.is-active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.fit-pill.is-rest { color: var(--muted); }

/* ── Exercise card ──────────────────────────────────────────────── */
.fit-ex {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--fit-r); padding: 16px; margin-bottom: 13px;
  box-shadow: var(--shadow-xs); transition: border-color .2s, background .2s;
}
.fit-ex.is-done {
  border-color: color-mix(in srgb, var(--fit-accent) 55%, transparent);
  background: linear-gradient(180deg, var(--fit-accent-soft), transparent);
}
.fit-ex-top { display: flex; align-items: flex-start; gap: 13px; }
.fit-ring {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  background:
    radial-gradient(closest-side, var(--surface) 79%, transparent 80% 100%),
    conic-gradient(var(--fit-accent) calc(var(--p, 0) * 1%), var(--surface3) 0);
  font-size: 12px; font-weight: 800; color: var(--text-secondary);
}
.fit-ex.is-done .fit-ring { color: var(--fit-accent); }
.fit-ex-name { flex: 1; font-size: 16px; font-weight: 700; line-height: 1.34; color: var(--text); }
.fit-ex-info {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border2); background: var(--surface2);
  color: var(--accent2); font-size: 15px; font-weight: 800;
  cursor: pointer; align-self: flex-start; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.fit-ex-info:hover { border-color: var(--accent); color: var(--accent); }
.fit-ex-info.is-empty { color: var(--muted-soft); }
.fit-ex-scheme {
  display: inline-block; margin-top: 4px; font-size: 13px;
  font-weight: 800; color: var(--fit-accent);
}
/* Per-set logging table — Set · Prev · kg · reps · ✓ */
.fit-settbl { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.fit-setrow {
  display: grid;
  grid-template-columns: 30px minmax(58px, 1fr) 1fr 1fr 46px;
  gap: 8px; align-items: center;
}
.fit-sethead {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding: 0 2px 2px;
}
.fit-setcell { font-variant-numeric: tabular-nums; }
.fit-setn {
  text-align: center; font-weight: 800; color: var(--text-secondary); font-size: 14px;
}
.fit-setprev {
  font-size: 12px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.fit-setin {
  min-height: 44px; padding: 8px 10px; text-align: center;
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.fit-setrow.is-done .fit-setin {
  border-color: color-mix(in srgb, var(--fit-accent) 45%, transparent);
  background: var(--fit-accent-soft);
}
.fit-setdone {
  min-height: 44px; min-width: 44px; border-radius: 12px; cursor: pointer;
  border: 2px solid color-mix(in srgb, var(--fit-accent) 50%, transparent);
  background: var(--surface2); color: var(--muted);
  font-size: 18px; font-weight: 800; transition: transform .1s, background .12s;
}
.fit-setdone:active { transform: scale(.92); }
.fit-setdone.is-done {
  background: var(--fit-accent); color: #04140d; border-color: var(--fit-accent);
}

.fit-finish {
  margin-top: 6px; padding: 13px; border-radius: 12px;
  background: var(--surface2); border: 1px dashed var(--border2);
  font-size: 13px; color: var(--text-secondary); text-align: center; font-weight: 600;
}
.fit-restday { text-align: center; padding: 54px 20px; color: var(--muted); }
.fit-restday .fit-rest-emoji { font-size: 46px; margin-bottom: 14px; }
.fit-restday b { color: var(--text); display: block; font-size: 18px; margin-bottom: 6px; }

.fit-restset {
  display: flex; align-items: center; gap: 10px; margin: 8px 0 16px;
  font-size: 12px; color: var(--muted);
}
.fit-restset .fit-select { padding: 7px 10px; min-height: 38px; }

/* ── Progress bar / day footer ──────────────────────────────────── */
.fit-progress {
  position: sticky; bottom: 12px; margin: 18px auto 0; max-width: 760px;
  background: var(--surface-elev); border: 1px solid var(--border2);
  border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 11px;
}
.fit-progress-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 11px; border-top: 1px solid var(--border);
}
.fit-sess { display: flex; align-items: center; gap: 12px; }
.fit-sess-main { flex: 1; min-width: 0; }
.fit-sess-lbl {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted);
}
.fit-sess-time { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.15; }
.fit-sess.is-paused .fit-sess-time { color: var(--muted); }
.fit-sess.is-done .fit-sess-lbl { color: var(--fit-accent); }
.fit-sess.is-done .fit-sess-time { font-size: 15px; font-weight: 700; color: var(--text-secondary); }
.fit-sess .fit-btn { flex: 0 0 auto; }
.fit-progress-track {
  flex: 1; height: 8px; border-radius: 5px; background: var(--surface3);
  overflow: hidden;
}
.fit-progress-track > span {
  display: block; height: 100%; background: var(--fit-accent);
  transition: width .25s ease;
}
.fit-progress-num { font-size: 13px; color: var(--text-secondary); font-weight: 700; white-space: nowrap; }
.fit-progress-num b { color: var(--fit-accent); }

/* ── Summary / stats ────────────────────────────────────────────── */
.fit-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fit-stat {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 13px; padding: 14px;
}
.fit-stat-k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.fit-stat-v { font-size: 24px; font-weight: 800; color: var(--fit-accent); margin-top: 6px; font-variant-numeric: tabular-nums; }
.fit-prow { padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.fit-prow:last-child { border-bottom: none; }
.fit-prow .fit-pn { font-weight: 700; color: var(--text); }
.fit-prow .fit-pv { color: var(--muted); margin-top: 3px; }
.fit-prow .fit-up { color: var(--fit-accent); font-weight: 800; }
.fit-spark { width: 100%; height: 42px; display: block; margin-top: 8px;
  background: var(--surface2); border-radius: 9px; }
.fit-bar { height: 8px; border-radius: 5px; background: var(--surface3); overflow: hidden; margin-top: 7px; }
.fit-bar > span { display: block; height: 100%; background: var(--fit-accent); }

/* ── Body gauges ────────────────────────────────────────────────── */
.fit-gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fit-gauge {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 13px; padding: 14px; text-align: center;
}
.fit-gauge-v { font-size: 26px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.fit-gauge-k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 4px; font-weight: 700; }
.fit-gauge-x { font-size: 11px; color: var(--muted-soft); margin-top: 4px; }
.fit-field { margin-bottom: 12px; }
.fit-field label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin-bottom: 6px;
}

/* ── Plans list ─────────────────────────────────────────────────── */
.fit-plan {
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  padding: 14px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 13px; margin-bottom: 10px;
}
.fit-plan.is-active { border-color: color-mix(in srgb, var(--fit-accent) 50%, transparent); }
.fit-plan-main { min-width: 0; }
.fit-plan-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.fit-plan-actions .fit-btn { flex: 1 1 auto; min-width: 92px; }
.fit-plan-title { font-size: 15px; font-weight: 700; color: var(--text); }
.fit-plan-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.fit-badge {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; padding: 3px 8px; border-radius: 999px;
  background: var(--fit-accent-soft); color: var(--fit-accent);
}
.fit-source-chip {
  font-size: 10px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border2); border-radius: 999px; padding: 2px 7px;
}
.fit-new-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fit-new-tile {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 16px; border-radius: 13px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border2);
  text-align: left; color: var(--text); font-family: inherit; min-height: 92px;
}
.fit-new-tile:hover { border-color: var(--accent); }
.fit-new-tile b { font-size: 14px; font-weight: 700; }
.fit-new-tile span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.fit-new-tile .fit-new-ico { font-size: 20px; }

/* ── Empty / skeleton ───────────────────────────────────────────── */
.fit-empty {
  text-align: center; padding: 44px 22px; color: var(--muted);
  border: 1px dashed var(--border2); border-radius: var(--fit-r);
  background: var(--surface);
}
.fit-empty .fit-empty-ico { font-size: 44px; margin-bottom: 12px; }
.fit-empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.fit-empty p { font-size: 13px; line-height: 1.55; margin-bottom: 18px; }
.fit-skeleton { padding: 8px 0; }
.fit-sk-line, .fit-sk-card {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 37%, var(--surface2) 63%);
  background-size: 400% 100%; animation: fit-sh 1.4s ease infinite;
  border-radius: 12px;
}
.fit-sk-line { height: 26px; width: 50%; margin-bottom: 16px; }
.fit-sk-card { height: 96px; margin-bottom: 13px; }
@keyframes fit-sh { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.fit-disclaimer {
  font-size: 11px; color: var(--muted); text-align: center;
  margin-top: 10px; line-height: 1.5;
}
.fit-warn {
  background: var(--red-soft); border: 1px solid var(--red-soft);
  color: var(--text); border-radius: 12px; padding: 12px 14px;
  font-size: 13px; line-height: 1.5; margin-bottom: 14px;
}
.fit-warn b { color: var(--red); }
.fit-parq-ok, .fit-parq-flag {
  font-size: 12px; font-weight: 700; border-radius: 10px;
  padding: 9px 12px; margin: 6px 0 4px;
}
.fit-parq-ok { color: var(--fit-accent); background: var(--fit-accent-soft); }
.fit-parq-flag { color: var(--red); background: var(--red-soft); }

.fit-job-banner {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600; line-height: 1.4;
  border: 1px solid var(--border2); border-radius: 12px;
  padding: 12px 14px; margin: 0 0 14px;
  background: var(--surface2); color: var(--text-secondary);
}
.fit-job-banner[hidden] { display: none; }
.fit-job-banner .fit-job-ico { flex: 0 0 auto; font-size: 16px; }
.fit-job-banner.is-working {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft); color: var(--text);
}
.fit-job-banner.is-done {
  border-color: color-mix(in srgb, var(--fit-accent) 50%, transparent);
  background: var(--fit-accent-soft); color: var(--text);
}
.fit-job-banner.is-error { background: var(--red-soft); color: var(--text); }
.fit-job-banner.is-error .fit-job-ico { color: var(--red); }

/* ═══ Body-level: rest timer (fixed) ═══════════════════════════════
   Lives at body level (sibling of #app) NOT inside .page — a
   position:fixed child of .page is trapped by .page's persistent
   transform (same reason as #task-detail-modal).                    */
.fit-timer {
  position: fixed; left: 0; right: 0;
  bottom: 0; z-index: 1200;
  background: var(--surface-elev);
  border-top: 1px solid var(--border2);
  box-shadow: 0 -12px 32px rgba(0,0,0,.30);
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 16px;
}
.fit-timer[hidden] { display: none; }
.fit-timer-dial {
  flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(closest-side, var(--surface-elev) 76%, transparent 78%),
    conic-gradient(var(--fit-accent) calc(var(--tp,100) * 1%), var(--surface3) 0);
}
.fit-timer-time {
  font-size: 22px; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums; font-family: 'DM Mono', ui-monospace, monospace;
}
.fit-timer-body { flex: 1; }
.fit-timer-lbl {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted);
}
.fit-timer-btns { display: flex; gap: 8px; }
.fit-timer-btns button {
  min-height: 44px; min-width: 52px; border-radius: 11px;
  border: 1px solid var(--border2); background: var(--surface2);
  color: var(--text); font-weight: 700; font-size: 14px;
  font-family: inherit; cursor: pointer;
}
.fit-timer-btns .fit-skip {
  background: var(--fit-accent); border-color: var(--fit-accent); color: #04140d;
}

/* ═══ Body-level: modal ════════════════════════════════════════════ */
.fit-modal-backdrop {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(4,6,12,.66); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; overflow-y: auto;
}
.fit-modal-backdrop[hidden] { display: none; }
.fit-modal {
  background: var(--surface); width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--border2); border-bottom: none;
  box-shadow: var(--shadow-xl);
  max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.fit-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 18px 12px; flex: 0 0 auto;
}
.fit-modal-title { font-size: 18px; font-weight: 800; color: var(--text); }
.fit-modal-close {
  appearance: none; border: none; background: var(--surface2);
  color: var(--text-secondary); width: 36px; height: 36px;
  border-radius: 50%; font-size: 18px; cursor: pointer; flex: 0 0 auto;
}
.fit-modal-body { padding: 0 18px 18px; overflow-y: auto; flex: 1 1 auto; }
.fit-modal-foot {
  display: flex; gap: 10px; padding: 14px 18px 18px;
  border-top: 1px solid var(--border); flex: 0 0 auto;
}
.fit-modal-foot .fit-btn { flex: 1; }

.fit-step-h { font-size: 13px; font-weight: 800; color: var(--text); margin: 16px 0 10px; }
.fit-step-h:first-child { margin-top: 4px; }
.fit-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.fit-chip {
  padding: 9px 13px; border-radius: 999px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
  min-height: 40px; display: inline-flex; align-items: center;
  font-family: inherit;
}
.fit-chip.is-on {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--text);
}
.fit-preview {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; max-height: 320px; overflow-y: auto;
}
.fit-preview-day { margin-bottom: 14px; }
.fit-preview-day b { color: var(--text); font-size: 14px; }
.fit-preview-day ul { margin: 6px 0 0; padding-left: 18px; }
.fit-preview-day li { font-size: 13px; color: var(--text-secondary); margin: 3px 0; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 540px) {
  .fit-title { font-size: 22px; }
  .fit-stat-grid, .fit-gauges, .fit-new-grid { grid-template-columns: 1fr 1fr; }
  .fit-admin { width: 100%; }
  .fit-select { max-width: none; width: 100%; }
}
/* The rest timer is a focused, transient full-width bar — suppress the
   global bottom-right "Ask AI" launcher while it's up so its controls
   (incl. Skip) are never occluded. Reversible: a body class toggled by
   fitness.js only for the duration of the rest period. */
body.fit-rest-active #ai-chat-fab { display: none !important; }
@media (max-width: 380px) {
  .fit-setrow { grid-template-columns: 26px minmax(46px, .9fr) 1fr 1fr 42px; gap: 6px; }
  .fit-setin { padding: 8px 6px; font-size: 14px; }
  .fit-new-grid { grid-template-columns: 1fr; }
}

/* Light theme: the accent "done" fill needs darker ink. */
body[data-theme="light"] #page-fitness .fit-setdone.is-done,
body[data-theme="light"] .fit-btn.is-accent,
body[data-theme="light"] .fit-timer-btns .fit-skip { color: #053d29; }

/* ── Calendar ───────────────────────────────────────────────────── */
.fit-cal { display: block; }
.fit-cal-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.fit-cal-bar { display: flex; align-items: center; gap: 10px; }
.fit-cal-mlabel {
  font-size: 16px; font-weight: 800; color: var(--text);
  min-width: 130px; text-align: center;
}
.fit-iconbtn {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto;
  border: 1px solid var(--border2); background: var(--surface2);
  color: var(--text); font-size: 18px; line-height: 1; cursor: pointer;
}
.fit-iconbtn:hover { border-color: var(--fit-accent); }
.fit-iconbtn[disabled] { opacity: .35; pointer-events: none; }
.fit-seg {
  display: flex; gap: 4px; padding: 4px; border-radius: 11px;
  background: var(--surface2); border: 1px solid var(--border);
}
.fit-segbtn {
  min-height: 34px; padding: 6px 16px; border: none; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 13px;
  font-weight: 700; font-family: inherit; border-radius: 8px;
}
.fit-segbtn.is-on {
  background: var(--surface-elev); color: var(--text);
  box-shadow: var(--shadow-xs);
}

.fit-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px;
}
.fit-cal-dow {
  text-align: center; font-size: 10px; font-weight: 800;
  color: var(--muted); text-transform: uppercase; padding-bottom: 2px;
}
.fit-cal-cell {
  position: relative; aspect-ratio: 1 / 1; min-height: 42px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface2); color: var(--text-secondary);
  font-family: inherit; cursor: pointer; padding: 0;
  display: flex; align-items: flex-start; justify-content: flex-start;
}
.fit-cal-cell.is-empty {
  border-color: transparent; background: transparent; cursor: default;
}
.fit-cal-cell[data-empty] { cursor: default; }
.fit-cal-dn { font-size: 12px; font-weight: 700; padding: 5px 0 0 6px; }
.fit-cal-cell.is-today { outline: 2px solid var(--fit-accent); outline-offset: -2px; }
.fit-cal-dot {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85;
}
.fit-cal-badge {
  position: absolute; bottom: 4px; right: 5px; font-size: 10px;
  font-weight: 800; line-height: 1; padding: 2px 5px; border-radius: 999px;
  background: var(--surface-elev); color: var(--text);
}
/* Heat scale — shared by month cells and the per-person strip. */
.fit-cal-cell.h0 {}
.fit-cal-cell.h1 { background: color-mix(in srgb, var(--fit-accent) 20%, var(--surface2)); }
.fit-cal-cell.h2 { background: color-mix(in srgb, var(--fit-accent) 42%, var(--surface2)); }
.fit-cal-cell.h3 { background: color-mix(in srgb, var(--fit-accent) 66%, var(--surface2)); color: #04140d; }
.fit-cal-cell.h4 { background: var(--fit-accent); color: #04140d; border-color: var(--fit-accent); }
.fit-cal-cell.h3 .fit-cal-badge, .fit-cal-cell.h4 .fit-cal-badge { background: rgba(255,255,255,.85); color: #04140d; }

.fit-cal-legend {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 4px; margin-top: 12px; font-size: 10.5px; color: var(--muted);
}
.fit-cal-foot {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.fit-cal-foot b { color: var(--fit-accent); font-weight: 800; font-size: 16px; }
.fit-cal-load { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }

/* Per-person heatmap (Team) */
.fit-cal-sec {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); margin: 22px 0 12px;
}
.fit-heat { display: flex; flex-direction: column; gap: 7px; }
.fit-heat-row { display: flex; align-items: center; gap: 10px; }
.fit-heat-name {
  flex: 0 0 88px; width: 88px; font-size: 12px; font-weight: 700;
  color: var(--text); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.fit-heat-cells {
  display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none;
  padding-bottom: 2px;
}
.fit-heat-cells::-webkit-scrollbar { display: none; }
.fit-heat-c {
  flex: 0 0 auto; width: 13px; height: 13px; border-radius: 3px;
  background: var(--surface3); display: inline-block;
}
.fit-heat-c.h0 { background: var(--surface3); }
.fit-heat-c.h1 { background: color-mix(in srgb, var(--fit-accent) 28%, var(--surface3)); }
.fit-heat-c.h2 { background: color-mix(in srgb, var(--fit-accent) 50%, var(--surface3)); }
.fit-heat-c.h3 { background: color-mix(in srgb, var(--fit-accent) 72%, var(--surface3)); }
.fit-heat-c.h4 { background: var(--fit-accent); }

/* Calendar day modal */
.fit-daylist { display: block; }
.fit-cal-dur {
  font-size: 13px; font-weight: 700; color: var(--fit-accent);
  margin-bottom: 10px;
}
.fit-you {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--fit-accent);
  background: var(--fit-accent-soft); padding: 2px 7px;
  border-radius: 999px; margin-left: 6px;
}
@media (max-width: 380px) {
  .fit-cal-grid { gap: 4px; }
  .fit-cal-cell { min-height: 38px; }
  .fit-cal-dn { font-size: 11px; padding: 4px 0 0 5px; }
  .fit-heat-name { flex-basis: 70px; width: 70px; }
}
