/* Design system: "Ledger" structure in "Performance Green" (design port, Dec 2026).
   Light, bright ground; white cards; deep pine anchor; volt as the one signal colour.
   Fonts are served by the app itself (no CDN): Archivo, Archivo Black, Inter. */

@font-face { font-family: "Archivo"; src: url("/assets/font-archivo.ttf") format("truetype"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Archivo Black"; src: url("/assets/font-archivo-black.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/font-inter.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Archivo", "Inter", system-ui, sans-serif;
  --font-hero: "Archivo Black", "Archivo", "Inter", system-ui, sans-serif;
  --radius: 11px;
  --radius-small: 8px;
  --gap: 1rem;
  /* the palette, by name */
  --pine: #0B3D24;
  --volt: #B7E62E;
  --turf: #1E9E57;
  --ink: #12211A;
  --on-pine-muted: #A9B8AE;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F1F5F0;
  --surface: #ffffff;
  --surface-alt: #EAEFE8;
  --text: #12211A;
  --muted: #5F6B64;
  --faint: #7F8A83;
  --line: #E0E3DC;
  --line-soft: #EEF1EC;
  --accent: #0B3D24;
  --accent-ink: #ffffff;
  --accent-soft: #E4EEE5;
  --chip: #EEF0EA;
  --chip-ink: #3D4A35;
  --danger: #A8321F;
  --danger-ink: #ffffff;
  --danger-soft: #F7E6E1;
  --focus: #0B3D24;
  --shadow: 0 1px 2px rgba(16, 16, 18, 0.05);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D1712;
  --surface: #14221A;
  --surface-alt: #1B2D23;
  --text: #E6EEE8;
  --muted: #A0B2A7;
  --faint: #879A8E;
  --line: #26392E;
  --line-soft: #1F3127;
  --accent: #8FD4A9;
  --accent-ink: #0B1A12;
  --accent-soft: #1E3A2A;
  --chip: #213428;
  --chip-ink: #C9D8CE;
  --danger: #E9907D;
  --danger-ink: #1D0F0C;
  --danger-soft: #3A2420;
  --focus: #B7E62E;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; font-family: var(--font-body); }
p { margin: 0; }
a { color: var(--accent); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.noscript { padding: 2rem; text-align: center; }

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "top top" "nav main" "nav foot";
  min-height: 100vh;
}

.skip-link { position: absolute; left: -999rem; top: 0.5rem; background: var(--surface); padding: 0.5rem 0.75rem; z-index: 30; }
.skip-link:focus { left: 0.5rem; }

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 0.6rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.org-badge { display: flex; align-items: center; gap: 0.6rem; min-width: 0; color: var(--text); text-decoration: none; }
.org-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-mark { width: 2.1rem; height: 2.1rem; border-radius: var(--radius-small); object-fit: cover; flex: none; }
.monogram { display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.account-button {
  display: flex; align-items: center; gap: 0.5rem;
  background: transparent; color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.25rem 0.7rem 0.25rem 0.3rem;
  font: inherit; cursor: pointer; max-width: 16rem;
}
.account-button:hover { background: var(--surface-alt); }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { color: var(--muted); font-size: 0.8rem; }

.mainnav {
  grid-area: nav;
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--line);
}
.nav-link {
  display: block; padding: 0.5rem 0.75rem; border-radius: var(--radius-small);
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.nav-link:hover { background: var(--surface-alt); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.content { grid-area: main; padding: 1.75rem 2rem 3rem; min-width: 0; }
.content:focus { outline: none; }
.app-footer { grid-area: foot; padding: 0.75rem 2rem; color: var(--muted); font-size: 0.85rem; }

.page { max-width: 62rem; display: grid; gap: 1.25rem; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; }
.lead { color: var(--muted); margin-top: 0.25rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75rem; color: var(--muted); font-weight: 600; }

/* ---------- surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.placeholder, .notice {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2.25rem 1.5rem;
  text-align: center;
  color: var(--muted);
  display: grid; gap: 0.4rem;
}
.placeholder-title { font-family: var(--font-display); font-size: 1.2rem; color: var(--text); }
.notice h1, .notice h2 { color: var(--text); font-size: 1.3rem; }

.stack { display: grid; gap: 1.25rem; align-content: start; min-width: 0; }
.narrow-stack { max-width: 40rem; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 0.55rem 0.9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- forms ---------- */

.field { display: grid; gap: 0.3rem; min-width: 0; }
.field label, .label-row label { font-weight: 600; font-size: 0.92rem; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }

.input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 0.55rem 0.7rem;
  min-height: 2.6rem;
}
textarea.input { resize: vertical; min-height: 6rem; }
.input.narrow { max-width: 8rem; }
.input:disabled { opacity: 0.65; }
.file-input { font: inherit; color: var(--muted); max-width: 100%; }

.hint { color: var(--muted); font-size: 0.88rem; }
.counter { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); font-weight: 600; }

.error-slot:empty, .remove-slot:empty { display: none; }
.field-error, .form-error { color: var(--danger); font-size: 0.9rem; font-weight: 500; }
.form-error { background: var(--danger-soft); border-radius: var(--radius-small); padding: 0.55rem 0.75rem; }

.actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.saved { color: var(--accent); font-weight: 600; font-size: 0.92rem; }
.saved::before { content: "✓ "; }

.button {
  font: inherit; font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-small);
  padding: 0.5rem 0.95rem;
  min-height: 2.6rem;
  cursor: pointer;
}
.button:hover { background: var(--surface-alt); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover { filter: brightness(1.07); }
.button.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.button.danger-outline { color: var(--danger); border-color: var(--danger); }
.button.small { min-height: 2rem; padding: 0.25rem 0.65rem; font-size: 0.88rem; }
.button.wide { width: 100%; }

.icon-button {
  font: inherit; font-size: 1.3rem; line-height: 1;
  width: 2.5rem; height: 2.5rem;
  border: 1px solid transparent; border-radius: var(--radius-small);
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-button:hover, .icon-button[aria-expanded="true"] { background: var(--surface-alt); color: var(--text); }

/* ---------- menus ---------- */

.menu-anchor { position: relative; flex: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 0.35rem);
  min-width: 13rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.35rem;
  z-index: 20;
  display: grid; gap: 0.1rem;
}
.menu-item {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  width: 100%; text-align: left;
  font: inherit; color: var(--text); text-decoration: none;
  background: transparent; border: 0; border-radius: var(--radius-small);
  padding: 0.5rem 0.65rem; cursor: pointer;
}
.menu-item:hover { background: var(--surface-alt); }
.menu-item.danger { color: var(--danger); }
.menu-heading { padding: 0.3rem 0.65rem 0.1rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.menu-rule { border: 0; border-top: 1px solid var(--line); margin: 0.25rem 0; }
.tick { color: var(--accent); }

/* ---------- avatars ---------- */

.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-alt); }
.avatar.initials { display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.avatar-sm { width: 1.9rem; height: 1.9rem; font-size: 0.72rem; }
.avatar-md { width: 2.6rem; height: 2.6rem; font-size: 0.9rem; }
.avatar-lg { width: 4.5rem; height: 4.5rem; font-size: 1.4rem; }
.logo-lg { width: 4.5rem; height: 4.5rem; border-radius: var(--radius); object-fit: cover; flex: none; font-size: 1.6rem; }

.photo-row { display: flex; gap: 1.1rem; align-items: flex-start; flex-wrap: wrap; }
.photo-row > div:last-child { display: grid; gap: 0.6rem; min-width: 0; flex: 1 1 14rem; justify-items: start; }

/* ---------- team ---------- */

.team-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.team-row { padding: 0.8rem 1rem; border-top: 1px solid var(--line); display: grid; gap: 0.7rem; }
.team-row:first-child { border-top: 0; }
.team-main { display: flex; align-items: center; gap: 0.85rem; }
.team-who { min-width: 0; flex: 1 1 auto; }
.team-name { font-weight: 600; overflow-wrap: anywhere; }
.team-email { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.you { margin-left: 0.5rem; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.team-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface-alt); color: var(--muted); white-space: nowrap; }
.tag.role-owner, .tag.role-super_admin { background: var(--accent-soft); color: var(--accent); }
.tag.pending { background: transparent; border: 1px dashed var(--line); }
.tag.sent { background: var(--accent); color: var(--accent-ink); }
.confirm { background: var(--danger-soft); border-radius: var(--radius-small); padding: 0.75rem 0.9rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.confirm-actions { display: flex; gap: 0.5rem; }
.add-form { max-width: 40rem; }

/* ---------- profile side column ---------- */

.meter { width: 100%; height: 0.6rem; accent-color: var(--accent); }
.meter-text { font-weight: 600; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; font-size: 0.92rem; }
.steps .done { color: var(--accent); }
.steps .todo { color: var(--muted); }
.preview { text-align: center; justify-items: center; }
.preview-name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; overflow-wrap: anywhere; }
.preview-bio { white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-bio.empty { color: var(--muted); font-style: italic; }

/* ---------- owner zone ---------- */

.owner-zone { border-color: var(--danger); }
.zone-item { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.step { display: grid; gap: 0.9rem; padding: 1rem; background: var(--surface-alt); border-radius: var(--radius-small); }

/* ---------- signed-out pages ---------- */

.open-layout { min-height: 100vh; display: grid; align-content: start; justify-items: center; gap: 1.5rem; padding: 3rem 1rem; }
.wordmark { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; letter-spacing: 0.01em; color: var(--accent); }
.open-main { width: 100%; max-width: 27rem; }
.open-card { padding: 1.75rem; }
.aside { color: var(--muted); font-size: 0.92rem; text-align: center; }

/* ---------- round 1: roster, client pages, library ---------- */

.toolbar { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.toolbar .input { flex: 1 1 11rem; width: auto; min-width: 0; }
.toolbar .input.narrow-select, .toolbar select.input { flex: 0 1 12rem; }
.toolbar .counter { margin-left: auto; white-space: nowrap; }

.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font: inherit; font-size: 0.88rem; font-weight: 600;
  padding: 0.25rem 0.7rem; min-height: 2rem;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer;
}
span.chip { cursor: default; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip-x { font: inherit; font-size: 1rem; line-height: 1; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 0.1rem; }

.checks { border: 1px solid var(--line); border-radius: var(--radius-small); padding: 0.6rem 0.8rem 0.75rem; margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; min-width: 0; }
.checks legend { font-weight: 600; font-size: 0.92rem; padding: 0 0.3rem; }
.check { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2rem; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); flex: none; }
.checks .error-slot { flex: 1 1 100%; }
.field-label { font-weight: 600; font-size: 0.92rem; }
.pair.tight { gap: 0.5rem; }
.pair.tight, .client-app .pair.tight { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.list-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-small); flex-wrap: wrap; }
.list-main { flex: 1 1 12rem; min-width: 0; }
.list-row > .list-edit { flex: 1 1 100%; min-width: 0; }
.list-name { font-weight: 600; overflow-wrap: anywhere; }
.team-link { font-size: 0.88rem; }
.team-name a { color: inherit; text-decoration: none; }
.team-name a:hover { text-decoration: underline; }
.nav-own { margin-top: 0.6rem; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-small) var(--radius-small); }
a.button { display: inline-flex; align-items: center; text-decoration: none; }
.notice.left { text-align: left; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.narrow-page { max-width: 34rem; }

.schedule { border-collapse: collapse; width: 100%; max-width: 26rem; }
.schedule th, .schedule td { padding: 0.35rem 0.5rem; text-align: center; border-bottom: 1px solid var(--line); }
.schedule th[scope="row"] { text-align: left; font-weight: 500; }
.schedule thead th { font-size: 0.85rem; color: var(--muted); }
.schedule input { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }

.thumb { width: 2.6rem; height: 2.6rem; border-radius: var(--radius-small); object-fit: cover; flex: none; }
.thumb-lg { width: 9rem; aspect-ratio: 16 / 9; border-radius: var(--radius-small); object-fit: cover; }
.video-frame { width: 100%; max-width: 34rem; aspect-ratio: 16 / 9; background: var(--surface-alt); border-radius: var(--radius-small); overflow: hidden; display: grid; place-items: center; padding: 0; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.video-frame .hint { padding: 1rem; text-align: center; }
.video-player { width: 100%; max-width: 34rem; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-small); }

/* The client area: one column, sized for a phone first. */
.client-app { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr; grid-template-columns: minmax(0, 1fr); } /* one column no wider than the page, however long the organization's name */
.client-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.client-nav { display: flex; gap: 0.25rem; padding: 0.35rem 0.6rem; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 0; z-index: 10; }
.client-tab { padding: 0.5rem 0.85rem; border-radius: var(--radius-small); color: var(--text); text-decoration: none; white-space: nowrap; }
.client-tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.client-main { padding: 1.25rem 1rem 3rem; width: 100%; max-width: 44rem; margin: 0 auto; min-width: 0; }
.coach-who { display: flex; align-items: center; gap: 0.9rem; }

/* ---------- round 2: calendar, workout editor, block library ---------- */

.page.wide { max-width: none; }
.text-button { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.icon-button.small { width: 2rem; height: 2rem; font-size: 1.05rem; }
.icon-button:disabled { opacity: 0.35; cursor: default; }
.button:disabled { opacity: 0.5; cursor: default; }
.button.primary-soft { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
kbd { font: inherit; font-size: 0.85rem; font-weight: 600; padding: 0.1rem 0.4rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-alt); white-space: nowrap; }

.cal-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-small); overflow: hidden; background: var(--surface); }
.segmented .button { border: 0; border-radius: 0; min-height: 2.3rem; }
.segmented .button + .button { border-left: 1px solid var(--line); }
.segmented .button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.cal-range { font-size: 1.1rem; margin-right: auto; }
.search-anchor, .suggest-anchor { position: relative; min-width: 0; }
.search-anchor { flex: 0 1 16rem; }
.search-results, .suggestions {
  list-style: none; margin: 0; padding: 0.3rem;
  position: absolute; left: 0; right: 0; top: calc(100% + 0.25rem); z-index: 15;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-small); box-shadow: var(--shadow);
  max-height: 18rem; overflow-y: auto; display: grid; gap: 0.1rem;
}
.search-results { min-width: 15rem; }
.search-result, .suggestion {
  display: flex; flex-direction: column; gap: 0.05rem; width: 100%; text-align: left;
  font: inherit; color: var(--text); background: transparent; border: 0; border-radius: 4px; padding: 0.4rem 0.5rem; cursor: pointer;
}
.search-result:hover, .suggestion:hover, .suggestion.active { background: var(--accent-soft); }
.search-results .hint { padding: 0.4rem 0.5rem; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.notes-panel .plain-list { max-height: 22rem; overflow-y: auto; }
.note-row { display: grid; gap: 0.1rem; width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--surface-alt); border: 0; border-left: 4px solid var(--line); border-radius: var(--radius-small); padding: 0.45rem 0.6rem; cursor: pointer; }
.shortcut-list { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; margin: 0; align-items: baseline; }
.shortcut-list dd { margin: 0; }

.cal-grid { display: grid; gap: 0.5rem; align-items: start; }
.cal-grid.view-week, .cal-grid.view-month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-grid.view-day { grid-template-columns: minmax(0, 46rem); }
.cal-weekday { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0 0.3rem; }
.cal-day {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-small);
  padding: 0.5rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.45rem; align-content: start; min-width: 0; min-height: 10rem;
}
.view-month .cal-day { min-height: 6rem; }
.view-day .cal-day { padding: 0.9rem; }
.cal-day.is-off { background: var(--surface-alt); }
.cal-day.is-outside { opacity: 0.72; }
.cal-day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day.drop-target { outline: 2px dashed var(--accent); outline-offset: 1px; }
.cal-day-head { display: flex; align-items: baseline; gap: 0.35rem; flex-wrap: wrap; }
.cal-dow { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cal-dom { font-weight: 700; }
.today-tag { background: var(--accent); color: var(--accent-ink); }
.off-tag { font-size: 0.75rem; flex: 1 1 100%; }
.rest-marker { font-size: 0.85rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: var(--radius-small); border: 1px dashed var(--muted); overflow-wrap: anywhere; }

.note-band {
  --band: #7b8a8e;
  display: block; width: 100%; text-align: left; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text);
  background: var(--surface-alt); border: 0; border-left: 4px solid var(--band); border-radius: var(--radius-small);
  padding: 0.25rem 0.5rem; cursor: pointer; overflow-wrap: anywhere;
}
.note-band[data-color="red"], .note-row[data-color="red"] { --band: #c2452f; border-left-color: #c2452f; }
.note-band[data-color="orange"], .note-row[data-color="orange"] { --band: #d07a1c; border-left-color: #d07a1c; }
.note-band[data-color="green"], .note-row[data-color="green"] { --band: #3b8f58; border-left-color: #3b8f58; }
.note-band[data-color="blue"], .note-row[data-color="blue"] { --band: #2f78c2; border-left-color: #2f78c2; }
.note-band[data-color="purple"], .note-row[data-color="purple"] { --band: #8256c4; border-left-color: #8256c4; }
.note-details { padding: 0 0.5rem; }

.day-tools { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: auto; }
.day-tools .button.small { min-height: 1.8rem; padding: 0.15rem 0.5rem; font-size: 0.8rem; }
@media (min-width: 64.01rem) {
  /* Six weeks of days: the per-day controls shrink to quiet text so the month stays readable. */
  .view-month .cal-dow, .view-month .off-tag { display: none; }
  .view-month .day-tools { gap: 0 0.55rem; }
  .view-month .day-tools .button.small { border: 0; background: transparent; min-height: 1.5rem; padding: 0; font-size: 0.75rem; color: var(--muted); }
  .view-month .day-tools .button.small:hover { color: var(--accent); text-decoration: underline; }
  .view-month .day-tools .button.primary-soft { color: var(--accent); }
}

.wcard { border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--bg); padding: 0.45rem 0.5rem; display: grid; gap: 0.35rem; min-width: 0; }
.wcard.can-edit { cursor: pointer; }
.wcard.can-edit:hover { border-color: var(--accent); }
.wcard.status-past .wcard-title { color: var(--muted); }
.wcard-head { display: flex; align-items: flex-start; gap: 0.4rem; }
.wc-select { width: 1.05rem; height: 1.05rem; margin: 0.15rem 0 0; accent-color: var(--accent); flex: none; }
.wcard-title { font-size: 0.95rem; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.wcard-title.untitled { color: var(--muted); font-style: italic; font-weight: 500; }
.note-flag { color: var(--accent); flex: none; }
.wcard-text { font-size: 0.85rem; }
.wcard-part { display: grid; gap: 0.1rem; }
.private-note { border-left: 3px solid var(--accent); padding-left: 0.5rem; }
.wcard-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.wc-item { display: flex; gap: 0.4rem; align-items: baseline; font-size: 0.88rem; min-width: 0; }
.wc-item.is-linked { margin-top: -0.15rem; }
.wc-item-body { display: flex; flex-wrap: wrap; gap: 0.1rem 0.45rem; align-items: baseline; min-width: 0; }
.wc-item-name { font-weight: 600; overflow-wrap: anywhere; }
.wc-item-line { color: var(--muted); overflow-wrap: anywhere; flex: 1 1 100%; }
.wc-video { font-size: 0.8rem; font-weight: 600; }
.item-label { font-size: 0.75rem; font-weight: 700; color: var(--accent); min-width: 1.6rem; flex: none; font-variant-numeric: tabular-nums; }
.wcard-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.wcard-actions .button.small { min-height: 1.7rem; padding: 0.1rem 0.45rem; font-size: 0.78rem; font-weight: 500; }

.workout-editor, .inline-form {
  display: grid; gap: 0.75rem; min-width: 0; cursor: auto;
  background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius-small); padding: 0.75rem;
}
.inline-form { border-width: 1px; padding: 0.6rem; gap: 0.5rem; }
/* In the seven-column views the editor keeps its place in the day and spreads over the days beside it. */
.editor-slot { min-width: 0; }
.cal-day.is-editing { opacity: 1; }
.view-week .workout-editor, .view-month .workout-editor {
  --editor-width: min(38rem, calc(100vw - 3rem));
  position: relative; z-index: 5; width: var(--editor-width);
  box-shadow: var(--shadow), 0 12px 40px rgba(0, 0, 0, 0.18);
}
.cal-day.opens-left .workout-editor { margin-left: calc(100% - var(--editor-width)); }
.we-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; align-items: start; }
.workout-editor textarea.input, .inline-form textarea.input { min-height: 3.5rem; }
.we-items { display: grid; gap: 0.5rem; }
.we-items:empty { display: none; }
.we-item { display: grid; gap: 0.4rem; padding: 0.5rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--bg); min-width: 0; }
.we-item-controls { display: flex; align-items: center; gap: 0.15rem; }
.we-item-controls .item-label { margin-right: auto; font-size: 0.85rem; }
.we-ex-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 5.5rem; gap: 0.4rem; align-items: start; }
.we-cond-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.4rem; }
.link-toggle { justify-self: start; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--muted); background: transparent; border: 1px dashed var(--line); border-radius: 999px; padding: 0.1rem 0.6rem; cursor: pointer; }
.link-toggle[data-linked="true"] { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent); }
.block-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.block-tools > div:empty { display: none; }
.block-tools > div { flex: 1 1 100%; }
.insert-select { width: auto; flex: 1 1 11rem; min-height: 2rem; padding: 0.2rem 0.5rem; font-size: 0.88rem; }
.block-prompt { display: grid; gap: 0.35rem; padding: 0.5rem; background: var(--surface-alt); border-radius: var(--radius-small); }
.block-prompt-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.block-prompt-row .input { flex: 1 1 10rem; width: auto; min-height: 2rem; padding: 0.25rem 0.5rem; }
.demo-picker { display: grid; gap: 0.35rem; }

