:root {
  --bg: #EEF2EC;
  --surface: #FFFFFF;
  --surface-2: #F5F8F3;
  --surface-3: #DDE5DA;
  --line: #CFDACB;
  --line-strong: #A9BBA6;
  --ink: #0B2A1E;
  --ink-2: #3B5045;
  --muted: #5E7366;
  --accent: #0E3B2A;
  --accent-hover: #082C1F;
  --accent-ink: #FFFFFF;
  --accent-wash: #DCE8DD;
  --marker: #C9A54A;
  --marker-ink: #1C1503;
  --good: #1D7F2B;
  --good-wash: #DFF0E0;
  --warn: #8F6200;
  --warn-wash: #FBEFCF;
  --crit: #BF3131;
  --crit-wash: #F8DEDC;
  --c-run: #2a78d6;
  --c-bike: #eb6834;
  --c-row: #1baf7a;
  --c-ellip: #eda100;
  --c-hike: #e87ba4;
  --c-gym: #008300;
  --c-yoga: #4a3aa7;
  --c-other: #e34948;
  --c-swim: #0e7490;
  --z1: #D3E3D2;
  --z2: #A3C4A4;
  --z3: #6E9A6F;
  --z4: #2F6248;
  --z5: #0A2E21;
  --grid: #DFE8DC;
  --axis: #A9BBA6;
  --shadow: 0 1px 2px rgba(11, 42, 30, .05), 0 6px 20px rgba(11, 42, 30, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --tabbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #072519;
    --surface: #0F3326;
    --surface-2: #133A2C;
    --surface-3: #1A4434;
    --line: #22493A;
    --line-strong: #2F5A48;
    --ink: #E6EEE8;
    --ink-2: #B7CBBE;
    --muted: #8FA89A;
    --accent: #9BD3AC;
    --accent-hover: #B3DFC0;
    --accent-ink: #062015;
    --accent-wash: #16402E;
    --marker: #C9A54A;
    --marker-ink: #1C1503;
    --good: #43BD5A;
    --good-wash: #15301B;
    --warn: #E8B23A;
    --warn-wash: #33280E;
    --crit: #EA6A6A;
    --crit-wash: #3B1818;
    --c-run: #3987e5;
    --c-bike: #d95926;
    --c-row: #199e70;
    --c-ellip: #c98500;
    --c-hike: #d55181;
    --c-gym: #008300;
    --c-yoga: #9085e9;
    --c-other: #e66767;
    --c-swim: #22a3c4;
    --z1: #163A2A;
    --z2: #22553D;
    --z3: #3D7A57;
    --z4: #6FA982;
    --z5: #A8D3B4;
    --grid: #133426;
    --axis: #2F5A48;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #072519;
  --surface: #0F3326;
  --surface-2: #133A2C;
  --surface-3: #1A4434;
  --line: #22493A;
  --line-strong: #2F5A48;
  --ink: #E6EEE8;
  --ink-2: #B7CBBE;
  --muted: #8FA89A;
  --accent: #9BD3AC;
  --accent-hover: #B3DFC0;
  --accent-ink: #062015;
  --accent-wash: #16402E;
  --marker: #C9A54A;
  --marker-ink: #1C1503;
  --good: #43BD5A;
  --good-wash: #15301B;
  --warn: #E8B23A;
  --warn-wash: #33280E;
  --crit: #EA6A6A;
  --crit-wash: #3B1818;
  --c-run: #3987e5;
  --c-bike: #d95926;
  --c-row: #199e70;
  --c-ellip: #c98500;
  --c-hike: #d55181;
  --c-gym: #008300;
  --c-yoga: #9085e9;
  --c-other: #e66767;
  --c-swim: #22a3c4;
  --z1: #163A2A;
  --z2: #22553D;
  --z3: #3D7A57;
  --z4: #6FA982;
  --z5: #A8D3B4;
  --grid: #133426;
  --axis: #2F5A48;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; margin: 0; text-wrap: balance; line-height: 1.1; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 760px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand-mark { width: 32px; height: 32px; flex: none; }
/* wordmark: DUROPACE in Archivo SemiBold, semi-expanded, letter-spaced (matches brand/wordmark-*.svg) */
.brand-name { font-family: "Archivo", var(--font-display); font-weight: 600; font-stretch: 112.5%; font-variation-settings: "wdth" 112.5; text-transform: uppercase; font-size: 17px; letter-spacing: .18em; line-height: 1; }
.brand-name .bn-heavy, .brand-name .bn-light { font-weight: inherit; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2);
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.live { background: var(--good-wash); color: var(--good); }
.status-pill.off { background: var(--crit-wash); color: var(--crit); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }

main {
  max-width: 760px; margin: 0 auto;
  padding-inline: 16px;
  padding-block: 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom, 0px));
}
.view { display: none; flex-direction: column; gap: 14px; }
.view.active { display: flex; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar-inner { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); height: var(--tabbar-h); }
.tab {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  position: relative; white-space: nowrap; min-width: 0; padding: 0 2px;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-selected="true"] { color: var(--accent); }
.tab[aria-selected="true"]::before {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}
.tab .badge-dot { position: absolute; top: 10px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--marker); border: 2px solid var(--surface); }

