/* FT Fitness
   White canvas, near-black ink, one warm grey family. No accent colours:
   emphasis comes from type, weight and filled versus outlined shapes. */

:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --fill: #F6F6F4;
  --fill-2: #EEEEEB;
  --ink: #111111;
  --ink-2: #5F5E5A;
  --ink-3: #9B9A96;
  --line: #EAEAEA;
  --line-2: #D9D9D6;
  --btn: #111111;
  --btn-hover: #2B2B2B;
  --btn-ink: #FFFFFF;
  --danger: #9F2F2D;
  --focus: #111111;
  --on-ink: #FFFFFF;
  --fill-soft: #FBFBFA;
  --fill-softer: #FCFCFB;
  --ink-past: #4A4946;
  --chart-2: #C9C8C4;

  --f-display: 'Hanken Grotesk', system-ui, sans-serif;
  --f-body: 'Hanken Grotesk', system-ui, sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, monospace;

  --r-card: 12px;
  --r-ctl: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --tabbar: 66px;
  --gutter: 20px;
  color-scheme: light;
}

/* White on black. Same monochrome system, inverted, with greys re-stepped for a dark ground. */
:root[data-theme="dark"] {
  --bg: #0B0B0B;
  --surface: #141414;
  --fill: #1C1C1C;
  --fill-2: #262626;
  --ink: #F2F2F0;
  --ink-2: #B4B3AF;
  --ink-3: #85847F;
  --line: #262626;
  --line-2: #3A3A3A;
  --btn: #F2F2F0;
  --btn-hover: #DADAD6;
  --btn-ink: #0B0B0B;
  --danger: #F08A80;
  --focus: #F2F2F0;
  --on-ink: #0B0B0B;
  --fill-soft: #101010;
  --fill-softer: #121212;
  --ink-past: #9A9995;
  --chart-2: #5C5B57;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
/* Safety net: a chevron with no sizing rule of its own stays small. Zero specificity, so any real rule wins. */
:where(svg.chev) { width: 17px; height: 17px; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Type ---------- */
.display { font-family: var(--f-display); font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; }
.d-xxl { font-size: clamp(56px, 15vw, 84px); line-height: 0.95; letter-spacing: -0.05em; }
.d-xl { font-size: clamp(32px, 8.5vw, 44px); line-height: 1.05; letter-spacing: -0.04em; }
.d-l { font-size: 28px; line-height: 1.1; }
.d-m { font-size: 21px; line-height: 1.15; letter-spacing: -0.025em; }
.d-s { font-size: 18px; line-height: 1.2; letter-spacing: -0.02em; }
.display em, .italic { font-style: italic; }
.label { font: 500 12.5px/1.35 var(--f-body); color: var(--ink-3); letter-spacing: 0.005em; }
.mono { font-family: var(--f-mono); font-size: 0.86em; letter-spacing: -0.01em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 14px; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
#app { position: relative; }
.shell { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-word { font: 800 18px/1 var(--f-display); letter-spacing: -0.04em; }
.brand-word span { color: var(--ink-3); }
.topbar-actions { display: flex; gap: 6px; align-items: center; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px; border: 0;
  background: transparent; cursor: pointer; color: var(--ink);
  transition: background 0.2s;
}
.icon-btn:hover { background: var(--fill); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .badge {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--ink); color: var(--on-ink);
  font: 600 10px/16px var(--f-body); text-align: center;
}

main#view {
  padding: 8px var(--gutter) calc(var(--tabbar) + 40px + env(safe-area-inset-bottom));
  max-width: 720px; margin: 0 auto;
}
.coach main#view { max-width: 1160px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-decoration: none; color: var(--ink-3);
  font: 500 11px/1 var(--f-body);
  -webkit-tap-highlight-color: transparent; transition: color 0.2s;
}
.tab svg { width: 22px; height: 22px; transition: transform 0.25s var(--ease); }
.tab[aria-current="page"] { color: var(--ink); }
.tab:active svg { transform: scale(0.9); }
.tabbar .brand { display: none; }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: auto 1fr; align-items: start; }
  .topbar { grid-column: 2; }
  .tabbar {
    position: sticky; top: 0; grid-row: 1 / span 2; height: 100dvh;
    display: flex; flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 24px 14px; border-top: 0; border-right: 1px solid var(--line);
    background: var(--bg); backdrop-filter: none;
  }
  .tabbar .brand { display: flex; padding: 0 10px 28px; }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; height: 42px; padding: 0 12px; border-radius: 8px; font-size: 14.5px; color: var(--ink-2); }
  .tab:hover { background: var(--fill); }
  .tab[aria-current="page"] { background: var(--fill); color: var(--ink); font-weight: 600; }
  .topbar .brand { visibility: hidden; }
  main#view { padding-bottom: 72px; grid-column: 2; width: 100%; }
}