@media (max-width: 64rem) {
  /* Days stack into one column; the weekday strip of the month view has no use then. */
  .cal-grid.view-week, .cal-grid.view-month, .cal-grid.view-day { grid-template-columns: minmax(0, 1fr); }
  .cal-weekday { display: none; }
  .cal-day, .view-month .cal-day { min-height: 0; }
  .cal-grid .cal-day .workout-editor, .cal-grid .cal-day.opens-left .workout-editor { width: auto; margin-left: 0; box-shadow: none; }
  .cal-range { flex: 1 1 100%; order: -1; }
}

@media (max-width: 30rem) {
  .we-top, .we-ex-fields, .we-cond-fields { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- small screens ---------- */

@media (max-width: 52rem) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 46rem) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; grid-template-areas: "top" "nav" "main" "foot"; }
  .topbar { padding: 0.5rem 0.9rem; }
  .mainnav { flex-direction: row; overflow-x: auto; padding: 0.4rem 0.6rem; border-right: 0; border-bottom: 1px solid var(--line); background: var(--surface); }
  .content { padding: 1.1rem 0.9rem 2.5rem; }
  .app-footer { padding: 0.75rem 0.9rem; }
  .account-button { max-width: 11rem; }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .team-main { flex-wrap: wrap; }
  .team-tags { justify-content: flex-start; flex: 1 1 100%; order: 3; }
  h1 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .nav-link, .menu-item, .icon-button { transition: background-color 120ms ease, filter 120ms ease; }
}

/* ---- Round 3: the client's workouts (client area) and results on the coach's calendar ---- */
.stack.tight { gap: 0.9rem; }
.tag.progress-completed { background: var(--accent-soft); color: var(--accent); }
.tag.progress-missed { background: var(--danger-soft); color: var(--danger); }
.check-row { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 600; min-height: 2.2rem; cursor: pointer; }
.check-row input { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.weight-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.4rem; align-items: center; max-width: 16rem; }

