/* Client app layout. Shared tokens and form styles live in ../styles.css. */
body.app {
  background: var(--sky);
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--brand-blue);
  color: var(--white);
}

.topbar img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.topbar .title {
  font-weight: 800;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .sub {
  font-size: 13px;
  font-weight: 600;
}

.topbar button {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

main.screen {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

main.screen > * + * {
  margin-top: 14px;
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
}

.tabs a svg {
  width: 24px;
  height: 24px;
}

.tabs a[aria-current='page'] {
  color: var(--brand-blue);
}

.tabs a[aria-current='page']::after {
  content: '';
  width: 24px;
  height: 3px;
  border-radius: 3px;
  background: var(--brand-blue);
}

@media (max-width: 420px) {
  .tabs a { font-size: 10px; padding-inline: 1px; }
  .tabs a svg { width: 21px; height: 21px; }
}

/* Training plan */
.training-intro,
.supp-intro {
  padding: 20px;
  border-radius: 16px;
  background: var(--brand-blue);
  color: var(--white);
}

.training-intro .kicker,
.supp-intro .kicker { color: var(--white); opacity: 0.8; }
.training-intro h2,
.supp-intro h2 { margin: 4px 0 8px; color: var(--white); }
.training-intro p,
.supp-intro p { margin-bottom: 0; }
.training-today {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
}
.training-today span { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.training-today strong { font-size: 17px; }
.training-days { display: grid; gap: 10px; }
.training-day { padding: 0; overflow: hidden; }
.training-day summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}
.training-day summary::-webkit-details-marker { display: none; }
.training-day summary > span:nth-child(2) { flex: 1; }
.training-day summary strong,
.training-day summary small { display: block; }
.training-day summary small { margin-top: 2px; color: #5e6b7e; font-size: 13px; }
.training-day summary em { color: var(--brand-blue); font-size: 12px; font-style: normal; font-weight: 800; }
.day-pill {
  min-width: 58px;
  padding: 7px 8px;
  border-radius: 8px;
  background: var(--sky);
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.training-day[open] summary { border-bottom: 1px solid var(--line); }
.training-details { padding: 4px 14px 14px; }
.training-exercises { list-style: none; padding: 0; margin: 0; }
.training-exercise { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.training-exercise:last-child { border-bottom: 0; }
.exercise-map { position: relative; flex: none; width: 54px; }
.exercise-map .exercise-count { position: absolute; top: 0; left: 0; width: 20px; height: 20px; font-size: 11px; box-shadow: 0 0 0 2px #fff; }
.exercise-map svg.mx { width: 54px; margin-top: 2px; }
.exercise-muscles { margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--brand-blue); }
.exercise-count {
  display: grid;
  place-items: center;
  flex: none;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--sky);
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 800;
}
.exercise-meta { margin-top: 3px; font-size: 13px; color: #5e6b7e; }
.exercise-note { margin: 5px 0 0; font-size: 13px; }
.training-session-note { margin: 8px 0 0; padding: 10px; border-radius: 8px; background: var(--sky); font-size: 13px; }

/* Workbook-inspired supplement guide */
.supp-intro { background: #2747f5; }
.supp-intro p:last-child { line-height: 1.55; }
.supp-grid { display: grid; gap: 12px; }
@media (min-width: 620px) { .supp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.supp-card { margin: 0; border-top: 4px solid #2747f5; }
.supp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.supp-priority { padding: 4px 9px; border-radius: 999px; background: #e8ecff; color: #2747f5; font-size: 12px; font-weight: 800; }
.supp-evidence { color: #5e6b7e; font-size: 12px; font-weight: 700; }
.supp-card h3 { margin: 10px 0 12px; color: #2747f5; }
.supp-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.supp-facts div { padding: 9px; border-radius: 8px; background: #e8ecff; }
.supp-facts span,
.supp-facts strong { display: block; }
.supp-facts span { margin-bottom: 3px; color: #5e6b7e; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.supp-facts strong { font-size: 13px; line-height: 1.4; }
.supp-card > p { margin: 12px 0 0; color: #5e6b7e; font-size: 13px; line-height: 1.5; }
.supp-source { color: #5e6b7e; font-size: 12px; line-height: 1.5; }
.assigned-supps { display: grid; gap: 12px; }
.assigned-supps h2 { margin: 0; }
.supp-coach-note { white-space: pre-wrap; }

.coach-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.coach-shortcuts a { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--navy); border-top: 4px solid var(--brand-blue); }
.coach-shortcuts b { color: var(--brand-blue); font-size: 17px; }
.coach-shortcuts span { font-size: 13px; }
.coach-editor-intro h2 { margin-bottom: 8px; }
.coach-editor-intro p:last-of-type { margin-top: 0; }
.coach-editor-intro button + button { margin-left: 8px; }
.coach-preview { display: grid; gap: 12px; }
@media (max-width: 560px) {
  .coach-shortcuts { grid-template-columns: 1fr; }
}

/* Segmented choice buttons (Trained? / Meal plan? / 1-10 scales) */
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choices input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.choices label {
  margin: 0;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 14px;
  border: 1px solid #8fa6c8;
  border-radius: 999px;
  background: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
}

.choices input:checked + label {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: var(--white);
}

.choices input:focus-visible + label {
  outline: 3px solid var(--sand);
  outline-offset: 2px;
}

.choices.scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.scale label {
  padding: 8px 0;
  min-width: 0;
}

.metrics {
  list-style: none;
  margin: 0;
  padding: 0;
}

.metric {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.metric:last-child {
  border-bottom: 0;
}

.metric-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 15px;
}

.metric-nums {
  font-variant-numeric: tabular-nums;
  margin: 2px 0 6px;
}

.metric-nums span {
  font-size: 14px;
}

.daybar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.daybar h2 {
  margin: 0;
  font-size: 20px;
  text-align: center;
}

.daybar .btn {
  min-width: 48px;
  padding: 0 14px;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.week-strip a {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  border-radius: 10px;
  text-decoration: none;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  background: var(--white);
  border: 1px solid var(--line);
}

.week-strip a .dot {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  border: 1.5px solid var(--navy);
}

.week-strip a.done .dot {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

.week-strip a[aria-current='date'] {
  border: 2px solid var(--brand-blue);
}

.week-strip a.future {
  opacity: 0.45;
  pointer-events: none;
}

.targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 14px;
}

.targets b {
  font-weight: 800;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 560px) {
  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tile {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.tile .k {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tile .v {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  position: relative; /* keeps visually hidden labels inside the scroll area */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

th,
td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td.wrap-text {
  white-space: normal;
  min-width: 180px;
}

.bar {
  height: 8px;
  border-radius: 8px;
  background: var(--sky);
  overflow: hidden;
  min-width: 70px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--brand-blue);
}

.status {
  font-weight: 800;
  font-size: 13px;
}

.status.good {
  color: var(--good);
}

.status.warn {
  color: var(--warn);
}

.status.bad {
  color: var(--bad);
}

.chart {
  width: 100%;
  height: auto;
}

.chart text {
  font-size: 12px;
  fill: var(--navy);
}

.photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.photo-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}

.photo-slot .frame {
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  border: 2px dashed #8fa6c8;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-slot .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-slot input[type='file'] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.photo-slot label.btn {
  margin: 0;
  font-size: 14px;
}

.client-list {
  display: grid;
  gap: 10px;
}

.client-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  text-decoration: none;
  color: var(--navy);
}

.client-row .name {
  font-weight: 800;
  font-size: 17px;
}

.client-row .meta {
  font-size: 14px;
}

.flag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--sand);
  color: var(--navy);
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 2px;
}

.subtabs a {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--navy);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.subtabs a[aria-current='page'] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.feedback {
  background: var(--sky);
  border-left: 4px solid var(--brand-blue);
  border-radius: 8px;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  box-shadow: var(--shadow);
}

.toast.error {
  background: var(--bad);
}

.center {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin-bottom: 16px;
}

.muted-box {
  background: var(--sky);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ===================================================================== */
/* 2026-10 redesign: client home, habit tracker, coach hub, coach CRM     */
/* ===================================================================== */

body.app { background: linear-gradient(180deg, #eef4fe 0, var(--sky) 240px); }
.topbar { background: linear-gradient(120deg, #2444f9, #1a33c9); box-shadow: 0 6px 20px rgba(36, 68, 249, 0.25); }
.topbar .sub { opacity: 0.85; }
.avatar {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.18); border: 1.5px solid rgba(255, 255, 255, 0.6);
  color: var(--white); font-weight: 800; text-decoration: none;
}
.card { border-radius: 16px; border-color: #dbe6f7; }
.tabs { box-shadow: 0 -6px 20px rgba(11, 37, 69, 0.06); }
.tabs a[aria-current='page'] svg { background: #e8edff; border-radius: 10px; padding: 2px; }
.tabs a[aria-current='page']::after { display: none; }

.date-stepper {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center;
  padding: 4px; border-radius: 999px; background: var(--white); border: 1px solid #dbe6f7;
}
.date-stepper a, .date-stepper span { display: grid; place-items: center; height: 40px; border-radius: 50%; font-size: 22px; color: var(--brand-blue); text-decoration: none; }
.date-stepper a:hover { background: var(--sky); }
.date-stepper b { font-size: 15px; }

.checkin-row { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--navy); }
.checkin-row > span:nth-child(2) { flex: 1; min-width: 0; }
.checkin-row b, .checkin-row small { display: block; }
.checkin-row small { color: var(--ink-2); font-size: 13px; }
.chev { color: #9aa8bd; font-size: 22px; line-height: 1; }
.coach-note { border-left: 4px solid var(--brand-blue); }
.coach-note > div { white-space: pre-wrap; }

.panel { background: var(--white); border: 1px solid #dbe6f7; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.panel-banner { position: relative; padding: 18px 16px 16px; color: var(--white); background: linear-gradient(120deg, #0b2545 0%, #1a33c9 100%); overflow: hidden; }
.panel-banner::after {
  content: ''; position: absolute; right: -30px; top: -40px; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%);
}
.panel-banner.nutrition { background: linear-gradient(120deg, #1a33c9 0%, #2444f9 60%, #5b8cff 100%); }
.panel-banner.recovery { background: linear-gradient(120deg, #0b2545 0%, #2a5bd7 100%); }
.panel-banner h2 { margin: 0; font-size: 20px; }
.panel-banner p { margin: 2px 0 0; font-size: 13px; opacity: 0.85; }
.panel-body { padding: 4px 14px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #edf2fb; }
.prow:last-child { border-bottom: 0; }
.prow-text { flex: 1; min-width: 0; }
.prow-text b, .prow-text small { display: block; }
.prow-text small { color: var(--ink-2); font-size: 12px; }
.prow-val { flex: 0 0 44%; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; }
.prow-val i { font-style: normal; font-weight: 600; color: var(--ink-2); font-size: 12px; }
.pbar { height: 7px; margin-top: 6px; border-radius: 99px; background: #e8eef9; overflow: hidden; }
.pbar span { display: block; height: 100%; border-radius: 99px; background: #c3cfe3; transition: width 0.4s ease; }
.pbar.good span { background: var(--hit); }
.pbar.warn span { background: var(--close); }
.pbar.bad span { background: var(--off); }

.habit-icon {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: #eef3ff; border: 1px solid #dde6fb; font-size: 19px; color: var(--brand-blue);
}
.habit-icon svg { width: 22px; height: 22px; }
.habit-icon.sm { display: inline-grid; width: 26px; height: 26px; border-radius: 8px; font-size: 14px; margin-right: 8px; vertical-align: middle; }

.state { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; color: var(--white); }
.state svg { width: 18px; height: 18px; }
.state.empty { border: 2px solid #b8c4d6; background: var(--white); }
.state.good { background: var(--hit); }
.state.warn { background: var(--close); }
.state.bad { background: var(--off); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--white); border: 1px solid #dbe6f7; }
.segmented a { padding: 9px; border-radius: 999px; text-align: center; font-weight: 700; font-size: 14px; color: var(--navy); text-decoration: none; }
.segmented a[aria-selected='true'] { background: var(--brand-blue); color: var(--white); }
.section-label { margin: 18px 0 6px !important; font-size: 13px; font-weight: 800; color: var(--ink-2); }

.habit-list { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid #dbe6f7; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.habit + .habit { border-top: 1px solid #edf2fb; }
.habit-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: none; font: inherit; color: var(--navy); text-align: left; cursor: pointer; }
.habit-row:hover { background: #f7faff; }
.habit-text { flex: 1; min-width: 0; }
.habit-text b, .habit-text small { display: block; }
.habit-text small { color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.habit-row[aria-expanded='true'] .chev { transform: rotate(90deg); }
.habit-entry { padding: 0 14px 14px 66px; }
.entry-row { display: flex; gap: 8px; }
.entry-row input { flex: 1; }

table.habit-week th:first-child { min-width: 170px; white-space: normal; text-transform: none; letter-spacing: 0; font-size: 14px; }
table.habit-week th small { display: block; margin-left: 34px; color: var(--ink-2); font-weight: 600; font-size: 11px; }
table.habit-week td, table.habit-week thead th { text-align: center; }
table.habit-week thead th:first-child { text-align: left; }
.hits { font-weight: 800; }
.dot-s { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; background: #dbe3ef; }
.dot-s.good { background: var(--hit); }
.dot-s.warn { background: var(--close); }
.dot-s.bad { background: var(--off); }
.dot-s.empty { background: var(--white); border: 2px solid #c3cfe3; }
.dot-s.future { background: transparent; border: 2px dashed #dbe3ef; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 10px 0 0; font-size: 12px; color: var(--ink-2); }
.legend .dot-s { margin-right: -8px; }
.own-habits { list-style: none; margin: 0; padding: 0; }
.own-habits li { display: flex; align-items: center; gap: 4px; padding: 8px 0; border-bottom: 1px solid #edf2fb; }
.own-habits li > span:nth-child(2) { flex: 1; }
.own-habits small { display: block; color: var(--ink-2); font-size: 12px; }
.hub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

/* ----- Coach CRM ----- */
body.crm-body { background: #f3f6fb; padding-bottom: 0 !important; }
.crm { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.crm.with-sections { grid-template-columns: 220px 210px minmax(0, 1fr); }
.crm-rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; background: var(--navy); color: #c9d6ea; }
.crm-brand { display: flex; align-items: center; gap: 10px; margin: 0 6px 18px; color: var(--white) !important; font-weight: 800; text-decoration: none; }
.crm-brand img { width: 34px; height: 34px; border-radius: 9px; }
.crm-brand small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #8fb0ff; }
.crm-rail > a:not(.crm-brand) { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #c9d6ea; text-decoration: none; font-weight: 700; font-size: 14px; }
.crm-rail > a svg { width: 20px; height: 20px; }
.crm-rail > a:hover { background: rgba(255, 255, 255, 0.06); }
.crm-rail > a[aria-current='page'] { background: var(--brand-blue); color: var(--white); }
.crm-signout { margin-top: auto; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 10px; background: none; color: #c9d6ea; font: inherit; font-size: 14px; cursor: pointer; }
.crm-sections { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; background: var(--white); border-right: 1px solid #e3eaf5; }
.crm-sections a { padding: 9px 12px; border-radius: 9px; color: var(--navy); text-decoration: none; font-size: 14px; font-weight: 600; }
.crm-sections a:hover { background: var(--sky); }
.crm-sections a[aria-current='page'] { background: var(--navy); color: var(--white); }
.crm-back { margin-bottom: 10px; font-weight: 800 !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-settings { margin-top: auto; border-top: 1px solid #e3eaf5; border-radius: 0 !important; padding-top: 14px !important; }
.crm-main { min-width: 0; padding: 0 24px 40px; }
.crm-main > * + * { margin-top: 14px; }
.crm-head { position: sticky; top: 0; z-index: 4; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 0 -24px; padding: 16px 24px 12px; background: rgba(243, 246, 251, 0.94); backdrop-filter: blur(6px); border-bottom: 1px solid #e3eaf5; }
.crm-head h1 { margin: 0; font-size: 22px; }
.crm-head p { margin: 0; color: var(--ink-2); font-size: 14px; }
.crm-sub { margin: 22px 0 0 !important; font-size: 16px; }
.crm-tabs { display: flex; gap: 22px; border-bottom: 1px solid #e3eaf5; }
.crm-tabs a { padding: 8px 0; color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.crm-tabs a[aria-current='page'] { color: var(--navy); border-color: var(--brand-blue); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card { padding: 14px 16px; background: var(--white); border: 1px solid #e3eaf5; border-radius: 12px; }
.stat-card .k { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.stat-card .v { margin-top: 6px; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-card .v .delta { margin-left: 8px; font-size: 13px; }
.stat-card .s { margin-top: 2px; font-size: 12px; color: var(--ink-2); }
.delta { font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.delta.good { color: var(--hit); }
.delta.bad { color: var(--off); }
.table-card { padding: 0; overflow: hidden; }
.crm-table th { background: #f7f9fd; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink-2); }
.crm-table th, .crm-table td { padding: 12px 16px; border-color: #edf2fb; }
.crm-table tbody tr:hover { background: #f7faff; }
.cell-status { display: inline-flex; align-items: center; gap: 8px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid #edf2fb; font-size: 13px; color: var(--ink-2); }
.pager-btns { display: inline-flex; align-items: center; gap: 8px; }
.pager .btn { min-height: 32px; min-width: 32px; padding: 0 10px; }
.pager .btn:disabled { opacity: 0.35; cursor: default; }
.crm .client-list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.crm .subtabs { display: none; }

@media (max-width: 900px) {
  .crm, .crm.with-sections { grid-template-columns: 1fr; }
  .crm-rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 12px; }
  .crm-brand { margin: 0 auto 0 0; }
  .crm-rail > a:not(.crm-brand) span { display: none; }
  .crm-signout { margin-top: 0; padding: 6px 10px; }
  .crm-sections { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px 10px; border-right: 0; border-bottom: 1px solid #e3eaf5; }
  .crm-sections a { flex: none; }
  .crm-back, .crm-settings { margin: 0 !important; border: 0 !important; padding-top: 9px !important; }
  .crm-main { padding: 0 16px 32px; }
  .crm-head { margin: 0 -16px; padding: 12px 16px; position: static; }
}

/* ===================================================================== */
/* 2026-10 v2: restyle to Abhey's reference (clean white phone UI, big    */
/* numbers, dark pills, soft gradient hero) in the Rewired blue and sand. */
/* ===================================================================== */

@font-face { font-family: 'Montserrat'; src: url('../assets/fonts/montserrat-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  --display: 'Montserrat', var(--font);
  --bg-app: #f4f6fa;
  --blue-2: #5b74ff;
  --muted: #8a96a8;
  --hair: #e6eaf2;
  --soft: 0 1px 2px rgba(11, 37, 69, 0.04), 0 10px 30px rgba(11, 37, 69, 0.06);
}
body.app { background: var(--bg-app); }
body.app[data-tab='home'] {
  background: linear-gradient(180deg, #2444f9 0, #4c66fb 140px, #9fb0ff 290px, #e1e8fd 430px, var(--bg-app) 560px) no-repeat, var(--bg-app);
}
body.app h1, body.app h2, body.app h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }
body.app .card { border: 0; border-radius: 22px; box-shadow: var(--soft); }
body.app .kicker { font-size: 11.5px; letter-spacing: 0.1em; }

/* top bar: two square icon buttons and a centred title */
.topbar { position: relative; max-width: 720px; margin: 0 auto; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 4px; background: none; box-shadow: none; color: var(--navy); }
body.app[data-tab='home'] .topbar { color: var(--white); }
.topbar .title { text-align: center; font: 600 16px/1.25 var(--display); white-space: normal; }
.topbar .sub { margin-top: 1px; font: 500 12px var(--font); color: var(--ink-2); opacity: 1; }
.topbar .icon-btn { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 14px; background: var(--white); border: 1px solid var(--hair); color: var(--navy); font-weight: 700; text-decoration: none; box-shadow: 0 1px 2px rgba(11, 37, 69, 0.05); }
.topbar .icon-btn img { width: 26px; height: 26px; border-radius: 7px; }
body.app[data-tab='home'] .topbar .icon-btn { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.45); color: var(--white); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.day-pill-nav { flex: 1; display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; }
.day-pill-nav b { padding: 9px 16px; border-radius: 12px; background: rgba(255, 255, 255, 0.2); font: 600 14px var(--font); white-space: nowrap; }
.day-pill-nav a, .day-pill-nav span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--white); font-size: 22px; text-decoration: none; }

/* bottom tab bar */
body.app { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.tabs { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.96); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--hair); box-shadow: none; }
.tabs a { gap: 4px; padding: 6px 2px; color: var(--muted); font: 500 11.5px var(--font); }
.tabs a svg { width: 22px; height: 22px; }
.tabs a[aria-current='page'] { color: var(--navy); font-weight: 700; }
.tabs a[aria-current='page'] svg { padding: 0; background: none; color: var(--brand-blue); }
@media (min-width: 760px) {
  .tabs { left: 50%; right: auto; bottom: 18px; width: 460px; transform: translateX(-50%); border: 1px solid var(--hair); border-radius: 22px; box-shadow: var(--soft); padding-bottom: 6px; }
}

/* buttons used across the new screens */
.btn-dark { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px; border: 0; border-radius: 14px; background: var(--navy); color: var(--white); font: 600 15px var(--font); text-decoration: none; cursor: pointer; }
.btn-dark:hover { background: #12325c; }
.btn-dark.wide { display: flex; width: 100%; }

/* Home: hero */
.hero { text-align: center; color: var(--white); padding-top: 6px; }
.hero-meta { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 500; opacity: 0.92; }
.hero-meta svg { width: 16px; height: 16px; }
.hero h1 { margin: 6px 0 18px; color: var(--white); font: 600 clamp(28px, 8vw, 36px)/1.15 var(--display); letter-spacing: -0.02em; }
.hero-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 26px 20px 22px; border-radius: 30px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), var(--white) 60%); border: 1px solid rgba(255, 255, 255, 0.85); box-shadow: 0 20px 50px rgba(36, 68, 249, 0.16); color: var(--navy); }
.hero-mark { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 12px; border-radius: 24px; background: linear-gradient(160deg, var(--blue-2), var(--brand-blue)); color: var(--white); box-shadow: 0 12px 28px rgba(36, 68, 249, 0.32); }
.hero-mark svg { width: 34px; height: 34px; }
.hero-card small { color: var(--ink-2); font-size: 13px; }
.hero-card b { margin: 2px 0; font: 600 30px/1.2 var(--display); letter-spacing: -0.02em; }
.hero-card .btn-dark { margin-top: 16px; }
.log-btn { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 7px 18px 7px 7px; border-radius: 999px; background: var(--white); border: 1px solid var(--hair); color: var(--navy); font-weight: 700; font-size: 14px; text-decoration: none; box-shadow: var(--soft); }
.log-btn span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sky); color: var(--brand-blue); }
.log-btn span svg { width: 20px; height: 20px; }
.log-btn.done span { background: var(--hit); color: var(--white); }

/* Home: score, dark stat pills */
main.screen > .score { margin-top: 28px; }
.score .label { margin: 0; color: var(--ink-2); font-size: 14px; }
.big-num { display: block; color: var(--navy); font: 600 64px/1.05 var(--display); letter-spacing: -0.04em; text-decoration: none; font-variant-numeric: tabular-nums; }
.big-num span { font-size: 0.42em; letter-spacing: -0.01em; color: var(--ink-2); }
.due-chip { padding: 3px 10px; border: 0; border-radius: 99px; background: var(--sand); color: var(--navy); font: 700 12px var(--font); cursor: pointer; }
main.screen > .pill-row { margin: 14px -16px 0; }
.pill-row { display: flex; gap: 10px; overflow-x: auto; padding: 0 16px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pill-row::-webkit-scrollbar, .quick-row::-webkit-scrollbar { display: none; }
.stat-pill { flex: 0 0 auto; min-width: 152px; padding: 14px 16px; border-radius: 18px; background: var(--navy); color: var(--white); scroll-snap-align: start; }
.sp-k { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: #c5d2ea; }
.sp-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
.sp-dot.good { background: #3ccf8a; } .sp-dot.warn { background: var(--close); } .sp-dot.bad { background: #ff6b6b; }
.stat-pill b { display: block; margin-top: 6px; font: 600 20px var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-pill b small { font: 500 12px var(--font); color: #c5d2ea; }

/* Home: coach note, quick access, trend, check-in due */
main.screen > .note-card { margin-top: 18px; }
.note-card { display: flex; gap: 14px; padding: 16px; border-radius: 22px; background: var(--white); box-shadow: var(--soft); }
.note-card p { margin: 0; }
.note-card .kicker { margin-bottom: 4px; }
.note-mark { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--brand-blue); color: var(--white); font: 800 22px var(--display); }
.note-mark i { font-style: normal; color: var(--sand); }
.sec-title { margin: 26px 0 0; font: 600 20px var(--display); letter-spacing: -0.01em; }
.sec-sub { margin: 2px 0 12px; color: var(--ink-2); font-size: 14px; }
.quick-row { display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.quick-tile { position: relative; flex: 0 0 150px; height: 132px; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; padding: 14px; border-radius: 22px; background: linear-gradient(160deg, #93a3ff 0%, var(--blue-2) 50%, #2f4cf9 100%); color: var(--white); text-decoration: none; scroll-snap-align: start; box-shadow: 0 12px 26px rgba(36, 68, 249, 0.2); }
.quick-tile:nth-child(2) { background: linear-gradient(160deg, #fde9c4 0%, var(--sand) 100%); color: var(--navy); box-shadow: 0 12px 26px rgba(183, 128, 42, 0.18); }
.quick-tile:nth-child(2) .qt-ic { border-color: rgba(11, 37, 69, 0.35); }
.qt-ic { position: absolute; top: 14px; left: 14px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid rgba(255, 255, 255, 0.7); }
.qt-ic svg { width: 20px; height: 20px; }
.quick-tile b { font: 600 14px/1.25 var(--display); }
.quick-tile small { font-size: 12px; opacity: 0.85; }
main.screen > .trend-card, main.screen > .due-card { margin-top: 26px; }
.trend-card { padding: 18px 16px 10px; border-radius: 26px; background: var(--white); box-shadow: var(--soft); }
.trend-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.trend-head b { display: block; font: 600 22px var(--display); font-variant-numeric: tabular-nums; }
.trend-head small { color: var(--ink-2); font-size: 13px; }
.trend-head .r { text-align: right; }
.trend-badge { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--brand-blue); border-left-color: #dce4ff; border-bottom-color: #dce4ff; color: var(--brand-blue); }
.trend-badge svg { width: 20px; height: 20px; }
.trend-title { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 0; font: 600 15px var(--display); }
.trend-title small { font: 500 12px var(--font); color: var(--ink-2); }
.trend { display: block; width: 100%; height: auto; margin-top: 6px; }
.trend text { font: 500 10px var(--font); fill: #9aa8bd; }
.trend text.on { fill: var(--navy); font-weight: 700; }
.trend text.tip { font-size: 11px; font-weight: 700; fill: var(--brand-blue); }
.trend-link { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; padding: 12px 4px 4px; border-top: 1px solid #eef1f6; color: var(--navy); font-weight: 600; font-size: 14px; text-decoration: none; }
.due-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding: 18px; border-radius: 26px; background: linear-gradient(160deg, var(--white) 0%, #fff6e6 100%); border: 1.5px solid var(--sand); box-shadow: var(--soft); scroll-margin: 20px; }
.due-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--sand); color: var(--navy); }
.due-ic svg { width: 24px; height: 24px; }
.due-card .kicker { color: #9a6416; margin: 0; }
.due-card h2 { margin: 0; font-size: 19px; }
.due-card p:not(.kicker) { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.due-card .btn-dark { grid-column: 1 / -1; margin-top: 10px; }

/* Meal plan */
.score.left { text-align: left; }
.ms { font-size: 12px; font-weight: 700; color: var(--muted); }
.ms.good { color: var(--hit); } .ms.warn { color: var(--warn); } .ms.bad { color: var(--off); }
.macro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.macro { display: grid; gap: 2px; padding: 14px; border-radius: 20px; background: var(--white); box-shadow: var(--soft); }
.macro .mk { font-size: 13px; color: var(--ink-2); }
.macro b { font: 600 22px var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.macro b small { font: 500 12px var(--font); color: var(--ink-2); }
.macro .pbar { margin-top: 6px; }
.plan-empty { display: flex; gap: 14px; padding: 18px; border-radius: 22px; background: var(--white); box-shadow: var(--soft); }
.plan-empty .qt-ic { position: static; flex: none; border: 0; background: var(--sky); color: var(--brand-blue); }
.plan-empty b { font: 600 16px var(--display); }
.plan-empty p { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); }
.wf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.wf-grid > div { padding: 14px; border-radius: 18px; background: var(--navy); color: var(--white); }
.wf-grid small { display: block; font-size: 12px; color: #c5d2ea; }
.wf-grid b { font: 600 20px var(--display); font-variant-numeric: tabular-nums; }
.wf-grid b span { font: 500 12px var(--font); color: #c5d2ea; }

/* Habits, training and the rest pick up the same surfaces */
.segmented { padding: 5px; border: 0; background: var(--navy); }
.segmented a { color: #c5d2ea; font-weight: 600; }
.segmented a[aria-selected='true'] { background: var(--white); color: var(--navy); }
.date-stepper { border: 1px solid var(--hair); border-radius: 16px; box-shadow: none; }
.habit-list, .panel { border: 0; border-radius: 22px; box-shadow: var(--soft); }
.habit + .habit { border-top-color: #eef1f6; }
.habit-icon { border: 0; border-radius: 14px; background: var(--sky); }
.section-label { font-weight: 600; }
.training-intro, .supp-intro { padding: 22px; border-radius: 26px; background: var(--white); color: var(--navy); box-shadow: var(--soft); }
.training-intro .kicker, .supp-intro .kicker { color: var(--brand-blue); opacity: 1; }
.training-intro h2, .supp-intro h2 { color: var(--navy); font-size: 28px; }
.training-intro p, .supp-intro p { color: var(--ink-2); }
.training-today { padding: 14px 16px; border-radius: 18px; background: var(--navy); color: var(--white); }
.training-today span { color: #c5d2ea; }
.day-pill { border-radius: 12px; }
.supp-card { border-top: 0; }
.tile { border: 0; border-radius: 20px; box-shadow: var(--soft); padding: 14px; }
.tile .k { font-weight: 600; letter-spacing: 0.02em; text-transform: none; font-size: 13px; color: var(--ink-2); }
.tile .v { font: 600 26px var(--display); }
.tiles .tile:first-child { background: var(--navy); color: var(--white); }
.tiles .tile:first-child .k { color: #c5d2ea; }
.checkin-row.card { border-radius: 20px; }

/* ----- Coach portal, same language ----- */
body.crm-body { background: var(--bg-app); }
.crm-rail { background: var(--white); color: var(--ink-2); border-right: 1px solid var(--hair); }
.crm-brand { color: var(--navy) !important; }
.crm-brand small { color: var(--brand-blue); }
.crm-rail > a:not(.crm-brand) { color: var(--ink-2); font-weight: 600; border-radius: 12px; }
.crm-rail > a:hover { background: var(--bg-app); }
.crm-rail > a[aria-current='page'] { background: var(--navy); color: var(--white); }
.crm-rail > a[aria-current='page'] svg { color: #8fb0ff; }
.crm-signout { border-color: var(--hair); color: var(--ink-2); border-radius: 12px; }
.crm-sections { background: var(--bg-app); border-right: 1px solid var(--hair); }
.crm-sections a { border-radius: 12px; }
.crm-sections a[aria-current='page'] { background: var(--white); color: var(--navy); font-weight: 700; box-shadow: var(--soft); }
.crm-settings { border-top-color: var(--hair); }
.crm-head { background: rgba(244, 246, 250, 0.92); border-bottom: 0; padding-top: 22px; }
.crm-head h1 { font: 600 28px var(--display); letter-spacing: -0.02em; }
.crm-tabs { border-bottom-color: var(--hair); }
.stat-card { border: 0; border-radius: 20px; box-shadow: var(--soft); padding: 16px 18px; }
.stat-card .v { font: 600 28px var(--display); letter-spacing: -0.02em; }
.stat-cards .stat-card:first-child { background: var(--navy); color: var(--white); }
.stat-cards .stat-card:first-child .k, .stat-cards .stat-card:first-child .s, .stat-cards .stat-card:first-child .delta { color: #c5d2ea; }
.stat-cards .stat-card:first-child .delta.good { color: #3ccf8a; }
.stat-cards .stat-card:first-child .delta.bad { color: #ff8a8a; }
.crm .card { border: 0; border-radius: 20px; box-shadow: var(--soft); }
.crm-table th { background: #f8f9fc; }
.client-row .name { font-family: var(--display); font-weight: 600; }

@media (max-width: 900px) {
  body.crm-body { padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
  .crm-rail { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 6; height: auto; flex-direction: row; flex-wrap: nowrap; justify-content: space-around; gap: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--hair); background: rgba(255, 255, 255, 0.96); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  .crm-brand { display: none; }
  .crm-rail > a:not(.crm-brand) { flex-direction: column; gap: 3px; padding: 6px 14px; background: none !important; color: var(--muted); font-size: 11.5px; font-weight: 500; }
  .crm-rail > a:not(.crm-brand) span { display: block; }
  .crm-rail > a[aria-current='page'] { color: var(--navy); font-weight: 700; }
  .crm-rail > a[aria-current='page'] svg { color: var(--brand-blue); }
  .crm-signout { align-self: center; margin: 0; padding: 8px 12px; border: 0; font-size: 11.5px; color: var(--muted); }
  .crm-sections { background: var(--bg-app); border-right: 0; border-bottom: 0; }
  .crm-sections a[aria-current='page'] { background: var(--navy); color: var(--white); box-shadow: none; }
  .crm-head { padding-top: 16px; }
  .crm-head h1 { font-size: 24px; }
}

/* ----- Meal plans and food logging ----- */
/* Components below set display; the hidden attribute must still win. */
body.app [hidden], body.crm-body [hidden], .sheet [hidden] { display: none !important; }
.meal-view { padding: 16px; border-radius: 22px; background: var(--white); box-shadow: var(--soft); }
main.screen > .meal-view, .meal-view + .meal-view { margin-top: 12px; }
.mv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mv-head h3 { margin: 0; font-size: 17px; }
.mv-head h3 small { font: 500 13px var(--font); color: var(--ink-2); }
.mv-head span { font: 600 14px var(--display); color: var(--brand-blue); font-variant-numeric: tabular-nums; }
.mv-total { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 14px 16px; border-radius: 18px; background: var(--navy); color: var(--white); }
.mv-total span { color: #c5d2ea; font-size: 13px; }
.mv-total b { font-variant-numeric: tabular-nums; font-size: 14px; }

/* food rows: name and badges on the left, Calories and macros on the right */
.fi-list { list-style: none; margin: 8px 0 0; padding: 0; }
.fi-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid #eef1f6; flex-wrap: wrap; }
.fi-list li:first-child { border-top: 0; }
.fi-name { flex: 1 1 140px; min-width: 0; }
.fi-name b, .fi-name small { display: block; }
.fi-name b { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.fi-name small { font-size: 12px; color: var(--ink-2); }
.fi-name .swap { color: #9a6416; font-weight: 600; }
.fi-mac { text-align: right; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fi-mac small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.fi-tools { display: inline-flex; align-items: center; gap: 6px; }
.unknown { color: var(--warn); font-weight: 700; }
.unknown-note { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--close-soft); color: var(--warn); font-size: 13px; }

/* source and data-quality badges */
.fbs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.fb { display: inline-block; padding: 1px 7px; border-radius: 99px; background: var(--bg-app); border: 1px solid var(--hair); color: var(--ink-2); font: 600 11px/1.6 var(--font); white-space: nowrap; }
.fb.q-reference { background: var(--hit-soft); border-color: transparent; color: #146c43; }
.fb.q-label { background: var(--sky); border-color: transparent; color: #1f3bd6; }
.fb.q-calculated { background: #eef0ff; border-color: transparent; color: #3d4fb8; }
.fb.q-estimate, .fb.q-self_reported { background: #fff4df; border-color: transparent; color: #8a5a10; }
.fb.warn { background: var(--close-soft); border-color: transparent; color: var(--warn); }

/* a planned meal and what happened */
.ml-list, .ml-grid { display: grid; gap: 12px; }
.ml-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.meal-card { padding: 16px; border-radius: 22px; background: var(--white); box-shadow: var(--soft); }
.ml.logged { box-shadow: var(--soft), inset 4px 0 0 var(--hit); }
.ml.logged.adjusted, .ml.logged.replaced { box-shadow: var(--soft), inset 4px 0 0 var(--close); }
.ml.logged.skipped { box-shadow: var(--soft), inset 4px 0 0 #b9c3d3; }
.ml-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ml-head h3 { margin: 0; font-size: 17px; }
.ml-head small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ml-chip { flex: none; padding: 4px 10px; border-radius: 99px; font: 700 12px var(--font); }
.ml-chip.good { background: var(--hit-soft); color: #146c43; }
.ml-chip.warn { background: var(--close-soft); color: var(--warn); }
.ml-chip.muted { background: var(--bg-app); color: var(--ink-2); }
.ml-sum { margin: 10px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.ml-sum .delta { font-size: 13px; }
.ml-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.ml-planned { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.ml-planned summary { cursor: pointer; font-weight: 600; }
.ml-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ml-actions .btn-dark { min-height: 44px; padding: 0 18px; }
.ml-btn, .mi-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--hair); border-radius: 12px; background: var(--white); color: var(--navy); font: 600 14px var(--font); text-decoration: none; cursor: pointer; }
.ml-btn:hover, .mi-btn:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.ml-btn.small { min-height: 34px; padding: 0 10px; font-size: 13px; border-radius: 10px; }
.ml-btn.x { width: 34px; padding: 0; font-size: 18px; color: var(--ink-2); }
.ml-btn:disabled { opacity: 0.5; cursor: default; }
.ml-editor { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hair); display: grid; gap: 10px; }
.ml-q { margin: 0; font-weight: 700; }
.ml-note-field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.adj-list { list-style: none; margin: 0; padding: 0; }
.adj-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #eef1f6; }
.adj-list li:first-child { border-top: 0; }
.adj-amt { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); }
.adj-amt input { width: 86px; min-height: 40px; padding: 6px 8px; text-align: right; border-radius: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.seg label { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--hair); border-radius: 999px; background: var(--white); font: 600 14px var(--font); cursor: pointer; }
.seg label:has(input:checked) { background: var(--navy); border-color: var(--navy); color: var(--white); }
.seg input { accent-color: var(--brand-blue); }
.radio-list { display: grid; gap: 6px; }
.radio-list label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 12px; font-weight: 600; cursor: pointer; }
.radio-list label:has(input:checked) { border-color: var(--brand-blue); background: var(--sky); }
.radio-list small { margin-left: auto; color: var(--ink-2); font-weight: 500; }
.add-row { display: flex; width: 100%; align-items: center; justify-content: center; min-height: 44px; margin-top: 8px; border: 1.5px dashed #c6d0e2; border-radius: 14px; background: none; color: var(--brand-blue); font: 700 14px var(--font); cursor: pointer; }
.add-row:hover { border-color: var(--brand-blue); background: var(--sky); }
.fl-slot + .fl-slot { margin-top: 12px; }
.from-log { padding: 12px 14px; margin-bottom: 12px; border-radius: 14px; background: var(--sky); }
.from-log > p:first-child { margin: 0 0 6px; font-weight: 700; }
.from-log a { display: inline-block; margin-top: 8px; font-weight: 700; }
.credits { margin-top: 18px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.credits summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.credits p { margin: 8px 0 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--brand-blue); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.form-msg { margin: 0; min-height: 0; color: var(--off); font-size: 14px; font-weight: 600; }
.form-msg:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { padding: 7px 12px; border: 1px solid var(--hair); border-radius: 999px; background: var(--white); color: var(--navy); font: 600 13px var(--font); cursor: pointer; }
.chip[aria-selected='true'] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.chip:hover { border-color: var(--brand-blue); }

/* food picker sheet */
body.sheet-open { overflow: hidden; }
.sheet-wrap { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: rgba(11, 37, 69, 0.38); }
.sheet { display: flex; flex-direction: column; width: 100%; max-width: 560px; max-height: min(92vh, 760px); border-radius: 24px 24px 0 0; background: var(--white); box-shadow: 0 -10px 40px rgba(11, 37, 69, 0.2); padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 760px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 24px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 8px; }
.sheet-head h2 { margin: 0; font: 600 18px var(--display); }
.sheet-x { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--bg-app); color: var(--navy); font-size: 22px; cursor: pointer; }
.sheet-body { overflow-y: auto; padding: 4px 18px 18px; display: grid; gap: 10px; align-content: start; }
.fp-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-app); }
.fp-tabs button { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font: 600 13px var(--font); cursor: pointer; }
.fp-tabs button[aria-selected='true'] { background: var(--white); color: var(--navy); box-shadow: 0 1px 3px rgba(11, 37, 69, 0.1); }
.fp-pane { display: grid; gap: 10px; }
.fp-q { width: 100%; }
.fp-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fp-hit { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 12px; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.fp-hit:hover, .fp-hit:focus-visible { background: var(--bg-app); }
.fp-name { flex: 1; min-width: 0; }
.fp-name b, .fp-name small { display: block; }
.fp-name b { font-weight: 600; font-size: 14px; }
.fp-name small { font-size: 12px; color: var(--ink-2); }
.fp-mac { text-align: right; font-weight: 700; font-size: 14px; white-space: nowrap; }
.fp-mac small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-2); }
.fp-none { padding: 10px; color: var(--ink-2); font-size: 14px; }
.fp-form { display: grid; gap: 8px; }
.fp-form label { font-weight: 600; font-size: 14px; }
.fp-basis { display: flex; gap: 14px; border: 0; padding: 0; margin: 0; }
.fp-basis legend { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.fp-basis label { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
.fp-amount-row { display: flex; align-items: center; gap: 8px; }
.fp-amount-row input { flex: 1; min-width: 0; }
.fp-amount-row select { width: auto; }
.fp-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.fp-num { display: grid; gap: 4px; font-size: 13px !important; }
.fp-energy { display: flex; gap: 4px; }
.fp-energy input { flex: 1; min-width: 0; }
.fp-energy select { width: 70px; }
.fp-food b { display: block; font: 600 17px var(--display); }
.fp-food small { display: block; color: var(--ink-2); }
.fp-food .hint { margin: 6px 0 0; }
.fp-back { justify-self: start; text-decoration: none; }
.fp-preview { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* coach: plan cards, library */
.plan-card h2 { margin: 2px 0 8px; font: 600 22px var(--display); }
.plan-note { white-space: pre-wrap; padding: 10px 12px; border-left: 3px solid var(--sand); background: #fffaf0; border-radius: 0 10px 10px 0; }
.end-form { display: grid; gap: 6px; margin-top: 12px; max-width: 360px; }
.crm-table tr.on { background: var(--sky); }
.lib-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.lib-card a { display: grid; gap: 3px; height: 100%; padding: 16px 18px; border-radius: 20px; background: var(--white); box-shadow: var(--soft); color: var(--navy); text-decoration: none; }
.lib-card a:hover { box-shadow: var(--soft), inset 0 0 0 1.5px var(--brand-blue); }
.lib-card b { font: 600 16px var(--display); }
.lib-card small { color: var(--ink-2); font-size: 13px; }
.lib-card.archived a { opacity: 0.6; }
.tp-head { display: grid; gap: 8px; }
.tp-name { padding: 6px 8px; margin-left: -8px; border: 1px solid transparent; border-radius: 10px; background: none; font: 600 22px var(--display); color: var(--navy); }
.tp-name:hover, .tp-name:focus { border-color: var(--hair); background: var(--bg-app); }
.tp-days { display: grid; gap: 10px; }
.tp-meals { display: grid; gap: 12px; }
.meal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meal-name { flex: 1 1 160px; min-width: 0; padding: 6px 8px; margin-left: -8px; border: 1px solid transparent; border-radius: 10px; background: none; font: 600 18px var(--display); color: var(--navy); }
.meal-name:hover, .meal-name:focus { border-color: var(--hair); background: var(--bg-app); }
.tp-time { width: auto; min-height: 40px; }
.meal-sum { display: block; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--brand-blue); font-variant-numeric: tabular-nums; }
.tp-note { margin-top: 8px; width: 100%; font-size: 14px; }
.mp-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.mp-totals .unknown-note { grid-column: 1 / -1; }
.mp-t { padding: 14px 16px; border-radius: 18px; background: var(--white); box-shadow: var(--soft); }
.mp-t:first-child { background: var(--navy); color: var(--white); }
.mp-t:first-child span, .mp-t:first-child b small { color: #c5d2ea; }
.mp-t span { display: block; font-size: 13px; color: var(--ink-2); }
.mp-t b { display: block; margin-top: 2px; font: 600 22px var(--display); font-variant-numeric: tabular-nums; }
.mp-t b small { font: 500 12px var(--font); color: var(--ink-2); }
.mp-save { margin: 0; font-size: 13px; color: var(--ink-2); }
.mp-save.bad { color: var(--off); font-weight: 700; }
.rc-source { font-size: 13px; color: var(--ink-2); }
.rc-h { margin: 10px 0 0; font-size: 16px; }
.rc-table th, .rc-table td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rc-portion { margin-top: 12px; display: grid; gap: 6px; max-width: 360px; }
.rc-portion label { font-weight: 600; }
.ri-lines { margin: 12px 0; padding-left: 22px; display: grid; gap: 10px; }
.ri-line { padding: 10px 12px; border: 1px solid var(--hair); border-radius: 14px; }
.ri-line.todo { border-color: var(--close); background: #fffaf3; }
.ri-line.skip { opacity: 0.6; }
.ri-orig { margin: 0 0 8px; font-weight: 600; }
.ri-orig small { display: block; font-weight: 500; color: var(--warn); }
.ri-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.ri-row select[data-food] { flex: 1 1 220px; min-width: 0; }
.ri-row select[data-portion] { width: auto; max-width: 100%; }
.ri-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.ri-check { color: var(--warn); }
.rv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rv { padding: 14px 16px; border-radius: 18px; background: var(--white); box-shadow: var(--soft); }
.rv-top { display: flex; align-items: flex-start; gap: 10px; }
.rv .hint { margin: 6px 0 0; }
.rv-form { margin-top: 10px; display: grid; gap: 8px; }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.rv-grid label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
@media (max-width: 640px) {
  .ml-actions > * { flex: 1 1 calc(50% - 8px); }
  .ml-actions .btn-dark { flex-basis: 100%; }
}

/* ===================================================================== */
/* Sign-in screens: an embossed, low-contrast preview of the app sits     */
/* behind the form (client app, or the coach dashboard with ?coach).      */
/* ===================================================================== */

.login-art {
  --emb: #e7eefc;
  --emb-ink: #a6b7d9;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(60% 50% at 80% 30%, #f4f8ff 0, transparent 70%), linear-gradient(160deg, #eef3fe, #e2eafb);
  font-family: var(--font);
  color: var(--emb-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}
.login-art .e-up {
  background: var(--emb);
  box-shadow: -6px -6px 14px rgba(255, 255, 255, 0.85), 8px 10px 22px rgba(36, 68, 249, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.login-art .e-in {
  background: var(--emb);
  box-shadow: inset 3px 3px 7px rgba(36, 68, 249, 0.12), inset -3px -3px 7px rgba(255, 255, 255, 0.9);
}
.login-art small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.login-art b { font-weight: 800; }
.login-art svg { width: 100%; height: 100%; }
.login-art polyline { fill: none; stroke: #b9c8ea; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1px 0 #fff); }

/* client: three phones, tilted, on the right */
.la-stage { position: absolute; left: 50%; top: 50%; display: flex; gap: 36px; align-items: flex-start; transform: translate(-6%, -50%) rotate(-10deg); }
.la-phone { width: 250px; height: 520px; flex: none; border-radius: 40px; padding: 18px 16px; display: grid; gap: 12px; align-content: start; animation: la-float 9s ease-in-out infinite; }
.la-phone.mid { margin-top: 90px; animation-delay: -3s; }
.la-phone:last-child { animation-delay: -6s; }
.la-hero { border-radius: 24px; padding: 16px; display: grid; gap: 4px; box-shadow: inset 3px 3px 7px rgba(36, 68, 249, 0.12), inset -3px -3px 7px rgba(255, 255, 255, 0.9); }
.la-hero b { font-size: 18px; }
.la-hero strong { font-size: 52px; line-height: 1; font-weight: 800; letter-spacing: -0.04em; margin-top: 8px; }
.la-head { display: grid; gap: 2px; padding: 4px; }
.la-head b { font-size: 22px; }
.la-row { display: flex; align-items: center; gap: 10px; border-radius: 16px; padding: 14px; font-size: 14px; }
.la-row.tall { padding-block: 20px; }
.la-row span { margin-left: auto; font-weight: 700; }
.la-row span + span { margin-left: 16px; }
.la-two, .la-three { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.la-three { grid-template-columns: repeat(3, 1fr); }
.la-two > div, .la-three > div { border-radius: 16px; padding: 12px; display: grid; gap: 4px; }
.la-two b, .la-three b { font-size: 17px; white-space: nowrap; }
.la-row b { white-space: nowrap; overflow: hidden; text-overflow: clip; }
.la-chart { height: 90px; border-radius: 18px; padding: 12px; }
.la-bar { height: 14px; border-radius: 99px; padding: 3px; }
.la-bar i { display: block; width: 72%; height: 100%; border-radius: 99px; background: #dbe5fb; box-shadow: 0 1px 0 #fff; }
@keyframes la-float { 50% { transform: translateY(-12px); } }

/* coach: a dashboard, turned away in perspective */
.la-desk { position: absolute; left: 46%; top: 50%; width: 1000px; height: 620px; border-radius: 28px; padding: 22px; display: grid; grid-template-columns: 200px 1fr; gap: 22px; transform: translateY(-50%) perspective(1800px) rotateY(-22deg) rotateX(8deg); transform-origin: left center; }
.la-side { display: grid; gap: 8px; align-content: start; }
.la-logo { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.la-name { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; font-size: 14px; font-weight: 700; }
.la-name i { width: 26px; height: 26px; border-radius: 50%; }
.la-main { display: grid; gap: 12px; align-content: start; }
.la-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.la-stats > div { border-radius: 18px; padding: 14px; display: grid; gap: 6px; }
.la-stats b { font-size: 30px; line-height: 1; }
.la-chart.wide { height: 120px; }

main.login { position: relative; z-index: 1; max-width: 440px; }
.login-home {
  position: fixed; z-index: 2;
  top: calc(16px + env(safe-area-inset-top, 0px)); left: calc(16px + env(safe-area-inset-left, 0px));
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px 8px 12px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.9); color: var(--navy); font-weight: 700; font-size: 14px; text-decoration: none;
  box-shadow: 0 1px 2px rgba(11, 37, 69, 0.06), 0 6px 18px rgba(36, 68, 249, 0.12);
}
.login-home svg { width: 18px; height: 18px; }
.login-home:hover { color: var(--brand-blue); }
.login-home:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }
@media (max-width: 959px) { main.login { padding-top: calc(72px + env(safe-area-inset-top, 0px)); } }
@media (min-width: 960px) { .login-home { top: 32px; left: calc(max(32px, 8vw) + 16px); } }
main.login .card { background: rgba(255, 255, 255, 0.94); border-color: rgba(255, 255, 255, 0.9); box-shadow: 0 2px 4px rgba(11, 37, 69, 0.05), 0 24px 60px rgba(36, 68, 249, 0.16); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.login-kicker { margin-bottom: -6px; font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand-blue); }

@media (min-width: 960px) {
  main.login { margin-left: max(32px, 8vw); min-height: 100vh; padding-block: 48px; }
}
@media (max-width: 959px) {
  .la-stage { left: 50%; top: auto; bottom: -220px; transform: translateX(-50%) rotate(-10deg) scale(0.78); }
  .la-desk { left: 8%; top: auto; bottom: -160px; transform: perspective(1800px) rotateY(-18deg) rotateX(14deg) scale(0.7); transform-origin: left bottom; }
  .login-art { -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0, #000 55%); mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0, #000 55%); }
}
@media (prefers-reduced-motion: reduce) {
  .la-phone { animation: none; }
}

/* ---------------------------------------------------------------- muscle map
   Front and back figures from exercises.js. Brand blue marks the main focus,
   a light blue what the exercise also works. */
svg.mx { display: block; width: 100%; height: auto; overflow: visible;
  --mx-body: #e9eef5; --mx-idle: #cbd5e4; --mx-primary: var(--brand-blue); --mx-secondary: #a9b8ff; }
svg.mx text { fill: #7a879b; font: 600 9px var(--font); letter-spacing: 0.06em; text-transform: uppercase; }
.mx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mx-chip { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.5; }
.mx-chip.p { background: var(--brand-blue); color: #fff; }
.mx-chip.s { background: #e6ebff; color: #2034b8; }
.mx-empty { color: var(--ink-2); font-size: 13px; }
.mx-legend { display: flex; gap: 14px; color: var(--ink-2); font-size: 12px; }
.mx-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.mx-legend i.p { background: var(--brand-blue); }
.mx-legend i.s { background: #a9b8ff; }

/* ----------------------------------------------------- coach training builder */
.tp .tp-days { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 18px 0; }
.tp-day { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.tp-day-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 10px; }
.tp-day-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 4px; min-height: 44px;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 10px;
}
.tp-day-toggle > svg { width: 20px; height: 20px; flex: none; color: var(--ink-2); transition: transform .2s; }
.tp-day.open .tp-day-toggle > svg { transform: rotate(180deg); }
.tp-day.is-rest .tp-day-toggle > svg { visibility: hidden; }
.tp-day-num {
  flex: none; min-width: 64px; padding: 7px 10px; border-radius: 9px; background: var(--brand-blue); color: #fff;
  font-size: 13px; font-weight: 800; text-align: center;
}
.tp-day.is-rest .tp-day-num { background: #e4e9f1; color: #5e6b7e; }
.tp-day-sum { flex: 1; min-width: 0; }
.tp-day-sum b, .tp-day-sum small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-day-sum b { font-size: 15px; }
.tp-day-sum small { margin-top: 1px; color: var(--ink-2); font-size: 13px; }
.tp-day.is-rest .tp-day-sum b { color: #5e6b7e; }
.tp-rest { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tp-rest input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--brand-blue); }
.tp-day.is-rest .tp-rest { background: var(--sky); border-color: var(--sky); color: var(--navy); }

.tp-rest-block { display: none; }
.tp-day.is-rest .tp-rest-block {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; margin: 0 12px 12px; min-height: 92px;
  border-radius: 10px; color: #5e6b7e; text-align: center;
  background: repeating-linear-gradient(-45deg, #f3f6fa 0 10px, #eaeff6 10px 20px);
}
.tp-rest-block strong { font-size: 16px; color: #3c4a5f; letter-spacing: 0.02em; }
.tp-rest-block span { font-size: 13px; }
.tp-day-body { display: none; padding: 4px 12px 14px; border-top: 1px solid var(--line); }
.tp-day.open:not(.is-rest) .tp-day-body { display: grid; gap: 14px; }
.tp-session { margin: 10px 0 0; max-width: 420px; }
.tp-session-note textarea { min-height: 64px; }
.tp-day-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: start; }
.tp-day-map { position: sticky; top: 16px; display: grid; gap: 10px; padding: 14px; border-radius: 12px; background: #f6f8fc; }
.tp-day-map svg.mx { max-width: 190px; margin: 0 auto; }

.tp-ex-list { display: grid; gap: 10px; }
.tp-ex {
  position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 12px; border: 1px solid #dfe7f3; border-radius: 12px; background: #fbfcfe;
}
.tp-ex.picking { z-index: 50; border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(36, 68, 249, 0.12); }
.tp-ex-map { position: relative; }
.tp-ex-map svg.mx { width: 76px; }
.tp-ex-num {
  position: absolute; top: -2px; left: -2px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: 11px; font-weight: 800; box-shadow: 0 0 0 2px #fbfcfe;
}
.tp-ex-main { display: grid; gap: 10px; min-width: 0; }
.tp-pick { position: relative; }
.tp-pick-btn {
  display: grid; grid-template-columns: minmax(0, 1fr) 20px; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  width: 100%; min-height: 52px; padding: 8px 12px; border: 1px solid #8fa6c8; border-radius: 10px; background: #fff;
  color: var(--navy); font: inherit; text-align: left; cursor: pointer;
}
.tp-pick-btn:hover { border-color: var(--brand-blue); }
.tp-pick-btn[aria-expanded="true"] { border-color: var(--brand-blue); }
.tp-pick-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-pick-name.placeholder { color: var(--brand-blue); }
.tp-pick-btn small { grid-column: 1; color: var(--ink-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-pick-btn > svg { grid-column: 2; grid-row: 1 / span 2; width: 20px; height: 20px; color: var(--ink-2); }
.tp-ex-fields { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: end; }
.tp-num { margin: 0; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.tp-num input, .tp-num select { display: block; width: 86px; min-height: 42px; margin-top: 4px; padding: 8px 10px; }
.tp-num select { width: 70px; }
.tp-rir { margin: 0; padding: 0; border: 0; min-width: 0; }
.tp-rir legend { padding: 0; margin-bottom: 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.tp-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: #e9eef6; }
.tp-seg button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: #4a5a70; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.tp-seg button[aria-pressed="true"] { background: #fff; color: var(--brand-blue); box-shadow: 0 1px 3px rgba(11, 37, 69, 0.15); }
.tp-note { margin: 0; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.tp-note input { margin-top: 4px; min-height: 40px; padding: 8px 10px; font-size: 14px; }
.tp-del {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid #f0c9c5; border-radius: 10px;
  background: #fff; color: var(--bad); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.tp-del svg { width: 16px; height: 16px; }
.tp-del:hover { background: #fdf1f0; }
.tp-add {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 10px;
  border: 1.5px dashed #9db3e0; border-radius: 12px; background: #fff; color: var(--brand-blue); font: inherit; font-weight: 700; cursor: pointer;
}
.tp-add svg { width: 18px; height: 18px; }
.tp-add:hover { background: var(--sky); border-style: solid; }
.tp-save { position: sticky; bottom: 12px; z-index: 6; display: flex; justify-content: flex-end; }
.tp-save .btn { box-shadow: 0 6px 18px rgba(36, 68, 249, 0.3); }

/* The exercise picker panel */
.tp-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: min(640px, calc(100vw - 48px));
  display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
  box-shadow: 0 18px 50px rgba(11, 37, 69, 0.18);
}
.tp-panel[hidden] { display: none; }
.tp-panel-search { position: relative; }
.tp-panel-search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-2); }
.tp-panel-search input { padding-left: 38px; min-height: 46px; }
.tp-filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tp-filters button {
  flex: none; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: #3c4a5f; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.tp-filters button[aria-pressed="true"] { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.tp-custom .tp-filters { flex-wrap: wrap; overflow: visible; }
.tp-panel-body { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 12px; }
.tp-results { max-height: 320px; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 2px; }
.tp-group { margin: 8px 6px 4px; color: var(--ink-2); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.tp-group:first-child { margin-top: 0; }
.tp-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px;
  background: none; color: var(--navy); font: inherit; text-align: left; cursor: pointer;
}
.tp-opt b { display: block; font-size: 14px; }
.tp-opt small { display: block; color: var(--ink-2); font-size: 12px; }
.tp-opt.active { background: var(--sky); }
.tp-opt.active b { color: var(--brand-blue); }
.tp-new { margin-top: 6px; border: 1px dashed #9db3e0; }
.tp-plus { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-blue); color: #fff; font-weight: 800; }
.tp-none { margin: 6px; color: var(--ink-2); font-size: 14px; }
.tp-preview { display: grid; align-content: start; gap: 8px; padding: 10px; border-radius: 12px; background: #f6f8fc; text-align: center; }
.tp-preview p { margin: 0; font-size: 13px; }
.tp-preview .mx-chips { justify-content: center; }
.tp-custom { display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.tp-custom[hidden] { display: none; }
.tp-custom .kicker { margin: 0; }
.tp-c-label { margin: 0; font-size: 13px; font-weight: 700; }

@media (max-width: 900px) {
  .tp-day-grid { grid-template-columns: 1fr; }
  .tp-day-map { position: static; grid-template-columns: 120px minmax(0, 1fr); align-items: center; }
  .tp-day-map svg.mx { grid-row: span 2; max-width: 120px; }
  .tp-day-map .mx-legend { grid-column: 2; }
}
@media (max-width: 560px) {
  .tp-day-head { flex-wrap: wrap; padding: 8px; }
  .tp-day-num { min-width: 56px; }
  .tp-ex { grid-template-columns: 56px minmax(0, 1fr); padding: 10px; }
  .tp-ex-map svg.mx { width: 56px; }
  .tp-ex.picking { z-index: 1000; }
  .tp-ex.picking::after { content: ""; position: fixed; inset: 0; z-index: 10; background: rgba(11, 37, 69, 0.35); }
  .tp-del { grid-column: 1 / -1; justify-content: center; }
  .tp-num input { width: 74px; }
  .tp-panel { position: fixed; z-index: 20; inset: auto 0 0 0; width: auto; max-height: 82vh; border-radius: 18px 18px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .tp-panel-body { grid-template-columns: 1fr; }
  .tp-preview { display: none; }
  .tp-results { max-height: 46vh; }
}

/* ------------------------------------------------------------ check-in day */
.checkin-day-card { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 10px 16px; align-items: end; }
.checkin-day-card .kicker { margin-bottom: 4px; }
.checkin-day-pick { margin: 0; }
.checkin-next { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--sky); color: var(--navy); font-size: 14px; font-weight: 600; }
.checkin-window { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.checkin-window.open { background: var(--hit-soft); color: var(--good); }
.checkin-window.upcoming { background: var(--sky); color: var(--navy); }
.checkin-window.closed { background: #eef1f5; color: #4a5a70; }
.checkin-fields { margin: 0; padding: 0; border: 0; min-width: 0; }
.checkin-fields[disabled] { opacity: 0.6; }
@media (max-width: 560px) {
  .checkin-day-card { grid-template-columns: 1fr; }
}

/* "Add custom exercise" card under the training plan */
.tp-custom-card { display: grid; gap: 12px; }
.tp-custom-card .kicker { margin: 0; }
.tp-custom-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 10px; }
.tp-custom-grid label { margin: 0; }
.tp-custom-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tp-custom-map svg.mx { width: 76px; }
.tp-custom-list { display: grid; gap: 8px; }
@media (max-width: 900px) { .tp-custom-grid { grid-template-columns: 1fr 1fr; } .tp-custom-grid label:first-child { grid-column: 1 / -1; } }
@media (max-width: 560px) { .tp-custom-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------- client workout log */
.wl { display: grid; gap: 14px; }
.wl h2 { margin: 0 0 6px; }
.wl-done { color: var(--good); }
.wl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.wl-ex { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.wl-ex-head { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.wl-ex-head > div:last-child { display: grid; gap: 2px; min-width: 0; }
.wl-ex-head small { color: var(--muted); font-size: 13px; }
.wl-ex-map svg.mx { width: 54px; }
.wl-ex-map:empty { display: none; }
.wl-prev { color: #4a5a70 !important; }
.wl-sets { display: grid; gap: 8px; }
.wl-set { display: grid; grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.wl-n { font-size: 13px; font-weight: 700; color: var(--navy); }
.wl-set label { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0; }
.wl-set label span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.wl-set input { min-width: 0; width: 100%; text-align: center; }
.wl-set input::placeholder { color: #b4bfcf; }
.wl-add { justify-self: start; background: none; border: 0; padding: 4px 0; color: var(--brand-blue); font-weight: 700; cursor: pointer; }
.wl-history details { border-top: 1px solid var(--line); padding: 10px 0; }
.wl-history summary { display: flex; justify-content: space-between; gap: 10px; cursor: pointer; }
.wl-history summary span { color: var(--muted); font-size: 14px; }
.wl-history ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.wl-history li { display: grid; gap: 2px; font-size: 14px; }
.wl-history li span { color: #4a5a70; }

/* Extra meals a client adds on the meal plan page */
.extra-meal { margin-bottom: 12px; }
.xm-tag { font-size: 12px; font-weight: 700; color: #8a5a00; background: #fff4dd; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.xm-new { display: grid; gap: 8px; }
.xm-form { display: grid; gap: 10px; padding: 14px; border: 1.5px dashed #c6d0e2; border-radius: 14px; }
.xm-form[hidden] { display: none; }
.xm-form label { margin: 0; }
.xm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Home: check-in button and alert */
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 10px; }
.checkin-btn { position: relative; }
.checkin-btn.due { border-color: var(--bad); color: var(--bad); }
.checkin-btn.due span { background: #fde8e6; color: var(--bad); }
.checkin-btn .red-dot { position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); border: 2px solid var(--white); }
.checkin-btn.locked { opacity: 0.55; filter: grayscale(1); cursor: not-allowed; box-shadow: none; }
.checkin-alert { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 12px 14px; border-radius: 16px; background: #fde8e6; border: 1.5px solid var(--bad); color: var(--bad); text-decoration: none; }
.checkin-alert.soon { background: #fff4dd; border-color: #e0a43a; color: #8a5a00; }
.checkin-alert > span:nth-child(2) { flex: 1; min-width: 0; }
.checkin-alert b, .checkin-alert small { display: block; }
.checkin-alert b { font-size: 15px; }
.checkin-alert small { font-size: 13px; color: var(--ink-2); }
.ca-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.18); animation: ca-pulse 1.6s ease-in-out infinite; }
.checkin-alert.soon .ca-dot { box-shadow: 0 0 0 4px rgba(224, 164, 58, 0.25); }
@keyframes ca-pulse { 50% { transform: scale(0.75); } }
@media (prefers-reduced-motion: reduce) { .ca-dot { animation: none; } }

/* Check-in page: photo prompt */
.photo-prompt { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--navy); border: 1.5px solid #e0a43a; background: #fffaf0; }
.photo-prompt.done { border-color: var(--hair); background: var(--white); }
.photo-prompt > span:nth-child(2) { flex: 1; min-width: 0; }
.photo-prompt b, .photo-prompt small { display: block; }
.photo-prompt small { color: var(--ink-2); font-size: 13px; }
.wl-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wl-meta label { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; }
.wl-meta input, .wl-meta select { display: block; width: 100%; min-width: 0; max-width: 100%; height: 48px; margin: 0; box-sizing: border-box; }
.wl-meta input[type="date"] { -webkit-appearance: none; appearance: none; text-align: left; }
.wl-meta input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.wl-meta select { text-overflow: ellipsis; }
@media (max-width: 560px) { .wl-meta { grid-template-columns: 1fr; } }

/* Meal names the client can change, and the "Macros only" entry */
.ml-head h3 { display: flex; align-items: center; gap: 6px; }
.ml-rename { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: var(--bg-app); color: var(--ink-2); cursor: pointer; }
.ml-rename:hover { background: var(--sky); color: var(--brand-blue); }
.ml-rename-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.ml-rename-form input { flex: 1 1 160px; min-width: 0; min-height: 40px; }
.ml-orig { display: block; color: var(--muted); font-size: 12px; }
.fp-tabs.four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 560px) { .fp-tabs.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fp-kcal { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--sky); color: var(--navy); }
.fp-kcal span { font-size: 14px; font-weight: 600; }
.fp-kcal b { font: 700 22px var(--display); }
.fb.q-macro { background: var(--sky); color: var(--brand-blue); }
.ml-btn.primary { background: var(--brand-blue); border-color: var(--brand-blue); color: var(--white); }
.fb.q-macro { border-color: transparent; }
.ml-btn.primary:hover { color: var(--white); filter: brightness(1.08); }