/* ---------- Page header ---------- */
.page-head { padding: 18px 0 26px; display: grid; gap: 8px; }
.page-head .row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-left: -4px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px; }
.back:hover { color: var(--ink); }
.back svg { width: 18px; height: 18px; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; transition: border-color 0.2s, box-shadow 0.2s; }
a.card:hover, button.card:hover { border-color: var(--line-2); box-shadow: 0 2px 10px rgba(17, 17, 17, 0.04); }
.card.flat { background: var(--fill); border-color: transparent; }
.card + .card, .stack > * + * { margin-top: 12px; }
.section { margin-top: 40px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 14px; }
.section-head a:not(.btn), .link { color: var(--ink-2); font-weight: 500; font-size: 14px; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.section-head a:hover, .link:hover { color: var(--ink); text-decoration-color: var(--ink); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
/* Former dark panels are now quiet filled panels */
.board { background: var(--fill); border-radius: 16px; padding: 22px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: var(--r-ctl); border: 1px solid transparent;
  background: var(--btn); color: var(--btn-ink);
  font: 600 15px/1 var(--f-body); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn.block { width: 100%; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
.btn.ghost, .btn.on-board-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover, .btn.on-board-ghost:hover { background: var(--fill); }
.btn.chalk { background: var(--btn); color: var(--btn-ink); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--line-2); }
.btn.loading { pointer-events: none; opacity: 0.6; }

/* ---------- Activity markers (monochrome) ---------- */
.plate { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ink); }
.type-bar { display: none; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border-radius: 999px; background: var(--fill); border: 1px solid transparent;
  font: 500 12.5px/1 var(--f-body); color: var(--ink-2); white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; }
.chip.hit { background: var(--ink); color: var(--on-ink); }
.chip.on-track { background: var(--fill); color: var(--ink-2); }
.chip.behind { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.chip.quiet { background: var(--surface); border-color: var(--ink); color: var(--ink); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 10px; background: var(--fill); }
.seg button, .seg a {
  height: 40px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  font: 500 14px/1 var(--f-body); color: var(--ink-2); text-decoration: none;
  display: grid; place-items: center; transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg [aria-selected="true"], .seg [aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(17, 17, 17, 0.08), 0 0 0 1px rgba(17, 17, 17, 0.04); }

.pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 8px; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: 500 13.5px/1 var(--f-body); color: var(--ink-2); transition: all 0.2s; }
.pill:hover { border-color: var(--line-2); color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* ---------- Avatars ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--fill-2); color: var(--ink);
  font: 600 12.5px/1 var(--f-body); letter-spacing: 0.02em;
  box-shadow: 0 0 0 2px var(--bg);
}
.avatar svg { width: 16px; height: 16px; color: var(--ink-3); }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }
.avatar.sm { width: 26px; height: 26px; font-size: 9.5px; letter-spacing: 0; }
.avatar.coach { background: var(--ink); color: var(--on-ink); }
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -4px; }
.avatar-stack .more { background: var(--surface); color: var(--ink-2); box-shadow: 0 0 0 2px var(--bg), inset 0 0 0 1px var(--line); }