/* home and calendar */
.today-card { display: grid; gap: 0.6rem; }
.workout-link {
  display: flex; align-items: center; gap: 0.5rem 0.75rem; flex-wrap: wrap; min-height: 2.9rem;
  padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: var(--radius-small);
  background: var(--surface); color: var(--text); text-decoration: none;
}
.workout-link:hover { border-color: var(--accent); }
.workout-link[data-progress="completed"] { border-left: 4px solid var(--accent); }
.workout-link[data-progress="missed"] { border-left: 4px solid var(--danger); }
.workout-link-title { font-weight: 600; flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; }
.workout-link-title.untitled, .workout-head .untitled { color: var(--muted); font-style: italic; font-weight: 500; }
.app-days { display: grid; gap: 0.75rem; }
.app-day { display: grid; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-alt); min-width: 0; }
.app-day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.app-day-head { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.app-day-name { font-weight: 700; }
.app-day .button.small { justify-self: start; }

/* one workout */
.workout-page { max-width: 44rem; }
.workout-head { display: grid; gap: 0.4rem; }
.workout-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; color: var(--muted); }
.aw-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.aw-item { display: grid; gap: 0.5rem; padding: 0.85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.aw-item.is-linked { margin-top: -0.5rem; border-top-style: dashed; border-top-left-radius: 0; border-top-right-radius: 0; }
.aw-item-head { display: flex; align-items: baseline; gap: 0.5rem; }
.aw-item-head .item-label { font-size: 0.9rem; }
.aw-item-name { font-size: 1.05rem; overflow-wrap: anywhere; }
.aw-item-line { color: var(--muted); overflow-wrap: anywhere; }
.aw-result { display: grid; gap: 0.5rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.aw-result .result-text { min-height: 2.6rem; resize: vertical; }
.aw-result .saved-slot { min-height: 1.2rem; }
.completion-card { display: grid; gap: 0.4rem; border-left: 4px solid var(--accent); }
.completion-form { gap: 0.75rem; }
.swap-options { max-height: 18rem; overflow-y: auto; }
.swap-option {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; width: 100%; min-height: 2.75rem; text-align: left;
  padding: 0.5rem 0.65rem; border: 1px solid var(--line); border-radius: var(--radius-small);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.swap-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.swap-option > span:first-child { font-weight: 600; flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; }
.client-editor { gap: 0.9rem; }
.ae-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.ae-item { display: grid; gap: 0.4rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--bg); min-width: 0; }
.ae-item .button.small { justify-self: start; }

/* a demonstration over the page */
.video-panel { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: rgba(10, 16, 18, 0.72); }
.video-panel-box { width: min(40rem, 100%); display: grid; gap: 0.75rem; padding: 0.9rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.video-panel-box .video-frame, .video-panel-box .video-player { max-width: none; }
.video-panel-box h2 { font-size: 1.05rem; overflow-wrap: anywhere; min-width: 0; }

/* the coach's calendar */
.wcard.progress-completed { border-left: 3px solid var(--accent); }
.wcard.progress-missed { border-left: 3px solid var(--danger); }
.wcard-marks { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.wcard-marks .tag { white-space: normal; }
.wc-completion { display: grid; gap: 0.1rem; padding: 0.3rem 0.45rem; border-radius: var(--radius-small); background: var(--accent-soft); font-size: 0.85rem; min-width: 0; }
.wc-completion-figures { font-weight: 600; }
.wc-item-line.wc-result { color: var(--text); font-size: 0.82rem; padding: 0.1rem 0.4rem; border-radius: var(--radius-small); background: var(--surface-alt); flex: 0 1 auto; }
.wc-item-line.wc-result.is-done { background: var(--accent-soft); }
.wc-item-line.wc-swaps { font-size: 0.78rem; font-style: italic; }
.wc-item-body .button.small.wc-log { min-height: 1.4rem; padding: 0 0.4rem; font-size: 0.74rem; font-weight: 500; opacity: 0.75; }
.wc-item-body .button.small.wc-log:hover, .wc-item-body .button.small.wc-log:focus-visible { opacity: 1; }
.wc-item-body .rl-form { flex: 1 1 100%; }
.cal-toolbar .button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.wc-completion .eyebrow { text-transform: none; letter-spacing: 0; font-size: 0.78rem; }
.wcard-marks .tag { border-radius: var(--radius-small); font-weight: 500; }

/* ---- Round 4: programs ---- */
.program-page .panel-head { flex-wrap: wrap; }
.program-days .pg-day, .program-calendar .cal-day { min-height: 7rem; }
.program-week { grid-column: 1 / -1; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0.35rem 0.3rem 0; }
.program-calendar { display: grid; gap: 0.6rem; min-width: 0; }
.sync-summary { font-size: 0.92rem; font-weight: 500; color: var(--accent); background: var(--accent-soft); border-radius: var(--radius-small); padding: 0.45rem 0.7rem; }
.program-tag { white-space: normal; overflow-wrap: anywhere; }
.program-tag.is-attached { background: var(--accent-soft); color: var(--accent); }
.program-state { font-weight: 500; }
.assign-list { display: grid; gap: 0.1rem; max-height: 16rem; overflow-y: auto; }
.assign-list .check-row { font-weight: 500; }
.assign-panel .inline-form { border: 0; padding: 0; }
.assignment-row .team-main { flex-wrap: wrap; }
.assignment-row .team-tags { align-items: center; }
.program-page > div:empty { display: none; }

/* ---- Round 5: habits ---- */
.segmented a.button { text-decoration: none; display: inline-flex; align-items: center; }
.segmented a.button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.habit-form-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: start; }
.habit-form-row > .field { flex: 1 1 11rem; }
.habit-form-row > .input { flex: 1 1 11rem; }
.habit-form-row > .error-slot { flex: 1 1 100%; }
.habit-form-row > .error-slot:empty, .nc-row > .error-slot:empty { display: none; }
.habit-days { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.habit-panel:empty { display: none; }
.habit-week .habit-day { min-height: 7rem; }
.habit-item {
  display: grid; gap: 0.1rem; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; min-width: 0;
  padding: 0.35rem 0.5rem; background: var(--surface-alt); border: 1px solid transparent; border-left: 3px solid var(--line); border-radius: var(--radius-small);
}
.habit-item:hover { border-color: var(--line); border-left-color: var(--muted); }
.habit-item-name { font-weight: 600; font-size: 0.88rem; overflow-wrap: anywhere; }
.habit-item-state { font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }
.habit-item.status-met { border-left-color: var(--accent); background: var(--accent-soft); }
.habit-item.status-not_met, .habit-item.status-missed { border-left-color: var(--danger); }
.habit-item.status-due { border-left-color: var(--focus); }
.habit-item.status-upcoming { background: transparent; border-color: var(--line); border-left-color: var(--line); }
.habit-none { padding: 0 0.3rem; }
.tag.habit-state-running, .tag.habit-status-met { background: var(--accent-soft); color: var(--accent); }
.tag.habit-status-not_met, .tag.habit-status-missed { background: var(--danger-soft); color: var(--danger); }
.tag.habit-status-upcoming, .tag.habit-state-upcoming { background: transparent; border: 1px dashed var(--line); }
.reuse summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; }
.reuse[open] summary { margin-bottom: 0.6rem; }
.reuse-options { display: grid; gap: 0.35rem; max-height: 14rem; overflow-y: auto; margin-top: 0.6rem; }
.reuse-option {
  display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; align-items: baseline; text-align: left; font: inherit; color: inherit; cursor: pointer;
  padding: 0.4rem 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-small);
}
.reuse-option:hover { background: var(--surface-alt); }
.nc-row { display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; align-items: center; }
.nc-row .check { flex: 0 0 9.5rem; font-weight: 600; }
.nc-row > .error-slot { flex: 1 1 100%; }
.habit-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.habit-card-head h2 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.habit-card { border-left: 3px solid var(--line); }
.habit-card.status-met { border-left-color: var(--accent); }
.habit-card.status-not_met, .habit-card.status-missed { border-left-color: var(--danger); }
.habit-target { font-weight: 600; }
.today-list .workout-link .hint { margin-left: auto; }

/* ---------- metrics (round 6a) ---------- */

:root[data-theme="light"] { --chart-second: #a8590a; }
:root[data-theme="dark"] { --chart-second: #e3ab5c; }

.metric-pick { display: flex; flex-wrap: wrap; gap: 0.15rem 1.25rem; }
.metric-pick .check { overflow-wrap: anywhere; }
.metric-order { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; max-width: 30rem; }
.metric-order-line { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.5rem; background: var(--surface-alt); border-radius: var(--radius-small); }
.metric-order-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

.range-bar { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; }
.range-presets { max-width: 100%; }
.range-presets .button { padding-left: 0.7rem; padding-right: 0.7rem; white-space: nowrap; }
.team-tags { align-items: center; }
.range-custom { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.range-custom .input { width: auto; min-width: 9.5rem; flex: 1 1 9.5rem; }
.range-bar > .error-slot { flex: 1 1 100%; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.75rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 0.85rem; display: grid; gap: 0.15rem; align-content: start; min-width: 0; }
.stat-number { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.metric-chart-card { padding: 0.75rem 0.85rem; }
.metric-chart { margin: 0; display: grid; gap: 0.4rem; }
.metric-chart-svg { width: 100%; height: auto; display: block; }
.metric-chart-empty { padding: 1.5rem 0.5rem; text-align: center; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 12px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-opacity: 0.45; stroke-linejoin: round; }
.chart-average { fill: none; stroke: var(--chart-second); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-trend line { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 6 5; }
.chart-trend circle { fill: var(--text); }
.chart-point { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.chart-note-ring { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; }
.chart-key { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-swatch { display: inline-block; width: 1.4rem; height: 0; flex: none; }
.chart-swatch.swatch-point { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--accent); }
.chart-swatch.swatch-note { width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 1.5px solid var(--accent); background: radial-gradient(circle, var(--accent) 0 38%, transparent 42%); }
.chart-swatch.swatch-trend { border-top: 2px dashed var(--text); }
.chart-swatch.swatch-average { border-top: 3px solid var(--chart-second); }

.history-head { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: flex-end; justify-content: space-between; }
.result-list:empty, .result-add:empty { display: none; }
.result-row { gap: 0.4rem; }
.result-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.9rem; }
.result-date { flex: 0 0 7.5rem; color: var(--muted); font-size: 0.92rem; }
.result-value { font-weight: 600; font-variant-numeric: tabular-nums; flex: 0 0 auto; min-width: 5.5rem; }
.result-change { font-variant-numeric: tabular-nums; }
.result-actions { margin-left: auto; display: flex; gap: 0.4rem; }
.result-note { font-size: 0.92rem; overflow-wrap: anywhere; }
.result-edit { display: grid; gap: 0.5rem; }
.result-edit-fields { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.result-edit-fields .input { flex: 1 1 9rem; width: auto; min-width: 0; }
.result-edit-fields .input.narrow { flex: 0 1 8rem; }
.result-form .field { flex: 1 1 10rem; }
.metric-list-main .team-name a { overflow-wrap: anywhere; }

@media (max-width: 30rem) {
  .result-date { flex-basis: 100%; }
  .result-actions { margin-left: 0; flex: 1 1 100%; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .range-presets { display: flex; width: 100%; }
  .range-presets .button { flex: 1 1 auto; padding-left: 0.3rem; padding-right: 0.3rem; font-size: 0.88rem; justify-content: center; }
  .metric-chart-card { padding: 0.5rem 0.4rem; }
}

/* Round 6b: client records (priorities, ratios, progress photos) */
.section-head { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: flex-end; justify-content: space-between; }
.records-page h3 { font-size: 1.05rem; }
.priority-list:empty { display: none; }
.priority-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.priority-place { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 0.85rem; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.priority-text { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.priority-actions { display: flex; gap: 0.35rem; flex: none; margin-left: auto; }
.priority-form { display: grid; gap: 0.4rem; }
.priority-form-line { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.priority-form-line .input { flex: 1 1 14rem; width: auto; min-width: 0; }
.priority-new { padding: 0.8rem 1rem; }

.ratio-main { align-items: flex-start; }
.ratio-figures { flex: none; display: grid; gap: 0.2rem; justify-items: end; text-align: right; }
.ratio-actual { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ratio-reading { min-height: 1.4rem; }
.tag.ratio-within { background: var(--accent-soft); color: var(--accent); }
.tag.ratio-below, .tag.ratio-above { background: var(--danger-soft); color: var(--danger); }
.tag.ratio-missing { background: transparent; border: 1px dashed var(--line); }

.photo-frame { margin: 0; display: grid; gap: 0.25rem; width: 6.5rem; min-width: 0; }
.photo-link { display: block; aspect-ratio: 3 / 4; border-radius: var(--radius-small); overflow: hidden; background: var(--surface-alt); border: 1px solid var(--line); }
.photo-link img { width: 100%; height: 100%; object-fit: cover; display: block; font-size: 0.75rem; color: var(--muted); }
.photo-frame figcaption, .photo-gap-name { font-size: 0.8rem; color: var(--muted); text-align: center; }
.photo-gap { aspect-ratio: 3 / 4; border: 1px dashed var(--line); border-radius: var(--radius-small); display: grid; place-items: center; text-align: center; font-size: 0.8rem; color: var(--muted); padding: 0.25rem; }
.photo-strip { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.photo-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; max-width: 30rem; }
.photo-slot { display: grid; gap: 0.4rem; align-content: start; min-width: 0; }
.photo-slot .photo-frame { width: 100%; }
.photo-slot-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; }
.photo-pick { position: relative; cursor: pointer; }
.photo-file { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo-file:disabled { cursor: progress; }
.photo-pick:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.photo-set-form { padding-bottom: 0.25rem; }
.compare-view { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem; align-items: start; }
.compare-view .photo-frame { width: 100%; max-width: 22rem; }
.compare-head { min-width: 0; overflow-wrap: anywhere; }
.compare-none { grid-column: 1 / -1; }

@media (max-width: 30rem) {
  /* four links now share the switch on a client's pages: keep them on one line on a phone */
  .segmented a.button { padding-left: 0.45rem; padding-right: 0.45rem; font-size: 0.92rem; }
  .ratio-main { flex-wrap: wrap; }
  .ratio-figures { justify-items: start; text-align: left; flex: 1 1 100%; }
  .photo-slots { gap: 0.5rem; }
  .photo-strip .photo-frame { width: 5.6rem; }
  .priority-form-line .input { flex-basis: 100%; }
}

/* Round 7a: engagement (compliance, streak, load) and goals */
.engage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; align-items: start; }
.engage-wide { grid-column: 1 / -1; }
.engage-grid .card { display: grid; gap: 0.55rem; align-content: start; min-width: 0; }
.figure-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.figure-table th, .figure-table td { padding: 0.4rem 0.35rem; text-align: right; vertical-align: top; border-top: 1px solid var(--line); }
.figure-table thead th, .figure-table thead td { border-top: 0; font-size: 0.78rem; font-weight: 600; color: var(--muted); vertical-align: bottom; }
.figure-table tbody th { text-align: left; font-weight: 600; font-size: 0.92rem; padding-left: 0; }
.figure-table .figure-sub th, .figure-table .figure-sub td { border-top: 0; padding-top: 0; }
.figure-table .figure-sub th { font-weight: 500; font-size: 0.78rem; color: var(--muted); }
.figure-table td:last-child, .figure-table th:last-child { padding-right: 0; }
.figure { display: block; font-size: 1.1rem; font-weight: 600; line-height: 1.25; }
.figure-note { display: block; font-size: 0.78rem; color: var(--muted); line-height: 1.3; }
.engage-number { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.engage-unit { font-family: var(--font-body); font-size: 0.95rem; font-weight: 500; color: var(--muted); }
.streak-form { display: grid; gap: 0.4rem; }
.streak-form .input.narrow { flex: 0 1 7rem; width: 7rem; }
.engage-home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 0.75rem; }
.engage-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; min-width: 0; }

.goal-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.goal-body { flex: 1 1 12rem; min-width: 0; display: grid; gap: 0.1rem; }
.goal-text { overflow-wrap: anywhere; }
.goal-row[data-status="reached"] .goal-text { color: var(--muted); }
.goal-check { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); color: var(--accent-ink); font-size: 1rem; font-weight: 700; line-height: 1; display: grid; place-items: center; padding: 0; cursor: pointer; }
.goal-check:hover { border-color: var(--accent); }
.goal-check:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.goal-check[aria-pressed="true"], .goal-check[data-on="true"] { background: var(--accent); border-color: var(--accent); }
.goal-check.static { cursor: default; }
.goal-check.static:hover { border-color: var(--line); }
.goal-check.static[data-on="true"]:hover { border-color: var(--accent); }
.goal-form { display: grid; gap: 0.6rem; }
.tag.goal-late { background: var(--danger-soft); color: var(--danger); }
.sr-note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 40rem) {
  .engage-grid { grid-template-columns: minmax(0, 1fr); }
  .engage-home { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 30rem) {
  .figure-table th, .figure-table td { padding-left: 0.2rem; padding-right: 0.2rem; }
  .figure-table tbody th { font-size: 0.85rem; }
  .figure-table thead td { width: 4.7rem; } /* the row names keep their words whole on a phone */
  .figure { font-size: 1rem; }
  .figure-note { font-size: 0.72rem; }
  .goal-line .priority-actions { margin-left: 2.65rem; }
}

/* ---------------------------------------------------------------- round 7b: plans */

/* One colour per kind of phase, used by the timeline, the phase lines and the chart bands.
   Never the only sign: every block, line and band also carries the kind's name. */
:root[data-theme="light"] { --kind-base: #2f6fb0; --kind-build: #2f8550; --kind-peak: #c2452f; --kind-recovery: #7a50bd; --kind-other: #6b7b80; }
:root[data-theme="dark"] { --kind-base: #6aa7e6; --kind-build: #6fc08a; --kind-peak: #ec8a76; --kind-recovery: #b79cec; --kind-other: #9aabae; }
[data-kind="base"] { --kind: var(--kind-base); }
[data-kind="build"] { --kind: var(--kind-build); }
[data-kind="peak"] { --kind: var(--kind-peak); }
[data-kind="recovery"] { --kind: var(--kind-recovery); }
[data-kind="other"] { --kind: var(--kind-other); }

.plan-row { min-width: 0; }
.plan-notes { color: var(--muted); }
.plan-timeline { display: grid; gap: 0.25rem; min-width: 0; }
.plan-track { position: relative; height: 3rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface-alt); overflow: hidden; }
.plan-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.plan-tick.is-year { width: 2px; background: var(--muted); opacity: 0.5; }
.plan-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; }
.plan-track-ends { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.8rem; }
.phase-block {
  position: absolute; top: 0.3rem; bottom: 0.3rem; min-width: 3px; padding: 0 0.4rem; margin: 0;
  border: 0; border-left: 3px solid var(--kind, var(--muted)); border-radius: 3px;
  background: color-mix(in srgb, var(--kind, var(--muted)) 26%, var(--surface));
  color: var(--text); font: inherit; font-size: 0.82rem; font-weight: 600; text-align: left;
  overflow: hidden; white-space: nowrap; cursor: pointer;
}
.phase-block:hover { background: color-mix(in srgb, var(--kind, var(--muted)) 38%, var(--surface)); }
.phase-block:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.phase-block[aria-expanded="true"] { background: color-mix(in srgb, var(--kind, var(--muted)) 46%, var(--surface)); box-shadow: inset 0 0 0 2px var(--kind, var(--muted)); }
.phase-block-name { display: block; overflow: hidden; text-overflow: clip; }

.phase-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.phase-line { display: flex; align-items: center; gap: 0.3rem 0.6rem; min-width: 0; }
.phase-line-text { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.6rem; }
.phase-line .button { flex: none; }
.phase-swatch { flex: none; width: 0.8rem; height: 0.8rem; border-radius: 3px; background: var(--kind, var(--muted)); }

.phase-panel { display: grid; gap: 0.9rem; min-width: 0; padding: 0.9rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--kind, var(--accent)); border-radius: var(--radius-small); background: var(--bg); }
.phase-panel h3:focus { outline: none; }
.phase-panel h3:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.phase-panel h4 { margin: 0; font-size: 1rem; }
.phase-ends { min-height: 1.3em; margin: -0.4rem 0 0; }
.tag-rows { display: grid; gap: 0.5rem; }
.tag-row { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 0.2rem 0.75rem; align-items: center; }
.tag-row .error-slot { grid-column: 2; }
.tag-row .hint { margin: 0; }
.tag-row-name { font-weight: 600; font-size: 0.92rem; }
.phase-facts { margin: 0; display: grid; gap: 0.5rem; }
.phase-fact { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 0.2rem 0.75rem; }
.phase-fact dt { font-weight: 600; font-size: 0.92rem; }
.phase-fact dd { margin: 0; }

/* The plan's day tags on a calendar day: a guide, quieter than a workout. */
.day-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.day-tag { font-size: 0.75rem; font-weight: 600; line-height: 1.3; padding: 0.1rem 0.45rem; border-radius: 999px; border: 1px dashed var(--muted); color: var(--muted); overflow-wrap: anywhere; min-width: 0; }

/* The phases behind a metric's chart. */
.chart-phase-band { fill: var(--kind, var(--muted)); fill-opacity: 0.13; }
.chart-phase-edge { stroke: var(--kind, var(--muted)); stroke-width: 3; }
.chart-phase-label { fill: var(--muted); font-size: 11px; font-weight: 600; font-family: var(--font-body); }
.chart-phases { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; }
.chart-swatch.swatch-phase { width: 0.8rem; height: 0.8rem; border-radius: 3px; background: var(--kind, var(--muted)); opacity: 0.6; }

@media (max-width: 30rem) {
  .tag-row, .phase-fact { grid-template-columns: minmax(0, 1fr); }
  .tag-row .error-slot { grid-column: 1; }
  .phase-panel { padding: 0.75rem 0.7rem; }
}

/* ---- Round 8a: messages ---- */

/* The unread count beside a navigation link and on a conversation in the inbox. */
.unread-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.3rem; height: 1.3rem; padding: 0 0.35rem; margin-left: 0.4rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.72rem; font-weight: 700; line-height: 1; vertical-align: middle; }

.link-button { background: none; border: 0; padding: 0.15rem 0.1rem; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-button.danger-text { color: var(--danger); }
.muted-note { color: var(--muted); font-style: italic; }

/* The inbox: one line per conversation. */
.conversation-list { padding: 0; overflow: hidden; }
.conversation { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1rem; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); min-width: 0; }
.conversation:last-child { border-bottom: 0; }
.conversation:hover { background: var(--surface-alt); }
.conversation-main { display: grid; gap: 0.1rem; flex: 1; min-width: 0; }
.conversation-name { font-weight: 500; }
.conversation-unread .conversation-name, .conversation-unread .conversation-last { font-weight: 700; }
.conversation-last { color: var(--muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-unread .conversation-last { color: var(--text); }
.conversation-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex: none; }

/* One conversation: the rows scroll in their own box, the writing box stays beneath. */
.thread { display: grid; gap: 0.75rem; min-width: 0; }
.thread-older { display: flex; justify-content: center; }
.thread-older:empty { display: none; }
.thread-list { display: flex; flex-direction: column; gap: 0.6rem; max-height: min(62vh, 38rem); overflow-y: auto; padding: 0.9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.thread-empty { text-align: center; padding: 1.5rem 0; }
.message { display: grid; gap: 0.3rem; max-width: min(34rem, 86%); padding: 0.6rem 0.8rem; border-radius: var(--radius); background: var(--surface-alt); min-width: 0; }
.message-own { align-self: flex-end; background: var(--accent-soft); }
.message-other { align-self: flex-start; }
.message-gone { background: none; border: 1px dashed var(--line); }
.message-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; align-items: baseline; font-size: 0.8rem; color: var(--muted); }
.message-who { font-weight: 700; color: var(--text); }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-quote { display: grid; gap: 0.1rem; text-align: left; font: inherit; font-size: 0.86rem; color: var(--muted); background: none; border: 0; border-left: 3px solid var(--accent); padding: 0.1rem 0 0.1rem 0.6rem; cursor: pointer; overflow-wrap: anywhere; min-width: 0; }
.message-quote-who { font-weight: 700; font-size: 0.78rem; }
.message-files { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.message-file { display: grid; gap: 0.15rem; max-width: 100%; padding: 0.4rem 0.55rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); color: var(--text); text-decoration: none; min-width: 0; }
.message-file:hover { border-color: var(--accent); }
.message-file-name { font-weight: 600; font-size: 0.88rem; overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 2px; }
.message-thumb { width: 9rem; height: 6.5rem; object-fit: cover; border-radius: 4px; background: var(--surface-alt); display: block; }
.message-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.9rem; font-size: 0.8rem; color: var(--muted); }
.message-foot:empty { display: none; }
.message .confirm { margin-top: 0.2rem; }

/* The writing box. */
.composer { display: grid; gap: 0.5rem; min-width: 0; }
.composer:empty { display: none; }
.composer-text { resize: vertical; min-height: 4.5rem; }
.composer-replying { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.3rem 0.8rem; padding: 0.45rem 0.7rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius-small); font-size: 0.9rem; overflow-wrap: anywhere; }
.composer-files { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.composer-files:empty { display: none; }
.composer-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.6rem; padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 0.86rem; overflow-wrap: anywhere; min-width: 0; }
.composer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }
.composer-send { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; margin-left: auto; }
.composer-attach { position: relative; cursor: pointer; }
.composer-attach:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
/* The file box itself stays out of sight; its label is the button. */
.composer-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.composer-later { display: grid; gap: 0.4rem; padding: 0.75rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); }
.composer-later .input, .scheduled .input[type="datetime-local"] { max-width: 17rem; }
.composer-note:empty { display: none; }

/* Messages waiting to go out. */
.scheduled { display: grid; gap: 0.6rem; }
.scheduled-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 1rem; font-weight: 600; }

/* A message to many: the boxes to tick. */
.check-list { border: 1px solid var(--line); border-radius: var(--radius-small); padding: 0.6rem 0.85rem 0.75rem; margin: 0; display: grid; gap: 0.35rem; max-height: 20rem; overflow-y: auto; min-width: 0; }
.check-list legend { font-weight: 600; font-size: 0.92rem; padding: 0 0.3rem; }

@media (max-width: 30rem) {
  .message { max-width: 94%; }
  .thread-list { padding: 0.6rem; max-height: 58vh; }
  .conversation { padding: 0.7rem 0.75rem; }
  .composer-send { margin-left: 0; }
}
.check-list .check-row { font-weight: 500; }

/* ---------- round 8b: comments, reactions, private day notes, notifications ---------- */

/* The bell in both shells. */
.topbar-end { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 2.4rem; min-height: 2.4rem; padding: 0 0.4rem; border-radius: var(--radius-small); color: var(--text); text-decoration: none; }
.bell:hover, .bell[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.bell .unread-badge { margin-left: 0.15rem; }
.bell-sign { display: block; flex: none; }
/* In the client's top bar the bell stays on the line of the buttons beside it. */
.client-top .actions { flex-wrap: nowrap; flex: none; }
.client-top .org-badge { flex: 1 1 auto; }

/* The panel under a workout or a habit day. */
.thread-title { font-size: 1.05rem; margin: 0; }
.thread-panel { display: grid; gap: 0.7rem; min-width: 0; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.thread-panel[aria-busy="true"] { min-height: 2.5rem; }
.reaction-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.reaction-row:empty { display: none; }
.reaction { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 2.1rem; min-width: 2.6rem; justify-content: center; padding: 0.15rem 0.55rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.95rem; line-height: 1; cursor: pointer; }
.reaction:hover:not(:disabled) { border-color: var(--accent); }
.reaction.is-mine { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.reaction:disabled { cursor: default; opacity: 0.75; }
.reaction-count:empty { display: none; }
.reaction-count { font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; min-width: 0; }
.comment { padding: 0.5rem 0.7rem; border-radius: var(--radius-small); background: var(--surface-alt); min-width: 0; }
.comment.side-coach { border-left: 3px solid var(--accent); }
.comment.side-client { border-left: 3px solid var(--line); }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; font-size: 0.86rem; }
.comment-author { font-weight: 600; overflow-wrap: anywhere; }
.comment-when { color: var(--muted); }
.comment-head .link-button { margin-left: auto; }
.comment-text { margin: 0.2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: grid; gap: 0.4rem; }
.comment-form .input, .day-note .input { resize: vertical; min-height: 3.2rem; width: 100%; }
.comment-writing:empty { display: none; }
.day-note { display: grid; gap: 0.4rem; padding: 0.7rem 0.8rem; border: 1px dashed var(--line); border-radius: var(--radius-small); background: var(--surface); }
.day-note-title { margin: 0; font-size: 0.95rem; }
.day-note .hint { margin: 0; }
.saved:empty { display: none; }
.wcard-feedback { margin-top: 0.15rem; }
.wcard .thread-panel { font-size: 0.86rem; cursor: auto; }
.wcard .thread-panel .reaction { min-height: 1.8rem; min-width: 2.2rem; padding: 0.1rem 0.4rem; font-size: 0.86rem; }
.wcard .thread-panel .comment { padding: 0.4rem 0.5rem; }

/* The list of notifications. */
.notif-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.notif-tools .input { width: auto; min-width: 11rem; max-width: 100%; }
.notif-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.notif-list > li { border-bottom: 1px solid var(--line); }
.notif-list > li:last-child { border-bottom: 0; }
.notif-row { display: flex; align-items: flex-start; gap: 0.7rem; width: 100%; padding: 0.8rem 1rem; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.notif-row:hover { background: var(--surface-alt); }
.notif-dot { flex: none; width: 0.6rem; height: 0.6rem; margin-top: 0.45rem; border-radius: 50%; border: 1px solid var(--line); }
.notif-row.is-unread .notif-dot { background: var(--accent); border-color: var(--accent); }
.notif-main { display: grid; gap: 0.1rem; min-width: 0; }
.notif-what { overflow-wrap: anywhere; }
.notif-row.is-unread .notif-what { font-weight: 600; }
.notif-when { color: var(--muted); font-size: 0.85rem; }

/* The personal switches. */
.ns-table { width: 100%; border-collapse: collapse; }
.ns-table th, .ns-table td { padding: 0.6rem 0.4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ns-table thead th { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.ns-table tbody tr:last-child th, .ns-table tbody tr:last-child td { border-bottom: 0; }
.ns-table tbody th { font-weight: 400; }
.ns-kind { display: block; font-weight: 600; }
.ns-what { display: block; }
.ns-table .ns-switch { width: 5.2rem; text-align: center; }
.ns-table input[type="checkbox"] { width: 1.3rem; height: 1.3rem; accent-color: var(--accent); }

@media (max-width: 30rem) {
  .ns-table .ns-switch { width: 3.6rem; font-size: 0.78rem; }
  .notif-row { padding: 0.7rem 0.75rem; }
  .notif-tools .input { flex: 1 1 100%; }
}

/* ---------- round 8c: group chats ---------- */
.groups-section { margin-top: 1.75rem; }
.groups-section h2 { margin: 0; }
.group-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; border-radius: var(--radius-small); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.9rem; text-transform: uppercase; }
.conversation-name { overflow-wrap: anywhere; }

/* Who is in the group, folded away until asked for. */
.group-people { margin: 0.25rem 0 1rem; font-size: 0.92rem; color: var(--muted); }
.group-people summary { cursor: pointer; font-weight: 600; width: fit-content; max-width: 100%; }
.group-people p { margin: 0.3rem 0 0; overflow-wrap: anywhere; }
.group-people strong { color: var(--text); }

/* Pinned messages sit above the rows. */
.thread-pins { display: grid; gap: 0.35rem; padding: 0.6rem 0.75rem; background: var(--accent-soft); border-radius: var(--radius); min-width: 0; }
.thread-pins:empty { display: none; }
.pinned-title { margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.pinned { display: flex; flex-wrap: wrap; gap: 0.1rem 0.6rem; align-items: baseline; width: 100%; padding: 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; min-width: 0; }
.pinned:hover { border-color: var(--accent); }
.pinned-who { font-weight: 700; flex: none; max-width: 100%; overflow-wrap: anywhere; }
.pinned-text { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.message-role { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; padding: 0 0.35rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.message-pin-mark { border-color: var(--accent); color: var(--accent); }
.message-pinned { border-color: var(--accent); }
.message-who { overflow-wrap: anywhere; }

/* The settings of a group. */
.group-settings { margin-bottom: 1.25rem; }
.group-settings h2 { font-size: 1.1rem; margin: 0; }
.group-settings > section + section { padding-top: 1.1rem; border-top: 1px solid var(--line); }
.link-list, .member-list { display: grid; border: 1px solid var(--line); border-radius: var(--radius-small); overflow: hidden; }
.link-row, .member-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.9rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); min-width: 0; }
.link-row:last-child, .member-row:last-child { border-bottom: 0; }
.link-name, .member-name { font-weight: 600; flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.member-tag { color: var(--muted); font-size: 0.85rem; flex: 0 1 auto; }
.link-row .check-row, .link-form .check-row { font-weight: 500; }
.link-row .check-row input:disabled + span { color: var(--muted); }
.link-form { display: grid; gap: 0.6rem; }
.link-form .input { max-width: 26rem; }
.add-people-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 0.9rem; }
.group-leave { margin-top: 1.5rem; display: grid; gap: 0.5rem; justify-items: start; }
.group-leave .confirm { width: 100%; }

@media (max-width: 30rem) {
  .link-row, .member-row { padding: 0.5rem 0.6rem; }
  .thread-pins { padding: 0.5rem; }
}
.page > h1 + .groups-section { margin-top: 0.75rem; }
/* Delta 12: the two answers to a question in a group stay on one line each, and go under one another when the row is too narrow. */
.group-settings .confirm-actions, .group-leave .confirm-actions { flex-wrap: wrap; }
.group-settings .confirm-actions .button, .group-leave .confirm-actions .button { white-space: nowrap; }

/* ---------- consults, check-ins and client forms (rounds 9a, 9b) ---------- */

/* Rows that open something: a template, a consult, a check-in, a form. */
.ctpl-list, .consult-list, .checkin-list, .form-list { list-style: none; margin: 0; padding: 0; display: grid; }
.ctpl-list { overflow: hidden; padding: 0; }
.form-list.card { padding: 0.35rem 1rem; }
.ctpl-list > li, .consult-list > li, .checkin-list > li, .form-list > li { border-bottom: 1px solid var(--line); min-width: 0; }
.ctpl-list > li:last-child, .consult-list > li:last-child, .checkin-list > li:last-child, .form-list > li:last-child { border-bottom: 0; }
.ctpl-row, .consult-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap;
  width: 100%; min-width: 0; padding: 0.75rem 1rem; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.consult-row { padding: 0.7rem 0.25rem; }
.ctpl-row:hover, .consult-row:hover { background: var(--surface-alt); }
.ctpl-row-main, .consult-row-main { display: grid; gap: 0.1rem; min-width: 0; flex: 1 1 12rem; }
.starter-line { margin: 0; }
.starter-line .link-button { font-size: inherit; }

/* The template editor and the consult form. */
.q-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; counter-reset: question; }
.q-row, .sec-row { display: grid; gap: 0.5rem; padding: 0.75rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); min-width: 0; }
.q-row { counter-increment: question; }
.q-row-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, 14rem); gap: 0.5rem; align-items: start; }
.q-row-main::before { content: none; }
.q-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; }
.q-options { display: grid; gap: 0.3rem; }
.q-options .hint { margin: 0; }
.q-row > .error-slot:empty, .sec-row > .error-slot:empty, .q-row-foot > .error-slot:empty { display: none; }
.sec-rows { display: grid; gap: 0.75rem; }
.sec-row-head { display: flex; gap: 0.5rem; align-items: center; }
.sec-row-head .input { flex: 1 1 auto; min-width: 0; }
.ctpl-editor textarea.input, .consult-form textarea.input { resize: vertical; }
.ctpl-editor [readonly], .consult-form [readonly] { background: var(--surface-alt); }

/* A client's consult page. */
.consult-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; }
.consult-fact { font-weight: 600; overflow-wrap: anywhere; }
.cis-status { margin: 0; }
.checkin-item.is-open, .form-item.is-open { padding-bottom: 0.9rem; }
.checkin-details { padding: 0.25rem 0.25rem 0; min-width: 0; }
.consult-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.timeline-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.3rem 0 0.3rem 0.75rem; border-left: 3px solid var(--line); }
.timeline-row.is-check_in { border-left-color: var(--accent); }
.timeline-date { font-weight: 600; min-width: 9.5rem; }

/* Answers as they are read. */
.answer-list { margin: 0; display: grid; gap: 0.6rem; }
.answer-row { display: grid; gap: 0.1rem; min-width: 0; }
.answer-row dt { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.answer-row dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
.answer-row.is-empty dd { font-weight: 400; color: var(--muted); font-style: italic; }

/* Questions as they are answered. */
.question-sheet { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; counter-reset: sheet; }
.question-row { display: grid; gap: 0.4rem; min-width: 0; counter-increment: sheet; }
.question-text { font-weight: 600; overflow-wrap: anywhere; }
.question-text::before { content: counter(sheet) ". "; color: var(--muted); font-weight: 400; }
.question-row select.input { max-width: 18rem; }

/* On the client's home page: something is waiting. */
.due-card { display: block; text-decoration: none; color: var(--text); border-left: 4px solid var(--accent); }
.due-card:hover { background: var(--accent-soft); }

@media (max-width: 34rem) {
  .q-row-main { grid-template-columns: minmax(0, 1fr); }
  .timeline-date { min-width: 0; }
  /* Six links now share the switch between a client's pages: on a phone they take a second line. */
  .segmented { flex-wrap: wrap; max-width: 100%; }
  .segmented a.button { flex: 1 1 auto; justify-content: center; border-top: 1px solid var(--line); margin-top: -1px; }
}

/* ---------- the coach dashboard (round 9c) ---------- */

.dashboard .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; min-width: 0; }
.dashboard .panel-head .input, .dash-tools .input { width: auto; max-width: 100%; min-width: 0; }
.dash-tools { display: flex; gap: 0.5rem; flex-wrap: wrap; min-width: 0; max-width: 100%; }
/* A select is as wide as its longest option (a long client name): inside a row of tools it
   may shrink, and the columns of the page never grow past the screen because of it. */
.dash-tools select.input { flex: 0 1 auto; width: auto; }
.dashboard .stack, .dashboard .card { grid-template-columns: minmax(0, 1fr); }
.figure-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0.75rem; }
.figure-grid .hint { margin: 0; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (min-width: 68rem) {
  .dash-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

/* What clients did. */
.update-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.update-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.update-row:last-child { border-bottom: 0; }
.update-row[data-kind="workout"] .update-what::before { content: "● "; color: var(--accent); }
.update-row[data-kind="habit"] .update-what::before { content: "◆ "; color: var(--muted); }
.update-row[data-kind="check_in"] .update-what::before { content: "■ "; color: var(--muted); }
.update-main { display: grid; gap: 0.15rem; min-width: 0; }
.update-what { overflow-wrap: anywhere; }
.update-facts, .update-when { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.update-remark { font-style: italic; overflow-wrap: anywhere; }
/* The two controls of a row sit under what it says, so the words keep the full width. */
.update-actions { flex-wrap: wrap; justify-content: flex-start; gap: 0.5rem; }
.update-row > .thread-panel, .update-row > div:last-child { min-width: 0; }
.update-row > div:last-child:empty { display: none; }

/* Contacts of the week. */
.contacts-summary { margin: 0; }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; }
.contact-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; padding: 0.45rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.contact-row:last-child { border-bottom: 0; }
.contact-name { font-weight: 600; overflow-wrap: anywhere; min-width: 0; text-decoration: none; color: var(--text); }
.contact-name:hover { text-decoration: underline; }

/* Figures on the coach list. */
.figure-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: 0.4rem 0.9rem; }
.figure-facts > div { display: grid; min-width: 0; }
.figure-facts dt { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.figure-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.coach-figures { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--line); }
.team-figures { display: grid; gap: 0.4rem; }

/* The watch list and the to-dos (round 9c, part 2). */
.watch-list, .todo-list { list-style: none; margin: 0; padding: 0; display: grid; }
.watch-row { display: grid; gap: 0.6rem; padding: 0.7rem 0 0.7rem 0.75rem; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; min-width: 0; }
.watch-row:last-child { border-bottom: 0; }
.watch-row.is-pressing { border-left-color: var(--danger); }
.watch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem 1rem; min-width: 0; }
.watch-who { display: grid; gap: 0.3rem; min-width: 0; }
.watch-who .team-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.watch-flags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.watch-flags .tag { white-space: normal; }
.tag.watch-pressing { background: var(--danger-soft); color: var(--danger); }
.watch-details { min-width: 0; }
.watch-details .figure-grid .hint { margin: 0; }
.watch-pause { align-items: center; }
.watch-services { padding: 0.7rem 0.8rem; border: 1px dashed var(--line); border-radius: var(--radius-small); }
.panel-head h2 .tag { vertical-align: middle; font-family: var(--font-body); }

.todo-new .input[type="text"], .todo-edit .input[type="text"] { width: 100%; }
.todo-new .dash-tools .input, .todo-edit .dash-tools .input { flex: 1 1 9rem; }
.todo-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.3rem 0.7rem; align-items: start; padding: 0.6rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.todo-row:last-child { border-bottom: 0; }
.todo-row > form { grid-column: 1 / -1; }
.todo-row input[type="checkbox"] { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; accent-color: var(--accent); }
.todo-mark { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.todo-main { display: grid; gap: 0.1rem; min-width: 0; }
.todo-text { overflow-wrap: anywhere; }
.todo-row.is-done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-late { color: var(--danger); }
.todo-actions { gap: 0.4rem; }
.todo-row .hint { margin: 0; }

/* On a client's calendar: how far they are programmed. */
.due-line { display: flex; flex-wrap: wrap; gap: 0.4rem; min-height: 1.5rem; }
.due-chip { white-space: normal; }
.due-chip.is-flagged { background: var(--danger-soft); color: var(--danger); }

/* Round 6c: evaluation templates in the library and a client's evaluations. */
.evt-item .eyebrow, .eval-item .eyebrow { margin: 0; }
.evt-item .hint, .eval-item .hint { margin: 0; }
.evt-findings { list-style: none; margin: 0; padding: 0 0 0 0.75rem; border-left: 2px solid var(--line); display: grid; gap: 0.5rem; }
.evt-finding { display: grid; gap: 0.3rem; min-width: 0; }
.evt-finding > .error-slot:empty { display: none; }
.evt-finding-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0.5rem; align-items: start; }
.evt-editor textarea.input, .eval-form textarea.input { resize: vertical; }
.evt-editor [readonly], .eval-form [readonly] { background: var(--surface-alt); }
.eval-starter { align-items: center; }
.eval-starter > .button { flex: 0 0 auto; }
.eval-item-title { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.eval-value-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.eval-ok-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: start; }
.eval-ok-row > .input { flex: 0 1 11rem; }
.eval-finding { flex: 1 1 12rem; display: grid; gap: 0.3rem; min-width: 0; }
.eval-finding[hidden] { display: none; }
.eval-finding > .error-slot:empty { display: none; }
.evaluations-page .saved-slot:empty { display: none; }
.evaluations-page .saved a { font-weight: 600; }
@media (max-width: 640px) {
  .evt-finding-main { grid-template-columns: minmax(0, 1fr); }
  .evt-item .q-row-main { grid-template-columns: minmax(0, 1fr); }
}

/* Round 6c, part 2: the metric an exercise feeds, in the workout editor and on the client's workout page. */
.we-ex-metric-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; min-width: 0; }
.we-ex-metric-row .hint { margin: 0; }
.we-ex-metric-row .we-ex-metric { flex: 1 1 12rem; min-width: 0; max-width: 22rem; }
.aw-item-metric-slot:empty { display: none; }
.aw-item-metric { margin: 0; padding: 0.4rem 0.6rem; border-radius: var(--radius-small); background: var(--accent-soft); font-size: 0.92rem; overflow-wrap: anywhere; }
/* Long words in a template or an evaluation wrap inside their box instead of widening the page. */
.eval-form, .evt-editor, .eval-items, .evt-items, .evt-findings { min-width: 0; }
.eval-form > *, .evt-editor > *, .eval-item > *, .evt-item > *, .evt-finding-main > * { min-width: 0; max-width: 100%; }
.eval-form h3, .eval-form .hint, .evt-editor h2, .evt-editor .hint, .evaluations-page .saved { overflow-wrap: anywhere; }
.eval-form select.input, .evt-editor select.input, .eval-starter select.input { min-width: 0; max-width: 100%; }
.eval-ok-row { min-width: 0; }