/* ---------- cards & common ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head .sub { font-size: 13px; color: var(--muted); }
.eyebrow {
  font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 6px 2px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--line); border: 0; margin: 2px 0; }
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); padding: 0 8px; }
.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.chip.accent { background: var(--accent-wash); color: var(--accent); }
.chip.good { background: var(--good-wash); color: var(--good); }
.chip.warn { background: var(--warn-wash); color: var(--warn); }
.chip.crit { background: var(--crit-wash); color: var(--crit); }
.chip.marker { background: var(--marker); color: var(--marker-ink); }
.chip .sw { width: 8px; height: 8px; border-radius: 2px; }
.phase-chip { font-family: var(--font-display); letter-spacing: .06em; text-transform: uppercase; font-size: 13px; }

.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface-2); font-size: 14px;
}
.banner.warn { background: var(--warn-wash); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.banner.crit { background: var(--crit-wash); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.banner.accent { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.banner.good { background: var(--good-wash); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.banner strong { display: block; }
.banner .btn { margin-left: auto; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type="text"], input[type="number"], input[type="date"], input[type="password"], input[type="email"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px; color: var(--ink);
}
textarea { min-height: 76px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr 1fr; } }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-val {
  min-width: 36px; text-align: center; font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink);
}
.scale-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 500; margin-top: -2px; }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button {
  flex: 1; min-height: 40px; border: 0; background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2);
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* ---------- sheet (bottom sheet / dialog) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 10, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 640px; max-height: 92%; overflow: auto;
  background: var(--surface); border-radius: 18px 18px 0 0; border: 1px solid var(--line);
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 14px;
}
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 16px; max-height: 88%; } }
.busy-backdrop { z-index: 80; align-items: center; }
.sheet.busy { max-width: 440px; border-radius: 16px; margin: 16px; width: calc(100% - 32px); padding: 20px; gap: 12px; }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 4px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -8px; background: var(--surface); padding: 8px 0; z-index: 2; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 90;
  transform: translateX(-50%) translateY(8px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  transition: opacity .18s, transform .18s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- today / header ---------- */
.today-head { display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 0; }
.today-date { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; text-transform: uppercase; letter-spacing: .02em; }
.countdowns { display: flex; gap: 8px; flex-wrap: wrap; }
.countdown {
  display: flex; align-items: baseline; gap: 6px; padding: 5px 9px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.countdown b { font-family: var(--font-display); font-size: 20px; color: var(--ink); font-weight: 700; }

/* week strip */
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wday {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 2px 7px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
}
.wday .dname { font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wday .dnum { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1; }
.wday .dots { display: flex; gap: 3px; min-height: 8px; }
.wday .dots i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.wday .dots i.hollow { background: transparent !important; border: 1.5px solid var(--line-strong); width: 7px; height: 7px; }
.wday.today { border-color: var(--marker); box-shadow: inset 0 0 0 1px var(--marker); }
.wday.sel { background: var(--accent-wash); border-color: var(--accent); }

/* ---------- workout cards ---------- */
.wo { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.wo-top { display: flex; gap: 12px; padding: 14px 14px 10px; align-items: flex-start; }
.wo-type {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; color: #fff;
}
.wo-type svg { width: 22px; height: 22px; }
.wo-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.1; }
.wo-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.wo-meta b { color: var(--ink); font-weight: 600; }
.wo-slot { font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.wo-profile { display: block; width: 100%; height: 44px; padding: 0 14px; }
.wo-steps { list-style: none; margin: 0; padding: 4px 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.wo-steps li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: baseline; font-size: 14px; }
.wo-steps .zt { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; padding: 1px 5px; border-radius: 4px; text-align: center; background: var(--surface-3); color: var(--ink-2); }
.wo-steps .dur { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.wo-purpose { padding: 0 14px 12px; font-size: 13.5px; color: var(--ink-2); }
.wo-foot { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); align-items: center; flex-wrap: wrap; }
.wo.done .wo-foot { background: var(--good-wash); }
.done-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--good); font-size: 14px; }

/* plan day list */
.day { display: flex; flex-direction: column; gap: 8px; }
.day-head { display: flex; align-items: baseline; gap: 10px; padding: 4px 2px; }
.day-head .dn { font-family: var(--font-display); font-weight: 700; font-size: 18px; text-transform: uppercase; letter-spacing: .04em; }
.day-head .dd { color: var(--muted); font-size: 13px; }
.day-head .dnote { color: var(--ink-2); font-size: 13px; margin-left: auto; text-align: right; }
.day.is-today .dn { color: var(--accent); }
.rest-row { padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); font-size: 14px; }

/* availability grid */
.avail { display: flex; flex-direction: column; gap: 8px; }
.avail-day { display: grid; grid-template-columns: 52px 1fr 1fr; gap: 8px; align-items: stretch; }
.avail-day .lbl { font-family: var(--font-display); font-weight: 700; font-size: 16px; text-transform: uppercase; display: flex; flex-direction: column; justify-content: center; line-height: 1.05; }
.avail-day .lbl span { font-family: var(--font-body); font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: none; }
.slot { border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 5px; background: var(--surface); min-width: 0; }
.slot.on { border-color: var(--accent); background: var(--accent-wash); }
.slot-toggle { border: 0; background: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 2px 2px; font-weight: 700; font-size: 13px; color: var(--ink-2); font-family: var(--font-display); letter-spacing: .06em; }
.slot.on .slot-toggle { color: var(--accent); }
.slot-toggle .box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; background: var(--surface); }
.slot.on .slot-toggle .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.slot select { min-height: 34px; padding: 4px 6px; font-size: 14px; border-radius: 7px; }
.slot .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.slot:not(.on) .opts { display: none; }

/* stepper */
.steps { display: flex; gap: 4px; }
.steps button {
  flex: 1; border: 0; background: none; cursor: pointer; padding: 0; display: flex; flex-direction: column; gap: 5px; align-items: stretch; text-align: left;
  font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}
