/* ── PTS Coach Shell ──────────────────────────────────────────────────────
   TrueCoach layout density on the Chalk Line palette.

   Everything here is namespaced `tc-` (tokens `--tc-*`) so it can be dropped
   into the coach pages without colliding with the per-page tokens each of
   them still declares inline.

   Palette source of truth: shared/tokens.css (OPS-101 P3). Every --tc-* name
   below is an alias of a --pt-* token, so the coach pages share one palette,
   type system and shape scale with the athlete app. Pages must link
   shared/tokens.css before this file.

   Theming comes from tokens.css too: dark follows the OS unless <html>
   carries data-pt-theme="light" or "dark". The rail stays dark ink in both.
   ─────────────────────────────────────────────────────────────────────── */

:root {
  /* ground + surfaces */
  --tc-bg: var(--pt-bg);
  --tc-surface: var(--pt-surface);
  --tc-surface-2: var(--pt-sunken);
  --tc-surface-3: var(--pt-line);
  --tc-border: var(--pt-line);
  --tc-border-strong: var(--pt-line-strong);

  /* ink */
  --tc-text: var(--pt-ink);
  --tc-text-muted: var(--pt-muted);
  /* "dim" used to be a third, fainter grey at 3.6:1. Chalk Line keeps muted
     text at 4.5:1 or better, so dim is the same as muted. */
  --tc-text-dim: var(--pt-muted);

  /* accents: forest is the action colour; signal is for one CTA, counts and
     PR marks only */
  --tc-accent: var(--pt-forest);
  --tc-accent-hover: var(--pt-forest-hover);
  --tc-accent-soft: var(--pt-forest-tint);
  --tc-accent-ink: var(--pt-forest);
  --tc-on-accent: var(--pt-on-forest);
  --tc-orange: var(--pt-signal);
  --tc-orange-soft: var(--pt-signal-tint);
  --tc-red: var(--pt-danger);
  --tc-red-soft: var(--pt-danger-tint);
  --tc-green: var(--pt-success);
  --tc-green-soft: var(--pt-forest-tint);
  --tc-blue: var(--pt-info);

  /* the rail is always dark ink, in both themes — it is the app's spine */
  --tc-rail-bg: #141513;
  --tc-rail-bg-2: #24271F;
  --tc-rail-text: #A6A398;
  --tc-rail-text-active: #FFFFFF;
  --tc-rail-accent: #5BC285;
  --tc-rail-hover: rgba(255, 255, 255, 0.06);
  --tc-rail-border: rgba(255, 255, 255, 0.08);
  --tc-rail-key: #6B6A63;

  /* shape: controls 10, cards 14; cards carry a line, not a shadow, and
     only things that float (menus, modals, drawers) cast one */
  --tc-radius: var(--pt-radius-control);
  --tc-radius-lg: var(--pt-radius-card);
  --tc-radius-pill: 999px;
  --tc-shadow: none;
  --tc-shadow-lift: var(--pt-shadow-float);
  --tc-focus: 0 0 0 3px color-mix(in srgb, var(--pt-focus) 35%, transparent);

  /* type: Barlow for UI, Barlow Condensed for page titles, Plex Mono for
     numbers. --tc-font-heading is Barlow too; weight carries the hierarchy. */
  --tc-font: var(--pt-font-ui);
  --tc-font-heading: var(--pt-font-ui);
  --tc-font-display: var(--pt-font-display);
  --tc-font-mono: var(--pt-font-mono);

  --tc-rail-w: 88px;
  --tc-bottom-h: 60px;
}

/* ── Frame ──────────────────────────────────────────────────────────────
   The rail is fixed; every page gets a left offset instead of a wrapper so
   existing page markup stays untouched. */

body.tc-shelled {
  padding-left: var(--tc-rail-w);
}

@media (max-width: 767px) {
  body.tc-shelled {
    padding-left: 0;
    padding-bottom: calc(var(--tc-bottom-h) + env(safe-area-inset-bottom, 0px));
  }
}

/* Anything the page already pins to the viewport (headers, drawers, toasts,
   sticky bars) has to clear the rail too. Pages opt individual elements in
   with .tc-offset-left when their own CSS uses position:fixed;left:0. */
@media (min-width: 768px) {
  .tc-offset-left,
  /* coach.html / coach-program.html pin their session-expiry banner to left:0.
     Matched by id rather than by adding a class, because the smoke harness
     asserts that banner's markup character-for-character. */
  body.tc-shelled > #session-expired-banner { left: var(--tc-rail-w) !important; }
}

/* ── Left rail ──────────────────────────────────────────────────────── */

.tc-rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--tc-rail-w);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: var(--tc-rail-bg);
  border-right: 1px solid var(--tc-rail-border);
  font-family: var(--tc-font);
  overflow: hidden;
}

.tc-rail-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 13px 6px 11px;
  text-decoration: none;
  border-bottom: 1px solid var(--tc-rail-border);
}

.tc-rail-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.tc-rail-mark img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.tc-rail-wordmark {
  font-family: var(--tc-font-heading);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tc-rail-text);
}

.tc-rail-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.tc-rail-foot {
  display: flex;
  flex-direction: column;
  padding: 8px 0 12px;
  border-top: 1px solid var(--tc-rail-border);
  gap: 2px;
}

.tc-rail-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 11px 4px 10px;
  border: 0;
  background: none;
  width: 100%;
  cursor: pointer;
  color: var(--tc-rail-text);
  text-decoration: none;
  font-family: var(--tc-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.13s, color 0.13s;
}

.tc-rail-item:hover { background: var(--tc-rail-hover); color: var(--tc-rail-text-active); }
.tc-rail-item:focus-visible { outline: none; box-shadow: inset var(--tc-focus); }

.tc-rail-item.is-active {
  color: var(--tc-rail-text-active);
  background: var(--tc-rail-bg-2);
}

/* the 4px green active bar */
.tc-rail-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--tc-accent);
}