/* ---------- Lists ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 15px 18px; min-height: 60px; text-decoration: none; color: inherit; background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer; transition: background 0.2s; }
.list-item + .list-item { border-top: 1px solid var(--line); }
button.list-item:hover, a.list-item:hover { background: var(--fill); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .grow > .title, .list-item .grow > .sub { display: block; }
.list-item .sub { font-size: 13.5px; color: var(--ink-2); }
.list-item > svg.chev { width: 17px; height: 17px; color: var(--ink-3); flex: none; }
.list-item > svg:not(.chev) { width: 20px; height: 20px; color: var(--ink-2); flex: none; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.field > span { font-weight: 500; font-size: 14px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-2); background: var(--surface); font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06); }
.input.sm { min-height: 38px; padding: 7px 10px; font-size: 14px; border-radius: 8px; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 500; min-height: 1px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background 0.2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.3s var(--ease); }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(18px); background: var(--on-ink); }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; }
.stepper button { width: 34px; height: 34px; border-radius: 7px; border: 0; background: var(--fill); cursor: pointer; font-size: 18px; }
.stepper output { min-width: 34px; text-align: center; font: 600 20px/1 var(--f-display); }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 90; touch-action: none; background: rgba(17, 17, 17, 0.28); opacity: 0; transition: opacity 0.3s; }
.sheet {
  position: fixed; z-index: 91; left: 0; right: 0; bottom: 0;
  max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 10px var(--gutter) calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.45s var(--ease);
  will-change: transform;
  box-shadow: 0 -12px 40px -12px rgba(17, 17, 17, 0.16);
}
.sheet::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 16px; }
.sheet.open { transform: none; }
.sheet-backdrop.open { opacity: 1; }
.sheet .sheet-title { margin: 2px 0 8px; }
.sheet .sheet-actions { display: grid; gap: 10px; margin-top: 24px; }
@media (min-width: 640px) {
  .sheet { left: 50%; right: auto; bottom: 50%; width: min(500px, 92vw); border-radius: 16px; transform: translate(-50%, 54%); opacity: 0; transition: transform 0.4s var(--ease), opacity 0.25s; padding: 28px; }
  .sheet.open { transform: translate(-50%, 50%); opacity: 1; }
  .sheet::before { display: none; }
}

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 100; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 440px; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--on-ink); font-weight: 500; font-size: 14.5px; box-shadow: 0 10px 30px -10px rgba(17, 17, 17, 0.35); animation: toast-in 0.45s var(--ease) both; }
.toast.out { animation: toast-out 0.3s ease both; }
.toast svg { width: 17px; height: 17px; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- Week ticks: the accountability signature ---------- */
.ticks { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.tk { display: grid; justify-items: center; gap: 8px; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit; }
.tk:disabled { cursor: default; }
.tk-dot { width: 100%; max-width: 42px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--surface); transition: background 0.3s, border-color 0.3s, transform 0.2s var(--ease); }
.tk-dot svg { width: 46%; height: 46%; color: var(--on-ink); }
.tk.done .tk-dot { background: var(--ink); border-color: var(--ink); }
.tk.today .tk-dot { border: 1.5px dashed var(--ink); }
.tk.done.today .tk-dot { border-style: solid; }
.tk.future .tk-dot { background: transparent; border-color: var(--line); }
.tk:not(:disabled):hover .tk-dot { transform: scale(1.06); }
.tk-day { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.tk.today .tk-day { color: var(--ink); font-weight: 600; }
.tk.pop .tk-dot { animation: tick-pop 0.6s var(--ease); }
.tk.pop .tk-dot svg path { stroke-dasharray: 24; animation: tick-draw 0.5s 0.12s var(--ease) both; }
@keyframes tick-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes tick-draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }

/* Small week strips for lists */
.mini-week { display: grid; grid-template-columns: repeat(7, 9px); gap: 4px; }
.dots14 { display: grid; grid-template-columns: repeat(14, minmax(3px, 8px)); gap: clamp(2px, 0.4vw, 5px); width: 100%; max-width: 180px; min-width: 0; }
.mini-week i, .dots14 i { display: block; aspect-ratio: 1; border-radius: 50%; background: var(--fill-2); }
.mini-week i.on, .dots14 i.on { background: var(--ink); }
.mini-week i.today, .dots14 i.today { outline: 1px solid var(--ink-3); outline-offset: 1.5px; }

/* ---------- Stats ---------- */
.stat { display: grid; gap: 6px; }
.stat .num { font: 600 42px/1 var(--f-display); letter-spacing: -0.045em; }
.stat .num small { font-size: 0.45em; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }

/* ---------- Progress bar ---------- */
.bar { height: 4px; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width 0.7s var(--ease); }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; }
.chart .grid line { stroke: var(--line); }
.chart .axis text { fill: var(--ink-3); font: 400 10px var(--f-mono); }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--ink); opacity: 0.04; }
.chart .pt { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.chart .pt.last { fill: var(--ink); }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, auto); justify-content: space-between; gap: 8px 6px; }
.heat i { width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--fill-2); }
.heat i.on { background: var(--ink); }
.heat i.future { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 36px 24px; border: 1px dashed var(--line-2); border-radius: var(--r-card); display: grid; gap: 12px; justify-items: center; }
.empty-state p { color: var(--ink-2); max-width: 34ch; }