.steps button::before { content: ""; height: 4px; border-radius: 2px; background: var(--line); }
.steps button.done::before { background: var(--accent); opacity: .5; }
.steps button[aria-current="step"] { color: var(--ink); }
.steps button[aria-current="step"]::before { background: var(--accent); }
.q { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; padding-top: 0; }
.q-label { font-weight: 600; font-size: 15px; color: var(--ink); }
.q-help { font-size: 13px; color: var(--muted); }
.inj-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.pain-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
@media (max-width: 420px) { .pain-grid { grid-template-columns: 1fr; } }
.areas { display: flex; flex-wrap: wrap; gap: 6px; }
.area-btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 14px; font-weight: 500; cursor: pointer; }
.area-btn[aria-pressed="true"] { background: var(--warn-wash); border-color: var(--warn); color: var(--ink); }
.light { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.light i { width: 10px; height: 10px; border-radius: 50%; display: block; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 520px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .k { font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.kpi .s { font-size: 12.5px; color: var(--ink-2); }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart text { fill: var(--muted); font-family: var(--font-body); font-size: 11px; }
.chart text.hi { fill: var(--ink); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.legend i.line { height: 3px; border-radius: 2px; width: 14px; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 10px; border-radius: 8px;
  font-size: 12.5px; line-height: 1.35; min-width: 120px; box-shadow: var(--shadow); transform: translate(-50%, -100%); white-space: nowrap;
}
.tip b { font-weight: 700; }
.tip .tr { display: flex; align-items: center; gap: 6px; }
.tip .tr i { width: 8px; height: 8px; border-radius: 2px; display: block; }

/* log list */
.wk-group { display: flex; flex-direction: column; gap: 8px; }
.wk-group-head { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 2px 0; gap: 8px; }
.wk-group-head .t { font-family: var(--font-display); font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.wk-group-head .s { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.srow { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.srow-main { display: flex; gap: 12px; align-items: center; padding: 12px; cursor: pointer; width: 100%; border: 0; background: none; text-align: left; }
.srow-ic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; }
.srow-ic svg { width: 20px; height: 20px; }
.srow-t { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow-m { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.srow-r { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.srow-detail { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 420px) { .statgrid { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface-2); border-radius: 8px; padding: 8px; }
.stat .k { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-family: var(--font-display); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* coach / AI */
.coach { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); background: linear-gradient(180deg, var(--accent-wash), var(--surface) 70%); }
.coach-tag { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.coach-tag svg { width: 16px; height: 16px; }
.readiness { display: flex; align-items: center; gap: 10px; }
.readiness .score { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; }
.meter { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.bul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ai-status { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .toast { transition: none; } }

/* rehab checklist */
.rx { display: flex; flex-direction: column; gap: 0; }
.rx-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; border-top: 1px solid var(--line); }
.rx-row:first-child { border-top: 0; }
.rx-item { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 0; align-items: start; }
.rx-item input { width: 22px; height: 22px; accent-color: var(--accent); margin: 1px 0 0; }
.rx-item .n { font-weight: 600; }
.rx-item .d { font-size: 13px; color: var(--ink-2); }
.rx-item.checked .n { color: var(--muted); text-decoration: line-through; }

/* season timeline */
.season { display: flex; flex-direction: column; gap: 0; }
.season-row { display: grid; grid-template-columns: 38px 82px 1fr auto; gap: 8px; align-items: center; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 13.5px; }
.season-row .wn { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.season-row.cur { background: var(--accent-wash); border-radius: 8px; }
.season-row.race { font-weight: 700; }
.phase-bar { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

.zones-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.zones-table td, .zones-table th { padding: 7px 6px; border-top: 1px solid var(--line); text-align: left; }
.zones-table th { font-family: var(--font-display); font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-top: 0; }
.zones-table .zsw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: -2px; margin-right: 6px; }

details.more > summary { cursor: pointer; list-style: none; font-weight: 600; color: var(--accent); display: flex; align-items: center; gap: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font-size: 18px; line-height: 1; }
details.more[open] > summary::after { content: "–"; }
.diag { font-family: var(--font-mono); font-size: 11.5px; background: var(--surface-2); border-radius: 8px; padding: 10px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- sign-in & start-up ---------- */
[hidden] { display: none !important; }
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px)); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-mark { width: 44px; height: 44px; }
.auth-brand .brand-name { font-size: 22px; }
.splash .brand-mark { width: 72px; height: 72px; }
.splash .brand-name { font-size: 24px; }
.auth-brand .brand-sub { white-space: normal; }
.auth-card code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
.splash .auth-brand { flex-direction: column; text-align: center; gap: 14px; }
.setup-step { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.setup-step:first-of-type { border-top: 0; }
.setup-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font-family: var(--font-display); font-weight: 700; background: var(--surface-3); color: var(--ink-2); }
.setup-step.done .setup-n { background: var(--good-wash); color: var(--good); }
.setup-step.done b { color: var(--muted); }
.sync-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.sync-row:first-of-type { border-top: 0; }
.card > h3 + .sync-row { border-top: 0; }
a { color: var(--accent); }

/* ---------- health and safety ---------- */
.safety-note {
  display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px; border-radius: 10px;
  background: var(--warn-wash); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  font-size: 12.5px; line-height: 1.45; color: var(--ink);
}
.safety-ic { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--warn); }
.safety-list li { margin-bottom: 6px; }
.safety-foot { text-align: center; margin-top: 4px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ===================== DuroPace additions ===================== */
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.info-btn { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: 700 12.5px/1 var(--font-body, system-ui); cursor: pointer; display: inline-grid; place-items: center; flex: none; padding: 0; }
.info-btn:hover { border-color: var(--accent); color: var(--accent); }
.card:has(> .card-head .info-btn) { position: relative; }
.card-head:has(.info-btn) { padding-right: 30px; }
.card-head .info-btn { position: absolute; top: 14px; right: 14px; }
.gloss { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.gloss dt { font-weight: 600; }
.gloss dd { margin: 0; color: var(--ink-2); }
@media (max-width: 520px) { .gloss { grid-template-columns: 1fr; } .gloss dd { margin-bottom: 6px; } }
.phase-plain { font-size: 13.5px; color: var(--ink-2); }

/* programme */
.phase-strip { display: flex; gap: 2px; height: 16px; margin: 4px 0 2px; }
.phase-strip i { flex: 1 1 0; min-width: 3px; border-radius: 3px; display: block; }
.phase-strip i.cur { outline: 2px solid var(--ink); outline-offset: 1px; }
.phase-strip i.race { background: var(--marker) !important; opacity: 1 !important; }
.pw-this { border-top: 1px solid var(--line); padding-top: 10px; }
.pw-list { display: flex; flex-direction: column; gap: 6px; }
.pw { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pw summary { display: grid; grid-template-columns: 38px 58px 1fr auto; gap: 8px; align-items: center; padding: 9px 12px; cursor: pointer; list-style: none; font-size: 14px; }
.pw summary::-webkit-details-marker { display: none; }
.pw summary::after { content: "›"; color: var(--muted); transition: transform .15s; margin-left: 4px; grid-column: 5; }
.pw[open] summary::after { transform: rotate(90deg); }
.pw.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pw.race { border-color: var(--marker); }
.pw-n { font-family: var(--font-display); font-weight: 700; color: var(--muted); }
.pw-d { color: var(--ink-2); }
.pw-p { font-weight: 600; min-width: 0; }
.pw-h { color: var(--ink-2); white-space: nowrap; }
.pw-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 420px) { .pw summary { grid-template-columns: 30px 1fr auto; } .pw-d { display: none; } }

/* workouts */
.wo.race { border-color: var(--marker); box-shadow: 0 0 0 1px var(--marker) inset; }
.wo-guard { padding: 0 14px 10px; color: var(--ink-2); }

/* availability tools */
.avail-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.avail-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; align-items: center; }
.avail-pick .lbl { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.avail-pick .span2 { grid-column: 1 / -1; }
.avail-pick select { width: 100%; min-width: 0; padding: 7px 28px 7px 10px; font-size: 14px; }
.avail-day button.lbl { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; }
.avail-day button.lbl:hover { color: var(--accent); }
.avail-day button.lbl:disabled { cursor: default; color: inherit; }

/* progress analytics */
.an-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.an-period { flex: 1 1 280px; max-width: 420px; }
.an-period button { flex: 1; padding: 8px 4px; white-space: nowrap; }
.an-sport select { padding: 8px 30px 8px 10px; }
.an-said { font-size: 15px; line-height: 1.5; margin: 0; color: var(--ink-2); }
.an-said b { color: var(--ink); }
.kpi .delta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .delta b { font-weight: 700; color: var(--ink-2); }
.kpi .delta.good b { color: var(--good); }
.kpi .delta.bad b { color: var(--crit); }
.an-now { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.an-now .k { display: block; font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.an-now b { font-family: var(--font-display); font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.tbl-view summary { font-size: 13px; color: var(--accent); cursor: pointer; margin-top: 4px; }
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl thead th { font-family: var(--font-display); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tbl .num { text-align: right; }
.tbl tbody th { font-weight: 600; }
.tbl .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; }
.records { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .records { grid-template-columns: 1fr; } }
.records li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.records .k { font-family: var(--font-display); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.records b { font-family: var(--font-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.records .d { font-size: 12.5px; color: var(--ink-2); }
.records .chip { margin-top: 4px; }
.calendar { overflow-x: auto; max-width: 100%; }
.calendar svg { display: block; max-width: none; }
.calendar text { font-size: 9.5px; fill: var(--muted); font-family: var(--font-body, system-ui); }
.cal.l0 { fill: var(--surface-3); background: var(--surface-3); }
.cal.l1 { fill: color-mix(in srgb, var(--accent) 28%, var(--surface)); background: color-mix(in srgb, var(--accent) 28%, var(--surface)); }
.cal.l2 { fill: color-mix(in srgb, var(--accent) 50%, var(--surface)); background: color-mix(in srgb, var(--accent) 50%, var(--surface)); }
.cal.l3 { fill: color-mix(in srgb, var(--accent) 75%, var(--surface)); background: color-mix(in srgb, var(--accent) 75%, var(--surface)); }
.cal.l4 { fill: var(--accent); background: var(--accent); }
.cal-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.cal-legend span.muted { color: var(--muted); }

:root { --i-easy: #A3C4A4; --i-mod: #3E8C98; --i-hard: #0A2E21; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --i-easy: #2E6A73; --i-mod: #6FA982; --i-hard: #CDEBEF; } }
:root[data-theme="dark"] { --i-easy: #2E6A73; --i-mod: #6FA982; --i-hard: #CDEBEF; }

/* heat map */
.heat-wrap { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.heat-map { height: 340px; width: 100%; background: var(--surface-2); }
@media (min-width: 720px) { .heat-map { height: 400px; } }
.heat-tools { position: absolute; top: 10px; right: 10px; z-index: 500; display: flex; gap: 6px; }
.heat-tools .btn { background: var(--surface); box-shadow: var(--shadow); }
.heat-msg { position: absolute; left: 10px; right: 10px; bottom: 26px; z-index: 500; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; color: var(--ink-2); }
.heat-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 460px) { .heat-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.heat-stats div { display: flex; flex-direction: column; }
.heat-stats b { font-family: var(--font-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.heat-stats span { font-size: 12.5px; color: var(--ink-2); }
.heat-legend { align-items: center; justify-content: space-between; }
.heat-legend i.ramp { width: 60px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #2E6B4F, #3F8B5E, #E0A526, #D9480F); }
.heat-legend .check { font-size: 13px; font-weight: 500; }
.heat-legend .check input { width: 17px; height: 17px; }
.heat-about summary { font-size: 13px; color: var(--accent); cursor: pointer; }
.heat-about[open] { display: flex; flex-direction: column; gap: 8px; }
.heat-card.map-full { position: fixed; inset: 0; z-index: 900; border-radius: 0; margin: 0; overflow-y: auto; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.heat-card.map-full .heat-map { height: calc(100dvh - 190px); min-height: 300px; }
body.no-scroll { overflow: hidden; }
.leaflet-container { font: 12px/1.4 var(--font-body, system-ui); background: var(--surface-2); }
.leaflet-control-attribution { font-size: 10px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-bar a { background: var(--surface); color: var(--ink); border-color: var(--line); }
  :root:not([data-theme="light"]) .leaflet-control-attribution { background: rgba(7, 37, 25, .75); color: var(--ink-2); }
  :root:not([data-theme="light"]) .leaflet-control-attribution a { color: var(--accent); }
  :root:not([data-theme="light"]) .heat-legend i.ramp { background: linear-gradient(90deg, #3D8A5C, #9BD3AC, #C9A54A, #FF7A45); }
}

/* ---------- race celebration ---------- */
.card.celebrate { position: relative; overflow: hidden; border: 2px solid var(--marker); background: linear-gradient(160deg, var(--surface) 55%, var(--warn-wash)); }
.celebrate-h { font-family: var(--font-display); font-size: 22px; line-height: 1.2; margin: 2px 0; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -12px; left: calc(var(--i) * 7% + 2%); width: 6px; height: 11px; border-radius: 1px; opacity: 0;
  background: var(--marker); animation: wp-confetti 2.8s cubic-bezier(.3, .6, .5, 1) calc(var(--i) * .09s) 2; }
.confetti i:nth-child(3n) { background: var(--accent); width: 5px; }
.confetti i:nth-child(3n+1) { background: var(--c-bike); height: 8px; }
.confetti i:nth-child(4n) { background: var(--good); }
@keyframes wp-confetti { 0% { transform: translateY(0) rotate(0); opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(240px) rotate(600deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* ---------- training history import ---------- */
ol.how { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

/* ---------- exercise guide ---------- */
.ex-fig { display: block; width: 100%; height: auto; }
.ex-thumb { width: 64px; height: 46px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; display: grid; place-items: center; flex: none; }
.ex-thumb:hover { border-color: var(--line-strong); }
.ex-q { font-size: 12px; font-weight: 600; color: var(--accent); }
.ex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ex-list li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.ex-list li:first-child { border-top: 0; }
.ex-name { font-weight: 600; color: var(--ink); text-decoration-color: var(--line-strong); text-align: left; }
.ex-stage { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ex-view { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 6px 4px; display: flex; flex-direction: column; gap: 2px; }
.ex-view figcaption { font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: center; letter-spacing: .02em; }
.ex-still { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ex-mine { background: var(--accent-wash); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.ex-ladder { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.ex-card { display: flex; flex-direction: column; gap: 4px; align-items: stretch; padding: 6px 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); text-align: left; }
.ex-card:hover { border-color: var(--line-strong); }
.ex-card .ex-fig { background: var(--surface-2); border-radius: 6px; }

/* ---------- quicker planning, watch set-up, Google button ---------- */
.same-week { background: var(--accent-wash); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
[data-bchip][aria-pressed="true"], [data-watch][aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--ink); }
.watch-how { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.q-label.small { font-size: 14px; font-weight: 600; margin-bottom: 6px; }

/* ---------- daily readiness ---------- */
.ready-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.ready-card[data-l="good"] { border-left-color: var(--good); }
.ready-card[data-l="ok"] { border-left-color: var(--marker); }
.ready-card[data-l="low"] { border-left-color: var(--crit); }
.ready-main { display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; }
div.ready-main { cursor: default; }
.ready-main .chev { color: var(--muted); font-size: 22px; line-height: 1; }
.ready-ring { width: 54px; height: 54px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 4px solid var(--line-strong); background: var(--surface-2); }
.ready-ring b { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1; }
.ready-ring[data-l="good"] { border-color: var(--good); color: var(--good); background: var(--good-wash); }
.ready-ring[data-l="ok"] { border-color: var(--marker); color: var(--warn); background: var(--warn-wash); }
.ready-ring[data-l="low"] { border-color: var(--crit); color: var(--crit); background: var(--crit-wash); }
.ready-h { display: block; font-size: 17px; line-height: 1.2; margin: 1px 0 4px; }
.ready-facts { display: flex; flex-wrap: wrap; gap: 4px; }
.ready-why, .ready-adv { margin: 0; }
.ready-act { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.ready-act .btn { margin-left: auto; flex: none; }

/* ---------- activity maps and repeat routes ---------- */
.act-map-wrap { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); margin: 10px 0 8px; }
.act-map { height: 210px; width: 100%; background: var(--surface-2); }
.act-map.tall { height: 280px; }
@media (min-width: 720px) { .act-map { height: 260px; } .act-map.tall { height: 340px; } }
.route-cmp { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 2px; }
.route-cmp p { margin: 0; }
.route-cmp-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.route-cmp-h .linkish { margin-left: auto; font-size: 13px; }
.route-list { display: flex; flex-direction: column; }
.route-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; }
.route-list .route-row:first-child { border-top: 0; }
.route-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.route-r b { font-family: var(--font-display); font-size: 19px; line-height: 1; }
.tbl tr.best td { font-weight: 700; }
/* keep Leaflet's own layers (z-index 400-1000) inside the map, below the tab bar and sheets */
.heat-wrap, .act-map-wrap { isolation: isolate; }
/* exercise views: full width, one above the other, on phones */
@media (max-width: 560px) { .ex-stage { grid-template-columns: 1fr; } .ex-view .ex-fig { max-height: 260px; } }

/* ---------- follow-along player ---------- */
.fa-root { position: fixed; inset: 0; z-index: 1200; background: var(--bg); display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); gap: 10px; }
.fa-top { display: flex; align-items: center; gap: 10px; }
.fa-title { flex: 1; font-family: var(--font-display); font-weight: 700; font-size: 20px; text-transform: uppercase; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fa-x, .fa-snd { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 18px; color: var(--ink); cursor: pointer; }
.fa-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.fa-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.fa-stage { position: relative; flex: 1 1 auto; min-height: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; }
.fa-fig { width: 100%; height: 100%; display: grid; place-items: center; }
.fa-fig svg { width: 100%; height: 100%; max-height: 46vh; }
.fa-noimg { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--ink-2); text-align: center; padding: 20px; }
.fa-view { position: absolute; right: 10px; bottom: 10px; font: 600 13px var(--font-body); border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--accent); padding: 6px 12px; cursor: pointer; }
.fa-info { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.fa-phase { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.fa-root[data-kind="rest"] .fa-phase, .fa-root[data-kind="switch"] .fa-phase { color: var(--warn); }
.fa-name { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.1; }
.fa-big { font-family: var(--font-display); font-weight: 700; font-size: 72px; line-height: 1; font-variant-numeric: tabular-nums; }
.fa-root[data-kind="rest"] .fa-big { color: var(--ink-2); }
.fa-sub { font-size: 14.5px; color: var(--ink-2); min-height: 2.6em; }
.fa-end { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.fa-ctl { display: flex; justify-content: center; align-items: center; gap: 22px; }
.fa-ctl button { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 22px; color: var(--ink); cursor: pointer; }
.fa-ctl .fa-play { width: 76px; height: 76px; background: var(--accent); color: var(--accent-ink); border: 0; font-size: 30px; }
@media (max-height: 640px) { .fa-big { font-size: 54px; } .fa-name { font-size: 22px; } .fa-ctl button { width: 48px; height: 48px; } .fa-ctl .fa-play { width: 62px; height: 62px; } }
.fa-go { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- share card ---------- */
.share-prev { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; place-items: center; }
.share-prev img { max-width: 100%; max-height: 52vh; border-radius: 8px; box-shadow: var(--shadow); }

/* ---------- ask the coach ---------- */
.sheet.tall { height: 92%; }
.sheet.tall .chat { flex: 1; min-height: 0; }
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.chat-log { flex: 1; min-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.cm { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; max-width: 92%; }
.cm.me { align-self: flex-end; align-items: flex-end; }
.cm .cb { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 9px 12px; font-size: 15px; line-height: 1.45; }
.cm.me .cb { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-radius: 14px 14px 4px 14px; }
.chat-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-sugg .chip { border: 1px solid var(--line); background: var(--surface); cursor: pointer; white-space: normal; text-align: left; font-weight: 500; padding: 6px 10px; }
.chat-in { display: flex; gap: 8px; align-items: flex-end; }
.chat-in textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); }

/* ---------- race course ---------- */
.cp-pin span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #C9A54A; color: #1C1503; font: 700 11px var(--font-body, system-ui); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.course-box { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.course-box.has { border-style: solid; background: var(--accent-wash); }
.cs-prof { position: relative; }
.cs-prof svg { display: block; width: 100%; height: auto; }
.cs-prof text { font: 10.5px var(--font-body, system-ui); fill: var(--muted); }
.cs-prof .cpl { stroke: var(--ink-2); stroke-dasharray: 3 3; stroke-width: 1; }
.cs-prof .cpn { fill: #C9A54A; stroke: #fff; stroke-width: 1.5; }
.cs-prof .cpt { font-weight: 700; fill: #1C1503; font-size: 9.5px; }
.cs-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.cs-legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.cs-ctl { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr; gap: 8px; }
@media (max-width: 460px) { .cs-ctl { grid-template-columns: 1fr 1fr; } .cs-ctl .field:first-child { grid-column: 1 / -1; } }
.legs td, .legs th { white-space: nowrap; }
.legs td.name { white-space: normal; min-width: 90px; }
.legs tr.sleep td { color: var(--accent); font-size: 12.5px; }
.legs .tight { color: var(--crit); font-weight: 700; }
.cp-edit { display: grid; grid-template-columns: 1fr 70px 70px 32px; gap: 6px; align-items: center; }
.cp-edit input { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 0; }
.cp-edit .hd { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.spec li { margin-bottom: 4px; }
.legs { font-size: 13px; }
.legs th, .legs td { padding-left: 5px; padding-right: 5px; }
.fa-fig svg { max-height: none; }
.fa-stage { max-height: 50vh; }

/* ---------- always fit the phone (also with Android's large text setting) ---------- */
/* buttons and chips wrap onto two lines rather than pushing the page wider than the screen */
.btn { white-space: normal; max-width: 100%; text-align: center; line-height: 1.2; padding-top: 6px; padding-bottom: 6px; overflow-wrap: break-word; }
.chip { white-space: normal; max-width: 100%; overflow-wrap: break-word; }
.row, .wo-foot, .section-title, .card-head { flex-wrap: wrap; min-width: 0; }
.grow, .wo-top > .grow, .srow-main .grow { min-width: 0; }
#main, .sheet, .card, .banner, .wo, .fa-root { overflow-wrap: break-word; }
#main img, #main svg, #main canvas, .sheet img, .sheet svg, .sheet canvas { max-width: 100%; }
.sheet input, .sheet select, .sheet textarea, #main input, #main select, #main textarea { max-width: 100%; min-width: 0; }
.grid2 > *, .grid3 > *, .cs-ctl > * { min-width: 0; }
.wday { min-width: 0; }
/* the last line of defence: the page itself never scrolls sideways */
html, body { overflow-x: clip; max-width: 100%; }
.wo-steps li { grid-template-columns: 34px minmax(0, 1fr) minmax(0, max-content); }
.wo-steps .dur { white-space: normal; text-align: right; max-width: 42vw; }
.setup-step .btn, .banner .btn, .srow-r .chip { flex-shrink: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .status-pill #statusText { display: none; } .status-pill { padding: 6px; } .topbar-inner { gap: 8px; } }
.tab { overflow: hidden; text-overflow: ellipsis; letter-spacing: 0; }
.tab > span:last-child, .tab .tl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-steps .dur { max-width: 34vw; }
@media (max-width: 420px) { .tab { font-size: 10.5px; padding: 0; text-overflow: clip; } }
@media (max-width: 420px) { .tab { text-transform: none; font-size: 11.5px; font-family: var(--font-body); } }
@media (max-width: 420px) { .tab { font-size: 10.5px; font-weight: 700; } .tabbar-inner { padding: 0 2px; } }
@media (max-width: 420px) { .tabbar-inner { grid-template-columns: 1.05fr 0.95fr 0.8fr 1.3fr 1fr 0.95fr; } }

/* ---------- update 9: sync buttons, swipeable week, compact plan header, stats months ---------- */
.today-top { display: flex; align-items: flex-start; gap: 10px; }
.sync-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.sync-btn svg { width: 16px; height: 16px; }
.sync-btn[disabled] svg { animation: wp-spin 1s linear infinite; }
@keyframes wp-spin { to { transform: rotate(360deg); } }
.sync-line { margin: -4px 2px 0; color: var(--ink-2); }
.log-head { align-items: center; flex-wrap: wrap; }
.log-head .row { margin-left: auto; }
.banner.unrated { margin-top: 6px; }
.sync-box .sync-row:first-child { padding-top: 0; }

.wk-title { align-items: center; }
.wk-title .grow { text-align: center; min-width: 0; }
.wk-title h3 { margin: 0; }
.wk-title .icon-btn { font-size: 22px; line-height: 1; }
.wk-pager { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; touch-action: pan-x pan-y; }
.wk-pager::-webkit-scrollbar { display: none; }
.wk-page { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.wk-actions { justify-content: center; gap: 6px; }

.plan-nav { padding-top: 10px; padding-bottom: 10px; gap: 8px; }
.plan-nav h2 { margin: 0; }

.stats-head { align-items: center; }
.stats-head .grow { min-width: 0; text-align: center; }
.stats-head .icon-btn { font-size: 22px; line-height: 1; }
.stats-head .icon-btn[disabled] { opacity: .35; cursor: default; }
.month-strip { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; scroll-snap-type: x proximity; }
.month-strip::-webkit-scrollbar { display: none; }
.mpill { flex: 0 0 auto; width: 46px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; scroll-snap-align: center; }
.mpill b { font-size: 12.5px; }
.mpill > span:last-child { font-size: 10.5px; color: var(--ink-3, var(--ink-2)); }
.mpill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mpill[aria-pressed="true"] > span:last-child { color: inherit; opacity: .85; }
.mbar { width: 14px; height: 28px; display: flex; align-items: flex-end; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.mbar i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; }
.mpill[aria-pressed="true"] .mbar { background: rgba(255,255,255,.25); }
.mpill[aria-pressed="true"] .mbar i { background: var(--accent-ink); }
.an-custom { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.an-custom .field { flex: 1 1 130px; min-width: 0; }
.an-custom input { width: 100%; min-width: 0; }
.prog-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prog-chips .chip { border: 0; cursor: pointer; }
.prog-chips .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
b.good { color: var(--good); }
b.bad { color: var(--crit); }

/* ---------- update 10: big tap answers, issues, quick logging, weather, kit, gestures, tour ---------- */
body { overscroll-behavior-y: contain; }
.taps { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 6px; }
.tap {
  min-height: 52px; padding: 6px 4px; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--surface);
  color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-align: center; line-height: 1.15; overflow-wrap: break-word; min-width: 0; -webkit-user-select: none; user-select: none;
}
.tap b { font-size: 14px; font-weight: 650; }
.tap small { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.tap:active { transform: scale(.97); }
.tap[aria-checked="true"], .tap[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tap[aria-checked="true"] small, .tap[aria-pressed="true"] small { color: inherit; opacity: .85; }
.taps-num .tap { min-height: 48px; }
.taps-num .tap b { font-size: 18px; font-family: var(--font-display); }
.taps-sub .tap { min-height: 58px; }
@media (max-width: 380px) { .taps[style*="--n:5"] .tap b { font-size: 12.5px; } }
.issues { display: flex; flex-direction: column; gap: 10px; }
.iss-row { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.prefill-tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-wash); border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: 1px; }

.mic-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--accent); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; cursor: pointer; flex: none; }
.mic-btn svg { width: 16px; height: 16px; }
.mic-btn.listening { background: var(--crit-wash); color: var(--crit); border-color: var(--crit); animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--crit) 18%, transparent); } }

.toast.has-act { pointer-events: auto; display: flex; align-items: center; gap: 14px; text-align: left; }
.toast-act { background: none; border: 0; color: var(--marker); font-weight: 700; font-size: 14px; cursor: pointer; padding: 6px 2px; flex: none; text-transform: uppercase; letter-spacing: .04em; }

.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--lines, 3); line-clamp: var(--lines, 3); overflow: hidden; }
.clamp-wrap.open .clamp { display: block; -webkit-line-clamp: unset; overflow: visible; }
.more-btn { font-size: 13px; margin-top: 2px; }
.coach .clamp-wrap p { margin: 0; }

.act-prompt { gap: 12px; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.act-prompt .q-label { margin-bottom: -4px; }
.ap-note-row { display: flex; gap: 8px; align-items: flex-start; }
.ap-note-row textarea { flex: 1; min-width: 0; min-height: 40px; resize: vertical; }
.quick-done { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

details.kit { margin: 0 14px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 8px 12px; }
details.kit > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
details.kit > summary::-webkit-details-marker { display: none; }
.kit-g { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.kit-g .check { align-items: flex-start; font-weight: 450; }
.kit-g .check input { margin-top: 1px; }

.wx-card .card-head { margin-bottom: 0; }
.wx-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wx-day { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; min-width: 0; }
.wx-day.today { border-color: var(--accent); }
.wx-day.warn { background: var(--warn-wash); }
.wx-day b { font-size: 14px; }
.wx-ic { width: 22px; height: 22px; color: var(--ink-2); }
.wx-key { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--marker); }

details.day { display: block; }
details.day > summary.day-head { cursor: pointer; list-style: none; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
details.day > summary::-webkit-details-marker { display: none; }
details.day[open] > summary.day-head { border-color: transparent; background: transparent; padding: 4px 2px; }
details.day.is-today > summary.day-head { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
details.day.all-done > summary .dsum { color: var(--good); }
.day-head .dsum { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.day[open] .dsum { visibility: hidden; }
.day-head .chev { color: var(--muted); font-size: 20px; line-height: 1; transition: transform .15s; flex: none; }
details.day[open] .chev { transform: rotate(90deg); }
.day-body { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.days-head { align-items: center; margin-bottom: -6px; }

.race-find { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius); background: var(--accent-wash); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.race-find .field { gap: 2px; }
#eFindOut:empty { display: none; }
.found-tag:empty { display: none; }
.found-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 999px; padding: 1px 7px; margin-left: 6px; background: var(--good-wash); color: var(--good); vertical-align: 1px; }
.found-tag.check { background: var(--warn-wash); color: var(--warn); }
input.was-check, textarea.was-check { border-color: var(--warn); }

.ptr { position: fixed; top: calc(64px + env(safe-area-inset-top, 0px)); left: 50%; z-index: 30; transform: translate(-50%, -48px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(0,0,0,.12); font-size: 13px; font-weight: 600; color: var(--accent); }
.ptr-ic svg { width: 18px; height: 18px; display: block; }
.ptr.busy .ptr-ic { animation: spin .8s linear infinite; }

.view.slide-l { animation: slidel .22s ease-out; }
.view.slide-r { animation: slider .22s ease-out; }
@keyframes slidel { from { opacity: .4; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes slider { from { opacity: .4; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view.slide-l, .view.slide-r { animation: none; } }

.tour { position: fixed; inset: 0; z-index: 120; background: color-mix(in srgb, var(--ink) 55%, transparent); display: grid; place-items: center; padding: 16px; }
.tour-card { width: min(420px, 100%); background: var(--surface); border-radius: 18px; padding: 18px 16px 14px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.tour-pages { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.tour-pages::-webkit-scrollbar { display: none; }
.tour-page { flex: 0 0 100%; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 6px 8px; }
.tour-page p { color: var(--ink-2); font-size: 15px; }
.tour-ic { width: 64px; height: 64px; border-radius: 18px; background: var(--accent-wash); color: var(--accent); display: grid; place-items: center; }
.tour-ic svg { width: 34px; height: 34px; }
.tour-dots { display: flex; justify-content: center; gap: 6px; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.tour-dots i.on { background: var(--accent); width: 20px; border-radius: 4px; }
.taps.wrap5 { container-type: inline-size; }
@media (max-width: 640px) {
  .taps.wrap5 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .taps.wrap5 .tap { grid-column: span 2; }
  .taps.wrap5 .tap:nth-child(n+4) { grid-column: span 3; }
}
details.day.is-today[open] > summary.day-head { border-color: transparent; }
.field > .found-tag { align-self: flex-start; margin: 0 0 2px; }
b.chk { color: var(--warn); text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
/* with a sheet open, messages show at the top so they never cover its buttons */
body:has(#sheetRoot .sheet) .toast { top: calc(env(safe-area-inset-top, 0px) + 12px); bottom: auto; }
.banner-btns { display: flex; flex-direction: column; gap: 6px; flex: none; margin-left: auto; }
.banner-btns .btn { margin-left: 0; }

/* an outdoor activity without a map: a short line saying why */
.nomap { margin: 10px 0 0; }

/* Settings → Events: the name and details on top, the buttons underneath (long race names
   used to squeeze down to one letter a line beside three buttons) */
.ev-row { display: grid; gap: 8px; min-width: 0; }
.ev-main { min-width: 0; overflow-wrap: anywhere; }
.ev-main b { display: block; }
.ev-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.row.between > .grow { flex: 1 1 140px; } /* text beside buttons wraps above them rather than squeezing */
.wp-tiles-dim .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85) saturate(.6); }

/* paywall: yearly or monthly */
.plan-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 14px; min-height: 92px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.plan-opt b { font-size: 15px; }
.plan-opt span { font-size: 17px; font-weight: 700; }
.plan-opt small { color: var(--ink-2); font-size: 12.5px; }
.plan-opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-wash); box-shadow: inset 0 0 0 1.5px var(--accent); }
.plan-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