.tc-rail-icon {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tc-rail-label { line-height: 1.1; text-align: center; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.tc-rail-count {
  position: absolute;
  top: 6px;
  right: 14px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: var(--tc-radius-pill);
  background: var(--tc-orange);
  color: var(--pt-on-signal);
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

.tc-rail-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--tc-rail-accent);
  color: #0B1A11;
  display: grid;
  place-items: center;
  font-family: var(--tc-font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Account popover, anchored off the rail foot */
.tc-rail-pop {
  position: fixed;
  left: calc(var(--tc-rail-w) + 8px);
  bottom: 14px;
  z-index: 1300;
  min-width: 210px;
  padding: 12px;
  border-radius: var(--tc-radius-lg);
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  box-shadow: var(--tc-shadow-lift);
  color: var(--tc-text);
  font-size: 13px;
}
.tc-rail-pop[hidden] { display: none !important; }
.tc-rail-pop-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--tc-text-dim); }
.tc-rail-pop-email { font-weight: 600; margin: 2px 0 10px; word-break: break-all; }

/* Mobile: the rail becomes a bottom bar. */
@media (max-width: 767px) {
  .tc-rail {
    inset: auto 0 0 0;
    width: auto;
    height: calc(var(--tc-bottom-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    flex-direction: row;
    border-right: 0;
    border-top: 1px solid var(--tc-rail-border);
  }
  .tc-rail-brand { display: none; }
  .tc-rail-nav,
  .tc-rail-foot {
    flex-direction: row;
    flex: 1;
    padding: 0;
    border-top: 0;
    overflow: visible;
  }
  .tc-rail-foot { flex: 0 0 auto; }
  /* Phone bar: the destinations carry labels and share the remaining width;
     the utility group is icons only so eight targets still fit 375px. */
  .tc-rail-item { padding: 6px 2px; font-size: 9px; gap: 3px; min-width: 0; flex: 1; }
  .tc-rail-label { letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tc-rail-foot .tc-rail-item { flex: 0 0 42px; }
  .tc-rail-foot .tc-rail-label { display: none; }
  /* Keyboard shortcuts are meaningless on a phone. */
  #tc-help-btn { display: none; }
  .tc-rail-item.is-active { background: none; }
  .tc-rail-item.is-active::before {
    left: 10px; right: 10px; top: 0; bottom: auto;
    width: auto; height: 3px; border-radius: 0 0 3px 3px;
  }
  .tc-rail-icon { width: 20px; height: 20px; }
  .tc-rail-count { top: 2px; right: 4px; }
  .tc-rail-avatar { width: 26px; height: 26px; font-size: 10px; }
  .tc-rail-pop { left: 8px; right: 8px; bottom: calc(var(--tc-bottom-h) + env(safe-area-inset-bottom, 0px) + 8px); }
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.tc-btn-primary,
.tc-btn-secondary,
.tc-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--tc-radius);
  border: 1px solid transparent;
  font-family: var(--tc-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.tc-btn-primary:focus-visible,
.tc-btn-secondary:focus-visible,
.tc-btn-danger:focus-visible { outline: none; box-shadow: var(--tc-focus); }

.tc-btn-primary { background: var(--tc-accent); color: var(--tc-on-accent); }
.tc-btn-primary:hover { background: var(--tc-accent-hover); }

.tc-btn-secondary {
  background: var(--tc-surface);
  color: var(--tc-text);
  border-color: var(--tc-border-strong);
}
.tc-btn-secondary:hover { background: var(--tc-surface-2); border-color: var(--tc-text-dim); }

.tc-btn-danger { background: transparent; color: var(--tc-red); border-color: var(--tc-red); }
.tc-btn-danger:hover { background: var(--tc-red-soft); }

.tc-btn-sm { padding: 5px 11px; font-size: 13px; }

/* ── Keyboard hint ──────────────────────────────────────────────────── */

.tc-kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--tc-surface-2);
  border: 1px solid var(--tc-border-strong);
  border-bottom-width: 2px;
  color: var(--tc-text-muted);
  font-family: var(--tc-font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

/* ── Badges, chips, pills ───────────────────────────────────────────── */

.tc-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--tc-radius-pill);
  background: var(--tc-surface-3);
  color: var(--tc-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tc-badge--green { background: var(--tc-green-soft); color: var(--tc-green); }
.tc-badge--orange { background: var(--tc-orange-soft); color: var(--tc-orange); }
.tc-badge--red { background: var(--tc-red-soft); color: var(--tc-red); }
.tc-badge--ink { background: var(--tc-rail-bg); color: #fff; }

.tc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--tc-radius-pill);
  border: 1px solid var(--tc-border-strong);
  background: var(--tc-surface);
  color: var(--tc-text-muted);
  font-family: var(--tc-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
}
.tc-chip:hover { border-color: var(--tc-text-dim); color: var(--tc-text); }
.tc-chip.is-active,
.tc-chip[aria-pressed="true"] {
  background: var(--tc-accent);
  border-color: var(--tc-accent);
  color: var(--tc-on-accent);
}
.tc-chip-x {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: inherit; opacity: 0.6; font-size: 13px; line-height: 1;
}
.tc-chip-x:hover { opacity: 1; }

/* "+ Add to group" — the dashed sibling of a chip */
.tc-chip--add {
  border-style: dashed;
  background: transparent;
  color: var(--tc-text-dim);
}
.tc-chip--add:hover {
  border-style: solid;
  border-color: var(--tc-accent);
  color: var(--tc-accent);
  background: var(--tc-accent-soft);
}

/* Due-state pill: overdue red / today orange / future neutral. */
.tc-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--tc-radius-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--tc-surface-3);
  color: var(--tc-text-muted);
}
.tc-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.tc-pill--overdue { background: var(--tc-red-soft); color: var(--tc-red); }
.tc-pill--today { background: var(--tc-orange-soft); color: var(--tc-orange); }
.tc-pill--future { background: var(--tc-surface-3); color: var(--tc-text-muted); }
.tc-pill--done { background: var(--tc-green-soft); color: var(--tc-green); }

/* ── Compliance triple ──────────────────────────────────────────────
   Three tabular-nums percentages, superscript %, the TrueCoach roster read:
   completed / on-time / volume. */

.tc-compliance {
  display: inline-flex;
  align-items: flex-start;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}
.tc-compliance-item { display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1; }
.tc-compliance-value {
  font-family: var(--tc-font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--tc-text);
  font-variant-numeric: tabular-nums;
}
.tc-compliance-value sup { font-size: 9px; font-weight: 600; top: -0.55em; margin-left: 1px; color: var(--tc-text-dim); }
.tc-compliance-label { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tc-text-dim); }
.tc-compliance-value.is-low { color: var(--tc-red); }
.tc-compliance-value.is-mid { color: var(--tc-orange); }
.tc-compliance-value.is-high { color: var(--tc-green); }
.tc-compliance-value.is-empty { color: var(--tc-text-dim); font-weight: 500; }
.tc-compliance-none { font-size: 13px; color: var(--tc-text-dim); white-space: nowrap; }

/* ── Table ──────────────────────────────────────────────────────────
   Rounded card, tinted header row, sortable headers, row hover. */

.tc-table-wrap {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-lg);
  box-shadow: var(--tc-shadow);
  overflow: hidden;
}
.tc-table-scroll { overflow-x: auto; }

.tc-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--tc-font);
  font-size: 14px;
  color: var(--tc-text);
}

.tc-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--tc-surface-2);
  border-bottom: 1px solid var(--tc-border);
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--tc-text-muted);
  white-space: nowrap;
}

.tc-table th.tc-sortable { cursor: pointer; user-select: none; }
.tc-table th.tc-sortable:hover { color: var(--tc-text); background: var(--tc-surface-3); }
.tc-table th.tc-sortable::after {
  content: '↕';
  margin-left: 5px;
  opacity: 0.35;
  font-size: 10px;
}
.tc-table th.tc-sortable[aria-sort="ascending"]::after { content: '↑'; opacity: 1; color: var(--tc-accent); }
.tc-table th.tc-sortable[aria-sort="descending"]::after { content: '↓'; opacity: 1; color: var(--tc-accent); }

.tc-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--tc-border);
  vertical-align: middle;
}
.tc-table tbody tr:last-child td { border-bottom: 0; }
.tc-table tbody tr { transition: background 0.1s; }
.tc-table tbody tr:hover { background: var(--tc-surface-2); }
.tc-table tbody tr.is-selected { background: var(--tc-accent-soft); }

.tc-table .tc-num { text-align: right; font-variant-numeric: tabular-nums; }
.tc-table .tc-tight { width: 1%; white-space: nowrap; }