/* ---------------------------------------------------------------- round 10a: the money pages */
.test-banner { background: var(--accent-soft); color: var(--text); border: 1px dashed var(--accent); border-radius: var(--radius-small); padding: 0.55rem 0.8rem; font-size: 0.92rem; overflow-wrap: anywhere; }
.money-page .tabs { margin-top: -0.25rem; }
.money-row { min-width: 0; }
.money-row-main { display: flex; align-items: center; gap: 0.4rem 0.75rem; flex-wrap: wrap; min-width: 0; }
.money-row-main > .button, .money-row-main > .money-row-actions { margin-left: auto; }
.money-row-title { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.money-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.money-row-detail { overflow-wrap: anywhere; }
.money-row-actions { margin-left: auto; }
.tag.money-good { background: var(--accent-soft); color: var(--accent); }
.tag.money-bad { background: var(--danger-soft); color: var(--danger); }
.tag.money-open { background: transparent; border: 1px solid var(--line); color: var(--text); }
.link-state { display: flex; align-items: center; gap: 0.5rem 0.75rem; flex-wrap: wrap; }
.money-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3rem 1rem; margin: 0; }
.money-facts dt { color: var(--muted); font-size: 0.9rem; }
.money-facts dd { margin: 0; overflow-wrap: anywhere; }
.money-form { min-width: 0; }
.money-form .input { max-width: 100%; }
.money-form textarea.input { resize: vertical; }
.money-form-title { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.money-form.stack, .bare-card.stack, .bare-card .stack { grid-template-columns: minmax(0, 1fr); } /* a long name never widens the form */
.money-editor { border-top: 1px solid var(--line); padding-top: 0.9rem; min-width: 0; }
.money-price { min-width: 0; }
.money-price .error-slot { flex: 1 1 100%; }
.money-toolbar { align-items: flex-end; justify-content: space-between; }
.money-toolbar .field { min-width: 10rem; }
.money-refunds { padding-left: 0.9rem; border-left: 2px solid var(--line); gap: 0.2rem; }
.money-refunds li { overflow-wrap: anywhere; }
.money-total { font-size: 1.05rem; }
.money-inline { padding: 0.9rem; box-shadow: none; }
.client-money > h2 { margin-top: 0.5rem; }
/* Round 10b: retainers, their periods, and the hold. */
.period-list { margin: 0; padding-left: 0.9rem; border-left: 2px solid var(--line); gap: 0.35rem; }
.period-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 0.75rem; min-width: 0; font-size: 0.94rem; }
.period-row > * { min-width: 0; overflow-wrap: anywhere; }
.period-days { font-weight: 600; }
.money-row .confirm.stack { display: grid; justify-content: stretch; align-items: start; }
.money-row .confirm .field { min-width: 0; }
.held-banner { background: var(--danger-soft); color: var(--text); border: 1px solid var(--danger); border-radius: var(--radius-small); padding: 0.7rem 0.9rem; overflow-wrap: anywhere; }
.held-page { max-width: 38rem; }
.held-page h1 { overflow-wrap: anywhere; }
a.tag.money-bad { text-decoration: none; white-space: normal; }
a.tag.money-bad:hover, a.tag.money-bad:focus-visible { text-decoration: underline; }
a.money-row-title { color: inherit; }
/* One metric's page: a name of one very long word never widens the page (found in round 10a). */
.metric-page .page-header > div { min-width: 0; }
.metric-page .page-header h1, .metric-page .page-header p { overflow-wrap: anywhere; }
.saved-slot:empty { display: none; }