/* ---------- Skeleton ---------- */
.skeleton { display: grid; gap: 12px; padding-top: 24px; }
.skeleton i { display: block; height: 120px; border-radius: var(--r-card); background: linear-gradient(90deg, var(--fill), var(--fill-soft), var(--fill)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton i:first-child { height: 56px; width: 55%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Motion ---------- */
/* backwards, not both: a transform left on #view after the animation would trap position:fixed children (the message composer). */
.view-enter { animation: view-in 0.6s var(--ease) backwards; }
@keyframes view-in { from { opacity: 0; transform: translateY(12px); } }
.rise > * { animation: view-in 0.6s var(--ease) backwards; }
.rise > *:nth-child(2) { animation-delay: 0.06s; }
.rise > *:nth-child(3) { animation-delay: 0.12s; }
.rise > *:nth-child(4) { animation-delay: 0.18s; }
.rise > *:nth-child(5) { animation-delay: 0.24s; }
.rise > *:nth-child(n + 6) { animation-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; }
  [data-intro] .intro { animation-delay: 5s !important; }
}

/* Cards inside grids never take the stacked-card top margin */
:is(.grid-2, .grid-3, .kpis, .pack-grid, .plan-grid, .nut-grid, .shop, .pb-grid) > .card { margin-top: 0; }

/* Demo only: flip between Fin's view and a client's */
.demo-switch { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px dashed var(--line-2); font: 500 12.5px/1 var(--f-body); color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.demo-switch:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Wordmark ---------- */
.wm { display: inline-flex; align-items: center; gap: 0.23em; font-size: 30px; line-height: 1; color: var(--ink); font-family: var(--f-display); white-space: nowrap; }
.wm-ft { font-weight: 800; font-size: 1em; letter-spacing: -0.07em; line-height: 0.82; padding-right: 0.04em; }
.wm-rule { align-self: center; width: max(1.5px, 0.024em); height: 0.8em; background: currentColor; }
.wm-txt { display: flex; flex-direction: column; gap: 0.1em; }
.wm-name { font-size: 0.34em; font-weight: 700; letter-spacing: 0.18em; }
.wm-sub { font-size: 0.148em; font-weight: 600; letter-spacing: 0.32em; color: var(--ink-2); }
.wm.sm { font-size: 30px; }
.wm.sm .wm-name { font-size: 0.4em; letter-spacing: 0.16em; }
.wm.sm .wm-sub { display: none; }
.wm.xl { font-size: clamp(76px, 23vw, 108px); }
.welcome-logo { margin: 0; }

/* Opening logo animation (public/js/intro.js). Shown only on a fresh open. */
.intro { display: none; }
[data-intro] .intro { display: grid; place-items: center; position: fixed; inset: 0; z-index: 1000; background: var(--bg); cursor: pointer; -webkit-tap-highlight-color: transparent; contain: layout paint; animation: intro-bail 0.3s 5s forwards; }
/* Failsafe: if intro.js never runs (lost on a bad signal), the cover clears itself. */
@keyframes intro-bail { to { opacity: 0; visibility: hidden; pointer-events: none; } }
.intro .wm.is-pre { opacity: 0; }

/* Sessions left, top right on every client screen */
.bal-pill { display: inline-block; flex: none; box-sizing: content-box; height: 32px; line-height: 32px; padding: 0 14px; border-radius: 999px; background: var(--fill); color: var(--ink-2); font: 500 13px/32px var(--f-body); text-decoration: none; white-space: nowrap; transition: background 0.2s; }
.bal-pill b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.bal-pill:hover { background: var(--fill-2); }
.bal-pill.bal-low { background: var(--ink); color: color-mix(in srgb, var(--on-ink) 75%, transparent); }
.bal-pill.bal-low b { color: var(--on-ink); }
/* Plain inline text inside the pill. The low state is .bal-low, not .low, which views.css uses for a list. */
.bal-sep { display: inline-block; vertical-align: -1px; width: 1px; height: 12px; background: currentColor; opacity: 0.35; margin: 0 9px; }
.bal-pill > span { display: inline; white-space: nowrap; }
.bal-pill b { margin-right: 1px; }
@media (max-width: 440px) { .bal-cls { display: none !important; } .demo-switch { padding: 0 10px; } }
@media (max-width: 400px) { .bal-left { display: none; } .demo-switch { padding: 0 8px; } .topbar { gap: 8px; } }

/* Coach nav: three tabs fold behind More on a phone */
@media (max-width: 959px) { .tab.desk-only { display: none; } }
@media (min-width: 960px) { .tab.mob-only { display: none; } }
.chip.away { background: var(--surface); border: 1px dashed var(--ink-3); color: var(--ink-2); }

/* Fin previewing a client's app: a strip across the top with the way back, always in view. */
.topbar.has-preview { flex-wrap: wrap; row-gap: 10px; }
.preview-strip {
  flex: 0 0 calc(100% + 2 * var(--gutter)); margin: -10px calc(-1 * var(--gutter)) 0;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px var(--gutter); background: var(--ink); color: var(--bg); font-size: 13.5px; line-height: 1.3;
}
.preview-strip button {
  flex: none; display: inline-flex; align-items: center; gap: 3px; height: 30px; padding: 0 12px 0 8px;
  border: 0; border-radius: 999px; background: var(--bg); color: var(--ink); font: 600 13px/1 var(--f-body); cursor: pointer;
}
.preview-strip button svg { width: 16px; height: 16px; }
.preview-pick { margin-top: 18px; }
.preview-strip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.chip { cursor: pointer; }