.tc-cell-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tc-cell-avatar {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--tc-surface-3);
  color: var(--tc-text-muted);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  font-family: var(--tc-font-heading);
}
.tc-cell-name { display: block; font-weight: 600; }
.tc-cell-sub { display: block; font-size: 12px; color: var(--tc-text-dim); }

/* ── Drawer (left-side client rail) ─────────────────────────────────── */

.tc-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1350;
  background: rgba(23, 17, 11, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.tc-drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

.tc-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--tc-rail-w);
  z-index: 1400;
  width: min(340px, 86vw);
  display: flex;
  flex-direction: column;
  background: var(--tc-surface);
  border-right: 1px solid var(--tc-border);
  /* clear the rail as well as its own width, or the panel pokes back in */
  transform: translateX(calc(-100% - var(--tc-rail-w) - 8px));
  transition: transform 0.2s ease;
  font-family: var(--tc-font);
  color: var(--tc-text);
}
.tc-drawer.is-open { transform: none; box-shadow: var(--tc-shadow-lift); }

.tc-drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--tc-border);
}
.tc-drawer-title { font-family: var(--tc-font-heading); font-size: 16px; font-weight: 600; }
.tc-drawer-sub { font-size: 12px; color: var(--tc-text-dim); margin-top: 2px; }
.tc-drawer-close {
  margin-left: auto;
  border: 0; background: none; cursor: pointer;
  color: var(--tc-text-dim); font-size: 16px; line-height: 1; padding: 4px;
  border-radius: 6px;
}
.tc-drawer-close:hover { background: var(--tc-surface-2); color: var(--tc-text); }
.tc-drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 10px 18px; }

.tc-drawer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--tc-radius);
  background: none;
  color: inherit;
  font-family: var(--tc-font);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.tc-drawer-item:hover { background: var(--tc-surface-2); }
.tc-drawer-item.is-active { background: var(--tc-accent-soft); color: var(--tc-accent-ink); font-weight: 600; }
.tc-drawer-search { padding: 10px 12px 0; }

@media (max-width: 767px) {
  .tc-drawer { left: 0; bottom: calc(var(--tc-bottom-h) + env(safe-area-inset-bottom, 0px)); }
}

/* ── Modal ──────────────────────────────────────────────────────────── */

.tc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 17, 11, 0.5);
}
.tc-modal-overlay.is-open { display: flex; }

.tc-modal {
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-lg);
  box-shadow: var(--tc-shadow-lift);
  color: var(--tc-text);
  font-family: var(--tc-font);
  overflow: hidden;
}
.tc-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--tc-border);
}
.tc-modal-title { font-family: var(--tc-font-heading); font-size: 17px; font-weight: 600; }
.tc-modal-sub { font-size: 13px; color: var(--tc-text-dim); margin-top: 2px; }
.tc-modal-close {
  margin-left: auto;
  border: 0; background: none; cursor: pointer;
  color: var(--tc-text-dim); font-size: 17px; line-height: 1; padding: 4px;
  border-radius: 6px;
}
.tc-modal-close:hover { background: var(--tc-surface-2); color: var(--tc-text); }
.tc-modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; min-height: 0; }
.tc-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--tc-border);
  background: var(--tc-surface-2);
}

/* Shortcut list inside the ? modal */
.tc-shortcut-list { display: grid; gap: 2px; }
.tc-shortcut {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 2px;
  font-size: 14px;
  border-bottom: 1px solid var(--tc-border);
}
.tc-shortcut:last-child { border-bottom: 0; }
.tc-shortcut-keys { flex: none; min-width: 92px; display: flex; gap: 4px; }
.tc-shortcut-desc { color: var(--tc-text-muted); }

/* Text input used by the shell (jumper, drawer search) */
.tc-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--tc-radius);
  border: 1px solid var(--tc-border-strong);
  background: var(--tc-surface-2);
  color: var(--tc-text);
  font-family: var(--tc-font);
  font-size: 14px;
  outline: none;
}
.tc-input:focus { border-color: var(--tc-accent); box-shadow: var(--tc-focus); background: var(--tc-surface); }
.tc-input::placeholder { color: var(--tc-text-dim); }

/* ── Bottom sticky multi-select action bar ──────────────────────────── */

.tc-action-bar {
  position: fixed;
  left: var(--tc-rail-w);
  right: 0;
  bottom: 0;
  z-index: 1250;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px calc(11px + env(safe-area-inset-bottom, 0px));
  background: var(--tc-rail-bg);
  border-top: 1px solid var(--tc-rail-border);
  color: #fff;
  font-family: var(--tc-font);
  transform: translateY(102%);
  transition: transform 0.18s ease;
}
.tc-action-bar.is-open { transform: none; }
.tc-action-bar-count { font-family: var(--tc-font-heading); font-size: 15px; font-weight: 600; }
.tc-action-bar-hint { font-size: 12px; color: var(--tc-rail-text); }
.tc-action-bar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tc-action-bar .tc-btn-secondary {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}
.tc-action-bar .tc-btn-secondary:hover { background: rgba(255, 255, 255, 0.18); }
.tc-action-bar .tc-btn-danger { color: #ff9a90; border-color: rgba(255, 154, 144, 0.5); }

@media (max-width: 767px) {
  .tc-action-bar {
    left: 0;
    bottom: calc(var(--tc-bottom-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: 11px;
    flex-wrap: wrap;
  }
  .tc-action-bar-actions { margin-left: 0; width: 100%; }
  .tc-action-bar-actions > * { flex: 1; }
}

/* ── Calendar day cell + workout card ───────────────────────────────── */

.tc-day-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 128px;
  padding: 6px 5px;
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
}
.tc-day-cell.is-today { border-color: var(--tc-accent); box-shadow: inset 0 0 0 1px var(--tc-accent); }
.tc-day-cell.is-rest { background: var(--tc-surface-2); }
.tc-day-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--tc-text-dim);
}
.tc-day-num { font-family: var(--tc-font-heading); font-size: 14px; font-weight: 600; color: var(--tc-text); letter-spacing: 0; }
/* today's number is a filled accent circle (TrueCoach uses blue; PTS green) */
.tc-day-num.is-today {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--tc-accent); color: var(--tc-on-accent);
}
.tc-day-add {
  margin-left: auto;
  border: 0; background: none; cursor: pointer;
  color: var(--tc-text-dim); font-size: 15px; line-height: 1; padding: 0 3px;
  border-radius: 5px;
}
.tc-day-cell:hover .tc-day-add { color: var(--tc-accent); }
.tc-day-empty { font-size: 12px; color: var(--tc-text-dim); padding: 6px 2px; }

/* Flush, not inset: the day cell is already a box, so the card draws no second
   one. Its only frame is the left state bar (green complete / red missed), the
   way TrueCoach marks a workout. */
.tc-workout-card {
  position: relative;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  padding: 4px 2px 6px 7px;
  min-width: 0;
}
.tc-workout-card:hover { background: var(--tc-surface-2); }
/* The whole card is the open target, so it takes the pointer and the focus
   ring; the title is plain text inside it now rather than a nested button. */
.tc-workout-card.is-openable { cursor: pointer; }
.tc-workout-card.is-openable:focus-visible { outline: none; box-shadow: var(--tc-focus); border-radius: 4px; }
.tc-workout-card.is-complete { border-left-color: var(--tc-green); }
.tc-workout-card.is-missed { border-left-color: var(--tc-red); }

