/* =========================================================
   RepSheet: shared styles
   Change the colours in :root to re-theme the whole site.
   ========================================================= */
:root {
  /* Palette: calm evergreen with a warm apricot accent */
  --brand: #0e6b62;          /* primary (buttons, links) */
  --brand-dark: #0a4f48;
  --brand-ink: #083b36;      /* headings on tinted areas */
  --brand-tint: #e5f1ee;     /* soft fills */
  --brand-tint-2: #f1f7f5;
  --accent: #c2410c;         /* movement arrows and highlights */
  --accent-tint: #fff1e6;
  --ink: #17232b;
  --ink-soft: #52606b;
  --ink-faint: #5d6a74;
  --line: #e3e6e3;
  --line-strong: #c9cfcb;
  --bg: #f6f5f1;             /* warm paper */
  --card: #ffffff;
  --focus: #0e6b62;
  --danger: #b42318;
  --warn-bg: #fff4e5;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(23, 35, 43, .05);
  --shadow: 0 1px 2px rgba(23, 35, 43, .04), 0 6px 20px -8px rgba(23, 35, 43, .10);
  --shadow-lg: 0 2px 4px rgba(23, 35, 43, .04), 0 18px 40px -16px rgba(23, 35, 43, .22);
  --ease: cubic-bezier(.2, .7, .2, 1);

  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 16px; line-height: 1.55; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.015em; font-weight: 700; }
h2 { font-size: 1.15rem; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
::selection { background: #cfe7e1; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 560px) { .wrap { padding: 0 16px; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 50; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.print-only { display: none; }
.hint { color: var(--ink-soft); font-weight: 400; font-size: .875rem; }
.warn { background: var(--warn-bg); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .875rem; margin: 12px 0 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246, 245, 241, .82);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(23, 35, 43, .07);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand, .brand-link { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-link:hover { color: var(--ink); }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-mark .bm-page { fill: var(--brand); }
.brand-mark .bm-tick { fill: var(--accent); }
.wordmark { font-size: 1.2rem; font-weight: 750; letter-spacing: -0.03em; }
.wordmark span { font-weight: 400; color: var(--brand); margin-left: 1px; }
.privacy-badge { display: flex; align-items: center; gap: 7px; margin: 0; font-size: .8125rem; font-weight: 600; color: var(--brand-ink); background: var(--brand-tint); padding: 6px 12px; border-radius: 999px; }
.privacy-badge svg { width: 14px; height: 14px; fill: var(--brand); }
.btn-ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); border-radius: 999px; padding: 6px 14px; font-size: .8125rem; font-weight: 600; cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease); }
.btn-ghost:hover { background: #fff; border-color: var(--ink-faint); }
.btn-ghost[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 28px; padding-top: 28px; padding-bottom: 40px; align-items: start; }
.panel { background: var(--card); border: 1px solid rgba(23, 35, 43, .06); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 24px; }
.library { position: sticky; top: 92px; max-height: calc(100vh - 112px); display: flex; flex-direction: column; gap: 14px; }
.library h2, .programme-toolbar h2 { font-size: 1.25rem; }
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .library { position: static; max-height: none; }
  .library-list { max-height: 420px; }
}
@media (max-width: 560px) { .panel { padding: 18px; border-radius: var(--radius); } }

/* ---------- Form fields ---------- */
input[type="text"], input[type="search"], input[type="email"], input[type="date"], input[type="number"], textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fcfcfb; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:hover, textarea:hover { border-color: var(--ink-faint); }
input:focus, textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(14, 107, 98, .16); }
input[type="search"] { padding-left: 40px; background: #fcfcfb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238794a0' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center / 18px; }
input[type="checkbox"] { accent-color: var(--brand); width: 18px; height: 18px; margin: 0; }
textarea { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .875rem; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }
.tick-row { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 14px; }
.remember { display: flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--ink-soft); cursor: pointer; }
.large-toggle { display: flex; align-items: center; gap: 10px; font-size: .875rem; cursor: pointer; }
.large-toggle input, .remember input { flex: none; }
#no-id-hint { margin: 6px 0 0; font-size: .8125rem; }
.general-notes-field { margin-top: 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  border: 1px solid transparent; border-radius: 999px; padding: 9px 18px; font-weight: 600; font-size: .9375rem;
  cursor: pointer; white-space: nowrap; text-decoration: none; color: inherit;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(10, 79, 72, .3), inset 0 1px 0 rgba(255,255,255,.14); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; box-shadow: 0 6px 16px -6px rgba(10, 79, 72, .55); }