/* The bill's own page and the page of the test processor: no sign-in, no frame. */
.bare-layout { min-height: 100vh; display: grid; align-content: start; justify-items: center; padding: 2.5rem 1rem; }
.bare-main { width: 100%; max-width: 34rem; min-width: 0; }
.bare-card { padding: 1.5rem; min-width: 0; }
.bare-card h1, .bare-card p { overflow-wrap: anywhere; }
.bare-card .input { max-width: 100%; }
.pay-head { display: flex; gap: 0.9rem; align-items: flex-start; min-width: 0; }
.pay-head > div { min-width: 0; }
.pay-org { font-weight: 600; color: var(--accent); overflow-wrap: anywhere; }
.pay-lines { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pay-lines th { text-align: left; font-weight: 400; overflow-wrap: anywhere; padding: 0.45rem 0.5rem 0.45rem 0; }
.pay-lines td { text-align: right; font-variant-numeric: tabular-nums; padding: 0.45rem 0; width: 9.5rem; }
.pay-lines tr { border-top: 1px solid var(--line); }
.pay-lines tr:first-child { border-top: 0; }
.pay-lines .pay-total th, .pay-lines .pay-total td { font-weight: 700; border-top: 2px solid var(--text); }
.pay-state { font-size: 1rem; }
@media (max-width: 30rem) {
  .money-row-main > .button, .money-row-main > .money-row-actions, .money-row-actions { margin-left: 0; }
  .money-facts { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .money-facts dd { margin-bottom: 0.4rem; }
  .pay-lines td { width: 7rem; }
}

/* Round 10c: selling to visitors. The public pages (a listing, a shop, the checkout, the
   page after paying) and the editors behind them. A public page is a reading page: one
   column, the organization's own words, the prices set apart at the end of what they belong to. */
.bare-main.wide { max-width: 46rem; }
.public-page { padding: clamp(1.25rem, 4vw, 2.5rem); display: grid; gap: 1.4rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.public-page.has-color { border-top: 0.5rem solid var(--shop-color); }
.public-page h1, .public-page h2, .public-page h3, .public-page p, .public-page li, .public-page dt, .public-page dd, .public-page blockquote, .public-page figcaption { overflow-wrap: anywhere; }
.public-mast { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.public-org { font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; overflow-wrap: anywhere; min-width: 0; }
.public-title { font-size: clamp(1.9rem, 6vw, 2.8rem); line-height: 1.1; letter-spacing: -0.01em; }
.public-prose { display: grid; gap: 0.7rem; }
.public-prose p { margin: 0; white-space: pre-line; max-width: 62ch; }
.public-prose:empty, .public-prose p:empty { display: none; }
.public-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.public-facts li { border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.8rem; font-size: 0.9rem; background: var(--surface-alt); }
.public-image { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 24rem; object-fit: cover; border-radius: var(--radius); background: var(--surface-alt); overflow: hidden; font-size: 0.85rem; color: var(--muted); }
.public-link { overflow-wrap: anywhere; }
.public-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.public-links:empty { display: none; }
.public-coach { display: grid; gap: 0.7rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--surface-alt); min-width: 0; }
.public-coach-head { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.public-coach-name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; margin: 0; min-width: 0; }
.public-prices, .public-section, .public-shelf, .public-item { display: grid; gap: 0.8rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.public-section + .public-section { border-top: 1px solid var(--line); padding-top: 1.4rem; }
.public-section:empty { display: none; }
.public-shelf + .public-shelf { margin-top: 0.8rem; }
.public-item { padding-left: 0.9rem; border-left: 3px solid var(--accent-soft); }
.public-price-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.public-price { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; flex-wrap: wrap; padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.public-price-main { display: grid; gap: 0.15rem; min-width: 0; flex: 1 1 12rem; }
.public-price-name { font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.public-price-amount { font-variant-numeric: tabular-nums; color: var(--muted); margin: 0; }
.public-closed { border: 1px dashed var(--line); border-radius: var(--radius-small); padding: 0.6rem 0.8rem; color: var(--muted); margin: 0; }
.public-questions { margin: 0; display: grid; gap: 0.9rem; }
.public-question dt { font-weight: 600; }
.public-question dd { margin: 0.2rem 0 0; color: var(--muted); white-space: pre-line; }
.public-quote { margin: 0; padding: 0.2rem 0 0.2rem 1rem; border-left: 3px solid var(--accent); display: grid; gap: 0.35rem; }
.public-quote blockquote { margin: 0; font-family: var(--font-display); font-size: 1.1rem; white-space: pre-line; }
.public-quote figcaption { color: var(--muted); font-size: 0.9rem; }
.public-quote figcaption::before { content: "— "; }
.public-contact { display: grid; gap: 0.4rem; }
.public-contact p { margin: 0; }
.public-note { text-align: center; }
.checkout-what { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; display: grid; gap: 0.2rem; background: var(--surface-alt); min-width: 0; }
.checkout-what p { margin: 0; overflow-wrap: anywhere; }
.button.is-off { opacity: 0.5; cursor: not-allowed; }

/* The editors: a listing, a shop, the list of purchases. */
.preview-banner { background: var(--surface-alt); border: 1px dashed var(--muted); border-radius: var(--radius-small); padding: 0.6rem 0.85rem; font-size: 0.92rem; overflow-wrap: anywhere; }
.preview-page { justify-items: stretch; }
.preview-page .public-page { max-width: 46rem; }
.public-address { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92rem; overflow-wrap: anywhere; margin: 0; padding: 0.5rem 0.7rem; background: var(--surface-alt); border-radius: var(--radius-small); }
.check-line { display: flex; align-items: flex-start; gap: 0.45rem; min-width: 0; }
.check-line input { margin-top: 0.25rem; flex: none; }
.check-line span { min-width: 0; overflow-wrap: anywhere; }
.listing-editor .card, .shop-editor .card { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.listing-editor .input, .shop-editor .input { max-width: 100%; }
.listing-editor textarea.input, .shop-editor textarea.input { resize: vertical; }
.listing-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--gap); align-items: start; }
.length-pair { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.length-pair select.input { width: auto; flex: 0 1 9rem; }
.listing-coach { margin: 0; overflow-wrap: anywhere; }
.picture-now { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.picture-preview { width: 9rem; height: 6rem; object-fit: cover; border-radius: var(--radius-small); background: var(--surface-alt); }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-small); }
.shop-shelf { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.shop-item, .shop-pair { border-left: 3px solid var(--accent-soft); padding-left: 0.8rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.shop-row-head { display: flex; align-items: flex-end; gap: 0.6rem; flex-wrap: wrap; min-width: 0; }
.shop-row-head > .field { flex: 1 1 14rem; }
.shop-prices { border: 1px solid var(--line); border-radius: var(--radius-small); padding: 0.6rem 0.8rem; margin: 0; display: grid; gap: 0.35rem; min-width: 0; }
.shop-prices legend { font-weight: 600; font-size: 0.92rem; padding: 0 0.3rem; }
.money-selling { border-top: 1px dashed var(--line); padding-top: 0.9rem; min-width: 0; }
/* A name of one very long word never widens a page: the title of every page breaks where it
   has to (a program's name on its own page and on its public page's editor), and so does a
   buyer's address in the list of purchases. Found at 375 px in round 10c. */
.page-header > div { min-width: 0; }
.page-header h1, .page-header p { overflow-wrap: anywhere; }
.money-row-main > .hint { overflow-wrap: anywhere; min-width: 0; }
.listing-editor .hint, .shop-editor .hint, .listing-editor .muted-note, .shop-editor .muted-note { overflow-wrap: anywhere; }

/* ---- Round 10d: agreements ---- */
/* The text of an agreement is the organization's own: it keeps its line breaks, and a word
   of any length breaks where it has to. */
.agreement-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); min-width: 0; }
.agreement-footer { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-size: 0.88rem; border-top: 1px solid var(--line); padding-top: 0.7rem; margin: 0; }
.agreement-title { font-family: var(--font-display); overflow-wrap: anywhere; margin: 0; }
.agreement-doc, .agreement-page, .agreement-page .stack { grid-template-columns: minmax(0, 1fr); }
.agreement-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.5rem 1rem; }
.agreement-facts > div { display: grid; min-width: 0; }
.agreement-facts dt { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.agreement-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.agreement-row .money-row-title { text-decoration-thickness: 1px; }
/* A form opened inside a row (a template's fields, the client to send it to) never widens the row. */
.agreement-row { grid-template-columns: minmax(0, 1fr); }
.agreement-row .field, .client-agreements .field { min-width: 0; }
.agreement-row .field label, .client-agreements .field label { overflow-wrap: anywhere; }
.agreement-excerpt { white-space: pre-line; margin: 0; }
.agreement-input { resize: vertical; min-height: 10rem; }
.agreement-code { max-width: 11rem; font-variant-numeric: tabular-nums; letter-spacing: 0.25em; font-size: 1.15rem; }
.agreement-rule { border: 0; border-top: 1px solid var(--line); margin: 0; width: 100%; }
.agreement-page .check-line { font-weight: 500; }

/* ---- Round 10d: earnings ---- */
/* A rule box: what is earned in one place, with its kind, its value and a save of its own. */
.rule-box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0.75rem 0.95rem; display: grid; gap: 0.5rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.rule-box-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.75rem; min-width: 0; }
.rule-box-head .hint { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.rule-box-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem; min-width: 0; }
.rule-box-controls select.input { width: auto; flex: 0 1 12rem; min-width: 0; }
.rule-value { display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; min-width: 0; }
.rule-value:empty { display: none; }
.rule-value .hint { margin: 0; }
.rule-box[data-kind="none"] { border-style: dashed; }
.pay-run h3, .my-earnings h2 { margin: 0; overflow-wrap: anywhere; }
.pay-run { grid-template-columns: minmax(0, 1fr); }
.my-earnings .card { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.stat-tile .figure-note { overflow-wrap: anywhere; }
/* The money pages have thirteen entries now: where there is room they wrap onto a second
   line instead of hiding the last ones off the edge; on a phone they keep scrolling sideways. */
@media (min-width: 720px) {
  .money-page .tabs { flex-wrap: wrap; overflow-x: visible; row-gap: 0; }
}

/* ------------------------------------------------------------------ round 11: reports, files of data, roster import */

/* Eleven links share the switch between a client's pages: they wrap rather than run off the edge. */
.segmented { flex-wrap: wrap; max-width: 100%; }

.report-form, .report-files, .export-box { margin: 1rem 0; }
.report-dates { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.report-dates[hidden] { display: none; }
.report-fieldset { border: 1px solid var(--line); border-radius: var(--radius-small); padding: 0.6rem 0.8rem; margin: 0.6rem 0; min-width: 0; }
.report-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.35rem 1rem; }
.report-section-choice.empty span { color: var(--muted); }
.report-choice { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0.4rem 0; }
.report-choice[hidden] { display: none; }
.actions.wrap { flex-wrap: wrap; }
.column-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.25rem 1rem; margin: 0.6rem 0; }
.column-choice span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

.report-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; align-items: center; }
.report-document { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; overflow-wrap: anywhere; }
.report-head { border-bottom: 2px solid var(--line); padding-bottom: 0.8rem; margin-bottom: 0.8rem; }
.report-org { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; color: var(--muted); }
.report-logo { max-height: 2.6rem; max-width: 8rem; object-fit: contain; }
.report-client { margin: 0.3rem 0 0.2rem; }
.report-range { margin: 0; }
.report-sub { color: var(--muted); font-weight: normal; }
.report-section { margin-top: 1.4rem; }
.report-section > h2 { font-size: 1.15rem; border-bottom: 1px solid var(--line); padding-bottom: 0.25rem; }
.report-item { padding: 0.5rem 0; border-bottom: 1px dashed var(--line); break-inside: avoid; page-break-inside: avoid; }
.report-item h3 { font-size: 1rem; margin: 0 0 0.25rem; display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: baseline; }
.report-subhead { font-size: 1rem; margin: 0.8rem 0 0.3rem; }
.report-line { margin: 0.2rem 0; }
.report-note { margin: 0.2rem 0; white-space: pre-wrap; }
.report-list { margin: 0.3rem 0 0.3rem 1.1rem; padding: 0; }
.report-list.compact li { font-size: 0.9rem; }
.report-days { list-style: none; margin: 0.3rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.15rem 1rem; font-size: 0.9rem; }
.report-day { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.report-day.missed span:nth-child(2) { color: var(--muted); }
.report-facts { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: 0.2rem 1rem; margin: 0.3rem 0; }
.report-facts dt { color: var(--muted); }
.report-facts dd { margin: 0; white-space: pre-wrap; }
.report-nothing { color: var(--muted); font-style: italic; }
.report-chart { width: 100%; max-width: 22rem; height: auto; display: block; margin: 0.3rem 0; }
.report-chart-axis { stroke: var(--line); stroke-width: 1; }
.report-chart-line { stroke: var(--accent); stroke-width: 2; }
.report-chart-dot { fill: var(--accent); }
.report-shares { margin-top: 1.2rem; }
.bare-main .report-page-wrap { max-width: 56rem; margin: 0 auto; }

.import-counts { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0; }
.import-count { border: 1px solid var(--line); border-radius: var(--radius-small); padding: 0.4rem 0.7rem; display: flex; gap: 0.4rem; align-items: baseline; background: var(--surface); }
.import-count.error strong { color: var(--danger, #b3261e); }
.import-headers { list-style: none; padding: 0; margin: 0.3rem 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.import-rows { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.8rem 0; }
.import-row { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); border-collapse: separate; table-layout: fixed; }
.import-row tr { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; padding: 0.45rem 0.6rem; }
.import-row th, .import-row td { display: block; text-align: left; font-weight: normal; min-width: 0; overflow-wrap: anywhere; }
div.import-row { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; padding: 0.45rem 0.6rem; overflow-wrap: anywhere; }
.import-row.error { border-color: var(--danger, #b3261e); }
.import-row.left_out { opacity: 0.7; }
.import-row-head { display: flex !important; gap: 0.5rem; align-items: center; flex: 1 0 100%; }
.import-cell { cursor: pointer; padding: 0.1rem 0.3rem; border-radius: var(--radius-small); }
.import-cell:hover, .import-cell:focus { background: var(--surface-alt); outline: none; }
.import-cell.problem { background: color-mix(in srgb, var(--danger, #b3261e) 10%, transparent); }
.import-cell.editing { display: flex !important; gap: 0.3rem; align-items: center; cursor: default; }
.import-label { color: var(--muted); }
.import-reason { display: block; font-size: 0.85rem; }

/* Print (reports 8.4): only the document, one section per sheet after the first, dark on white. */
@media print {
  @page { margin: 15mm; }
  html, body { background: #fff !important; color: #000 !important; }
  .topbar, .mainnav, .app-footer, .skip-link, .no-print, .report-shares, .report-controls { display: none !important; }
  .shell, .content, .bare-layout, .bare-main, .page { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; background: #fff !important; }
  .report-document { border: 0 !important; padding: 0 !important; background: #fff !important; color: #000 !important; box-shadow: none !important; }
  .report-document * { color: #000 !important; background: transparent !important; }
  .report-section { break-before: page; page-break-before: always; }
  .report-section:first-of-type { break-before: auto; page-break-before: auto; }
  .report-item, .report-chart { break-inside: avoid; page-break-inside: avoid; }
  .report-chart-line { stroke: #000 !important; }
  .report-chart-dot { fill: #000 !important; }
  .report-chart-axis { stroke: #888 !important; }
}

/* Print of a signed agreement (reports RP-AMD-7): only the document, flowing from one sheet to the next, without controls. */
@media print {
  .agreement-page[data-state="signed"] { border: 0 !important; box-shadow: none !important; max-width: none !important; padding: 0 !important; background: #fff !important; color: #000 !important; overflow: visible !important; }
  .agreement-page[data-state="signed"] * { color: #000 !important; background: transparent !important; }
  .agreement-page[data-state="signed"] button, .agreement-page[data-state="signed"] form, .agreement-page[data-state="signed"] .button { display: none !important; }
  .agreement-page[data-state="signed"] .agreement-text { white-space: pre-wrap; overflow: visible !important; max-height: none !important; }
  .bare-layout .wordmark { display: none !important; }
}

.import-cell.editing .button { white-space: nowrap; flex: none; }
.import-cell.editing .input { min-width: 0; flex: 1 1 auto; }

/* ---------------------------------------------------------------- round 12a: health data */
.health-source-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.health-source-head h2 { margin: 0; }
.health-source.state-needs_reauth .health-state, .health-source.state-unreachable .health-state, .health-source.state-stale .health-state { background: var(--danger-soft); color: var(--danger); }
.health-source.state-connected .health-state { background: var(--accent-soft); color: var(--accent); }
.health-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.25rem 1rem; }
.health-order { display: grid; gap: 0.75rem; }
.health-order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.health-order-item { display: flex; align-items: center; gap: 0.5rem; }
.health-order-item > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.trend-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.trend-head h2 { margin: 0 auto 0 0; }
.trend-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.trend-point { display: grid; grid-template-columns: 6.5rem 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 0.75rem; }
.trend-bar { grid-row: 1 / span 2; grid-column: 2; display: none; }
.trend-date { grid-column: 1; font-size: 0.85rem; color: var(--muted); }
.trend-value { grid-column: 2; overflow-wrap: anywhere; }
.trend-from { display: block; font-size: 0.85rem; }
.trend-days-7 .trend-point, .trend-bars.days-7 .trend-point { padding: 0.15rem 0; border-bottom: 1px solid var(--line); }
.trend-target { margin: 0; }
.device-tag { background: var(--accent-soft); color: var(--accent); }
.health-connection { padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.hint.block { display: block; }
.integration-line { align-items: flex-start; }

/* Round 12b, delta 19: the plan generator's drafts page and draft page. */
.draft-row {
  width: 100%; font: inherit; color: inherit; text-align: left;
  background: var(--surface); cursor: pointer; min-height: 2.8rem;
}
.draft-row:hover { background: var(--surface-alt); }
.draft-row:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.draft-row-intents { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; color: var(--muted); font-size: 0.9rem; }
.draft-intent + .draft-intent::before { content: "·"; margin-right: 0.35rem; }
.draft-row-open { color: var(--muted); font-size: 1.2rem; line-height: 1; }
.tag.state-ready { background: var(--accent-soft); color: var(--accent); }
.tag.state-accepted { background: var(--accent); color: var(--accent-ink); }
.tag.state-failed { background: var(--danger-soft); color: var(--danger); }
.day-checks { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; }
.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
@media (max-width: 40rem) { .two-columns { grid-template-columns: minmax(0, 1fr); } }
.draft-items { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.45rem; }
.draft-item { overflow-wrap: anywhere; }
.draft-item .badge { margin-left: 0.4rem; }
.draft-item-format { display: inline-block; margin-left: 0.25rem; vertical-align: 0.1em; white-space: normal; }
.draft-item-about { margin-top: 0.15rem; }
.badge { font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface-alt); color: var(--muted); }
.draft-state.state-failed { border-color: var(--danger); }
.sent-json { margin: 0; padding: 0.75rem; background: var(--surface-alt); border-radius: var(--radius-small); overflow-x: auto; font-size: 0.85rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.sent-raw { margin-top: 0.6rem; }
.sent-raw summary { cursor: pointer; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.4rem; }

/* Stage 1: session packs */
.pack-big { font-size: 1.6rem; font-weight: 700; margin: 0.25rem 0 0.75rem; }
.pack { border-top: 1px solid var(--line, rgba(127,127,127,.25)); padding-top: 0.75rem; margin-top: 0.75rem; }
.pack-head, .pack-status { margin: 0.2rem 0; }
.pack-uses { list-style: none; padding: 0; margin: 0.5rem 0; }
.pack-use { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.35rem 0; border-bottom: 1px dashed var(--line, rgba(127,127,127,.2)); }
.pack-history { margin-top: 0.75rem; }
.pack-history summary { cursor: pointer; font-weight: 600; }
.inline { display: flex; gap: 0.5rem; align-items: center; }

/* Stage 1: roster quick log */
.quick-log { border-top: 1px dashed var(--line); padding-top: 0.6rem; display: grid; gap: 0.4rem; }
.quick-log-who { margin: 0; }
.quick-log-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.quick-log-row .input { width: auto; max-width: 11rem; }
.quick-log-note { margin: 0; }
.quick-log-note.is-warning { color: var(--danger); font-weight: 600; }
.quick-log-note:empty { display: none; }
@media (max-width: 40rem) {
  .team-who { flex: 1 1 0; min-width: 0; }
  .team-name, .team-email { overflow-wrap: anywhere; }
}

/* Stage 1: Cory's coach-only desk (COACH_DESK=1). Sections of later stages stay out of the way;
   their pages still open by address. */
html.coach-desk [data-testid="nav-dashboard"],
html.coach-desk [data-testid="nav-programs"],
html.coach-desk [data-testid="nav-messages"],
html.coach-desk [data-testid="nav-agreements"],
html.coach-desk [data-testid="nav-earnings"],
html.coach-desk [data-testid="nav-integrations"],
html.coach-desk [data-testid="nav-coaches"],
html.coach-desk [data-testid="nav-business"],
html.coach-desk [data-testid="cal-face-money"],
html.coach-desk [data-testid="cal-face-agreements"],
html.coach-desk [data-testid="cal-face-health"],
html.coach-desk [data-testid="cp-messages-link"],
html.coach-desk [data-testid="due-exercise"],
html.coach-desk [data-testid="due-lifestyle"] { display: none !important; }
/* Stage 1: the photo picker no longer pushes the client page wider than a phone */
.photo-row > div:last-child > * { min-width: 0; max-width: 100%; }
.photo-row .file-input { width: 100%; }

/* Per-set logging (Dec 2026): one row per set under each exercise on a workout card.
   Six columns that fit a 390px phone without sideways scrolling. */
.set-log { flex: 1 1 100%; display: grid; gap: 0.35rem; min-width: 0; margin-top: 0.3rem; }
.set-rows { display: grid; gap: 0.25rem; min-width: 0; }
.set-row { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.8fr) 2.2rem 1.9rem; gap: 0.25rem; align-items: center; min-width: 0; }
.set-head { font-size: 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.set-no { text-align: center; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.set-row .set-input { min-width: 0; width: 100%; padding: 0.35rem 0.4rem; min-height: 2.2rem; font-size: 1rem; text-align: center; font-variant-numeric: tabular-nums; }
.set-row .set-input.is-planned { color: var(--muted); background: var(--surface-alt); }
.set-row.is-done .set-no { color: var(--accent); }
.set-tick, .set-remove { min-height: 2.2rem; border-radius: var(--radius-small); border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.set-tick.is-done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.set-remove { border-color: transparent; background: transparent; font-size: 1.1rem; }
.set-remove:hover { color: var(--danger); }
.set-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; min-width: 0; }
.set-unit-label { display: inline-flex; gap: 0.4rem; align-items: center; }
.set-unit-label .set-unit { width: auto; padding: 0.2rem 0.4rem; min-height: 2rem; }
.set-log .set-note { min-height: 2.4rem; height: 2.4rem; resize: vertical; }
.wc-logging { flex: 1 1 100%; margin: 0.2rem 0; font-weight: 600; }

/* =====================================================================================
   Design port (Dec 2026): "Ledger" structure in "Performance Green".
   Reference: ~/muse-design/directions/dir5-performance-green.{html,png}.
   Everything below is visual only. It sits last so it wins over the rules above, which keep
   their layout. Pine anchors (bars, buttons); volt is the single signal; turf only ticks sets.
   ===================================================================================== */

/* ---------- type ---------- */
body { font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
/* Tabular numerals wherever numbers are read or compared. Not on running text: Inter's tabular
   feature also widens the hyphen, which would space out words like "coach-only". */
input, select, .tag, .badge, .chip, .counter, .pack-n, .pack-big, .pack-head, .pack-status, .pack-use, .set-row, .wc-sets, .wc-logging,
.wc-result, .wc-completion, .cal-dom, .cal-range, .cal-day-head, .stat-number, .figure, .figure-table, .figure-facts dd, .schedule, .engage-number,
.result-value, .result-date, .result-change, .ratio-actual, .unread-badge, .item-label, .wc-item-body > [data-part="item-prescription"], table { font-variant-numeric: tabular-nums; }
h1, h2 { font-family: var(--font-display); letter-spacing: -0.01em; }
h1 { font-weight: 800; font-stretch: 106%; font-size: 1.75rem; line-height: 1.15; }
h2 { font-weight: 700; font-size: 1.15rem; }
h3 { font-family: var(--font-body); font-weight: 700; }
.lead { color: var(--muted); font-size: 0.92rem; }
.eyebrow, .menu-heading, .cal-weekday, .cal-dow, .program-week, .figure-facts dt {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint);
}
.hint { color: var(--muted); }
a { color: var(--accent); text-underline-offset: 0.15em; }

/* ---------- the top bar: deep pine, the wordmark with a volt dot ---------- */
.topbar { background: var(--pine); color: #fff; border-bottom: 0; padding: 0.7rem 1.25rem; }
.org-badge { color: #fff; }
.topbar .org-mark.monogram { display: none; } /* the wordmark stands alone; an uploaded logo still shows */
.org-name { font-family: var(--font-display); font-weight: 800; font-stretch: 112%; font-size: 0.98rem; letter-spacing: 0.06em; text-transform: uppercase; }
.org-gap { font-size: 0; }
.org-gap::after { content: "." / ""; font-size: 0.98rem; color: var(--volt); }
.topbar .bell { color: #fff; }
.topbar .bell:hover, .topbar .bell[aria-current="page"] { background: rgba(255, 255, 255, 0.1); color: #fff; }
.topbar .unread-badge { background: var(--volt); color: var(--ink); }
.topbar .account-button { color: #fff; border-color: rgba(255, 255, 255, 0.22); }
.topbar .account-button:hover, .topbar .account-button[aria-expanded="true"] { background: rgba(255, 255, 255, 0.08); }
.topbar .caret { color: var(--on-pine-muted); }
.topbar .avatar.initials { background: rgba(255, 255, 255, 0.14); color: #fff; }
.topbar .menu { color: var(--text); }
.client-top { background: var(--pine); color: #fff; border-bottom: 0; }
.client-top .org-badge, .client-top .bell, .client-top .account-button { color: #fff; }
.client-top .org-mark.monogram { background: rgba(255, 255, 255, 0.14); color: #fff; }
.client-top .account-button { border-color: rgba(255, 255, 255, 0.22); }
.client-top .menu { color: var(--text); }
.client-tab[aria-current="page"] { background: var(--pine); color: #fff; }

/* ---------- navigation ---------- */
.mainnav { border-right: 1px solid var(--line); gap: 0.2rem; }
.nav-link { font-weight: 600; font-size: 0.94rem; color: var(--text); border-radius: var(--radius-small); }
.nav-link:hover { background: var(--surface); }
.nav-link[aria-current="page"] { background: var(--surface); color: var(--pine); font-weight: 700; box-shadow: inset 3px 0 0 var(--pine), var(--shadow); }
.app-footer { color: var(--faint); font-size: 0.8rem; }

/* ---------- cards: white, 1px light border, 11px corners, a faint shadow ---------- */
.card, .team-list, .stat-tile, .open-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card { padding: 1.1rem 1.1rem 1.15rem; }
/* A card's own heading reads as a small letterspaced label over a hairline, as in the Ledger. */
.card > h2:first-child, .card > .panel-head:first-child > h2, .card > .section-head:first-child > h2, .card > .habit-card-head:first-child > h2 {
  font-family: var(--font-body); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint);
}
.card > h2:first-child { margin: -0.15rem -1.1rem 0; padding: 0 1.1rem 0.7rem; border-bottom: 1px solid var(--line-soft); }
.open-card > h1:first-child, .open-card > h2:first-child { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: -0.01em; text-transform: none; color: var(--text); border: 0; margin: 0; padding: 0; }
.placeholder, .notice { border-color: var(--line); background: transparent; border-radius: var(--radius); }
.placeholder-title { font-family: var(--font-display); font-weight: 700; }
.step, .block-prompt { background: var(--bg); border: 1px solid var(--line-soft); }

/* ---------- buttons: pine pills; quiet white secondaries ---------- */
.button { border-radius: 999px; font-weight: 650; padding: 0.5rem 1.05rem; border-color: var(--line); background: var(--surface); color: var(--text); }
.button:hover { background: var(--bg); border-color: #CDD3CA; }
.button.primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.button.primary:hover { background: #0E4A2C; filter: none; }
:root[data-theme="dark"] .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary-soft { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--pine); }
:root[data-theme="dark"] .button.primary-soft { color: var(--accent); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.button.small { padding: 0.22rem 0.75rem; font-size: 0.84rem; }
.text-button { color: var(--pine); font-weight: 600; }
:root[data-theme="dark"] .text-button { color: var(--accent); }
/* Segmented switches keep their joined shape; the chosen one is filled pine. */
.segmented { border-radius: 10px; border-color: var(--line); box-shadow: var(--shadow); }
.segmented .button { border-radius: 0; }
.segmented .button[aria-pressed="true"], .segmented a.button[aria-current="page"], .cal-toolbar .segmented .button[aria-pressed="true"] { background: var(--pine); color: #fff; border-color: var(--pine); }
:root[data-theme="dark"] .segmented .button[aria-pressed="true"], :root[data-theme="dark"] .segmented a.button[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.cal-toolbar .button[aria-pressed="true"] { background: var(--accent-soft); color: var(--pine); border-color: var(--pine); }
.tabs { border-bottom-color: var(--line); }
.tab { font-weight: 600; }
.tab[aria-current="page"] { color: var(--pine); border-bottom-color: var(--pine); border-bottom-width: 3px; }
:root[data-theme="dark"] .tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.icon-button { border-radius: 999px; }

/* ---------- forms ---------- */
.input { background: var(--surface); border-color: #D7DDD4; border-radius: var(--radius-small); }
:root[data-theme="dark"] .input { border-color: var(--line); }
.input:focus { border-color: var(--pine); outline: none; box-shadow: 0 0 0 3px rgba(11, 61, 36, 0.14); }
:root[data-theme="dark"] .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(143, 212, 169, 0.2); }
.field label, .label-row label, .field-label, .checks legend { font-weight: 650; font-size: 0.86rem; }
.checks { border-color: var(--line); border-radius: var(--radius-small); background: var(--surface); }
.saved { color: var(--pine); }
.saved::before { color: var(--turf); }
:root[data-theme="dark"] .saved { color: var(--accent); }

/* ---------- chips and tags: small, uppercase, letterspaced pills ---------- */
.tag, .badge { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; padding: 0.22rem 0.6rem; border-radius: 999px; background: var(--chip); color: var(--chip-ink); }
.tag.role-owner, .tag.role-super_admin, .tag.progress-completed, .tag.program-tag.is-attached, .tag.habit-status-met, .tag.habit-state-running, .tag.ratio-within { background: var(--chip); color: var(--chip-ink); }
.tag.sent { background: var(--volt); color: var(--ink); } /* a fresh signal: "Session logged" */
/* Attention: sessions at 2 or fewer, and none left. Pine with volt words, as the reference's unpaid chip. */
.tag.pack-chip.is-flagged, .due-chip.is-flagged { background: var(--pine); color: var(--volt); }
:root[data-theme="dark"] .tag.pack-chip.is-flagged, :root[data-theme="dark"] .due-chip.is-flagged { background: var(--volt); color: var(--pine); }
.tag.progress-missed, .tag.habit-status-missed, .tag.habit-status-not_met, .tag.goal-late, .tag.watch-pressing, .tag.ratio-below, .tag.ratio-above { background: var(--danger-soft); color: var(--danger); }
.chip { border-radius: 999px; font-weight: 650; border-color: var(--line); }
.chip.on { background: var(--pine); border-color: var(--pine); color: #fff; }
.today-tag { background: var(--volt); color: var(--ink); }
.unread-badge { background: var(--pine); color: #fff; }

/* ---------- tables ---------- */
.schedule thead th, .figure-table thead th, .figure-table thead td { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.schedule th, .schedule td, .figure-table th, .figure-table td { border-color: var(--line-soft); }
.schedule input, .check input, .check-row input, .todo-row input[type="checkbox"], .wc-select { accent-color: var(--pine); }
.figure, .stat-number, .engage-number, .ratio-actual { font-family: var(--font-hero); font-weight: 400; letter-spacing: 0; }

/* ---------- menus, avatars ---------- */
.menu { border-radius: var(--radius); box-shadow: 0 8px 28px rgba(16, 24, 18, 0.14); }
.avatar.initials { background: var(--accent-soft); color: var(--pine); }
:root[data-theme="dark"] .avatar.initials { color: var(--accent); }

/* ---------- the roster (Cory's landing) ---------- */
.team-list { overflow: hidden; }
.team-row { padding: 0.75rem 1rem; border-top-color: var(--line-soft); }
.team-name { font-weight: 650; font-size: 0.98rem; }
.team-email { font-size: 0.82rem; }
.team-row .button.small { min-height: 2.1rem; }
/* The sessions-left strip: one cell per client, a hero number with the name beneath. */
.pack-strip { padding: 0; gap: 0; overflow: hidden; }
.pack-strip > h2:first-child { margin: 0; padding: 0.8rem 1.1rem 0.65rem; }
.pack-cells { list-style: none; margin: 0; padding: 0; display: flex; }
.pack-cell { flex: 1 1 0; min-width: 0; display: grid; justify-items: stretch; text-align: center; border-right: 1px solid var(--line-soft); padding: 0 0 0.75rem; }
.pack-cell:last-child { border-right: 0; }
.pack-n { display: block; font-family: var(--font-hero); font-size: 1.9rem; line-height: 1; padding: 0.85rem 0 0.75rem; color: var(--text); }
.pack-cell.is-low .pack-n { box-shadow: inset 0 -6px 0 var(--volt); }
.pack-who { display: block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-top: 0.4rem; padding: 0 0.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- the client page ---------- */
.pack-big { font-family: var(--font-hero); font-weight: 400; font-size: 1.7rem; line-height: 1.1; margin: 0.1rem 0 0.6rem; }
.pack { border-top-color: var(--line-soft); }
.pack-head { font-weight: 650; }
.pack-use { border-bottom: 1px solid var(--line-soft); }
.quick-log { border-top-color: var(--line); }
.photo-row .file-input { color: var(--muted); }

/* ---------- the calendar: the app's own grid, wearing the tokens ---------- */
.cal-range { font-family: var(--font-display); font-weight: 800; font-stretch: 106%; }
.cal-day { border-radius: 10px; border-color: var(--line); box-shadow: var(--shadow); }
.cal-day.is-off { background: var(--surface-alt); }
.cal-day.is-today { border-color: var(--pine); box-shadow: inset 0 0 0 1px var(--pine), var(--shadow); }
:root[data-theme="dark"] .cal-day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-dom { font-family: var(--font-display); font-weight: 800; }
.wcard { background: var(--bg); border-color: var(--line); border-radius: var(--radius-small); }
.wcard.can-edit:hover { border-color: var(--pine); }
.wcard.progress-completed { border-left: 3px solid var(--pine); }
.wcard-title { font-weight: 700; }
.item-label { color: var(--faint); }
.wc-completion { background: var(--accent-soft); }
.wc-item-line.wc-result.is-done { background: var(--accent-soft); }
.workout-editor { border-color: var(--pine); border-radius: var(--radius); }
.inline-form { border-color: var(--line); border-radius: var(--radius); }
.note-band { border-radius: var(--radius-small); }
.rest-marker { border-radius: var(--radius-small); }
@media (min-width: 64.01rem) {
  .view-month .day-tools .button.small:hover { color: var(--pine); }
  .view-month .day-tools .button.primary-soft { color: var(--pine); }
}

/* ---- the day view: the Ledger's workout page ---- */
.view-day .cal-day { padding: 1.1rem 1.15rem 1.2rem; gap: 0.75rem; }
/* The time-and-place banner becomes the day's banner: volt, pine words, letterspaced. */
.view-day .cal-day-head { justify-self: start; display: inline-flex; align-items: center; gap: 0.4rem; background: var(--volt); color: var(--ink); padding: 0.2rem 0.5rem 0.15rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.view-day .cal-day-head .cal-dow, .view-day .cal-day-head .cal-dom { font: inherit; letter-spacing: inherit; color: inherit; }
.view-day .cal-day-head .today-tag { background: transparent; color: inherit; padding: 0; font-size: inherit; letter-spacing: inherit; }
.view-day .cal-day-head .today-tag::before { content: "· " / ""; }
.view-day .cal-day-head .off-tag { flex: 0 1 auto; font-size: inherit; }
.view-day .wcard { background: transparent; border: 0; padding: 0; gap: 0.7rem; }
.view-day .wcard.progress-completed { border-left: 0; }
.view-day .wcard-title { font-family: var(--font-display); font-weight: 800; font-stretch: 106%; font-size: 1.55rem; letter-spacing: -0.01em; line-height: 1.15; }
.view-day .wcard-head { align-items: center; }
.view-day .wcard-items { gap: 0.7rem; }
/* each exercise: its own white card, plan line at top right, then the set table */
.view-day .wc-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.8rem 0.95rem 0.75rem; align-items: flex-start; }
.view-day .wc-item.is-linked { margin-top: 0; border-top-style: dashed; }
.view-day .wc-item .item-label { padding-top: 0.2rem; }
.view-day .wc-item-body { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 0.75rem; align-items: baseline; }
.view-day .wc-item-body > * { grid-column: 1 / -1; }
.view-day .wc-item-body > .wc-item-name { grid-column: 1; font-size: 1rem; font-weight: 700; }
.view-day .wc-item-body > [data-part="item-prescription"] { grid-column: 2; grid-row: 1; justify-self: end; text-align: right; color: var(--faint); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; }
.view-day .wc-item-body > [data-part="item-prescription"]::before { content: "Plan " / ""; }
.view-day .wc-item-body > .tag, .view-day .wc-item-body > .wc-video { justify-self: start; }
.view-day .wc-item-body > .wc-log { justify-self: start; }
/* The one-line summary steps aside for the table in the day view (it stays for screen readers). */
.view-day .wc-result.has-table { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; padding: 0; }
.wc-sets { display: none; }
.view-day .wc-sets { display: block; min-width: 0; }
.wc-sets table { width: 100%; border-collapse: collapse; margin-top: 0.2rem; }
.wc-sets th { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); text-align: left; padding: 0 0 0.35rem; }
.wc-sets td { font-size: 0.9rem; font-weight: 600; padding: 0.4rem 0; border-top: 1px solid var(--line-soft); }
.wc-sets th:first-child, .wc-sets td:first-child { width: 3.2rem; }
.wc-sets td.ck { text-align: right; font-size: 0.8rem; font-weight: 700; }
.wc-sets tr.is-done td.ck::before { content: "✓ " / ""; color: var(--turf); }
.wc-sets-note { margin-top: 0.35rem; font-size: 0.85rem; color: var(--muted); }
/* the foot of the workout: the count, then Complete as the pine pill with its volt word */
.view-day .wc-logging { font-size: 0.82rem; color: var(--muted); }
.view-day .wcard-actions { align-items: center; gap: 0.4rem; }
.view-day .wcard-actions .button.small[data-testid="wc-complete"] { order: 9; margin-left: auto; background: var(--pine); border-color: var(--pine); color: #fff; font-size: 0.9rem; font-weight: 700; padding: 0.55rem 1.15rem; min-height: 2.5rem; }
.view-day [data-testid="wc-complete"]::after { content: " workout" / ""; color: var(--volt); }
.view-day .wcard-actions .button.small[data-testid="wc-complete"]:hover { background: #0E4A2C; }
.view-day .completion-form, .view-day .wcard > .inline-form { background: var(--surface); }

/* ---- per-set logging: the same table system, with boxes ---- */
.set-log { gap: 0.4rem; }
.set-rows { gap: 0; }
.set-row { padding: 0.28rem 0; border-top: 1px solid var(--line-soft); }
.set-row.set-head { border-top: 0; padding: 0 0 0.3rem; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em; color: var(--faint); }
.set-no { color: var(--text); font-weight: 600; }
.set-row.is-done .set-no { color: var(--text); }
.set-row .set-input { font-weight: 600; border-color: #DCE1D9; background: var(--surface); }
.set-row .set-input.is-planned { color: var(--faint); background: var(--bg); border-style: dashed; }
.set-tick, .set-remove { border-radius: var(--radius-small); }
.set-tick { color: #AAB3AD; border-color: #DCE1D9; background: var(--surface); }
.set-tick.is-done { background: #E7F5EC; border-color: #BFE3CD; color: var(--turf); }
:root[data-theme="dark"] .set-tick.is-done { background: #173826; border-color: #23573A; color: #5FD08E; }
.set-tick:hover { border-color: var(--pine); }
.set-unit-label .hint { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }

/* ---------- a workout on its own page (client area) wears the same cards ---------- */
.aw-item, .workout-link, .swap-option, .app-day { border-color: var(--line); border-radius: var(--radius); }
.workout-link[data-progress="completed"], .completion-card { border-left-color: var(--pine); }

/* ---------- signed-out pages ---------- */
.wordmark { font-family: var(--font-display); font-weight: 800; font-stretch: 112%; text-transform: uppercase; letter-spacing: 0.06em; font-size: 1.35rem; color: var(--pine); }
:root[data-theme="dark"] .wordmark { color: var(--text); }

/* ---------- small screens ---------- */
@media (max-width: 46rem) {
  .topbar { padding: 0.6rem 0.9rem; }
  .mainnav { background: var(--surface); border-bottom: 1px solid var(--line); }
  .nav-link[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--pine); background: transparent; }
  h1 { font-size: 1.5rem; }
  .view-day .cal-day { padding: 0.9rem 0.8rem 1rem; }
  .view-day .wc-item { padding: 0.75rem 0.8rem 0.7rem; }
  .pack-n { font-size: 1.6rem; }
}

/* Holders that wait for a form or a strip add no empty gap to the page while they are empty. */
.page > div:empty { display: none; }
@media (max-width: 46rem) {
  .org-name { font-size: 0.84rem; letter-spacing: 0.04em; }
  .org-gap::after { font-size: 0.84rem; }
  .topbar .account-button { max-width: 9rem; }
}
@media (max-width: 46rem) {
  .topbar { gap: 0.5rem; }
  .topbar .org-badge { flex: none; }
  .topbar .org-name { overflow: visible; }
  .topbar .account-button { min-width: 0; max-width: 7.5rem; }
}
.pack-use .button { white-space: nowrap; flex: none; }

/* =====================================================================================
   Revised design (dir5b, Dec 2026 stress test). Reference:
   ~/muse-design/directions/dir5b-performance-green-revised.{html,png}. Visual only.
   One hue, one meaning:
     brand / where you are  pine  #0B3D24  top bar, current nav item, chosen tab or segment, links
     action                 ink   #12211A  primary buttons, Complete workout (its word "workout" in volt)
     alert                  volt words on ink  "No sessions left", sessions at 2 or fewer, unread counts
     now                    volt fill  #B7E62E  today, the day banner
     done                   turf  #1E9E57  ticks on logged sets and finished work; "done" chips stay quiet grey
     error                  brick #A8321F  errors and missed items only
   ===================================================================================== */
:root { --action: #12211A; --action-hover: #23382C; --plan-ink: #3D4A35; }

/* ---------- action: ink pills (pine stays the brand) ---------- */
.button.primary { background: var(--action); border-color: var(--action); color: #fff; }
.button.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
:root[data-theme="dark"] .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary-soft { background: var(--chip); border-color: var(--chip); color: var(--action); }
.view-day .wcard-actions .button.small[data-testid="wc-complete"] { background: var(--action); border-color: var(--action); }
.view-day .wcard-actions .button.small[data-testid="wc-complete"]:hover { background: var(--action-hover); }

/* ---------- alert: volt words on ink, as the reference's "Unpaid" chip ---------- */
.tag.pack-chip.is-flagged, .due-chip.is-flagged { background: var(--ink); color: var(--volt); }
.unread-badge { background: var(--ink); color: var(--volt); }
.topbar .unread-badge { background: var(--volt); color: var(--ink); }

/* ---------- done: turf ticks; quiet grey "done" chips ---------- */
.tag.sent { background: var(--chip); color: var(--chip-ink); }
.tag.sent::before { content: "✓ " / ""; color: var(--turf); }
.tag.progress-completed { background: var(--chip); color: var(--chip-ink); }
.wcard.progress-completed { border-left-color: var(--turf); }
.workout-link[data-progress="completed"], .completion-card { border-left-color: var(--turf); }
.saved { color: var(--text); }
:root[data-theme="dark"] .tag.sent, :root[data-theme="dark"] .tag.progress-completed { background: var(--chip); color: var(--chip-ink); }

/* ---------- now: today is volt; the today card's outline is ink, not brand ---------- */
.cal-day.is-today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink), var(--shadow); }

/* ---------- the plan line: dark enough to read in gym light ---------- */
.view-day .wc-item-body > [data-part="item-prescription"] { color: var(--plan-ink); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
:root[data-theme="dark"] .view-day .wc-item-body > [data-part="item-prescription"] { color: var(--chip-ink); }
.wc-item-line[data-part="item-prescription"] { color: var(--plan-ink); }
:root[data-theme="dark"] .wc-item-line[data-part="item-prescription"] { color: var(--chip-ink); }
.wc-sets th, .set-row.set-head { color: #6B766F; }

/* ---------- the renewal strip: only who needs a talk, by full name ---------- */
.pack-who { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; letter-spacing: 0.1em; font-size: 0.62rem; padding: 0 0.4rem; }
.pack-strip-note { margin: 0; padding: 0.6rem 1.1rem 0.75rem; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 0.8rem; }
.pack-cells { border-bottom: 0; }

/* ---------- phone: session mode on the day view ---------- */
.session-more { display: none; }
@media (max-width: 46rem) {
  .page.calendar.session-mode { gap: 0.55rem; }
  .session-mode .page-header h1 { font-size: 1.15rem; }
  .session-mode .page-header { gap: 0.4rem; }
  .session-mode:not(.tools-open) .page-header .lead,
  .session-mode:not(.tools-open) .page-header .actions,
  .session-mode:not(.tools-open) > .cal-toolbar > .segmented:first-child,
  .session-mode:not(.tools-open) > .cal-toolbar > .search-anchor,
  .session-mode:not(.tools-open) > .cal-toolbar > .button.small,
  .session-mode:not(.tools-open) > .cal-toolbar > [data-testid="cal-copy"],
  .session-mode:not(.tools-open) > .cal-toolbar > [data-testid="cal-hide-results"],
  .session-mode:not(.tools-open) > .cal-toolbar > [data-testid="cal-tags-toggle"] { display: none; }
  .session-mode > .cal-toolbar { gap: 0.4rem; }
  .session-mode:not(.tools-open) > .cal-toolbar + .cal-toolbar:not(:has(> span:not(:empty))) { display: none; }
  .session-mode > .cal-toolbar .segmented .button { min-height: 2.25rem; padding: 0.3rem 0.8rem; font-size: 0.86rem; }
  .session-mode .cal-range { font-size: 0.95rem; }
  .session-mode > .session-more { display: flex; }
  .session-more-button { flex: 1 1 auto; justify-content: space-between; min-height: 2.5rem; font-size: 0.86rem; color: var(--muted); background: var(--surface); }
  .session-more-button::after { content: "▾" / ""; margin-left: auto; padding-left: 0.5rem; color: var(--faint); }
  .session-more-button[aria-expanded="true"]::after { content: "▴" / ""; }
  .session-mode .view-day .cal-day { padding: 0.85rem 0.75rem 1rem; }
  .session-mode .view-day .wcard-title { font-size: 1.5rem; }

  /* the dock pinned to the bottom of the screen: the session on the left, Complete in reach on the right */
  .session-dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; min-height: 4.1rem;
    display: grid; align-content: center; gap: 0.05rem;
    padding: 0.6rem 11.5rem calc(0.6rem + env(safe-area-inset-bottom)) 0.95rem;
    background: var(--surface); border-top: 2px solid var(--pine); box-shadow: 0 -6px 20px rgba(16, 24, 18, 0.08);
  }
  .session-dock-who { font-size: 0.86rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .session-dock-sets { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
  html.has-session-dock .shell { padding-bottom: 4.5rem; }
  .session-mode .wcard-actions .button.small[data-testid="wc-complete"].is-pinned {
    position: fixed; z-index: 41; right: 0.9rem; bottom: calc(0.65rem + env(safe-area-inset-bottom));
    margin: 0; min-height: 2.85rem; padding: 0.6rem 1.25rem; font-size: 0.95rem; box-shadow: 0 2px 8px rgba(16, 24, 18, 0.18);
  }
}
@media (min-width: 46.01rem) { .session-dock { display: none; } }

/* ---------- phone: the month as a grid at a glance ---------- */
.month-legend { display: none; }
@media (max-width: 46rem) {
  .page.calendar[data-view="month"] .cal-grid.view-month { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .page.calendar[data-view="month"] .cal-weekday { display: block; text-align: center; padding: 0 0 0.15rem; font-size: 0.6rem; letter-spacing: 0.08em; }
  .view-month .cal-day:not(.is-sheet) {
    min-height: 3.5rem; padding: 0.3rem 0.15rem 0.35rem; gap: 0.2rem; border-radius: 8px;
    display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; cursor: pointer; overflow: hidden;
  }
  .view-month .cal-day:not(.is-sheet) > * { pointer-events: none; }
  .view-month .cal-day:not(.is-sheet) > :not(.cal-day-head):not(.wcard):not(.rest-marker) { display: none; }
  .view-month .cal-day:not(.is-sheet) .cal-day-head { flex: 1 1 100%; justify-content: center; gap: 0; margin: 0; }
  .view-month .cal-day:not(.is-sheet) .cal-day-head > :not(.cal-dom) { display: none; }
  .view-month .cal-day:not(.is-sheet) .cal-dom { font-size: 0.78rem; line-height: 1.2; text-align: center; white-space: normal; }
  .view-month .cal-day:not(.is-sheet) > .wcard {
    width: 0.6rem; height: 0.6rem; min-height: 0; padding: 0; gap: 0; overflow: hidden; font-size: 0;
    border: 1.5px solid var(--pine); border-left-width: 1.5px; border-radius: 50%; background: transparent; box-shadow: none;
  }
  .view-month .cal-day:not(.is-sheet) > .wcard > * { display: none; }
  .view-month .cal-day:not(.is-sheet) > .wcard.progress-completed { background: var(--turf); border-color: var(--turf); }
  .view-month .cal-day:not(.is-sheet) > .wcard.progress-missed { border-color: var(--danger); }
  .view-month .cal-day:not(.is-sheet) > .rest-marker { flex: 1 1 100%; font-size: 0; padding: 0; border: 0; height: 2px; max-width: 1rem; background: var(--faint); border-radius: 1px; }
  .view-month .cal-day.is-today:not(.is-sheet) { background: var(--volt); border-color: var(--ink); box-shadow: none; }
  .view-month .cal-day.is-today:not(.is-sheet) > .wcard:not(.progress-completed) { border-color: var(--ink); }
  .view-month .cal-day.is-outside:not(.is-sheet) { opacity: 0.45; }
  .view-month .cal-day.is-off:not(.is-sheet):not(.is-today) { background: var(--surface-alt); }
  .month-sheet-slot { min-height: 3.5rem; border: 1px dashed var(--line); border-radius: 8px; display: flex; justify-content: center; padding-top: 0.3rem; font-family: var(--font-display); font-weight: 800; font-size: 0.78rem; color: var(--faint); }

  /* a tapped day opens as a sheet: the same cell, with its workouts and tools */
  .view-month .cal-day.is-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 82vh; overflow: auto; min-height: 0;
    padding: 0.9rem 0.95rem calc(1.1rem + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0;
    background: var(--surface); border: 0; box-shadow: 0 -10px 40px rgba(12, 20, 16, 0.25);
  }
  .view-month .cal-day.is-sheet .cal-dow { display: inline; }
  .month-sheet-close { justify-self: end; }
  .month-sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(12, 20, 16, 0.45); }
  html.has-month-sheet body { overflow: hidden; }
  .page.calendar[data-view="month"] .month-legend { display: flex; gap: 0.9rem; flex-wrap: wrap; align-items: center; font-size: 0.78rem; color: var(--muted); padding: 0.2rem 0.1rem; }
  .month-legend i { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 1.5px solid var(--pine); margin-right: 0.3rem; vertical-align: -0.05rem; }
  .month-legend .lg-done i { background: var(--turf); border-color: var(--turf); }
  .month-legend .lg-today i { background: var(--volt); border-color: var(--ink); border-radius: 3px; }
  .month-legend .lg-tap { margin-left: auto; color: var(--faint); }
}
/* the day view's banner already says "today"; its card keeps the plain border */
.view-day .cal-day.is-today { border-color: var(--line); box-shadow: var(--shadow); }
@media (max-width: 46rem) { .session-more-button { display: flex; text-align: left; } }