.tc-workout-card.is-selected { background: var(--tc-accent-soft); border-left-color: var(--tc-accent); }

.tc-workout-head { display: flex; align-items: flex-start; gap: 8px; }
.tc-workout-check { flex: none; margin-top: 2px; accent-color: var(--tc-accent); }
/* the workout-level "Schedule: / Intent:" block */
.tc-workout-desc {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--tc-text-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.is-untruncated .tc-workout-desc { display: block; overflow: visible; }
.tc-workout-title {
  font-family: var(--tc-font-heading);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--tc-text);
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.is-untruncated .tc-workout-title { display: block; overflow: visible; }
/* title colour carries the workout's state, as in TrueCoach */
.tc-workout-card.is-complete .tc-workout-title { color: var(--tc-green); }
.tc-workout-card.is-missed .tc-workout-title { color: var(--tc-orange); }
.tc-workout-program {
  font-size: 11px;
  color: var(--tc-text-dim);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* the ✥ move handle */
.tc-workout-handle {
  margin-left: auto;
  flex: none;
  border: 0; background: none; cursor: grab;
  color: var(--tc-text-dim);
  font-size: 13px; line-height: 1;
  padding: 2px 3px; border-radius: 5px;
  opacity: 0;
  transition: opacity 0.12s;
}
.tc-workout-card:hover .tc-workout-handle,
.tc-workout-handle:focus-visible { opacity: 1; }
.tc-workout-handle:active { cursor: grabbing; }

.tc-workout-rows { display: flex; flex-direction: column; margin-top: 7px; }

/* One exercise inside a workout card, shaped like TrueCoach's: the status mark
   sits in a narrow left gutter, and the order letter is INLINE bold text at the
   head of the name ("A1) Easy Bike or Row") rather than a chip in its own
   column. The chip cost ~26px of every row — at seven-column density that is
   the difference between reading an exercise name and reading "Bulgar…". */
.tc-ex-line {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 0 5px 0;
  font-size: 12px;
  line-height: 1.35;
  min-width: 0;
}
.tc-ex-line + .tc-ex-line { border-top: 1px solid var(--tc-border-subtle, rgba(0,0,0,0.045)); }
.tc-ex-body { flex: 1; min-width: 0; }
.tc-ex-letter {
  font-weight: 700;
  letter-spacing: 0;
  color: var(--tc-text-muted);
}
.tc-ex-line.is-superset .tc-ex-letter { color: var(--tc-accent); }
/* Calendar cells are ~170px wide at seven columns, so exercise names truncate
   by default — TrueCoach's "Truncate text" setting, on. Put .is-untruncated on
   the day cell (or the card) to let them wrap instead. */
.tc-ex-name {
  display: block; min-width: 0; color: var(--tc-text);
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-ex-rx {
  display: block;
  color: var(--tc-text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.is-untruncated .tc-ex-name,
.is-untruncated .tc-ex-rx { white-space: normal; overflow-wrap: anywhere; }
/* The demo-video marker on a prescribed exercise, in the card and the review
   panel. Dim by default (we looked, there is no demo), green when one is
   linked. It is absent entirely while the demo index is still loading, so the
   row never claims "no video" before we have checked. 14px so it costs almost
   nothing against the 280px column. */
.tc-ex-demo {
  flex: none;
  width: 14px; height: 14px;
  margin-top: 1px;
  padding: 0;
  border: 0; background: none;
  cursor: pointer;
  border-radius: 3px;
  color: var(--tc-text-dim);
  font-size: 9px; line-height: 14px;
  text-align: center;
  opacity: 0.5;
}
.tc-ex-demo.is-linked { color: var(--tc-green); opacity: 1; }
.tc-ex-demo:hover { background: var(--tc-accent-soft); color: var(--tc-accent); opacity: 1; }
.tc-ex-demo:focus-visible { outline: none; box-shadow: var(--tc-focus); opacity: 1; }
/* In the roomier panel the marker can be a touch larger. */
.tc-panel-body .tc-ex-demo { width: 18px; height: 18px; font-size: 11px; line-height: 18px; }

/* green ✓ / red ✕ status glyph — leading gutter, so the eye reads
   "did they do it / what was it" in that order, as TrueCoach does. The gutter
   holds its width when the mark is blank so names stay aligned down the card. */
.tc-ex-status { flex: none; width: 10px; margin-top: 1px; text-align: center; font-size: 11px; font-weight: 700; }
.tc-ex-status.is-done { color: var(--tc-green); }
.tc-ex-status.is-missed { color: var(--tc-red); }

/* the vertical bar tying an E1/E2 superset together */
.tc-superset-connector {
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--tc-accent);
  opacity: 0.55;
}
.tc-superset-group { position: relative; padding-left: 11px; }
.tc-superset-group .tc-ex-line { padding-left: 0; }

/* the light-green "what they actually did" block */
.tc-result {
  margin: 1px 0 4px 16px;
  max-width: calc(100% - 16px);
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--tc-green-soft);
  border-left: 2px solid var(--tc-green);
  color: var(--tc-accent-ink);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tc-result-note { display: block; font-weight: 400; color: var(--tc-text-muted); margin-top: 1px; }

/* ── Exercise editor row ────────────────────────────────────────────
   Drag gutter · trash · title input · Rx textarea · video + history gutter. */

.tc-exercise-row {
  display: grid;
  grid-template-columns: 26px 1fr 34px;
  grid-template-areas:
    'drag title icons'
    'drag rx    icons';
  gap: 6px 8px;
  align-items: start;
  padding: 9px 10px 9px 6px;
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
}
.tc-exercise-row + .tc-exercise-row { margin-top: 8px; }
.tc-exercise-row:hover { border-color: var(--tc-border-strong); }
.tc-exercise-row.is-superset { border-left: 3px solid var(--tc-accent); }

.tc-ex-gutter {
  grid-area: drag;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}
.tc-ex-drag {
  border: 0; background: none; cursor: grab;
  color: var(--tc-text-dim); font-size: 13px; line-height: 1; padding: 2px;
}
.tc-ex-drag:active { cursor: grabbing; }
.tc-ex-order {
  font-family: var(--tc-font-mono);
  font-size: 10px; font-weight: 700;
  color: var(--tc-text-muted);
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--tc-surface-3);
}
.tc-ex-trash {
  border: 0; background: none; cursor: pointer;
  color: var(--tc-text-dim); font-size: 13px; line-height: 1; padding: 2px;
  border-radius: 5px;
}
.tc-ex-trash:hover { color: var(--tc-red); background: var(--tc-red-soft); }

.tc-ex-title-input {
  grid-area: title;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--tc-text);
  font-family: var(--tc-font-heading);
  font-size: 14px;
  font-weight: 600;
  outline: none;
}
.tc-ex-title-input:hover { border-color: var(--tc-border); }
.tc-ex-title-input:focus { border-color: var(--tc-accent); background: var(--tc-surface-2); box-shadow: var(--tc-focus); }

.tc-ex-rx-input {
  grid-area: rx;
  width: 100%;
  min-height: 52px;
  resize: vertical;
  padding: 6px 8px;
  border: 1px solid var(--tc-border);
  border-radius: 6px;
  background: var(--tc-surface-2);
  color: var(--tc-text-muted);
  font-family: var(--tc-font);
  font-size: 13px;
  line-height: 1.45;
  outline: none;
}
.tc-ex-rx-input:focus { border-color: var(--tc-accent); background: var(--tc-surface); color: var(--tc-text); box-shadow: var(--tc-focus); }

.tc-ex-icons {
  grid-area: icons;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 3px;
}
.tc-ex-icon {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  font-size: 14px; line-height: 1;
  border: 1px solid var(--tc-border);
  border-radius: 6px;
  background: var(--tc-surface-2);
  color: var(--tc-text-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.tc-ex-icon:hover { border-color: var(--tc-accent); color: var(--tc-accent); background: var(--tc-accent-soft); }
.tc-ex-icon.has-video { color: var(--tc-green); border-color: var(--tc-green); }

/* the "+ Superset" pill that lives between two rows */
.tc-superset-add-wrap {
  display: flex;
  justify-content: center;
  margin: -6px 0 -6px;
  position: relative;
  z-index: 1;
  height: 20px;
  align-items: center;
}
.tc-superset-add {
  padding: 2px 10px;
  border-radius: var(--tc-radius-pill);
  border: 1px dashed var(--tc-border-strong);
  background: var(--tc-bg);
  color: var(--tc-text-dim);
  font-family: var(--tc-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.13s, color 0.13s, border-color 0.13s;
}
.tc-superset-add-wrap:hover .tc-superset-add,
.tc-superset-add:focus-visible { opacity: 1; border-color: var(--tc-accent); color: var(--tc-accent); }

/* ── Small helpers ──────────────────────────────────────────────────── */

.tc-section-title {
  font-family: var(--tc-font-heading);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tc-text-dim);
  margin-bottom: 10px;
}
.tc-sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   S1 — Client page additions (coach-calendar.html)

   Purely additive. Nothing above this line changes. These are the primitives
   the client page needs that the S0 kit did not yet cover: the second (client)
   rail, the calendar toolbar and its settings popover, the show/edit panel,
   the exercise-autocomplete dropdown and the per-exercise video popover.
   ══════════════════════════════════════════════════════════════════════════ */

:root { --tc-client-rail-w: 44px; }

/* The S0 action bar hides itself by translating 102% of its own height down.
   Below 768px it also sits `--tc-bottom-h` above the viewport floor, so the
   translation no longer clears the screen and the closed bar peeks out.
   Take it out of the paint entirely when nothing is selected. */
.tc-action-bar:not(.is-open) { visibility: hidden; }
.tc-action-bar.is-open { visibility: visible; }

/* ── Client header (OPS-101 P3) ───────────────────────────────────────
   Was a second 44px icon rail beside the global one. It is now a header
   strip above the calendar: who this client is, then their per-client
   actions with labels. It sticks to the top with the calendar toolbar
   stacked under it (the page opens scrolled to this week, so a header that
   scrolled away would never be seen). The class names stay
   `tc-client-rail*` so the calendar's JS and drawers are untouched. */

:root { --tc-client-head-h: 60px; }
.tc-client-rail {
  position: sticky; top: 0; z-index: 61;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  height: var(--tc-client-head-h);
  padding: 0 16px;
  background: var(--tc-bg);
  border-bottom: 1px solid var(--tc-border);
  overflow: hidden;
}
body.tc-has-client-rail .tc-cal-toolbar { top: var(--tc-client-head-h); }
body.tc-has-client-rail .tc-week-head { top: calc(var(--tc-client-head-h) + 53px); }
.tc-client-rail-initials {
  flex: none;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tc-accent);
  color: var(--tc-on-accent);
  font-family: var(--tc-font-heading);
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
}
.tc-client-rail-name {
  min-width: 0;
  margin: 0 auto 0 8px;
  font: 700 26px/1.05 var(--tc-font-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--tc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tc-client-rail-item {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--tc-radius);
  background: none;
  color: var(--tc-text-muted);
  font: 600 14px var(--tc-font);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
}
.tc-client-rail-item:hover { background: var(--tc-surface); border-color: var(--tc-border); color: var(--tc-text); }
.tc-client-rail-item.is-active { background: var(--tc-accent-soft); color: var(--tc-accent-ink); }
.tc-client-rail-item:focus-visible { outline: none; box-shadow: var(--tc-focus); }
.tc-client-rail-divider {
  flex: none;
  width: 1px; height: 20px;
  margin: 0 4px;
  background: var(--tc-border);
}

/* the page body no longer needs to clear a second rail */
.tc-client-main { margin-left: 0; min-width: 0; }

/* Below 1024px the actions drop their labels (icon buttons, with
   aria-labels and tooltips) so the header stays one row. */
@media (max-width: 1023px) {
  .tc-client-rail-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tc-client-rail-item { width: 38px; padding: 0; justify-content: center; }
}

@media (max-width: 767px) {
  :root { --tc-client-head-h: 52px; }
  /* Two stuck bars would take a fifth of a phone screen: the client header
     stays, the calendar toolbar scrolls away (as before P3). */
  body.tc-has-client-rail .tc-cal-toolbar { position: static; }
  .tc-client-rail { padding: 0 8px 0 12px; gap: 2px; overflow-x: auto; }
  .tc-client-rail-initials { width: 30px; height: 30px; font-size: 11px; }
  .tc-client-rail-name { font-size: 20px; margin-left: 6px; }
  .tc-client-rail-item { width: 36px; height: 36px; }
  .tc-client-rail-divider { display: none; }
}

/* ── Calendar toolbar ─────────────────────────────────────────────────── */

.tc-cal-toolbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--tc-bg);
  border-bottom: 1px solid var(--tc-border);
}
.tc-cal-month {
  font-family: var(--tc-font-display);
  font-size: 22px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.01em;
  margin: 0 4px;
  white-space: nowrap;
}
.tc-cal-nav {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--tc-border); border-radius: var(--tc-radius);
  background: var(--tc-surface);
  color: var(--tc-text-muted);
  font-size: 14px; cursor: pointer;
}
.tc-cal-nav:hover { border-color: var(--tc-text-dim); color: var(--tc-text); }
.tc-cal-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.tc-pop {
  position: absolute;
  z-index: 1450;
  min-width: 220px;
  padding: 12px 14px;
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-lg);
  box-shadow: var(--tc-shadow-lift);
  font-family: var(--tc-font);
  font-size: 13px;
  color: var(--tc-text);
}
.tc-pop[hidden] { display: none !important; }
/* The demo popover has to clear the workout panel (1460) and its autocomplete
   (1470); at the shared .tc-pop 1450 it opened UNDERNEATH the panel, so
   clicking a marker in a review panel looked like nothing happened. */