.btn-secondary { background: #fff; border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--ink-faint); color: var(--ink); }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 999px; width: 36px; height: 36px; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-soft); transition: background .15s var(--ease), color .15s var(--ease); }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn svg, .has-video svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.remove:hover { color: var(--danger); background: #fdecea; }

/* ---------- Pictures ---------- */
.pic { border-radius: var(--radius-sm); overflow: hidden; display: grid; place-items: center; background: var(--brand-tint-2); }
.pic svg, .pic img { display: block; width: 100%; height: auto; }
.pic img { object-fit: contain; }
.pic .placeholder { width: 50%; fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Library ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 5px 13px; font-size: .8125rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; transition: all .15s var(--ease); }
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
/* Library filters as dropdowns (17 Nov 2026): one compact row instead of three rows of chips */
.lib-filters { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px; }
.lib-filter { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lib-filter > span { font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.lib-filter select { width: 100%; min-height: 40px; padding: 6px 26px 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: .8125rem; font-weight: 600; cursor: pointer;
  appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238794a0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px; }
.lib-filter select:hover { border-color: var(--ink-faint); }
.lib-filter select:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(14, 107, 98, .16); }
.lib-filter.is-set > span { color: var(--brand); }
.lib-filter.is-set select { border-color: var(--brand); background-color: var(--brand-tint); color: var(--brand-ink); }
@media (max-width: 960px) { .lib-filters { max-width: 560px; } }
.library-list { list-style: none; margin: 0 -6px; padding: 0 6px 4px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; }
.lib-item { display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 7px; border: 1px solid transparent; border-radius: 14px; transition: background .15s var(--ease), border-color .15s var(--ease); }
.lib-item:hover { background: var(--brand-tint-2); border-color: var(--line); }
.lib-item .pic { width: 68px; height: 54px; flex: none; border-radius: 10px; }
.lib-item .pic svg, .lib-item .pic img { width: 100%; height: 100%; }
.lib-item .meta { flex: 1; min-width: 0; }
.lib-item .name { font-weight: 600; line-height: 1.3; font-size: .9375rem; }
.lib-item .area { font-size: .8125rem; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; }
.has-video { display: inline-flex; color: var(--brand); }
.has-video svg { width: 15px; height: 15px; }
.awaiting-check { display: inline-block; margin: 2px 0 1px; padding: 1px 7px; border-radius: 999px; background: var(--accent-tint); color: var(--accent); font-size: .6875rem; font-weight: 700; letter-spacing: .02em; }
.lib-item .add { flex: none; min-height: 34px; padding: 5px 14px; font-size: .8125rem; }
.lib-item .add.added { background: var(--brand-tint); color: var(--brand-ink); border-color: transparent; box-shadow: none; }
.lib-empty { color: var(--ink-soft); padding: 8px; }
.library-foot { margin: 0; font-size: .875rem; padding-top: 10px; border-top: 1px solid var(--line); }
/* Short screens (17 Nov 2026): if the window is not tall enough, the library stops sticking
   so the list never squashes to nothing and the bottom link cannot spill onto the footer. */
.library-foot { flex-shrink: 0; }
@media (min-width: 961px) and (max-height: 999px) {
  .library { position: static; max-height: none; }
  .library-list { max-height: 460px; }
}
/* The list must always show at least a few exercises, however many filter chips sit above it. */
.library-list { min-height: 240px; flex-shrink: 0; }
@media (min-width: 961px) and (min-height: 1000px) { .library-list { flex-shrink: 1; } .library { overflow-y: auto; } }

/* ---------- Programme ---------- */
.programme-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.programme-list { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; counter-reset: ex; }
.ex-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 18px;
  counter-increment: ex; break-inside: avoid; transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.ex-card.entering { animation: card-in .35s var(--ease); }
.ex-card:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ex-media .pic { width: 160px; border-radius: 12px; } /* smaller at Alex's request, 16 Nov 2026 */
/* Picture / video switch (only shown when an exercise has a video) */
.media-pic { position: relative; }
.media-toggle { display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; font-size: .8125rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; user-select: none; position: relative; }
.media-toggle input { position: absolute; opacity: 0; width: 34px; height: 20px; left: 50%; margin: 0 0 0 -17px; cursor: pointer; }
.mt-track { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong, #c9cfcb); position: relative; flex: none; transition: background .2s var(--ease); }
.mt-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.media-toggle input:checked + .mt-track { background: var(--brand); }
.media-toggle input:checked + .mt-track::after { transform: translateX(14px); }
.media-toggle input:focus-visible + .mt-track { outline: 3px solid var(--brand); outline-offset: 2px; }
.mt-pic { color: var(--brand-ink); }
.showing-video .mt-pic { color: var(--ink-soft); }
.showing-video .mt-vid { color: var(--brand-ink); }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.video-frame iframe, .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-host { margin: 6px 0 0; font-size: .75rem; }
/* In the builder the video takes the full width of the card while it is showing */
.ex-card:has(.showing-video) .ex-media { grid-column: 1 / -1; max-width: 520px; }
.ex-card:has(.showing-video) .ex-body { grid-column: 1 / -1; }
/* Speed buttons (half, normal, double) under moving pictures and videos */
.media-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 8px; }
.media-bar .media-toggle { margin-top: 0; }
.speed-ctl { display: inline-flex; align-items: center; gap: 2px; font-size: .8125rem; font-weight: 600; color: var(--ink-soft); }
.speed-word { margin-inline-end: 4px; }
.speed-ctl button { font: inherit; min-width: 34px; min-height: 28px; padding: 2px 6px; border: 1px solid var(--line-strong, #c9cfcb); background: var(--card); color: var(--ink-soft); cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease); }
.speed-ctl button:nth-of-type(1) { border-radius: 999px 0 0 999px; }
.speed-ctl button:nth-of-type(3) { border-radius: 0 999px 999px 0; }
.speed-ctl button + button { margin-inline-start: -1px; }
.speed-ctl button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; position: relative; }
.speed-ctl button:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; position: relative; z-index: 1; }
/* The small builder card picture: no "Speed" word, just the three buttons */
.ex-media .speed-word { display: none; }
@media print { .media-toggle, .media-video, .media-bar { display: none !important; } }
.ex-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ex-title { font-size: 1.125rem; display: flex; align-items: center; gap: 10px; }
.ex-title::before {
  content: counter(ex); display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 999px;
  background: var(--brand-tint); color: var(--brand-ink); font-size: .8125rem; font-weight: 700; letter-spacing: 0;
}
.ex-tools { display: flex; gap: 2px; flex: none; }
.drag-handle { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.drag-handle:active { cursor: grabbing; }
.drag-handle svg { fill: currentColor; stroke: none; }
.programme-list.is-sorting { user-select: none; -webkit-user-select: none; }
.ex-card.dragging { position: relative; z-index: 5; box-shadow: var(--shadow-lg); border-color: var(--brand); transition: none; animation: none; opacity: .96; cursor: grabbing; }
.ex-card.drop-before { box-shadow: 0 -4px 0 0 var(--brand); }
.ex-card.drop-after { box-shadow: 0 4px 0 0 var(--brand); }
@media (prefers-reduced-motion: reduce) { .ex-card.dragging { box-shadow: none; } }
.ex-steps { margin: 10px 0 14px; padding-left: 20px; color: var(--ink-soft); }
.ex-steps li + li { margin-top: 3px; }
.ex-steps li::marker { color: var(--ink-faint); }
.params { display: grid; grid-template-columns: repeat(3, 92px) minmax(0, 1fr); gap: 10px; align-items: end; }
.params .load { grid-column: 1 / -1; }
.params .field label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.params input { min-height: 40px; padding: 8px 12px; }
.ex-notes { margin-top: 12px; }
.ex-notes label { font-size: .8125rem; }
.ex-notes textarea { min-height: 42px; }
.param-summary { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9375rem; color: var(--brand-ink); background: var(--brand-tint); border-radius: 999px; padding: 6px 14px; margin: 12px 0 0; }

.progressions { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 0; background: #fcfcfb; overflow: hidden; }
.progressions summary { cursor: pointer; font-weight: 600; font-size: .875rem; padding: 10px 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
.progressions summary::-webkit-details-marker { display: none; }
.progressions summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(-45deg); transition: transform .2s var(--ease); margin-right: 2px; }
.progressions[open] summary::before { transform: rotate(45deg); }
.progressions summary:hover { background: var(--brand-tint-2); }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 4px 14px 14px; }
.options { border: none; margin: 0; padding: 0; min-width: 0; }
.own-prog { padding: 4px 14px 14px; }
.options-grid + .own-prog { border-top: 1px solid var(--line); padding-top: 12px; }
.own-prog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@container (max-width: 560px) { .own-prog-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .own-prog-grid { grid-template-columns: 1fr; } }
.own-prog label { display: block; font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 6px; }
.own-prog textarea { width: 100%; min-height: 42px; }
.own-prog .hint { margin: 6px 0 0; font-size: .8125rem; }
.options legend { font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding: 0; margin-bottom: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .875rem; padding: 4px 0; }
.check input { margin-top: 2px; flex: none; }
.check label { cursor: pointer; }

@media (max-width: 760px) {
  .ex-card { grid-template-columns: 1fr; gap: 14px; }
  .ex-media .pic { width: 100%; max-width: 220px; margin: 0 auto; }
  .params { grid-template-columns: repeat(3, 1fr); }
  .params .freq, .params .load { grid-column: 1 / -1; }
  .options-grid { grid-template-columns: 1fr; }
}

/* Empty state */
.empty-state { text-align: center; color: var(--ink-soft); padding: 36px 24px 32px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); margin-top: 24px; background: linear-gradient(180deg, var(--brand-tint-2), #fff 70%); }
.empty-state h3 { color: var(--ink); font-size: 1.125rem; margin-bottom: 20px; }
.empty-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.empty-steps li { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: var(--shadow-sm); }
.empty-steps strong { color: var(--ink); }
.empty-steps span:last-child { font-size: .875rem; }
.step-num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 700; margin-bottom: 6px; }
@media (max-width: 640px) { .empty-steps { grid-template-columns: 1fr; } }

/* ---------- Patient link ---------- */
.share { margin-top: 24px; display: flex; gap: 22px; align-items: flex-start; border: 1px solid var(--line); background: linear-gradient(135deg, var(--brand-tint-2), #fff); border-radius: var(--radius); padding: 20px; }
.share-qr { width: 136px; flex: none; background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.share-qr svg { display: block; width: 100%; height: auto; }
.share-body { flex: 1; min-width: 0; }
.share-body h3 { font-size: 1.0625rem; }
.share-body .hint { margin: 6px 0 12px; }
.share-row { display: flex; gap: 8px; }
.share-row input { min-width: 0; font-size: .8125rem; color: var(--ink-soft); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
@media (max-width: 560px) { .share { flex-direction: column; } .share-row { flex-wrap: wrap; } }

/* ---------- Footer ---------- */
.site-footer { padding: 24px 0 40px; font-size: .875rem; color: var(--ink-soft); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 20px; }
.site-footer p { margin: 0; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.footer-links a:hover { color: var(--brand); text-decoration: underline; }

/* Grouped footer (17 Nov 2026): short intro on the left, links in three small groups */
.site-footer .wrap.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: start; justify-content: stretch; }
.footer-about { max-width: 38ch; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.footer-brand { font-weight: 700; font-size: 1rem; color: var(--ink); letter-spacing: -.01em; }
.footer-brand span { color: var(--brand); }
.footer-support { margin: 4px 0 0; font-size: .875rem; color: var(--ink-faint); }
.footer-support[hidden] { display: none; }
.footer-licence { margin: 4px 0 0; font-size: .8125rem; color: var(--ink-faint); }
.footer-licence a { white-space: nowrap; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer-licence a:hover, .footer-licence a:focus-visible { color: var(--brand); }
.footer-support a { color: var(--ink-soft); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.footer-support a:hover, .footer-support a:focus-visible { color: var(--brand); }
.footer-nav { display: grid; grid-template-columns: repeat(3, auto); gap: 20px 48px; }
.footer-col h2 { margin: 0 0 8px; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.footer-col a { color: var(--ink-soft); text-decoration: none; font-weight: 500; display: inline-block; padding: 2px 0; }
.footer-col a:hover, .footer-col a:focus-visible { color: var(--brand); text-decoration: underline; }
@media (max-width: 760px) {
  .site-footer .wrap.footer-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .footer-about { max-width: none; }
  .footer-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
  .footer-col a { padding: 4px 0; }
}
@media (max-width: 380px) { .footer-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Dialog and toast ---------- */
dialog { border: none; border-radius: var(--radius-lg); padding: 0; max-width: 480px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); }
dialog[open] { animation: pop .2s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: rgba(23, 35, 43, .4); backdrop-filter: blur(3px); }
.dialog-body { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { font-size: 1.25rem; }
.dialog-body p { margin: 0; color: var(--ink-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .875rem; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .2s var(--ease), transform .2s var(--ease); pointer-events: none; z-index: 40; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Privacy and disclaimer pages ---------- */
.privacy-main { max-width: 780px; padding-top: 40px; padding-bottom: 56px; }
.privacy-main h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); letter-spacing: -0.03em; margin-bottom: 6px; }
.privacy-main h2 { font-size: 1.2rem; margin: 36px 0 10px; }
.privacy-main h2[id] { scroll-margin-top: 84px; }
.privacy-main p, .privacy-main li { max-width: 68ch; color: #2c3a43; }
.privacy-main ul { padding-left: 22px; }
.privacy-main li + li { margin-top: 6px; }
.privacy-main li::marker { color: var(--brand); }
.summary { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 18px 22px; margin-top: 22px; box-shadow: var(--shadow); }
.summary ul { margin: 8px 0 0; }
.todo { background: #fff2c4; padding: 1px 5px; border-radius: 4px; font-weight: 600; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Printed handout ---------- */
@media print {
  @page { margin: 13mm; }
  @page saver { margin: 8mm; }
  body.paper-saver { page: saver; }
  body { background: #fff; font-size: 12pt; }
  .no-print, .site-header, .field-grid, .remember, .ex-tools, .params, .ex-notes textarea, #general-notes, #goal, #plan { display: none !important; }
  .print-only { display: block; }
  .wrap, .layout { display: block; padding: 0; max-width: none; }
  .panel { border: none; box-shadow: none; padding: 0; border-radius: 0; }
  /* ----- Printed handout: header ----- */
  .print-head { display: flex; justify-content: space-between; gap: 8mm; align-items: stretch; border-top: 2.2mm solid var(--brand); padding-top: 5mm; margin-bottom: 4mm; }
  .print-kicker { margin: 0 0 1mm; font-size: 8.5pt; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
  .print-head h1 { font-size: 24pt; line-height: 1.05; letter-spacing: -.02em; color: var(--brand-ink); margin: 0 0 4mm; }
  .print-head dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5mm 8mm; margin: 0; }
  .print-head dl div { display: flex; flex-direction: column; border-left: .6mm solid var(--line-strong); padding-left: 2.5mm; }
  .print-head dt { font-size: 7.5pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
  .print-head dd { margin: 0; font-weight: 600; }
  .print-qr { width: 32mm; flex: none; text-align: center; border: .35mm solid var(--line-strong); border-radius: 3mm; padding: 3mm 3mm 2mm; align-self: flex-start; margin-right: .6mm; box-sizing: border-box; }
  .print-qr svg { width: 100%; height: auto; display: block; }
  .print-qr p { font-size: 7.5pt; line-height: 1.25; margin: 1.5mm 0 0; color: var(--ink-soft); }
  .print-qr strong { color: var(--brand-ink); display: block; font-size: 8.5pt; }
  #print-general-notes:empty { display: none; }
  #print-general-notes { position: relative; background: var(--brand-tint-2); padding: 3mm 4mm 3mm 6mm; border-radius: 2.5mm; white-space: pre-wrap; margin: 0 0 2mm; }
  #print-general-notes::before { content: "Advice from your physio"; display: block; font-size: 7.5pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 1mm; }
  #print-general-notes::after { content: ""; position: absolute; left: 0; top: 2.5mm; bottom: 2.5mm; width: 1mm; border-radius: 1mm; background: var(--brand); }
  .general-notes-field { margin-top: 0; }

  /* ----- Printed handout: exercises ----- */
  .programme-list { display: block; margin-top: 3mm; }
  .ex-card { display: block; position: relative; padding: 4mm 40mm 4mm 0; margin: 0; border: none; border-top: .3mm solid var(--line-strong); border-radius: 0; animation: none; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .ex-card:first-child { border-top: none; padding-top: 2mm; }
  .ex-card:hover { box-shadow: none; }
  .ex-top { display: block; }
  .ex-title { font-size: 14pt; gap: 3mm; letter-spacing: -.01em; }
  .ex-title::before { width: 8mm; height: 8mm; font-size: 11pt; background: var(--brand); color: #fff; }
  .ex-steps-pics .pic { background: none; place-items: start; }
  .ex-steps-pics svg { width: auto; max-width: 100%; height: 28mm; margin: 2.5mm 0 .5mm; }
  .ex-steps { color: var(--ink); margin: 2mm 0 0; padding: 0; list-style: none; counter-reset: step; }
  .ex-steps li { counter-increment: step; position: relative; padding-left: 7mm; }
  .ex-steps li + li { margin-top: .6mm; }
  .ex-steps li::before { content: counter(step); position: absolute; left: 0; top: .4mm; width: 4.6mm; height: 4.6mm; border-radius: 50%; border: .3mm solid var(--brand); color: var(--brand); font-size: 7.5pt; font-weight: 700; display: grid; place-items: center; line-height: 1; }
  .param-summary { display: none !important; }
  .dose-panel { position: absolute; right: 0; top: 4mm; width: 35mm; background: var(--brand-tint); border-radius: 3mm; padding: 3mm; text-align: center; }
  .ex-card:first-child .dose-panel { top: 2mm; }
  .dose-nums { display: flex; flex-wrap: wrap; justify-content: center; gap: 2mm 0; }
  .dose-cell { flex: 1 0 50%; display: flex; flex-direction: column; align-items: center; }
  .dose-cell b { font-size: 20pt; line-height: 1; color: var(--brand-ink); letter-spacing: -.02em; }
  .dose-cell span { font-size: 7.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-top: .8mm; }
  .dose-freq { margin: 2.5mm 0 0; padding-top: 2mm; border-top: .3mm solid rgba(8, 59, 54, .18); font-weight: 700; font-size: 9.5pt; color: var(--brand-ink); }
  .ex-notes { margin-top: 0; }
  .ex-notes .print-only { margin: 3mm 0 0; white-space: pre-wrap; padding: 2mm 3mm; border-left: 1mm solid var(--accent); background: var(--accent-tint); border-radius: 0 2mm 2mm 0; font-weight: 500; }
  .ex-notes .print-only:empty { display: none; }
  .options-print { margin-top: 2.5mm; font-size: 9.5pt; }
  .options-print strong { font-size: 7.5pt; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
  .options-print ul { margin: .5mm 0 0; padding-left: 5mm; }

  /* ----- Printed handout: tick chart and footer ----- */
  .print-ticks { margin-top: 5mm; break-inside: avoid; }
  .print-ticks h2 { font-size: 11pt; margin-bottom: 2mm; color: var(--brand-ink); }
  .print-ticks table { width: 100%; border-collapse: separate; border-spacing: 1mm; table-layout: fixed; }
  .print-ticks th, .print-ticks td { height: 8mm; text-align: center; font-size: 9pt; }
  .print-ticks td { border: .3mm solid var(--line-strong); border-radius: 1.5mm; }
  .print-ticks thead th { height: 5mm; font-weight: 700; font-size: 8pt; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
  .print-ticks tbody th { width: 18mm; font-weight: 600; text-align: left; font-size: 9pt; }
  .print-foot { margin-top: 6mm; padding-top: 3mm; border-top: .3mm solid var(--line-strong); font-size: 9.5pt; color: var(--ink-soft); display: flex; flex-direction: column; gap: 1mm; break-inside: avoid; }
  .print-foot p { margin: 0; }
  .print-safety strong { color: var(--danger); }
  .print-foot-contact:empty { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Large print handout */
  body.large-print { font-size: 16pt; line-height: 1.45; }
  .large-print .print-head h1 { font-size: 30pt; }
  .large-print .print-head dt { font-size: 10pt; }
  .large-print .print-qr { width: 40mm; }
  .large-print .print-qr p { font-size: 10pt; }
  .large-print .ex-card { padding-right: 50mm; }
  .large-print .ex-title { font-size: 20pt; }
  .large-print .ex-title::before { width: 10mm; height: 10mm; font-size: 14pt; }
  .large-print .ex-steps-pics svg { height: 58mm; }
  .large-print .ex-steps { color: #000; }
  .large-print .ex-steps li { padding-left: 9mm; }
  .large-print .ex-steps li::before { width: 6.5mm; height: 6.5mm; font-size: 11pt; }
  .large-print .dose-panel { width: 45mm; }
  .large-print .dose-cell b { font-size: 28pt; }
  .large-print .dose-cell span, .large-print .options-print strong, .large-print #print-general-notes::before { font-size: 10pt; }
  .large-print .dose-freq { font-size: 13pt; }
  .large-print .options-print { font-size: 13pt; }
  .large-print .print-foot { font-size: 13pt; }
  .large-print #print-general-notes { font-size: 14pt; }
  .large-print .print-ticks h2 { font-size: 15pt; }
  .large-print .print-ticks th, .large-print .print-ticks td { height: 13mm; font-size: 14pt; }
  .large-print .print-ticks tbody th { width: 28mm; }

  /* Black and white printing: no colour fills, black lines, pictures redrawn in black and white */
  body.bw-print { --brand: #000; --brand-dark: #000; --brand-ink: #000; --brand-tint: #fff; --brand-tint-2: #fff; --accent: #000; --accent-tint: #fff; --line: #000; --line-strong: #000; --ink: #000; --ink-soft: #222; --ink-faint: #333; }
  .bw-print .dose-panel { border: .4mm solid #000; }
  .bw-print .ex-title::before { background: #000; color: #fff; }
  .bw-print .print-safety strong { color: #000; }
  .bw-print .ex-card { border-left: none; border-right: none; border-bottom: none; }
  .bw-print #print-general-notes { border: 1px solid #000; }
  .bw-print .pic { background: #fff; }
  .bw-print .pic [stroke="#173a3a"] { stroke: #000; }
  .bw-print .pic [fill="#173a3a"] { fill: #000; }
  .bw-print .pic [stroke="#d6ebe5"] { stroke: #fff; }
  .bw-print .pic [fill="#d6ebe5"] { fill: #fff; }
  .bw-print .pic [stroke="#a6cfc4"] { stroke: #c8c8c8; }
  .bw-print .pic [fill="#a6cfc4"] { fill: #c8c8c8; }
  .bw-print .pic [stroke="#c2410c"] { stroke: #000; }
  .bw-print .pic [fill="#c2410c"] { fill: #000; }
  .bw-print .pic [stroke="#7a4fa3"] { stroke: #555; }
  .bw-print .pic [fill="#f1f7f5"] { fill: #fff; }
  .bw-print .pic [stroke="#8b9792"] { stroke: #444; }
  .bw-print .pic [fill="#eef1ee"] { fill: #fff; }
  .bw-print .pic [stroke="#b9c4bf"] { stroke: #555; }
  /* the smooth figures (22 Nov 2026): flat colours become greys, darker for the far side */
  .bw-print .pic [fill="#f1c9a5"] { fill: #c4c4c4; }
  .bw-print .pic [fill="#d9ad88"] { fill: #9c9c9c; }
  .bw-print .pic [fill="#97dad2"] { fill: #dedede; }
  .bw-print .pic [fill="#6fbdb4"] { fill: #b0b0b0; }
  .bw-print .pic [fill="#22b0b5"] { fill: #7a7a7a; }
  .bw-print .pic [fill="#16858a"] { fill: #5c5c5c; }
  .bw-print .pic [fill="#3a5a6e"] { fill: #2a2a2a; }
  .bw-print .pic [fill="#25404f"] { fill: #1a1a1a; }
  .bw-print .pic [fill="#3b2a20"] { fill: #1a1a1a; }
  .bw-print .pic [stroke="#b07c58"] { stroke: #000; }
  .bw-print .pic img { filter: grayscale(1) contrast(1.1); }
  .bw-print .print-qr p { color: #000; }

  /* Paper saver: two columns, smaller pictures and text, narrower margins */
  body.paper-saver { font-size: 10pt; line-height: 1.35; }
  .paper-saver .print-head h1 { font-size: 15pt; margin-bottom: 2px; }
  .paper-saver .print-qr { width: 22mm; }
  .paper-saver .programme-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; align-items: start; margin-top: 8px; }
  .paper-saver .print-head { padding-top: 3mm; margin-bottom: 3mm; border-top-width: 1.5mm; }
  .paper-saver .print-head h1 { margin-bottom: 2mm; }
  .paper-saver .ex-card, .paper-saver .ex-card:first-child { display: block; break-inside: avoid; page-break-inside: avoid; margin: 0; padding: 3mm; border: .3mm solid var(--line-strong); border-radius: 2.5mm; }
  .paper-saver .dose-panel, .paper-saver .ex-card:first-child .dose-panel { position: static; width: auto; display: flex; align-items: center; gap: 3mm; padding: 1.5mm 3mm; margin-top: 2mm; text-align: left; border-radius: 2mm; }
  .paper-saver .dose-nums { flex-wrap: nowrap; gap: 3mm; }
  .paper-saver .dose-cell { flex: none; flex-direction: row; align-items: baseline; gap: 1mm; }
  .paper-saver .dose-cell b { font-size: 12pt; }
  .paper-saver .dose-cell span { font-size: 7pt; margin: 0; }
  .paper-saver .dose-freq { margin: 0 0 0 auto; padding: 0; border: none; font-size: 8.5pt; }
  .paper-saver .ex-steps li { padding-left: 5.5mm; }
  .paper-saver .ex-steps li::before { width: 3.8mm; height: 3.8mm; font-size: 6.5pt; }
  .paper-saver .ex-title::before { width: 6mm; height: 6mm; font-size: 9pt; }
  .paper-saver .ex-title { font-size: 11pt; }
  .paper-saver .ex-steps-pics svg { height: 22mm; margin: 3px 0 0; }
  .paper-saver .ex-steps { margin: 2mm 0 0; }
  .paper-saver .options-print { font-size: 8.5pt; }
  .paper-saver .print-ticks th, .paper-saver .print-ticks td { height: 7mm; }
  .paper-saver .print-foot { margin-top: 8px; font-size: 8.5pt; }
  /* Large print needs the full width, so keep one column but still use smaller gaps */
  .paper-saver.large-print .programme-list { grid-template-columns: 1fr; }
  .paper-saver.large-print .ex-steps-pics svg { height: 44mm; }

}

/* ---------- Research-based additions: goal and plan, pain guide, time estimate ---------- */
.goal-plan { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-top: 16px; }
.goal-plan .hint { grid-column: 1 / -1; margin: -4px 0 0; }
.goal-plan input { width: 100%; }
@media (max-width: 640px) { .goal-plan { grid-template-columns: 1fr; } }
.programme-summary { margin: 18px 0 0; font-weight: 600; color: var(--brand-ink); }
.tip { background: var(--warn-bg); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9rem; margin: 10px 0 0; }
.pain-guide h2 { font-size: 1.1rem; margin: 0 0 10px; }
.pain-guide ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pain-guide li { position: relative; padding: 10px 14px 10px 44px; border-radius: var(--radius-sm); line-height: 1.4; }
.pain-guide li::before { content: ""; position: absolute; left: 14px; top: 12px; width: 18px; height: 18px; border-radius: 50%; }
.pain-guide strong { display: block; }
.pg-green { background: #e8f5ec; } .pg-green::before { background: #2e7d32; }
.pg-amber { background: #fff4e0; } .pg-amber::before { background: #e08a00; }
.pg-red { background: #fdecea; } .pg-red::before { background: #c62828; }

@media print {
  .goal-plan { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 6mm; margin: 0 0 3mm; }
  .gp-print h2 { font-size: 7.5pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin: 0 0 1mm; }
  .gp-print p { margin: 0; font-weight: 600; min-height: 1.4em; }
  .gp-print p.write-in { min-height: 0; height: 9mm; border-bottom: .3mm solid var(--line-strong); background: repeating-linear-gradient(transparent 0 8.4mm, var(--line-strong) 8.4mm 8.7mm); }
  .pain-guide { margin-top: 5mm; break-inside: avoid; }
  .pain-guide h2 { font-size: 11pt; margin: 0 0 2mm; color: var(--brand-ink); }
  .pain-guide ul { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2mm; }
  .pain-guide li { padding: 2.5mm 3mm 2.5mm 9mm; border-radius: 2mm; font-size: 9.5pt; line-height: 1.3; }
  .pain-guide li::before { left: 3mm; top: 3mm; width: 4mm; height: 4mm; }
  .large-print .pain-guide ul { grid-template-columns: 1fr; }
  .large-print .pain-guide li { font-size: 15pt; padding-left: 12mm; }
  .large-print .pain-guide li::before { width: 6mm; height: 6mm; }
  .large-print .pain-guide h2, .large-print .gp-print h2 { font-size: 14pt; }
  .large-print .gp-print p.write-in { height: 12mm; background: none; }
  .paper-saver .pain-guide { margin-top: 2mm; }
  .paper-saver .pain-guide h2 { font-size: 9.5pt; margin-bottom: 1mm; }
  .paper-saver .pain-guide li { font-size: 8.5pt; padding: 1.5mm 2mm 1.5mm 7mm; }
  .paper-saver .pain-guide li::before { left: 2mm; top: 2mm; width: 3.5mm; height: 3.5mm; }
  .paper-saver .print-foot { margin-top: 2mm; padding-top: 1.5mm; }
  .paper-saver .goal-plan { margin-bottom: 2mm; }
  .paper-saver .gp-print p.write-in { height: 7mm; background: none; }
  /* Black and white: no fills, so the three levels are told apart by outline style */
  .bw-print .pain-guide li { background: #fff; border: .3mm solid #000; }
  .bw-print .pg-green::before { background: #fff; border: .4mm solid #000; }
  .bw-print .pg-amber::before { background: linear-gradient(90deg, #000 50%, #fff 50%); border: .4mm solid #000; }
  .bw-print .pg-red::before { background: #000; }
  .bw-print .pg-red { border-width: .7mm; }
}

/* Clinician additions: pain limit, duration, notes summary */
.pain-level-field { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .875rem; }
.pain-level-field select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); font: inherit; font-weight: 400; }
.pain-level-field select:disabled { opacity: .5; }
.duration-field { grid-column: 1 / -1; }
#notes-text { width: 100%; font: .875rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
@media print {
  .pain-level-field, .duration-field { display: none !important; }
  .dose-load { margin: 1mm 0 0; font-size: 9pt; font-weight: 700; color: var(--brand-ink); text-align: center; }
  .paper-saver .dose-load { margin: 0 0 0 auto; font-size: 8.5pt; }
}

/* My templates */
.mt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow: auto; }
.mt-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.mt-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mt-meta strong { overflow-wrap: anywhere; }
.mt-empty { color: var(--ink-soft); font-size: .9rem; }
.mt-file-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-file-row label.btn { cursor: pointer; }
.mt-file-row input:focus-visible + label, .mt-file-row label:focus-within { outline: 2px solid var(--focus); }
.empty-templates { margin-top: 22px; }
.empty-templates p { margin: 0 0 10px; font-weight: 600; color: var(--ink); }
.mt-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mt-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); font: inherit; font-weight: 600; color: var(--brand-ink); cursor: pointer; }
.mt-chip span { font-size: .75rem; font-weight: 400; color: var(--ink-soft); }
.mt-chip:hover { border-color: var(--brand); }
#mt-name { font: inherit; }
@media print { .print-made { font-size: 7.5pt; color: var(--ink-faint); } }

/* Ready-made templates */
.starter-pick label { display: block; margin: 0 0 10px; font-weight: 600; color: var(--ink); }
.starter-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.starter-row select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); font: inherit; max-width: 100%; }
.starter-pick .hint { margin: 8px 0 0; }
.mt-starters summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.mt-starters[open] summary { margin-bottom: 8px; }
.mt-starters .hint { margin: 0 0 8px; }

/* Gentle page border on printed handouts (repeats on every page).
   The page margin is a little smaller, and the content is padded in from the border on every page. */
@media print {
  @page { margin: 8mm; }
  @page saver { margin: 5mm; }
  html, body { background: transparent !important; }
  .page-frame { display: block !important; position: fixed; inset: 0; border: .4mm solid #c9d6d1; border-radius: 4mm; pointer-events: none; z-index: 0; }
  .bw-print .page-frame { border-color: #999; }
  body > .wrap, body > main, body > footer { position: relative; z-index: 1; }
  body { padding: 5mm 6mm; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
  body.paper-saver { padding: 3.5mm 4.5mm; }
}
.page-frame { display: none; }

/* ---------- Three columns: library | handout | details (16 Nov 2026) ----------
   On wide screens the details panel sits on the right, so the chosen exercises show straight away.
   On smaller screens it sits above the handout, with the form folded away under "Patient, physio and print options". */
@media (min-width: 961px) { .layout { grid-template-columns: 340px minmax(0, 1fr); } }
.settings { display: flex; flex-direction: column; gap: 14px; }
.settings h2 { font-size: 1.25rem; }
.settings-actions { gap: 8px; }
.settings-actions #btn-print { order: -1; flex-basis: 100%; }
.settings-details summary { cursor: pointer; font-weight: 600; font-size: .9375rem; padding: 10px 0; border-top: 1px solid var(--line); list-style: none; display: flex; align-items: center; gap: 8px; }
.settings-details summary::-webkit-details-marker { display: none; }
.settings-details summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(-45deg); transition: transform .2s var(--ease); margin: 0 4px 0 2px; }
.settings-details[open] summary::before { transform: rotate(45deg); }
.settings-body { padding-top: 4px; }
.settings .tick-row { flex-direction: column; gap: 10px; }
.settings .goal-plan { grid-template-columns: 1fr; }
.programme-toolbar { padding-bottom: 14px; margin-bottom: 0; }
@media (min-width: 961px) and (max-width: 1239px) {
  .settings { grid-column: 2; grid-row: 1; }
  .programme { grid-column: 2; grid-row: 2; }
  .library { grid-row: 1 / span 2; }
  .settings .field-grid { grid-template-columns: 1fr 1fr; }
  .settings .tick-row { flex-direction: row; gap: 10px 28px; }
  .settings .goal-plan { grid-template-columns: 1fr 1fr; }
  .settings-actions #btn-print { order: 0; flex-basis: auto; }
}
@media (min-width: 1240px) {
  .wrap.layout, .site-header .wrap { max-width: 1680px; }
  .layout { grid-template-columns: 320px minmax(0, 1fr) 340px; gap: 24px; }
  /* Handout details follows the page (17 Nov 2026). No inner scrollbar: if the panel is taller than the
     window, app.js moves its sticky top so it scrolls with the page and stops once its end is in view;
     scrolling back up brings the top (Print and the buttons) straight back. */
  .settings { position: sticky; top: var(--settings-top, 92px); padding: 20px; }
  .settings .field-grid { grid-template-columns: 1fr; gap: 12px; }
  .settings-details > summary { display: none; }
  .settings-details { border-top: 1px solid var(--line); padding-top: 12px; }
}
@media (max-width: 960px) {
  .settings { order: 1; }
  .programme { order: 2; }
  .settings-actions #btn-print { order: 0; flex-basis: auto; }
}
@media print {
  .programme-toolbar { display: none !important; }
  .gp-print-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 6mm; margin: 0 0 3mm; }
  .paper-saver .gp-print-row { margin-bottom: 2mm; }
}
/* When the handout column is narrow (three columns on a laptop), keep cards compact */
.programme-list { container-type: inline-size; }
@media (min-width: 1240px) {
  @container (max-width: 620px) {
    .ex-card { grid-template-columns: 100px minmax(0, 1fr); gap: 14px; padding: 14px; }
    .ex-media .pic { width: 100px; max-width: none; margin: 0; }
    .ex-media .mt-pic { display: none; }
    .params { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .params .freq, .params .load { grid-column: 1 / -1; }
    .options-grid { grid-template-columns: 1fr; }
  }
}

/* Move up / move down buttons on each chosen exercise (17 Nov 2026: replaces dragging) */
.move-btn { border-color: var(--line-strong); background: #fff; color: var(--ink); width: 40px; height: 40px; }
.move-btn:hover { background: var(--brand-tint); color: var(--brand-ink); border-color: var(--brand); }
.move-btn:disabled { border-color: var(--line); }
.move-btn[hidden] { display: none; }
.ex-tools { gap: 6px; align-items: center; }
.ex-card.just-moved { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 107, 98, .18); transition: box-shadow .3s var(--ease), border-color .3s var(--ease); }

/* Shorter exercise cards (17 Nov 2026): fields on fewer rows, note folded away */
.ex-steps { margin: 8px 0 10px; font-size: .9375rem; line-height: 1.45; }
.ex-steps li + li { margin-top: 1px; }
.params { grid-template-columns: repeat(3, 84px) minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; }
.params .freq, .params .load { grid-column: auto; }
.params .field { gap: 4px; }
.params .field label { white-space: nowrap; letter-spacing: .04em; }
.params input { min-height: 38px; padding: 6px 10px; }
.param-summary { margin-top: 10px; padding: 4px 12px; font-size: .875rem; }
.ex-notes { margin-top: 8px; }
.note-toggle summary, .progressions summary { padding: 7px 12px; font-size: .875rem; font-weight: 600; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.note-toggle { border: 1px solid var(--line); border-radius: 12px; background: #fcfcfb; }
.note-toggle summary::-webkit-details-marker { display: none; }
.note-toggle summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(-45deg); transition: transform .2s var(--ease); margin-right: 2px; }
.note-toggle[open] summary::before { transform: rotate(45deg); }
.note-toggle:hover { background: var(--brand-tint-2); }
.note-toggle textarea { display: block; width: calc(100% - 24px); margin: 0 12px 12px; min-height: 42px; }
.progressions { margin-top: 8px; }
@container (max-width: 780px) {
  .params { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .params > .field { grid-column: span 2; }
  .params .freq, .params .load { grid-column: span 3; }
}
@media print { .note-toggle { display: none !important; } }

/* =========================================================
   Feel and finish (17 Nov 2026), following Alex's "apple-design" skill:
   instant press feedback, calm motion that can be interrupted,
   a see-through header that fades into the page, and support for
   reduce motion, reduce transparency and more contrast settings.
   ========================================================= */

/* 1. Instant feedback the moment something is pressed */
.btn, .btn-ghost, .chip, .icon-btn, .lib-item .add { transition: transform .1s ease-out, background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), color .15s var(--ease); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn:active:not(:disabled), .btn-ghost:active, .chip:active, .icon-btn:active:not(:disabled), .lib-item .add:active { transform: scale(.96); transition-duration: 0s; }

/* 2. Header: see-through layer the page scrolls under, with a soft fade instead of a hard line */
.site-header { border-bottom-color: transparent; transition: border-color .2s var(--ease); }
.site-header::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 14px; pointer-events: none; background: linear-gradient(rgba(23, 35, 43, .07), rgba(23, 35, 43, 0)); opacity: 0; transition: opacity .2s var(--ease); }
.is-scrolled .site-header::after { opacity: 1; }

/* 3. Panels that fold open and closed glide instead of jumping (browsers that support it) */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  details::details-content { height: 0; overflow: clip; transition: height .3s cubic-bezier(.25, .9, .3, 1), content-visibility .3s allow-discrete; }
  details[open]::details-content { height: auto; }
}

/* 4. Dialogs grow from where they sit and leave the same way */
dialog { transform-origin: 50% 40%; }

/* 5. Type: tighter tracking and leading as text gets bigger, slightly open for tiny labels */
h1 { letter-spacing: -0.025em; line-height: 1.1; }
h2 { letter-spacing: -0.015em; line-height: 1.2; }
h3, .ex-title { letter-spacing: -0.01em; line-height: 1.25; }
.hint { letter-spacing: .005em; }
body { font-optical-sizing: auto; }

/* 6. Clearer grouping in the details panel */
.settings-group { margin: 18px 0 8px; font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-soft); }
.settings-body > .settings-group:first-child { margin-top: 4px; }

/* 7. People who prefer less motion: gentle fades only, no sliding */
@media (prefers-reduced-motion: reduce) {
  .ex-card.entering { animation: fade-in .2s ease both !important; animation-duration: .2s !important; }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  .btn:active:not(:disabled), .btn-ghost:active, .chip:active, .icon-btn:active:not(:disabled), .lib-item .add:active { transform: none; }
  details::details-content { transition: none; }
}

/* 8. People who prefer less transparency: solid header and backdrops */
@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  dialog::backdrop { background: rgba(23, 35, 43, .6); backdrop-filter: none; }
}

/* 9. People who prefer more contrast: solid surfaces and clear edges */
@media (prefers-contrast: more) {
  :root { --line: #8a948f; --line-strong: #4f5a55; --ink-soft: #2f3a42; --ink-faint: #3a454d; }
  .site-header { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 1px solid var(--ink); }
  .site-header::after { display: none; }
  .panel, .ex-card, .lib-item .add, .chip, .btn-secondary, .move-btn { border: 1px solid var(--ink); }
  .hint { color: var(--ink-soft); }
}

@media print { .site-header::after { display: none; } }

/* ---------- A physio's own exercises (17 Nov 2026) ---------- */
.library-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.btn-own { width: 100%; }
.lib-item .own-edit { flex: none; width: 34px; height: 34px; }
.own-label { margin: 6px 0 0; }
.own-label .no-print { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--accent-tint); color: #9a3412; font-size: .75rem; font-weight: 700; }
.own-dialog { max-width: 560px; }
.own-dialog .dialog-body { max-height: calc(100vh - 48px); overflow-y: auto; }
.own-dialog select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fcfcfb; width: 100%; }
.own-dose { border: none; margin: 0; padding: 0; min-width: 0; }
.own-dose legend { font-weight: 600; font-size: .875rem; padding: 0; margin-bottom: 6px; }
.own-dose-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr); gap: 10px; }
.own-dose-grid label { font-size: .75rem; }
@media (max-width: 520px) { .own-dose-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .own-freq { grid-column: 1 / -1; } }
.own-photo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.own-photo-preview img { width: 88px; height: 66px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.own-photo-hint { margin: 2px 0 0 !important; font-size: .8125rem; }
.own-actions { align-items: center; flex-wrap: wrap; }
.own-spacer { flex: 1; }
.own-delete { color: var(--danger); }
@media print {
  .own-label { margin: 1mm 0 0; }
  .own-label .print-only { display: inline; font-size: 8pt; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
  .ex-steps-pics img { height: 28mm; width: auto; max-width: 100%; margin: 2.5mm 0 .5mm; border-radius: 2mm; }
  .large-print .ex-steps-pics img { height: 58mm; }
  .paper-saver .ex-steps-pics img { height: 22mm; }
}

/* ----- Contact page ----- */
.contact-main .lead { font-size: 1.0625rem; margin-top: 8px; }
.no-patient { display: flex; gap: 14px; align-items: flex-start; background: #fff7ed; border: 1px solid #f5d0b0; border-left: 4px solid var(--accent, #c2410c); border-radius: var(--radius); padding: 16px 20px; margin: 22px 0 26px; }
.no-patient svg { flex: none; width: 26px; height: 26px; fill: none; stroke: #c2410c; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 2px; }
.no-patient p { margin: 0; color: #4a2a12 !important; }
.contact-form { display: flex; flex-direction: column; gap: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.contact-form .field .hint { margin: 0; }
.contact-form .field label .hint { font-weight: 400; }
.contact-form select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; font-weight: 400; }
.contact-form select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(14, 107, 98, .16); }
.contact-form .confirm { color: var(--ink); font-weight: 600; }
.field-error { margin: 0; color: #b42318 !important; font-size: .875rem; font-weight: 600; }
.contact-warning { margin: 0; background: #fff2c4; border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9375rem; color: #5a4300 !important; }
.contact-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.contact-off { background: #fff2c4; border-radius: var(--radius-sm); padding: 10px 14px; font-weight: 600; }
.contact-done p { margin: 8px 0 0; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 560px) { .contact-form { padding: 18px; } }

/* Card tidy-up (17 Nov 2026, from Alex's screenshot):
   picture beside the title and steps, everything else full width underneath;
   dose boxes in two even rows whose labels can never run into each other;
   a clearer "can't move further" arrow. */
@media screen {
  .ex-more { grid-column: 1 / -1; min-width: 0; }
  .ex-media { align-self: start; }
  .ex-steps { margin-bottom: 0; }
  .ex-more .params { margin-top: 2px; }
  /* Sets, reps, hold on one row; how often and weight on the next. Every box lines up. */
  .params { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .params > .field { grid-column: span 2; min-width: 0; }
  .params > .freq, .params > .load { grid-column: span 3; }
  .params .field label { overflow: hidden; text-overflow: ellipsis; }
  .move-btn:disabled { opacity: 1; color: var(--line-strong); border-color: var(--line); background: var(--bg); }
}

/* Long exercise names in the library (17 Nov 2026): wrap or hyphenate inside their own space,
   never under the Add button */
.lib-item .meta { overflow: hidden; }
.lib-item .name { overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
/* When the library column is narrow, give the name more room: smaller picture and button */
.library-list { container-type: inline-size; }
@container (max-width: 290px) {
  .lib-item { gap: 8px; }
  .lib-item .pic { width: 50px; height: 42px; }
  .lib-item .add { padding: 5px 10px; }
}

/* =========================================================
   Builder additions (17 Nov 2026): side, duplicate, undo, favourites,
   type filter, body map, preview, bulk change, what's new, privacy check
   ========================================================= */
@media screen {
  .params > .freq, .params > .load, .params > .side { grid-column: span 2; }
}
.params select { min-height: 38px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; width: 100%; }
.dose-side { margin: 0 0 4px; font-weight: 700; color: var(--brand-ink); }
.icon-btn.duplicate:hover { color: var(--brand); background: var(--brand-tint); }

/* Undo bar */
.undo-bar { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); background: var(--ink); color: #fff; border-radius: 999px; padding: 6px 6px 6px 18px; display: flex; align-items: center; gap: 14px; font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .2s var(--ease), transform .2s var(--ease); z-index: 45; }
.undo-bar.show { opacity: 1; transform: translate(-50%, 0); }
.undo-bar button { background: #fff; color: var(--ink); border: 0; border-radius: 999px; padding: 7px 16px; font-weight: 700; cursor: pointer; min-height: 36px; }

/* Library: favourites, type chips, preview buttons */
.chips-type { margin-top: -4px; }
.chip-small { padding: 3px 10px; font-size: .75rem; }
.chips-level { margin-top: -2px; }
.chip-level::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: currentColor; opacity: .55; }
.chip-level-easy::before { background: #2e7d32; opacity: 1; }
.chip-level-medium::before { background: #d97706; opacity: 1; }
.chip-level-harder::before { background: #b42318; opacity: 1; }
.lvl-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lvl-easy { background: #2e7d32; } .lvl-medium { background: #d97706; } .lvl-harder { background: #b42318; }
.chip-special[aria-pressed="false"] { border-color: #f1c9a8; color: #9a3412; }
.lib-item .lib-preview { border: 0; padding: 0; background: none; cursor: zoom-in; flex: none; border-radius: 10px; }
.lib-item .name-btn { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: inherit; display: block; width: 100%; }
.lib-item .name-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.lib-item .fav { flex: none; width: 32px; height: 32px; }
.lib-item .fav svg { width: 17px; height: 17px; }
.lib-item .fav.on { color: #b45309; }
.lib-item .fav.on svg { fill: #f59e0b; stroke: #b45309; }
.lib-note { font-size: .8125rem; color: var(--ink-soft); padding: 2px 8px 6px; }

/* Body map */
.bm-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0; padding: 5px 14px; font-size: .8125rem; min-height: 32px; }
.bm-toggle svg { width: 15px; height: 15px; fill: currentColor; }
.bodymap { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-top: 8px; background: var(--brand-tint-2); text-align: center; }
.bm-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .875rem; }
.bm-side { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px; background: #fff; }
.bm-side button { border: 0; background: none; border-radius: 999px; padding: 3px 12px; font-weight: 600; font-size: .78rem; cursor: pointer; color: var(--ink-soft); }
.bm-side button[aria-pressed=true] { background: var(--ink); color: #fff; }
.bm-body { width: 100%; max-width: 150px; height: auto; margin: 6px auto 0; display: block; }
.bm-body .bm-sk { fill: #e1e8e4; stroke: #b9c3be; stroke-width: 1.5; }
.bm-zone { fill: var(--brand); fill-opacity: .14; cursor: pointer; transition: fill-opacity .15s; }
.bm-zone:hover, .bm-zone:focus-visible { fill-opacity: .4; outline: none; }
.bm-zone.on { fill: var(--accent); fill-opacity: .65; }
.bm-hint { margin: 4px 0 0; font-size: .75rem; }

/* Preview dialog */
.preview-dialog { border: 0; border-radius: var(--radius-lg); padding: 22px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); color: var(--ink); }
.preview-dialog::backdrop { background: rgba(23, 35, 43, .45); }
.preview-pic .pic { background: var(--brand-tint-2); border-radius: var(--radius); height: 240px; }
.preview-pic .pic svg, .preview-pic .pic img { width: 100%; height: 100%; }
.preview-dialog h2 { font-size: 1.3rem; margin-top: 14px; }
.preview-dialog .hint { margin: 2px 0 0; }
.preview-opts { font-size: .9rem; margin-top: 8px; }
.preview-opts b { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.preview-opts ul { margin: 2px 0 0; padding-left: 20px; }
.preview-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; position: sticky; bottom: 0; }

/* Change all exercises */
.bulk-tools { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 12px; background: #fcfcfb; }
.bulk-tools summary { padding: 7px 12px; font-size: .875rem; font-weight: 600; cursor: pointer; }
.bulk-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding: 0 12px 12px; }
.bulk-row label { width: 100%; font-size: .8125rem; color: var(--ink-soft); }
.bulk-row input { flex: 1; min-width: 160px; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }

/* What's new */
.whats-new { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-tint); border: 1px solid #f5d0b5; border-radius: 12px; padding: 10px 8px 10px 14px; margin: 0 0 12px; font-size: .875rem; }
.whats-new p { margin: 0; flex: 1; }

/* Privacy check */
.pc-flag { border-color: var(--accent) !important; box-shadow: 0 0 0 3px #fde0cc !important; }
.pc-warn { background: var(--warn-bg); border: 1px solid #f5c79e; border-radius: var(--radius-sm); padding: 8px 12px; font-size: .84rem; margin: 6px 0 4px; line-height: 1.45; }
.note-toggle .pc-warn { margin: -4px 12px 12px; }
.pc-warn b { color: #9a3412; }
.pc-warn mark { background: #ffd8bf; border-radius: 4px; padding: 0 3px; color: inherit; }
.pc-fix { margin-left: 4px; border: 1px solid var(--accent); background: #fff; color: #9a3412; border-radius: 999px; padding: 1px 10px; font-weight: 600; font-size: .8rem; cursor: pointer; }
@media print { .pc-warn, .undo-bar, .whats-new, .bulk-tools, .bodymap, .bm-toggle { display: none !important; } }
.print-kit { font-size: .85em; margin: 4px 0 0; color: #333; }

/* Easy read handout (17 Nov 2026): one exercise per page, very large text, big step pictures,
   no harder/easier lists. For people with learning disabilities, dementia or low literacy. */
@media print {
  body.easy-read { font-size: 18pt; line-height: 1.5; }
  .easy-read .ex-card { break-before: page; page-break-before: always; padding-right: 0 !important; }
  .easy-read .ex-card:first-child { break-before: auto; page-break-before: auto; }
  .easy-read .ex-title { font-size: 26pt; }
  .easy-read .ex-steps-pics svg { height: 58mm !important; width: 100%; }
  .easy-read .ex-steps { font-size: 18pt; color: #000; }
  .easy-read .ex-steps li { padding: 3mm 0 3mm 11mm; border-bottom: 1px dashed #bbb; }
  .easy-read .ex-steps li::before { width: 8mm; height: 8mm; font-size: 13pt; }
  .easy-read .dose-panel { position: static !important; width: auto !important; margin-top: 4mm; }
  .easy-read .dose-cell b { font-size: 34pt; }
  .easy-read .dose-cell span, .easy-read .dose-freq, .easy-read .dose-side { font-size: 15pt; }
  .easy-read .options-print { display: none !important; }
  .easy-read .print-kit { font-size: 15pt; }
}

/* Stages (17 Nov 2026) */
@media screen { .params > .stage { grid-column: span 2; } }
.stage-head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; background: var(--brand); color: #fff; border-radius: 12px; padding: 8px 14px; margin-bottom: 4px; }
.stage-head .stage-name { font-weight: 800; font-size: 1.05rem; }
.stage-head .stage-when { opacity: .9; font-weight: 600; }
.stage-head .stage-move { width: 100%; margin: 2px 0 0; font-size: .875rem; opacity: .95; }
.stage-editor { display: grid; gap: 10px; margin-top: 8px; }
.stage-row { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 12px; margin: 0; }
.stage-row legend { font-weight: 700; font-size: .8125rem; padding: 0 4px; color: var(--ink-soft); }
.stage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stage-row label { display: grid; gap: 4px; font-size: .8125rem; font-weight: 600; color: var(--ink-soft); }
.stage-row input, .stage-row textarea { font-weight: 400; color: var(--ink); min-height: 38px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); width: 100%; }
.stage-move-field { margin-top: 8px; }
.stage-remove { margin-top: 6px; font-size: .8125rem; color: var(--danger); }
@media print {
  .stage-head { background: none !important; color: #000; border: 2px solid #000; border-radius: 3mm; padding: 2mm 4mm; margin: 0 0 3mm; break-after: avoid; }
  .ex-card.stage-first { break-before: auto; }
  .stage-head .stage-name { font-size: 15pt; }
}

/* ---------- Info pages: tables (For NHS teams) ---------- */
.info-table { width: 100%; border-collapse: collapse; margin: 12px 0 8px; font-size: .95rem; }
.info-table th, .info-table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.info-table th { background: var(--card); font-weight: 650; }
@media (max-width: 600px) {
  .info-table, .info-table tbody, .info-table tr, .info-table td { display: block; width: 100%; }
  .info-table thead { display: none; }
  .info-table tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 4px 0; }
  .info-table td { border: 0; padding: 4px 12px; }
  .info-table td:first-child { font-weight: 650; }
}
.privacy-main kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font: inherit; font-size: .9em; background: var(--card); }

/* ---------- Phones and tablets: "Your handout is ready" (pdf-maker.js) ---------- */
.pdf-dialog { max-width: 440px; }
.pdf-bar { height: 8px; border-radius: 99px; background: var(--brand-tint-2, #e6f2ef); overflow: hidden; }
.pdf-bar span { display: block; height: 100%; width: 4%; background: var(--brand); border-radius: inherit; transition: width .3s ease; }
.pdf-ready, .pdf-making, .pdf-error { display: flex; flex-direction: column; gap: 14px; }
.pdf-ready[hidden], .pdf-making[hidden], .pdf-error[hidden] { display: none; }
.pdf-ready-head { display: flex; gap: 14px; align-items: center; }
.pdf-file-icon { width: 40px; height: 48px; flex: none; color: var(--ink-soft); }
.pdf-ready-title { outline: none; }
.pdf-file-name { font-size: .9rem; overflow-wrap: anywhere; }
.pdf-buttons { display: flex; flex-direction: column; gap: 10px; }
.pdf-buttons .btn { min-height: 52px; justify-content: center; font-size: 1.05rem; text-align: center; }
.pdf-buttons [hidden] { display: none; }
.pdf-foot { justify-content: space-between; }
@media print { .pdf-dialog { display: none !important; } }

/* ---------- Change several exercises at once ---------- */
.bulk-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 12px; }
.bulk-hint { margin: 0; }
.bulk-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.bulk-fields .bulk-wide { grid-column: span 3; }
@media (min-width: 640px) { .bulk-fields { grid-template-columns: repeat(6, minmax(0, 1fr)); } .bulk-fields .field { grid-column: span 2; } .bulk-fields .bulk-wide { grid-column: span 3; } }
.bulk-fields label { font-size: .8125rem; color: var(--ink-soft); }
.bulk-fields input { width: 100%; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.bulk-pick { border: 0; margin: 0; padding: 0; min-width: 0; }
.bulk-pick legend { font-size: .8125rem; font-weight: 650; padding: 0; margin-bottom: 4px; }
.bulk-pick-tools { display: flex; gap: 14px; margin-bottom: 6px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-size: .8125rem; text-decoration: underline; cursor: pointer; }
.bulk-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; background: #fff; max-height: 260px; overflow-y: auto; }
.bulk-item { display: grid; grid-template-columns: auto auto 1fr; grid-template-areas: "cb num name" "cb num dose"; align-items: center; gap: 0 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; min-height: 44px; }
.bulk-item:last-child { border-bottom: 0; }
.bulk-item input { grid-area: cb; width: 20px; height: 20px; accent-color: var(--brand); }
.bulk-num { grid-area: num; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 99px; background: var(--brand-tint-2); color: var(--brand-ink, var(--brand)); font-size: .75rem; font-weight: 700; }
.bulk-name { grid-area: name; font-weight: 600; font-size: .9rem; }
.bulk-dose { grid-area: dose; font-size: .8rem; color: var(--ink-soft); }
.bulk-item:has(input:not(:checked)) .bulk-name, .bulk-item:has(input:not(:checked)) .bulk-dose { opacity: .5; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- "In this handout" summary (stays in view on tablets and computers) ---------- */
.ex-summary { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 8px 12px 10px; }
.exs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.exs-head h3 { font-size: .8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin: 0; }
.ex-summary.is-collapsed { padding-bottom: 8px; }
.exs-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 10px; max-height: 40vh; overflow-y: auto; }
.exs-list[hidden] { display: none; }
.exs-stage { grid-column: 1 / -1; font-size: .75rem; font-weight: 700; color: var(--accent); margin-top: 4px; }
.exs-item { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "num name" "num dose"; gap: 0 8px; align-items: center; text-align: left; background: none; border: 0; border-radius: 8px; padding: 5px 6px; font: inherit; color: inherit; cursor: pointer; }
.exs-item:hover { background: var(--brand-tint-2); }
.exs-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.exs-num { grid-area: num; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 99px; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 700; }
.exs-name { grid-area: name; font-weight: 600; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exs-dose { grid-area: dose; font-size: .78rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Stays at the top of the handout while you scroll the cards, on tablets and computers only */
@media (min-width: 700px) {
  .ex-summary { position: sticky; top: calc(var(--header-h, 64px) + 2px); z-index: 5; box-shadow: 0 6px 16px -10px rgba(23, 35, 43, .25); }
}
@media (max-width: 699px) { .ex-summary { display: none; } }
@media print { .ex-summary { display: none !important; } }

/* ---------- Simple / Advanced view switch ---------- */
.view-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--brand-tint-2); border: 1px solid var(--line); }
.view-btn { border: 0; background: none; font: inherit; font-size: .875rem; font-weight: 600; color: var(--ink-soft); padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 34px; }
.view-btn[aria-pressed="true"] { background: #fff; color: var(--brand-ink, var(--brand)); box-shadow: 0 1px 3px rgba(23, 35, 43, .15); }
.view-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ex-extras { display: none; }
@media screen {
  .view-simple .ex-steps, .view-simple .field.load, .view-simple .field.side, .view-simple .field.stage,
  .view-simple .ex-notes, .view-simple .progressions,
  .view-simple .media-toggle, .view-simple .speed-ctl { display: none !important; }
  .view-simple .ex-card { grid-template-columns: 88px minmax(0, 1fr); gap: 10px 14px; padding: 12px 14px; }
  .view-simple .ex-media .pic { width: 88px; max-width: 88px; }
  .view-simple .ex-more .params { grid-template-columns: repeat(3, minmax(0, 84px)) minmax(0, 1fr); }
  .view-simple .ex-more .params > .field { grid-column: auto; }
  .view-simple .ex-extras { display: block; margin: 6px 0 0; font-size: .8125rem; color: var(--ink-soft); }
  .view-simple .param-summary { margin-bottom: 0; }
}
@media screen and (max-width: 560px) {
  .view-simple .ex-card { grid-template-columns: 64px minmax(0, 1fr); }
  .view-simple .ex-media .pic { width: 64px; max-width: 64px; }
  .view-simple .ex-more .params { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .view-simple .ex-more .params > .freq { grid-column: 1 / -1; }
  .view-simple .ex-top { flex-wrap: wrap; row-gap: 6px; }
}

/* ---------- Physio's message to the patient (17 Nov 2026) ---------- */
.message-field textarea { min-height: 4.2em; }
#btn-copy-patient.copied, #btn-copy.copied { background: var(--brand); border-color: var(--brand); color: #fff; }
@media print {
  .print-message[hidden] { display: none !important; }
  .print-message { border: .5mm solid var(--brand); border-left-width: 2mm; border-radius: 2.5mm; padding: 3mm 4mm; margin: 0 0 3mm; break-inside: avoid; }
  .print-message h2 { font-size: 7.5pt; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin: 0 0 1mm; }
  .print-message p { margin: 0; font-size: 1.08em; font-weight: 600; white-space: pre-wrap; }
  body.bw-print .print-message { border-color: #000; }
  body.bw-print .print-message h2 { color: #000; }
}
.lib-item .also-called { font-size: .78rem; color: var(--brand-ink); font-style: italic; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Accessibility menu (a11y-menu.js): a small dropdown under the button ---------- */
.a11y-menu { position: relative; }
.a11y-toggle { display: inline-flex; align-items: center; gap: 6px; }
.a11y-toggle svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.a11y-toggle .a11y-ico circle { fill: currentColor; stroke: none; }
.a11y-toggle .a11y-chev { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.a11y-toggle[aria-expanded="true"] { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-ink); }
.a11y-toggle[aria-expanded="true"] .a11y-chev { transform: rotate(180deg); }
.a11y-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: max-content; min-width: 200px; max-width: min(300px, calc(100vw - 32px)); background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 12px 32px -8px rgba(23, 35, 43, .28), 0 2px 6px rgba(23, 35, 43, .08); padding: 8px; }
.a11y-panel[hidden] { display: none; }
.a11y-row { display: flex; flex-direction: column; gap: 4px; }
.a11y-row .btn-ghost { display: flex; align-items: center; width: 100%; text-align: left; justify-content: flex-start; border-color: transparent; border-radius: 10px; padding: 9px 12px; font-size: .875rem; min-height: 40px; }
.a11y-row .btn-ghost:hover { background: var(--brand-tint-2); border-color: transparent; }
.a11y-row .btn-ghost[aria-pressed="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.a11y-row .btn-ghost svg { width: 16px; height: 16px; flex: none; }
.a11y-hint { margin: 6px 4px 2px; font-size: .75rem; line-height: 1.35; }
@media (max-width: 600px) { .a11y-panel { right: auto; left: 0; } }
@media (prefers-reduced-motion: reduce) { .a11y-toggle .a11y-chev { transition: none; } }
@media print { .a11y-panel { display: none !important; } }

/* ---------- Handout options: fold away (options-fold.js) ---------- */
.options-fold { margin: 14px 0 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.settings-details .options-fold > summary, .options-fold > summary { list-style: none; display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; padding: 10px 12px; margin: 0; border: 0; cursor: pointer; border-radius: var(--radius-sm); font-size: inherit; font-weight: inherit; }
.settings-details .options-fold > summary::before, .options-fold > summary::before { content: none; display: none; }
.options-fold > summary::-webkit-details-marker { display: none; }
.options-fold > summary:hover { background: var(--brand-tint-2); }
.options-fold > summary:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.options-fold > summary .settings-group { margin: 0; flex: none; white-space: nowrap; }
.options-fold-sum { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8125rem; color: var(--ink-soft); text-align: right; }
.options-fold-chev { flex: none; width: 16px; height: 16px; color: var(--ink-soft); transition: transform .25s var(--ease); }
.options-fold[open] .options-fold-chev { transform: rotate(180deg); }
.options-fold[open] .options-fold-sum { visibility: hidden; }
.options-fold-body { padding: 0 12px 12px; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .options-fold-chev { transition: none; } }

/* ---------- Handout details buttons: compact grid (17 Nov 2026) ---------- */
.settings .settings-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.settings .settings-actions #btn-print, .settings .settings-actions #btn-pdf { grid-column: span 3; order: 0; flex-basis: auto; min-width: 0; padding-left: 8px; padding-right: 8px; }
.settings .settings-actions .btn-secondary { grid-column: span 2; }
.settings .settings-actions .btn-secondary { padding: 6px 4px; font-size: .8125rem; min-height: 34px; min-width: 0; width: 100%; line-height: 1.15; white-space: normal; text-wrap: balance; justify-content: center; text-align: center; }
@media (max-width: 330px) { .settings .settings-actions .btn-secondary { grid-column: span 3; } }

/* ---------- Change the steps (Advanced view) ---------- */
.steps-edited-mark { display: inline-flex; align-items: center; flex: none; font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent, #c2410c); background: var(--accent-tint, #fff1e8); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; line-height: 1.5; }
.steps-edited-mark[hidden] { display: none; }
.steps-edit { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fcfcfb; overflow: hidden; }
.steps-edit summary { cursor: pointer; font-weight: 600; font-size: .875rem; padding: 10px 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
.steps-edit summary::-webkit-details-marker { display: none; }
.steps-edit summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(-45deg); transition: transform .2s var(--ease); margin-right: 2px; }
.steps-edit[open] summary::before { transform: rotate(45deg); }
.steps-edit summary:hover { background: var(--brand-tint-2); }
.steps-edit-body { padding: 4px 14px 14px; }
.steps-edit-body label { display: block; font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 6px; }
.steps-edit-body textarea { width: 100%; min-height: 72px; }
.steps-edit-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 6px; }
.steps-edit-foot .hint { margin: 0; font-size: .8125rem; }
.steps-reset { flex: none; font-size: .8125rem; padding: 6px 12px; min-height: 34px; }
.steps-reset:disabled { opacity: .5; cursor: default; }
@media (max-width: 520px) { .steps-edit-foot { flex-direction: column; } }
@media screen { .view-simple .steps-edit { display: none !important; } }
@media print { .steps-edit, .steps-edited-mark { display: none !important; } }

/* ---------- Dark mode on/off switch in the header (theme.js), always on show (17 Nov 2026) ---------- */
.theme-switch { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 1px solid var(--line-strong); color: var(--ink); border-radius: 999px; padding: 5px 6px 5px 12px; font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; min-height: 32px; transition: background .15s var(--ease), border-color .15s var(--ease); }
.theme-switch[hidden] { display: none; }
.theme-switch:hover { border-color: var(--ink-faint); }
.theme-switch:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.theme-switch:disabled { opacity: .55; cursor: not-allowed; }
.ts-track { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); transition: background .2s var(--ease); }
.ts-thumb { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .2s var(--ease); }
.theme-switch[aria-checked="true"] .ts-track { background: var(--brand); }
.theme-switch[aria-checked="true"] .ts-thumb { transform: translateX(14px); }
@media (prefers-reduced-motion: reduce) { .ts-track, .ts-thumb { transition: none; } }
@media (max-width: 380px) { .theme-switch { padding-left: 10px; gap: 6px; } }
@media print { .theme-switch { display: none !important; } }

/* ---------- Handout options under the action buttons; compact options (17 Nov 2026) ---------- */
.settings > .options-fold { margin: 0; }
.options-fold-body > :first-child { margin-top: 2px; }
.lang-inline { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.lang-inline label { margin: 0; font-size: .875rem; font-weight: 600; flex: none; }
.lang-inline select { flex: 1 1 auto; min-width: 0; width: auto; }
.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
.opt-toggle { display: flex; align-items: center; gap: 8px; font-size: .875rem; line-height: 1.25; padding: 6px 4px; border-radius: 8px; cursor: pointer; }
.opt-toggle:hover { background: var(--brand-tint-2); }
.opt-toggle input { flex: none; margin: 0; }
.opt-toggle[hidden] { display: none; }
.lang-en-row { margin: -4px 0 4px; }
.opt-note { margin: 0 0 8px; font-size: .75rem; line-height: 1.35; }
@media (max-width: 340px) { .opt-grid { grid-template-columns: 1fr; } }

/* ---------- Advice and goals: optional fold-away box (17 Nov 2026) ---------- */
.advice-fold { margin: 14px 0 4px; }
.advice-warn { margin: 2px 0 12px; font-size: .8125rem; }
.advice-fold .field { margin-bottom: 0; }
.advice-fold .field label { font-size: .875rem; }
.advice-fold .general-notes-field { margin-top: 10px; }
.advice-fold .message-field textarea, .advice-fold #general-notes { min-height: 3.2em; }
.advice-fold .goal-plan { margin-top: 10px; gap: 10px 12px; }
.advice-fold .goal-plan .hint { margin: 0; font-size: .75rem; }
/* Small phones: the switch shows a moon instead of the words, so the header stays on fewer lines
   (screen readers still hear "Dark mode") */
.ts-moon { display: none; flex: none; width: 16px; height: 16px; }
@media (max-width: 480px) {
  .theme-switch { padding-left: 10px; gap: 6px; }
  .theme-switch .ts-moon { display: block; }
  .theme-switch .ts-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Search-first library (17 Nov 2026): empty until the clinician types or picks a filter */
.library-list mark.hit { background: none; color: inherit; font-weight: 800; }
.lib-start { list-style: none; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 12px 18px; margin-bottom: 4px; border: 1.5px dashed var(--line-strong); border-radius: 16px; background: var(--brand-tint-2); }
.lib-start-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); margin-bottom: 4px; }
.lib-start-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lib-start-title { margin: 0; font-weight: 700; font-size: 1.0625rem; color: var(--ink); }
.lib-start-text { margin: 0; font-size: .875rem; line-height: 1.45; color: var(--ink-soft); max-width: 30ch; }
.lib-quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.lib-quick-btn { border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); border-radius: 999px; padding: 5px 12px; min-height: 32px; font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; }
.lib-quick-btn:hover, .lib-quick-btn:focus-visible { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-tint); outline: none; }
.lib-quick-btn:focus-visible { box-shadow: 0 0 0 3px rgba(14, 107, 98, .25); }
.lib-group { list-style: none; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 8px 2px; font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.lib-group-more, .lib-clear { border: 0; background: none; padding: 2px 4px; font: inherit; font-size: .8125rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.lib-count { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 4px; font-size: .8125rem; color: var(--ink-soft); }

/* ---------- Two steps (18 Nov 2026): 1 choose exercises, 2 edit and print ----------
   Step 1: search (left) | matching exercises (centre) | "Your handout" summary (right).
   Step 2: handout cards (centre) | handout details, print and options (right).
   Screen only: printing always prints the handout. */
.steps-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 12px; margin: -6px 0 -4px; }
.step-tab { display: inline-flex; align-items: center; gap: 9px; border: 0; background: none; padding: 6px 10px; border-radius: 999px; font: inherit; font-size: .9375rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.step-tab:hover:not(:disabled) { color: var(--ink); background: var(--brand-tint-2); }
.step-tab:disabled { cursor: default; opacity: .55; }
.step-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(14, 107, 98, .25); }
.step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); font-size: .8125rem; font-weight: 700; }
.step-tab[aria-current="step"] { color: var(--ink); }
.step-tab[aria-current="step"] .step-n { background: var(--brand); border-color: var(--brand); color: #fff; }
.step-line { width: 48px; height: 2px; border-radius: 2px; background: var(--line-strong); }

@media screen {
  html:not([data-step="edit"]) .programme, html:not([data-step="edit"]) .settings { display: none !important; }
  html[data-step="edit"] .library, html[data-step="edit"] .results, html[data-step="edit"] .picked, html[data-step="edit"] .next-bar { display: none !important; }
}
@media print { .steps-bar, .results, .picked, .next-bar { display: none !important; } }

/* Step 1 columns */
@media (min-width: 961px) {
  html:not([data-step="edit"]) .layout { grid-template-columns: 270px minmax(0, 1fr) 290px; gap: 22px; }
  html:not([data-step="edit"]) .library, html:not([data-step="edit"]) .picked { grid-row: auto; grid-column: auto; }
  .picked { position: sticky; top: 92px; max-height: calc(100vh - 112px); }
}
@media (min-width: 1240px) {
  html:not([data-step="edit"]) .layout { grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 24px; }
}

/* Centre: results as cards */
.results { padding: 20px; min-height: 420px; }
.results .library-list { max-height: none; min-height: 0; overflow: visible; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; container-type: normal; }
.results .lib-start, .results .lib-group, .results .lib-count, .results .lib-note, .results .lib-empty { grid-column: 1 / -1; }
.results .lib-start { padding: 48px 20px 40px; margin: 0; }
.results .lib-start-icon { width: 60px; height: 60px; }
.results .lib-start-icon svg { width: 28px; height: 28px; }
.results .lib-start-title { font-size: 1.375rem; }
.results .lib-start-text { font-size: 1rem; max-width: 40ch; }
.results .lib-quick-btn { min-height: 38px; padding: 6px 16px; font-size: .9375rem; }
.results .lib-group { padding: 10px 2px 0; }
.results .lib-count { padding: 0 2px; font-size: .875rem; }
.results .lib-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "pic pic" "meta meta" "fav add"; align-items: center; gap: 8px 6px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.results .lib-item:hover { border-color: var(--line-strong); background: var(--card); box-shadow: var(--shadow); }
.results .lib-item .lib-preview { grid-area: pic; width: 100%; }
.results .lib-item .pic { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 12px; }
.results .lib-item .meta { grid-area: meta; }
.results .lib-item .name { font-size: 1rem; }
.results .lib-item .fav { grid-area: fav; justify-self: start; }
.results .lib-item .own-edit { position: absolute; top: 14px; right: 14px; background: var(--card); }
.results .lib-item .add { grid-area: add; min-height: 38px; padding: 6px 20px; font-size: .875rem; }
.results .lib-item .also-called { white-space: normal; }

/* Right: "Your handout" summary */
.picked { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.picked-head { display: flex; align-items: center; gap: 10px; }
.picked-head h2 { font-size: 1.25rem; }
.picked-count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .8125rem; font-weight: 700; }
.picked-count:empty { display: none; }
.picked-empty { margin: 0; padding: 18px 12px; text-align: center; color: var(--ink-soft); font-size: .875rem; border: 1.5px dashed var(--line-strong); border-radius: 14px; }
.picked-list { list-style: none; margin: 0 -4px; padding: 0 4px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; scrollbar-width: thin; counter-reset: picked; }
.picked-item { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.picked-pic { flex: none; width: 48px; height: 38px; border-radius: 8px; overflow: hidden; }
.picked-pic .pic { width: 100%; height: 100%; }
.picked-pic svg, .picked-pic img { width: 100%; height: 100%; }
.picked-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.picked-name { font-weight: 600; font-size: .875rem; line-height: 1.3; overflow-wrap: break-word; }
.picked-dose { font-size: .75rem; color: var(--ink-faint); }
.picked-btns { flex: none; display: flex; gap: 0; }
.picked-btns .icon-btn { width: 28px; height: 28px; }
.picked-btns .icon-btn svg { width: 15px; height: 15px; }
.picked-btns .icon-btn:disabled { opacity: .3; }
.picked-time { margin: 0; font-size: .8125rem; color: var(--ink-soft); }
/* Quick Sets / Reps / Hold edits in each "Your handout" row (18 Nov 2026) */
.picked-item { flex-wrap: wrap; row-gap: 6px; }
.picked-quick { flex-basis: 100%; display: flex; gap: 6px; padding: 6px 2px 0; border-top: 1px dashed var(--line); }
.quick-field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; padding: 2px 6px 2px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: text; }
.quick-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); background: var(--card); }
.quick-field label { font-size: .6875rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; cursor: text; }
.quick-field input { flex: 1; min-width: 0; width: 100%; min-height: 28px; padding: 0; border: 0; background: transparent; font: inherit; font-size: .875rem; font-weight: 600; text-align: right; color: var(--ink); -moz-appearance: textfield; appearance: textfield; }
.quick-field input:focus { outline: none; box-shadow: none; }
.quick-field input::-webkit-outer-spin-button, .quick-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.quick-field input::placeholder { color: var(--ink-faint); font-weight: 400; }
.quick-unit { font-size: .75rem; color: var(--ink-faint); }
/* Narrower summary column (smaller laptops): label above the number so nothing is cut off */
@media (min-width: 961px) and (max-width: 1239px) {
  .quick-field { flex-direction: column; align-items: stretch; gap: 0; padding: 3px 8px; position: relative; }
  .quick-field label { line-height: 1.3; }
  .quick-field input { text-align: left; min-height: 22px; }
  .quick-unit { position: absolute; right: 8px; bottom: 5px; }
}
/* 16px on phones and tablets so iPhones don't zoom in when a box is tapped */
@media (max-width: 960px) { .quick-field input { font-size: 1rem; min-height: 32px; } }
.btn-next { width: 100%; min-height: 48px; font-size: 1rem; }
.btn-next:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.picked-templates { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 12px; font-size: .875rem; }
.picked-templates .starter-row { display: flex; gap: 8px; }
.picked-templates .starter-row select { flex: 1; min-width: 0; min-height: 40px; }
.picked.has-items .picked-templates { display: none; }

/* Step 2 columns */
.btn-back { min-height: 36px; padding: 6px 14px; font-size: .875rem; margin-right: auto; }
html[data-step="edit"] .programme-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
html[data-step="edit"] .programme-toolbar h2 { flex-basis: 100%; order: 2; }
html[data-step="edit"] .programme-toolbar .view-switch { order: 1; }
@media (min-width: 961px) {
  html[data-step="edit"] .layout { grid-template-columns: minmax(0, 1fr) 320px; }
  html[data-step="edit"] .programme { grid-column: 1; grid-row: 2; }
  html[data-step="edit"] .settings { grid-column: 2; grid-row: 2; }
  html[data-step="edit"] .settings .field-grid { grid-template-columns: 1fr; }
  html[data-step="edit"] .settings .goal-plan { grid-template-columns: 1fr; }
  html[data-step="edit"] .settings .tick-row { flex-direction: column; }
}
@media (min-width: 1240px) {
  html[data-step="edit"] .layout { grid-template-columns: minmax(0, 1fr) 360px; max-width: 1360px; }
}
.empty-state .btn { margin-top: 6px; }

/* Phones and tablets: one column, with a bar at the bottom to move on */
.next-bar { display: none; }
@media (max-width: 960px) {
  .steps-bar { gap: 6px; margin: 0; }
  .step-tab { font-size: .875rem; padding: 4px 6px; gap: 6px; }
  .step-line { width: 20px; }
  .results { padding: 14px; min-height: 0; }
  .results .library-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .results .lib-start { padding: 28px 14px 24px; }
  .picked-list { overflow: visible; }
  html:not([data-step="edit"]) .next-bar:not([hidden]) { display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(23, 35, 43, .18); font-weight: 600; font-size: .9375rem; }
  html:not([data-step="edit"]) .next-bar .btn { min-height: 42px; white-space: nowrap; }
  html:not([data-step="edit"]) body { padding-bottom: 80px; }
  html[data-step="edit"] .settings { order: 1; }
  html[data-step="edit"] .programme { order: 2; }
}
@media (max-width: 420px) {
  .results .library-list { grid-template-columns: 1fr 1fr; gap: 8px; }
  .results .lib-item { padding: 8px; gap: 6px 4px; }
  .results .lib-item .add { padding: 5px 12px; }
  .next-bar #next-bar-count { font-size: .8125rem; }
}
.picked-templates .hint { font-weight: 400; }
@media (max-width: 960px) { html:not([data-step="edit"]) .toast { bottom: 92px; } }
@media (min-width: 961px) { .results .library-list { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); } .results .lib-item .pic { aspect-ratio: 3 / 2; } }
.tut-link { position: absolute; right: 0; font-size: .8125rem; font-weight: 600; color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.steps-bar { position: relative; }
@media (max-width: 1100px) { .tut-link { position: static; margin-left: 8px; } }
@media (max-width: 960px) { .steps-bar { flex-wrap: wrap; } .tut-link { flex-basis: 100%; text-align: center; margin: 2px 0 0; } }

/* Tutorial link in the builder's top bar (18 Nov 2026) */
.header-tut { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; min-height: 32px; }
.header-tut:hover { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-ink); }
.header-tut .ht-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media print { .header-tut { display: none !important; } }
/* Small phones: book icon only, so the top bar stays on fewer lines (screen readers still hear "How to use") */
@media (max-width: 480px) {
  .header-tut { padding: 6px 10px; }
  .header-tut span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.physio-fold { margin: 0 0 4px; }
.physio-fold .tick-row { margin-top: 12px; }

/* ---------- Continue this programme (22 Nov 2026) ---------- */
.continue-dialog { max-width: 560px; }
.continue-scan-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.continue-scan-row .hint { flex-basis: 100%; margin: 0; }
.continue-camera { display: flex; flex-direction: column; gap: 8px; }
.continue-camera video { width: 100%; max-height: 50vh; border-radius: var(--radius-sm); background: #000; object-fit: cover; }
.continue-camera .hint { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.continue-stop { min-height: 34px; padding: 4px 12px; }
.continue-summary { margin: 0; font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.continue-notes { margin: 0; padding-left: 20px; font-size: .9rem; display: flex; flex-direction: column; gap: 4px; }
.continue-bring { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px 12px; margin: 0; }
.continue-bring legend { font-weight: 600; padding: 0 4px; }
.continue-bring > .hint { margin: 0 0 8px; }
.continue-choice { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; overflow-wrap: anywhere; }
.continue-choice input { margin-top: 3px; flex: none; }
.continue-pick .btn { width: 100%; }
.continue-pick .hint { margin: 8px 0 0; }
#continue-find:not([hidden]), #continue-found:not([hidden]) { display: flex; flex-direction: column; gap: 14px; }
#continue-find > p, #continue-found .warn { margin: 0; }

/* Shared by a colleague (22 Nov 2026): welcome note when a colleague's link opens the builder */
.shared-banner { grid-column: 1 / -1; display: flex; gap: 12px; align-items: flex-start; background: var(--brand-tint-2); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 14px; padding: 14px 10px 14px 16px; }
.shared-banner[hidden] { display: none; }
.shared-banner .sb-ico { flex: none; width: 28px; height: 28px; fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; margin-top: 2px; }
.shared-banner .sb-body { flex: 1; min-width: 0; }
.shared-banner p { margin: 0 0 4px; font-size: .9rem; line-height: 1.45; }
.shared-banner .sb-title { font-size: 1rem; }
.shared-banner .sb-text { color: var(--ink-soft); }
.shared-banner .sb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.shared-banner .sb-actions .btn { min-height: 38px; padding: 6px 16px; font-size: .875rem; }
.shared-banner .sb-actions .btn:disabled { opacity: 1; background: var(--brand-tint-2); color: var(--brand); border-color: var(--brand); cursor: default; }
html[data-step="edit"] #shared-edit { display: none; }
@media print { .shared-banner { display: none !important; } }

/* Exercises awaiting a clinical check: hidden from the library unless "Show unchecked exercises" is ticked (22 Nov 2026) */
.lib-unchecked { margin-top: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--accent-tint); }
.lib-unchecked label { display: flex; align-items: center; gap: 8px; font-size: .8125rem; font-weight: 700; color: var(--ink); cursor: pointer; }
.lib-unchecked input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); flex: none; }
.lib-unchecked .hint { margin: 3px 0 0 26px; font-size: .75rem; color: var(--ink-soft); }
.lib-hidden-note { grid-column: 1 / -1; list-style: none; padding: 8px; font-size: .8125rem; color: var(--ink-soft); }
.unchecked-label { margin: 6px 0 0; font-size: .75rem; color: var(--ink-soft); }
.unchecked-label .awaiting-check { margin-right: 4px; }
@media print { .unchecked-label { display: none !important; } }
.continue-dialog .dialog-actions { flex-wrap: wrap; }
@media (max-width: 480px) { .continue-dialog .dialog-actions .btn { flex: 1 1 auto; } #continue-load { flex-basis: 100%; order: -1; } }

/* ---------- UI fine-tune (22 Nov 2026) ---------- */
/* 1. Handout details: Print and Save as PDF, then a More menu for everything else */
.settings .settings-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.settings .settings-actions #btn-print, .settings .settings-actions #btn-pdf { grid-column: auto; }
.more-menu { position: relative; display: flex; }
.settings .settings-actions .more-toggle { grid-column: auto; width: auto; min-height: 44px; padding: 8px 14px; font-size: .9375rem; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.more-chev { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.more-toggle[aria-expanded="true"] .more-chev { transform: rotate(180deg); }
.more-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 230px; background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 12px 32px -8px rgba(23, 35, 43, .28), 0 2px 6px rgba(23, 35, 43, .08); padding: 6px; display: flex; flex-direction: column; }
.more-panel[hidden] { display: none; }
.more-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 9px; padding: 10px 12px; font: inherit; font-size: .9375rem; font-weight: 600; color: var(--ink); cursor: pointer; }
.more-item:hover, .more-item:focus-visible { background: var(--brand-tint); color: var(--brand-ink); }
.more-item:disabled { color: var(--ink-faint); cursor: default; background: none; }
.more-item.more-danger { border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; margin-top: 4px; padding-top: 12px; }
@media print { .more-panel { display: none !important; } }

/* 3. Phone-width exercise cards: tools under the name, dose boxes with room for their words */
@container (max-width: 460px) {
  .ex-top { flex-wrap: wrap; row-gap: 6px; }
  .ex-top .ex-title { flex: 1 1 100%; }
  .ex-top .ex-tools { margin-left: auto; }
  .params { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .params > .field { grid-column: span 2; }
  .params .freq { grid-column: 1 / -1; }
  .params .load, .params .side, .params .stage { grid-column: span 3; }
  .params .field label { white-space: normal; }
  .note-toggle summary, .progressions summary { flex-wrap: wrap; row-gap: 0; }
  .view-simple .ex-top .ex-title { flex-basis: auto; }
}

/* 5. "Show unchecked exercises": a quiet line, not an orange box */
.lib-unchecked { background: none; padding: 10px 0 0; border-top: 1px solid var(--line); border-radius: 0; margin-top: 12px; }
.lib-unchecked label { font-weight: 600; color: var(--ink-soft); }
.lib-unchecked .hint { font-size: .75rem; }

/* 6. Phones: logo and header buttons on one row, privacy note as a shield */
@media (max-width: 600px) {
  .hdr-compact .header-inner { flex-wrap: nowrap; gap: 8px; min-height: 58px; padding-top: 8px; padding-bottom: 8px; }
  .hdr-compact .header-right { flex-wrap: nowrap; gap: 6px; }
  .hdr-compact .privacy-badge .pb-text, .hdr-compact .a11y-toggle .a11y-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .privacy-badge:has(.pb-text) { padding: 8px; }
  .privacy-badge:has(.pb-text) svg { width: 16px; height: 16px; }
  .hdr-compact .a11y-toggle { padding: 6px 9px; display: inline-flex; align-items: center; gap: 2px; }
}
@media (max-width: 360px) { .hdr-compact .wordmark { display: none; } }
/* Narrow Handout details column (laptops with three columns, tablets): More gets its own row */
.panel.settings { container-type: inline-size; }
@container (max-width: 340px) {
  .settings .settings-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .settings .settings-actions .more-menu { grid-column: 1 / -1; }
  .settings .settings-actions .more-toggle { width: 100%; justify-content: center; }
  .more-panel { left: 0; right: 0; }
}