.tc-video-pop { z-index: 1550; }
.tc-video-pop-form { margin-top: 10px; }
.tc-video-pop-form label {
  display: block;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--tc-text-muted);
  margin-bottom: 4px;
}
.tc-video-pop-form label em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--tc-text-dim); }
.tc-video-pop-form input {
  width: 100%; padding: 7px 9px;
  border: 1px solid var(--tc-border); border-radius: var(--tc-radius);
  background: var(--tc-surface); color: var(--tc-text);
  font-family: var(--tc-font); font-size: 13px;
}
.tc-video-pop-form input:focus { outline: none; border-color: var(--tc-accent); box-shadow: var(--tc-focus); }
.tc-video-pop-actions { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.tc-video-pop-err { margin-top: 7px; font-size: 12px; color: var(--tc-red); }
.tc-video-pop-ok { margin-top: 7px; font-size: 12px; color: var(--tc-green); font-weight: 600; }
.tc-pop-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0;
  cursor: pointer;
}
.tc-pop-row input { accent-color: var(--tc-accent); }
.tc-pop-btn {
  display: block; width: 100%;
  padding: 7px 8px;
  border: 0; border-radius: var(--tc-radius);
  background: none; color: inherit;
  font-family: inherit; font-size: 13px; text-align: left;
  cursor: pointer;
}
.tc-pop-btn:hover { background: var(--tc-surface-2); }
.tc-pop-btn:disabled { opacity: 0.45; cursor: default; }

/* ── Week grid ────────────────────────────────────────────────────────── */

/* A day column below ~280px cannot hold "B1) Bulgarian Split Squat" and its Rx
   on one line, which is the whole job of this screen. Rather than shrink seven
   columns to fit whatever the window is, hold the column width and let the week
   scroll sideways — measured against TrueCoach, whose columns run ~280px and
   show six at a laptop width. Overridden to 0 on mobile, where the week
   stacks. */
:root { --tc-day-min: 280px; }
.tc-cal-body { padding: 0 10px 96px; }
.tc-week-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(var(--tc-day-min), 1fr));
  gap: 4px;
  position: sticky; top: 53px; z-index: 50;
  padding: 8px 0 6px;
  background: var(--tc-bg);
  font-size: 10px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--tc-text-dim);
}
.tc-week-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(var(--tc-day-min), 1fr));
  gap: 4px;
  margin-bottom: 4px;
}
.tc-month-rule {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 8px;
  font-family: var(--tc-font-heading);
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--tc-text-dim);
}
.tc-month-rule::after { content: ''; flex: 1; height: 1px; background: var(--tc-border); }

.tc-day-cell.is-drop-target { border-color: var(--tc-blue); box-shadow: inset 0 0 0 2px var(--tc-blue); }
.tc-day-cell.is-paste-conflict { border-color: var(--tc-orange); box-shadow: inset 0 0 0 2px var(--tc-orange); }

.tc-runway {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 6px 0 14px;
  padding: 11px 14px;
  border: 1px dashed var(--tc-orange);
  border-radius: var(--tc-radius);
  background: var(--tc-orange-soft);
  font-size: 13px; font-weight: 600; color: var(--tc-text);
}
.tc-runway a { color: var(--tc-orange); font-weight: 700; text-decoration: none; white-space: nowrap; }

/* Titles wrap at word boundaries; `anywhere` (the S0 default, right for
   exercise names and loads) would split "Conditioning" across two lines. */
.tc-workout-title { overflow-wrap: break-word; }

@media (max-width: 860px) {
  :root { --tc-day-min: 0px; }
  .tc-week-head { display: none; }
  .tc-week-row { grid-template-columns: 1fr; }
  .tc-day-cell { min-height: 0; }
  .tc-cal-body { padding: 0 10px 110px; }
  .tc-cal-toolbar { padding: 8px 10px; }
  .tc-cal-month { font-size: 17px; }
}

/* ── Show / edit panel ────────────────────────────────────────────────── */

.tc-panel-backdrop {
  position: fixed; inset: 0; z-index: 1440;
  background: rgba(23, 17, 11, 0.42);
  opacity: 0; pointer-events: none; transition: opacity 0.18s;
}
.tc-panel-backdrop.is-open { opacity: 1; pointer-events: auto; }

.tc-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 1460;
  width: min(720px, 100vw);
  display: flex; flex-direction: column;
  background: var(--tc-bg);
  border-left: 1px solid var(--tc-border);
  box-shadow: var(--tc-shadow-lift);
  transform: translateX(102%);
  transition: transform 0.2s ease;
  font-family: var(--tc-font);
  color: var(--tc-text);
}
.tc-panel.is-open { transform: none; }

/* The panel is a flex column, but its one child — the shell the renderers write
   into — was a plain div, so it sized to its content and spilled past the
   panel. .tc-panel-body's `flex: 1; min-height: 0; overflow-y: auto` was then
   measured against a parent of unbounded height and never scrolled: the wheel
   fell through to the calendar behind it. The shell has to carry the flex chain
   from the panel down to the body. */
#panel-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.tc-panel-statusbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--tc-green-soft);
  color: var(--tc-accent-ink);
  border-bottom: 1px solid var(--tc-border);
  font-size: 14px; font-weight: 600;
}
.tc-panel-statusbar.is-missed { background: var(--tc-red-soft); color: var(--tc-red); }
.tc-panel-statusbar.is-upcoming { background: var(--tc-surface-2); color: var(--tc-text-muted); }
.tc-panel-icons { margin-left: auto; display: flex; gap: 4px; }
.tc-panel-icon {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--tc-radius);
  background: rgba(255, 255, 255, 0.5);
  color: inherit; font-size: 13px; cursor: pointer;
}
.tc-panel-icon:hover { background: var(--tc-surface); }
.tc-panel-icon:disabled { opacity: 0.4; cursor: default; }
.tc-panel-subbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 16px;
  background: var(--tc-surface);
  border-bottom: 1px solid var(--tc-border);
}
.tc-panel-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  /* Reaching the end of the list must not hand the rest of the scroll to the
     calendar behind the panel. */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}
.tc-panel-card {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-lg);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.tc-panel-title {
  font-family: var(--tc-font-heading);
  font-size: 20px; font-weight: 600; line-height: 1.2;
}
/* A flex item is blockified, so a bare <button> would stretch the row's full
   width and centre its label; pin it left under the exercise name instead. */
.tc-panel-history {
  display: inline-block; align-self: flex-start;
  margin: 1px 0 5px 26px;
  border: 0; background: none; padding: 0;
  color: var(--tc-blue); font-family: inherit; font-size: 11.5px;
  text-align: left; cursor: pointer; text-decoration: underline;
}
.tc-result .tc-panel-history { display: block; margin-left: 0; }
.tc-composer-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tc-composer-tab {
  border: 1px solid var(--tc-border); border-radius: var(--tc-radius-pill);
  background: var(--tc-surface); color: var(--tc-text-muted);
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 4px 12px; cursor: pointer;
}
.tc-composer-tab.is-active { background: var(--tc-accent); border-color: var(--tc-accent); color: var(--tc-on-accent); }

.tc-note-row {
  padding: 9px 0;
  border-bottom: 1px solid var(--tc-border);
  font-size: 13px; line-height: 1.5;
  white-space: pre-line;
}
.tc-note-row:last-child { border-bottom: 0; }
.tc-note-meta { display: block; margin-top: 3px; font-size: 11px; color: var(--tc-text-dim); }

.tc-msg {
  max-width: 84%;
  margin-bottom: 8px;
  padding: 8px 11px;
  border-radius: var(--tc-radius-lg);
  font-size: 13px; line-height: 1.45;
  white-space: pre-line;
}
.tc-msg.is-coach { margin-left: auto; background: var(--tc-accent); color: var(--tc-on-accent); }
.tc-msg.is-athlete { background: var(--tc-surface-2); color: var(--tc-text); }
.tc-msg-time { display: block; margin-top: 3px; font-size: 10px; opacity: 0.7; }

@media (max-width: 767px) {
  .tc-panel { width: 100vw; bottom: calc(var(--tc-bottom-h) + env(safe-area-inset-bottom, 0px)); }
}

/* ── Editor: title/description, autocomplete dropdown, video popover ──── */

.tc-ed-title {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--tc-border); border-radius: var(--tc-radius);
  background: var(--tc-surface); color: var(--tc-text);
  font-family: var(--tc-font-heading); font-size: 19px; font-weight: 600;
}
.tc-ed-title:focus { outline: none; border-color: var(--tc-accent); box-shadow: var(--tc-focus); }
.tc-ed-desc {
  width: 100%; min-height: 70px; resize: vertical;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--tc-border); border-radius: var(--tc-radius);
  background: var(--tc-surface-2); color: var(--tc-text);
  font-family: var(--tc-font); font-size: 13px; line-height: 1.5;
}
.tc-ed-desc:focus { outline: none; border-color: var(--tc-accent); background: var(--tc-surface); box-shadow: var(--tc-focus); }

.tc-ex-title-wrap { grid-area: title; position: relative; min-width: 0; }

.tc-ac-list {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0;
  z-index: 1470;
  max-height: 260px; overflow-y: auto;
  background: var(--tc-surface);
  border: 1px solid var(--tc-border-strong);
  border-radius: var(--tc-radius);
  box-shadow: var(--tc-shadow-lift);
}
.tc-ac-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0; border-bottom: 1px solid var(--tc-border);
  background: none; color: var(--tc-text);
  font-family: var(--tc-font); font-size: 13px; text-align: left;
  cursor: pointer;
}
.tc-ac-item:last-child { border-bottom: 0; }
.tc-ac-item:hover, .tc-ac-item.is-active { background: var(--tc-accent-soft); }
.tc-ac-avatar {
  flex: none;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tc-surface-3);
  color: var(--tc-text-muted);
  font-family: var(--tc-font-heading); font-size: 9px; font-weight: 700;
}
.tc-ac-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-ac-hint { padding: 7px 10px; font-size: 12px; color: var(--tc-text-dim); }

.tc-video-pop { width: min(340px, 88vw); }
.tc-video-pop iframe, .tc-video-pop video {
  width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--tc-radius);
  background: #000;
}
.tc-video-pop-name { font-weight: 600; margin-bottom: 8px; }
.tc-video-pop a { color: var(--tc-blue); font-size: 12px; }

.tc-ed-addbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tc-ed-block {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--tc-border-strong);
  border-radius: var(--tc-radius);
  background: var(--tc-surface-2);
}
.tc-ed-block-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--tc-text-dim);
  margin-bottom: 6px;
}
.tc-ed-status { min-height: 18px; margin-top: 10px; font-size: 13px; color: var(--tc-red); }
.tc-exercise-row.is-dragging { opacity: 0.45; }
.tc-exercise-row.is-drop-before { box-shadow: inset 0 3px 0 var(--tc-accent); }

/* ── Toast + confirm (page-level, kept on tc tokens so dark mode works) ─ */

/* ONE .tc-toast rule for every coach page (S7 item 7). It used to be declared
   twice — this block and a later S2/Library block that dropped the off-screen
   transform, so a persistent toast element (coach-calendar.html, program-
   templates.html) sat on screen as an empty pill. The parked state is now the
   only state; a toast is visible only while it carries .is-open, and pages that
   create the element on demand add .is-open as they append it. */
.tc-toast {
  position: fixed; left: 50%; bottom: 20px;
  z-index: 1600;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 20px;
  border-radius: var(--tc-radius-pill);
  background: var(--tc-rail-bg); color: #fff;
  box-shadow: var(--tc-shadow-lift);
  font-family: var(--tc-font); font-size: 13.5px; font-weight: 600;
  transform: translateX(-50%) translateY(96px);
  transition: transform 0.2s ease;
}
.tc-toast.is-open { transform: translateX(-50%) translateY(0); }
/* Belt and braces: several pages keep a permanent, initially-empty toast
   element in the markup. If any rule ever loses the parking transform again
   (that is how a black pill sat at the bottom of the calendar), an empty toast
   still must not paint. */
.tc-toast:empty { display: none; }
.tc-toast.is-error { background: var(--tc-red); }
/* ── Page frame: sub-nav column + header + stats ─────────────────────────
   S2 (Library) additions. TrueCoach's second-level navigation is a white
   column to the left of the content, inside the dark rail. Generic enough
   for S4/S5 to reuse (Programs sections, Clients Active/Archived). */

.tc-split {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  align-items: start;
  gap: 0;
  min-height: 100vh;
}
.tc-subnav {
  background: var(--tc-surface);
  border-right: 1px solid var(--tc-border);
  padding: 22px 12px;
  position: sticky;
  top: 0;
  align-self: stretch;
  min-height: 100vh;
}
.tc-subnav-title {
  font-family: var(--tc-font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--tc-text-dim);
  padding: 0 10px 10px;
}
.tc-subnav-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  border-radius: var(--tc-radius);
  padding: 9px 10px;
  margin-bottom: 2px;
  font: 600 14px var(--tc-font);
  color: var(--tc-text-muted);
  text-decoration: none;
  cursor: pointer;
}
.tc-subnav-item:hover { background: var(--tc-surface-2); color: var(--tc-text); }
.tc-subnav-item.is-active { background: var(--tc-accent-soft); color: var(--tc-accent-ink); }
.tc-subnav-item:focus-visible { outline: 0; box-shadow: var(--tc-focus); }

.tc-content { padding: 26px clamp(16px, 3vw, 34px) 80px; max-width: 1280px; }

.tc-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.tc-page-title {
  margin: 0;
  font: 700 32px/1.05 var(--tc-font-display);
  color: var(--tc-text);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.tc-page-sub { margin: 4px 0 0; color: var(--tc-text-muted); font-size: 14px; }
.tc-page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.tc-stats { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tc-stat {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-lg);
  padding: 12px 14px;
}
.tc-stat strong { display: block; font: 700 22px var(--tc-font-heading); color: var(--tc-text); }
.tc-stat span { color: var(--tc-text-muted); font-size: 12px; }

.tc-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 0;
  margin-bottom: 12px;
  cursor: pointer;
  font: 600 13px var(--tc-font);
  color: var(--tc-text-muted);
}
.tc-breadcrumb:hover { color: var(--tc-accent); }

/* ── Forms ──────────────────────────────────────────────────────────── */

.tc-card {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-lg);
  box-shadow: var(--tc-shadow);
  padding: 20px clamp(16px, 2.4vw, 24px);
}
.tc-form { display: grid; gap: 16px; max-width: 680px; }
.tc-field { display: grid; gap: 6px; }
.tc-field > label { font: 700 13px var(--tc-font); color: var(--tc-text); }
.tc-req { color: var(--tc-red); }
.tc-hint { color: var(--tc-text-dim); font-size: 12px; }
.tc-error { color: var(--tc-red); font-size: 13px; min-height: 18px; }
.tc-notice {
  border: 1px solid var(--tc-border);
  background: var(--tc-surface-2);
  border-radius: var(--tc-radius);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--tc-text-muted);
}
.tc-notice--warn { border-color: var(--tc-orange); background: var(--tc-orange-soft); color: var(--tc-text); }
.tc-textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  color: var(--tc-text);
  font: 400 14px var(--tc-font);
  padding: 9px 11px;
}
.tc-textarea:focus { outline: 0; border-color: var(--tc-accent); box-shadow: var(--tc-focus); }
.tc-select {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  color: var(--tc-text);
  font: 400 14px var(--tc-font);
  padding: 9px 11px;
  min-height: 38px;
}
.tc-select:focus { outline: 0; border-color: var(--tc-accent); box-shadow: var(--tc-focus); }
.tc-or {
  display: flex; align-items: center; gap: 10px;
  color: var(--tc-text-dim); font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
}
.tc-or::before, .tc-or::after { content: ''; flex: 1; height: 1px; background: var(--tc-border); }
.tc-form-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--tc-border);
  margin-top: 4px; padding-top: 16px;
}
.tc-form-foot .tc-spacer { flex: 1; }
button[disabled], .tc-btn-primary[disabled], .tc-btn-secondary[disabled] { opacity: 0.5; cursor: not-allowed; }

.tc-video-frame {
  width: 100%; max-width: 480px; aspect-ratio: 16 / 9;
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius); background: #000;
}
.tc-thumb {
  width: 84px; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--tc-border); background: var(--tc-surface-3);
}

.tc-empty {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-lg);
  padding: 46px 20px;
  text-align: center;
  color: var(--tc-text-muted);
}

@media (max-width: 900px) {
  .tc-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  .tc-split { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .tc-subnav {
    position: static; min-height: 0;
    border-right: 0; border-bottom: 1px solid var(--tc-border);
    padding: 8px 10px;
    display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .tc-subnav-title { display: none; }
  .tc-subnav-item { width: auto; white-space: nowrap; margin-bottom: 0; }
  .tc-content { padding: 18px 16px 90px; }
  .tc-page-title { font-size: 28px; }
  .tc-page-actions { width: 100%; }
}

/* ══════════════════════════════════════════════════════════════════════════
   S1 FIX PASS (2026-09-11) — appended additively; nothing above is changed.
   ══════════════════════════════════════════════════════════════════════════ */

/* FIX 7: the client rail draws inline SVG line icons (same stroke language as
   `.tc-rail-icon` on the global rail), 20px, tinted by the item's own colour. */
.tc-client-rail-icon {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* FIX 8: with no client loaded the client header is hidden. */
.tc-client-rail[hidden] { display: none; }

/* ══════════════════════════════════════════════════════════════════════════
   P3 COACH SHELL (OPS-101, 2026-10-24) — Chalk Line sidebar.
   ≥1280px: labeled sidebar with shortcut keys (the approved mockup).
   768–1279px: the compact icon rail above, unchanged in shape.
   <768px: five-item bottom bar; Library, Admin, Search and the account sit
   in the More sheet.
   ══════════════════════════════════════════════════════════════════════════ */

.tc-rail-logo,
.tc-rail-key,
.tc-rail-account-label,
.tc-rail-item--phone { display: none; }

.tc-rail-item.is-active .tc-rail-icon { color: var(--tc-rail-accent); }
.tc-rail-item.is-active::before { background: var(--tc-rail-accent); }
.tc-rail-wordmark { font-family: var(--tc-font-display); font-size: 12px; font-weight: 700; }
.tc-rail-count { font-family: var(--tc-font-mono); font-weight: 500; }

@media (min-width: 1280px) {
  :root { --tc-rail-w: 232px; }

  .tc-rail { padding: 20px 12px 14px; border-right: 0; }
  .tc-rail-brand {
    flex-direction: row;
    justify-content: flex-start;
    padding: 2px 8px 22px;
    border-bottom: 0;
  }
  .tc-rail-mark,
  .tc-rail-wordmark { display: none; }
  .tc-rail-logo {
    display: block;
    width: 140px;
    height: auto;
    filter: invert(1);
  }

  .tc-rail-nav,
  .tc-rail-foot { padding: 0; gap: 2px; }
  .tc-rail-foot { border-top: 0; padding-top: 8px; }

  .tc-rail-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0;
  }
  .tc-rail-item.is-active::before { display: none; }
  .tc-rail-icon { width: 20px; height: 20px; flex-shrink: 0; }
  .tc-rail-label { font-size: 15px; text-align: left; line-height: 1.2; }
  .tc-rail-key {
    display: block;
    margin-left: auto;
    font: 500 11px var(--tc-font-mono);
    color: var(--tc-rail-key);
  }
  .tc-rail-item:hover .tc-rail-key,
  .tc-rail-item.is-active .tc-rail-key { color: var(--tc-rail-text); }
  .tc-rail-count {
    position: static;
    margin-left: auto;
    order: 3;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 11px;
  }
  /* A count replaces the key hint so the row never carries two badges. */
  .tc-rail-count:not([hidden]) ~ .tc-rail-key,
  .tc-rail-key:has(~ .tc-rail-count:not([hidden])) { display: none; }

  #tc-account-btn { height: 48px; margin-top: 6px; }
  .tc-rail-avatar { width: 28px; height: 28px; font-size: 11px; flex-shrink: 0; }
  .tc-rail-account-label {
    display: block;
    font-size: 13px;
    color: var(--tc-rail-text);
    min-width: 0;
  }
  .tc-rail-pop { bottom: 14px; }
}

@media (max-width: 767px) {
  .tc-rail-foot,
  .tc-rail-item--desk { display: none; }
  .tc-rail-item--phone { display: flex; }
  .tc-rail-item { font-size: 12px; gap: 4px; padding: 7px 2px 6px; }
  .tc-rail-label { font-size: 12px; font-weight: 600; }
  .tc-rail-icon { width: 22px; height: 22px; }
  .tc-rail-count { top: 3px; right: calc(50% - 22px); }
}

.tc-more-scrim {
  position: fixed;
  inset: 0;
  z-index: 1250;
  background: var(--pt-scrim);
}
.tc-more-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tc-bottom-h) + env(safe-area-inset-bottom, 0px));
  z-index: 1260;
  padding: 8px 12px 14px;
  border-radius: var(--tc-radius-lg) var(--tc-radius-lg) 0 0;
  background: var(--tc-surface);
  border-top: 1px solid var(--tc-border);
  color: var(--tc-text);
  font-family: var(--tc-font);
}
.tc-more-scrim[hidden],
.tc-more-sheet[hidden] { display: none !important; }
.tc-more-grip {
  width: 36px;
  height: 4px;
  margin: 0 auto 8px;
  border-radius: 2px;
  background: var(--tc-border-strong);
}
.tc-more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--tc-radius);
  background: none;
  color: var(--tc-text);
  font: 500 16px var(--tc-font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.tc-more-item .tc-rail-icon { width: 22px; height: 22px; color: var(--tc-text-muted); }
.tc-more-item.is-active { background: var(--tc-accent-soft); }
.tc-more-item.is-active .tc-rail-icon { color: var(--tc-accent); }
.tc-more-account {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--tc-border);
}
.tc-more-account .tc-rail-avatar { background: var(--tc-accent); color: var(--tc-on-accent); }
.tc-more-email { flex: 1; min-width: 0; font-size: 14px; color: var(--tc-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 768px) {
  .tc-more-scrim,
  .tc-more-sheet { display: none !important; }
}

/* Toasts that a page pins near the bottom edge sit above the phone bar. */
@media (max-width: 767px) {
  body.tc-shelled .toast { bottom: calc(var(--tc-bottom-h) + env(safe-area-inset-bottom, 0px) + 16px); }
}
