/* KARB Endurance design system.
   Warm ivory paper, charcoal ink, KARB orange; a night theme on charcoal.
   Archivo (expanded, echoing the KE wordmark) for display and numbers,
   Geist for text. Tabular numerals for pace, time and distance. */

@font-face { font-family: 'Archivo'; src: url('../assets/fonts/archivo-latin-wdth-normal.woff2') format('woff2-variations'), url('../assets/fonts/archivo-latin-wdth-normal.woff2') format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('../assets/fonts/archivo-latin-wdth-italic.woff2') format('woff2-variations'), url('../assets/fonts/archivo-latin-wdth-italic.woff2') format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-style: italic; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('../assets/fonts/geist-latin-wght-normal.woff2') format('woff2-variations'), url('../assets/fonts/geist-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

/* ───────── Tokens: day ───────── */
:root {
  --paper: #F5F0E6;
  --paper-2: #ECE5D6;
  --paper-3: #E1D8C5;
  --card: #FBF8F2;
  --card-2: #FFFDF9;
  --ink: #202720;
  --ink-2: #464B44;
  --ink-3: #6C6F66;
  --ink-4: #A09F94;
  --line: rgba(32, 39, 32, 0.10);
  --line-2: rgba(32, 39, 32, 0.18);
  --inverse: #202720;
  --inverse-ink: #F5F0E6;
  --inverse-ink-2: rgba(245, 240, 230, 0.66);

  --karb: #FE4902;
  --karb-ink: #C23A06;
  --karb-soft: #FFE1D0;
  --feature: radial-gradient(130% 95% at 100% 0%, rgba(255, 170, 115, 0.55) 0%, rgba(255, 170, 115, 0) 55%),
             radial-gradient(90% 80% at 0% 100%, rgba(60, 14, 2, 0.5) 0%, rgba(60, 14, 2, 0) 62%),
             linear-gradient(158deg, #FF6A20 0%, #F44A05 36%, #C3380A 72%, #7A2207 100%);
  --feature-ink: #FFF6EE;
  --feature-ink-2: rgba(255, 246, 238, 0.76);
  --feature-line: rgba(255, 246, 238, 0.22);

  --run: #E04506;
  --bike: #2C3E73;
  --swim: #1E5D62;
  --strength: #9E6656;
  --rest: #8A8C82;
  /* Gym split and race colours for dots and side bars (see core/tone.js) */
  --lower: #94604F;
  --upper: #4A5B70;
  --glute: #93425B;
  --arms: #86692D;
  --full: #3B3935;
  --plyo: #5F6E20;
  --race: #B8862A;
  /* Dark text on cream buttons inside a coloured banner, and the smoked panel tint */
  --feature-deep: #7A2A10;
  --feature-deeper: #3A1404;
  --feature-smoke: 40 14 4;
  --tone-accent: var(--karb);

  --good: #2F6B45;
  --good-soft: #DDE9DA;
  --warn: #9A5B00;
  --warn-ink: #5C3A04;
  --warn-soft: #F6E3C4;
  --bad: #A3271B;
  --bad-soft: #F6DAD4;

  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --shadow: 0 1px 0 rgba(32, 39, 32, 0.03), 0 10px 30px -18px rgba(32, 39, 32, 0.28);
  --shadow-lg: 0 30px 60px -30px rgba(122, 34, 7, 0.55), 0 8px 18px -10px rgba(122, 34, 7, 0.35);
  --glass: color-mix(in srgb, var(--card) 78%, transparent);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --rail: 252px;
  color-scheme: light;
}

/* ───────── Tokens: night ───────── */
:root[data-theme="dark"] {
  --paper: #0F120F;
  --paper-2: #171B17;
  --paper-3: #222722;
  --card: #191D19;
  --card-2: #1E231E;
  --ink: #F2EDE2;
  --ink-2: #CBC7BC;
  --ink-3: #979A90;
  --ink-4: #62665D;
  --line: rgba(242, 237, 226, 0.08);
  --line-2: rgba(242, 237, 226, 0.15);
  --inverse: #F2EDE2;
  --inverse-ink: #151915;
  --inverse-ink-2: rgba(21, 25, 21, 0.62);

  --karb-ink: #FF8248;
  --karb-soft: rgba(254, 73, 2, 0.17);
  --feature: radial-gradient(130% 95% at 100% 0%, rgba(255, 150, 90, 0.38) 0%, rgba(255, 150, 90, 0) 55%),
             radial-gradient(90% 80% at 0% 100%, rgba(20, 5, 0, 0.6) 0%, rgba(20, 5, 0, 0) 62%),
             linear-gradient(158deg, #F2601C 0%, #D9420A 36%, #9E2E08 72%, #561805 100%);

  --run: #FF6A2B;
  --bike: #7E95D6;
  --swim: #5BB3B8;
  --strength: #D49A87;
  --rest: #7C7F76;
  --lower: #D49A87;
  --upper: #9FB2C8;
  --glute: #E39AAE;
  --arms: #D4B870;
  --full: #B3AEA5;
  --plyo: #B9CB66;
  --race: #E3B25A;

  --good: #86CFA0;
  --good-soft: rgba(110, 190, 140, 0.14);
  --warn: #F2B65C;
  --warn-ink: #F6D29B;
  --warn-soft: rgba(242, 170, 60, 0.13);
  --bad: #F4907F;
  --bad-soft: rgba(244, 120, 100, 0.14);

  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 14px 32px -20px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 30px 60px -28px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 120, 60, 0.08);
  --glass: color-mix(in srgb, var(--card) 80%, transparent);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15.5px; line-height: 1.5; letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-wrap: break-word;
  transition: background-color .25s ease, color .25s ease;
}
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
::selection { background: var(--karb-soft); }
:focus-visible { outline: 2px solid var(--karb-ink); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.display { font-family: var(--display); font-stretch: 112%; font-weight: 650; letter-spacing: -0.02em; }
h1, h2, h3 { font-family: var(--display); font-weight: 650; font-stretch: 112%; letter-spacing: -0.025em; margin: 0; line-height: 1.04; }
h1 { font-size: clamp(27px, 5.6vw, 36px); }
h2 { font-size: clamp(20px, 3.8vw, 24px); letter-spacing: -0.02em; }
h3 { font-size: 17px; font-stretch: 108%; letter-spacing: -0.015em; line-height: 1.15; }
p { margin: 0; }
.eyebrow { font-family: var(--sans); font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.stack > * + * { margin-top: var(--gap, 12px); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.hide { display: none !important; }
.ico.rot { transform: rotate(90deg); }
.ico.inline { display: inline-block; vertical-align: -2px; margin-right: 3px; }

/* Logos swap with the theme */
.on-dark { display: none !important; }
:root[data-theme="dark"] .on-light { display: none !important; }
:root[data-theme="dark"] .on-dark { display: block !important; }

/* ───────── Shell ───────── */
.app { min-height: 100dvh; }
.rail { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px; background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.3) blur(16px); -webkit-backdrop-filter: saturate(1.3) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color .2s ease;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .mark { height: 18px; width: auto; }
.topbar .date { font-family: var(--display); font-stretch: 110%; font-weight: 650; font-size: 16px; line-height: 1.05; letter-spacing: -0.01em; }
.topbar .date small { display: block; font-family: var(--sans); font-stretch: 100%; font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-top: 3px; }
.iconbtn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; color: var(--ink); text-decoration: none; flex: none; transition: border-color .15s, background .15s;
}
.iconbtn:hover { border-color: var(--line-2); }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: var(--inverse); color: var(--inverse-ink); font-family: var(--display); font-stretch: 112%; font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; flex: none; }
.avatar.lg { width: 44px; height: 44px; font-size: 14px; }
.main { padding: 4px 16px calc(112px + var(--safe-b)); max-width: 1240px; margin: 0 auto; container: main / inline-size; min-width: 0; }
.col { min-width: 0; }

/* Floating tab bar */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px; border-radius: 24px; background: var(--glass);
  backdrop-filter: saturate(1.4) blur(20px); -webkit-backdrop-filter: saturate(1.4) blur(20px);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.tabbar a { display: grid; justify-items: center; gap: 1px; padding: 7px 0 6px; font-size: 11px; font-weight: 550; color: var(--ink-3); text-decoration: none; border-radius: 18px; position: relative; transition: background .15s, color .15s; }
.tabbar a[aria-current="page"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.tabbar a[aria-current="page"] .ico { color: var(--karb-ink); }
.tabbar .badge { position: absolute; top: 3px; left: calc(50% + 7px); }
@media (min-width: 600px) { .tabbar { left: 50%; right: auto; width: 460px; transform: translateX(-50%); } .main { padding-left: 28px; padding-right: 28px; } }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--karb); color: #fff; font-size: 10.5px; font-weight: 650; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }


.theme-toggle { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); }
.theme-toggle button { width: 34px; height: 30px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; }
.theme-toggle button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: var(--rail) 1fr; }
  .rail {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: 26px 16px 18px;
    border-right: 1px solid var(--line); background: var(--paper-2);
  }
  .rail .lockup { width: 158px; height: auto; margin: 4px 10px 6px; }
  .rail .tag { font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-3); margin: 0 10px 30px; font-weight: 600; }
  .rail nav { display: grid; gap: 2px; }
  .rail nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font-weight: 550; transition: background .15s;
  }
  .rail nav a .n { font-family: var(--display); font-stretch: 115%; font-style: italic; font-weight: 700; font-size: 11px; color: var(--ink-4); width: 18px; font-variant-numeric: tabular-nums; }
  .rail nav a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
  .rail nav a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
  .rail nav a[aria-current="page"] .n { color: var(--karb-ink); }
  .rail .foot { margin-top: auto; display: grid; gap: 10px; }
  .rail .who { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
  .rail .who .grow > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar { display: none; }
  .tabbar { display: none; }
  .main { padding: 30px 44px 64px; }
}
@media (min-width: 960px) and (max-width: 1199px) { :root { --rail: 220px; } .main { padding: 26px 28px 56px; } }

/* ───────── Buttons & inputs ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--inverse); background: var(--inverse); color: var(--inverse-ink); font-weight: 600; font-size: 14.5px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--ink-3); }
.btn.orange { background: var(--karb); border-color: var(--karb); color: #fff; }
.btn.on-feature { background: var(--feature-ink); color: var(--feature-deeper); border-color: var(--feature-ink); }
.btn.on-feature.ghost { background: rgba(255, 246, 238, 0.08); color: var(--feature-ink); border-color: rgba(255, 246, 238, .38); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--karb-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; min-width: 0; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card-2);
  font-size: 16px; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--ink-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--karb) 22%, transparent); }
.hint { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.grid2 > * { min-width: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg > * { flex: none; white-space: nowrap; }
.seg button, .seg a { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 550; color: var(--ink-3); cursor: pointer; min-height: 34px; text-decoration: none; display: inline-flex; align-items: center; }
.seg button[aria-pressed="true"], .seg a[aria-current="page"], .seg a[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale.ten { grid-template-columns: repeat(10, 1fr); gap: 4px; }
.scale button {
  min-height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card-2); font-family: var(--display); font-weight: 650; cursor: pointer; font-variant-numeric: tabular-nums;
}
.scale button[aria-pressed="true"] { background: var(--inverse); color: var(--inverse-ink); border-color: var(--inverse); }
.scale-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.toggle { position: relative; width: 46px; height: 28px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: var(--paper-3); transition: background .15s; pointer-events: none; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.toggle input:checked + span { background: var(--karb); }
.toggle input:checked + span::after { transform: translateX(18px); }
.toggle input:focus-visible + span { outline: 2px solid var(--karb-ink); outline-offset: 2px; }

/* ───────── Cards, chips, lists ───────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.paper { background: transparent; box-shadow: none; }
.card h3 + * { margin-top: 8px; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 21px; }
.section-head > :last-child { white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.chip .ico { width: 13px; height: 13px; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.karb { background: var(--karb-soft); color: var(--karb-ink); border-color: transparent; }
.chip.ink { background: var(--inverse); color: var(--inverse-ink); border-color: var(--inverse); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.list { display: grid; }
.list > .li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.list > .li:first-child { border-top: 0; }
a.li:hover .li-title { text-decoration: underline; text-underline-offset: 3px; }
.li-title { font-weight: 600; }
.li-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.empty { padding: 20px; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--ink-3); text-align: center; font-size: 14px; }

/* ───────── Week strip ───────── */
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin: 2px 0 14px; padding: 5px; background: var(--paper-2); border-radius: 20px; border: 1px solid var(--line); }
.weekstrip a { display: grid; justify-items: center; gap: 4px; padding: 7px 0 8px; border-radius: 15px; text-decoration: none; color: var(--ink-2); transition: background .15s; }
.weekstrip a:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.weekstrip .dw { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 650; color: var(--ink-3); }
.weekstrip .dn { font-family: var(--display); font-stretch: 105%; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.weekstrip .marks { display: flex; gap: 3px; height: 6px; align-items: center; }
.weekstrip .m { width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--m, var(--ink-4)); }
.weekstrip .m.done { background: var(--m, var(--ink-2)); border-color: var(--m, var(--ink-2)); }
.weekstrip .m.key { border-color: var(--karb); }
.weekstrip .m.key.done { background: var(--karb); }
.weekstrip .m.missed { border-color: var(--bad); border-style: dotted; }
.weekstrip .m.rest { width: 8px; height: 2px; border-radius: 2px; border: 0; background: var(--ink-4); }
.weekstrip a[aria-current="date"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.weekstrip a.today .dn { color: var(--karb-ink); }
.weekstrip a.today .dw { color: var(--karb-ink); }

/* ───────── Featured session ───────── */
.feature {
  position: relative; overflow: hidden; border-radius: 28px; padding: 20px 20px 18px; color: var(--feature-ink);
  background: var(--feature); box-shadow: var(--shadow-lg); isolation: isolate; container-type: inline-size; min-width: 0;
}
/* Track-lane flourish from the KE mark */
.feature::before {
  content: ''; position: absolute; right: -18px; top: 14px; width: 120px; height: 52px; z-index: -1; opacity: .11; pointer-events: none;
  background:
    linear-gradient(var(--feature-ink), var(--feature-ink)) 20px 0 / 100px 10px no-repeat,
    linear-gradient(var(--feature-ink), var(--feature-ink)) 10px 21px / 92px 10px no-repeat,
    linear-gradient(var(--feature-ink), var(--feature-ink)) 0 42px / 84px 10px no-repeat;
  transform: skewX(-28deg);
}
.feature::after { content: ''; position: absolute; inset: 0; background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="160" height="160"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2"/></filter><rect width="160" height="160" filter="url(%23n)" opacity=".07"/></svg>'); mix-blend-mode: overlay; pointer-events: none; z-index: -1; }
.feature.paper { background: var(--card); color: var(--ink); box-shadow: var(--shadow); border: 1px solid var(--line); }
.feature.paper::before { display: none; }
/* Session colours (core/tone.js). Running keeps the default KARB orange. Each tone swaps the
   banner gradient and the dark text used on cream buttons, so the Today banner, the session page
   and the set logger all follow the session. Tones only set variables; .feature paints them. */
.tone-strength, .tone-lower, .feature.strength { --feature: radial-gradient(130% 95% at 100% 0%, rgba(240, 190, 170, 0.4) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(158deg, #B67C6A 0%, #94604F 45%, #55311F 100%); --feature-deep: #5A3020; --feature-deeper: #2E170E; --feature-smoke: 40 18 10; --tone-accent: #94604F; }
.tone-upper { --feature: radial-gradient(130% 95% at 100% 0%, rgba(190, 210, 235, 0.36) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(158deg, #6B7E95 0%, #4A5B70 45%, #1F2834 100%); --feature-deep: #2A3646; --feature-deeper: #141B24; --feature-smoke: 12 18 28; --tone-accent: #4A5B70; }
.tone-glute { --feature: radial-gradient(130% 95% at 100% 0%, rgba(255, 180, 200, 0.36) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(158deg, #C0677F 0%, #93425B 45%, #4B1D2D 100%); --feature-deep: #5E2236; --feature-deeper: #2E0F1A; --feature-smoke: 40 10 20; --tone-accent: #93425B; }
.tone-arms { --feature: radial-gradient(130% 95% at 100% 0%, rgba(240, 215, 150, 0.4) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(158deg, #B2944A 0%, #86692D 45%, #433310 100%); --feature-deep: #4E3B12; --feature-deeper: #271D08; --feature-smoke: 34 24 6; --tone-accent: #86692D; }
.tone-full { --feature: radial-gradient(130% 95% at 100% 0%, rgba(238, 124, 66, 0.4) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(158deg, #5E5B56 0%, #3B3935 45%, #1A1917 100%); --feature-deep: #2A2826; --feature-deeper: #141312; --feature-smoke: 14 13 12; --tone-accent: #5E5B56; }
.tone-plyo { --feature: radial-gradient(130% 95% at 100% 0%, rgba(220, 235, 140, 0.36) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(158deg, #8E9F3C 0%, #5F6E20 45%, #2A320A 100%); --feature-deep: #36400F; --feature-deeper: #1A2005; --feature-smoke: 22 28 6; --tone-accent: #5F6E20; }
.tone-bike, .feature.bike { --feature: radial-gradient(130% 95% at 100% 0%, rgba(170, 190, 255, 0.36) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(158deg, #4259A0 0%, #2C3E73 45%, #121B3D 100%); --feature-deep: #1F2D57; --feature-deeper: #0E152B; --feature-smoke: 10 16 36; --tone-accent: #2C3E73; }
.tone-swim, .feature.swim { --feature: radial-gradient(130% 95% at 100% 0%, rgba(150, 230, 230, 0.34) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(158deg, #2F7E84 0%, #1E5D62 45%, #0C3235 100%); --feature-deep: #174A4E; --feature-deeper: #0A2426; --feature-smoke: 6 26 28; --tone-accent: #1E5D62; }
.tone-race { --feature: radial-gradient(130% 95% at 100% 0%, rgba(227, 160, 62, 0.5) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(158deg, #2C2A26 0%, #181715 45%, #0A0A09 100%); --feature-deep: #2C2A26; --feature-deeper: #0A0A09; --feature-smoke: 0 0 0; --tone-accent: #B8862A; }
.tone-brick, .feature.brick { --feature: radial-gradient(130% 95% at 100% 0%, rgba(255, 170, 115, 0.4) 0%, rgba(0, 0, 0, 0) 55%), linear-gradient(120deg, #2C3E73 0%, #4259A0 35%, #D9542A 75%, #7C2A14 100%); --feature-deep: #1F2D57; --feature-deeper: #0E152B; --tone-accent: #2C3E73; }
.feature.tone-race .tag { background: rgba(227, 178, 90, 0.22); color: #F4D9A0; }
.feature .eyebrow { color: var(--feature-ink-2); }
.feature.paper .eyebrow { color: var(--ink-3); }
.feature .title { font-family: var(--display); font-stretch: 114%; font-weight: 700; font-size: clamp(25px, 9.4cqi, 48px); line-height: 1; letter-spacing: -0.035em; margin-top: 10px; text-wrap: balance; }
.feature .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 10px; flex-wrap: wrap; }
.feature .head .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.feature .purpose { margin-top: 8px; font-size: 14.5px; color: var(--feature-ink-2); max-width: 46ch; }
.feature.paper .purpose { color: var(--ink-2); }
.feature .nums { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 clamp(14px, 5cqi, 24px); margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--feature-line); }
.feature.paper .nums { border-top-color: var(--line); }
.bignum { font-family: var(--display); font-stretch: 94%; font-size: clamp(24px, 10.2cqi, 48px); font-weight: 600; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bignum small { font-family: var(--sans); font-size: 0.34em; font-weight: 550; letter-spacing: 0; margin-left: 3px; opacity: .8; }
.biglabel { font-size: 12px; margin-top: 7px; color: var(--feature-ink-2); }
.feature.paper .biglabel { color: var(--ink-3); }
.feature .divider { border-left: 1px solid var(--feature-line); padding-left: clamp(14px, 5cqi, 24px); min-width: 0; }
@container (max-width: 290px) {
  .feature .nums { grid-template-columns: 1fr; }
  .feature .divider { border-left: 0; padding-left: 0; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--feature-line); }
}
.feature.paper .divider { border-left-color: var(--line); }
.feature .profile { margin-top: 16px; }
.feature .actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.feature .tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: rgba(255,246,238,.16); color: var(--feature-ink); backdrop-filter: blur(6px); }
.feature.paper .tag { background: var(--paper-2); color: var(--ink-2); }
/* Weekly mileage: run km by day, orange once the week is rebalanced */
.feature.mileage { --mi: var(--feature-ink); margin-top: 14px; }
.feature.mileage.paper { --mi: var(--ink); }
.mi-total { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.mi-total .bignum { font-size: clamp(40px, 15cqi, 64px); font-stretch: 110%; font-weight: 800; }
.mi-of { font-family: var(--display); font-weight: 600; font-size: 18px; opacity: .8; font-variant-numeric: tabular-nums; }
.mi-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--mi) 22%, transparent); }
.mi-day { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mi-col { height: 84px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.mi-col i, .mi-legend i { display: block; border-radius: 5px; }
.mi-col .done, .mi-legend .done { background: var(--mi); }
.mi-col .extra { background: color-mix(in srgb, var(--mi) 60%, transparent); }
.mi-col .plan, .mi-legend .plan { background: color-mix(in srgb, var(--mi) 30%, transparent); }
.mi-col .trim, .mi-legend .trim { border: 1.5px dashed color-mix(in srgb, var(--mi) 72%, transparent); box-sizing: border-box; }
.mi-col .none { height: 3px; background: color-mix(in srgb, var(--mi) 16%, transparent); }
.mi-d { text-align: center; font-size: 11px; font-weight: 600; color: color-mix(in srgb, var(--mi) 72%, transparent); }
.mi-day.today .mi-d { color: var(--mi); text-decoration: underline; text-underline-offset: 3px; }
.mi-k { text-align: center; font-family: var(--display); font-size: 12px; font-weight: 700; margin-top: -3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mi-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: color-mix(in srgb, var(--mi) 76%, transparent); }
.mi-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mi-legend i { width: 9px; height: 9px; border-radius: 3px; }
.mi-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.feature [data-adjusted] s { opacity: .7; }
.rb-rows { list-style: none; margin: 8px 0 0; padding: 0; }
.rb-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.rb-day { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--paper-2); color: var(--ink-2); }
.rb-row.changed .rb-day { background: var(--karb-soft); color: var(--karb-ink); }
.rb-row.key .rb-day { background: var(--inverse); color: var(--inverse-ink); }
.rb-row.done .rb-day { background: var(--good-soft); color: var(--good); }
.rb-why { display: block; font-size: 13px; color: var(--ink-3); line-height: 1.4; }
.rb-row.key .rb-why { color: var(--karb-ink); }
.rb-km { text-align: right; font-family: var(--display); font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.rb-row.changed .rb-km { color: var(--karb-ink); }
.rb-km s { display: block; font-family: var(--sans); font-weight: 500; font-size: 12px; color: var(--ink-3); }
.also { margin-top: 10px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: inherit; transition: border-color .15s; }
.also:hover { border-color: var(--line-2); }
.also .sw { width: 4px; align-self: stretch; border-radius: 4px; }

/* ───────── Interval profile ───────── */
.prof { position: relative; }
.prof svg { width: 100%; height: auto; overflow: visible; }
.prof .lbls { position: relative; height: 15px; margin-top: 5px; }
.prof .lbls span { position: absolute; top: 0; font-size: 10px; font-weight: 550; white-space: nowrap; opacity: .78; font-variant-numeric: tabular-nums; }
.prof-legend { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; margin-top: 8px; opacity: .78; }

/* ───────── Today layout ───────── */
.today-wrap { max-width: 760px; }
.today-grid { display: grid; gap: 14px; }
.today-grid > * { min-width: 0; }
.today-training { display: grid; gap: 12px; }
.training-overview { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 4px 2px 2px; }
.training-overview h1 { margin-top: 5px; font-size: clamp(27px, 8vw, 38px); font-weight: 740; font-stretch: 115%; letter-spacing: -.035em; }
.training-overview p { margin-top: 6px; color: var(--ink-3); font-size: 14px; font-weight: 520; }
.day-progress { position: relative; width: 56px; height: 56px; flex: none; color: var(--good); }
.day-progress > svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.day-progress > svg circle { fill: none; stroke-width: 4; }
.day-progress .track { stroke: var(--paper-3); }
.day-progress .value { stroke: currentColor; stroke-linecap: round; stroke-dasharray: var(--progress) 100; transition: stroke-dasharray .35s ease; }
.day-progress > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; color: var(--ink); }
.day-progress b { font-family: var(--display); font-size: 17px; line-height: 1; }
.day-progress small { margin-top: 5px; font-size: 10px; color: var(--ink-3); }
.day-progress .ico { color: var(--good); }
.training-sessions { display: grid; gap: 12px; }
.today-session-card { transition: transform .18s ease, box-shadow .18s ease; }
.today-session-card.is-next { box-shadow: var(--shadow-lg), 0 0 0 2px color-mix(in srgb, var(--tone-accent) 54%, var(--feature-ink)); }
.today-session-card.is-complete { box-shadow: 0 18px 42px -28px rgba(20, 24, 20, .66); }
.today-session-card .session-exercises { margin: 14px 0 0; padding-left: 18px; font-size: 13.5px; opacity: .92; }
.today-session-card .session-exercises li + li { margin-top: 3px; }
.today-session-card .session-exercises span { opacity: .75; }
.today-session-card .session-exercises .more { list-style: none; opacity: .75; }
.today-session-card.session-balanced, .today-session-card.session-compact { padding: 18px 20px; }
.today-session-card.session-balanced .title, .today-session-card.session-compact .title { font-size: clamp(25px, 8.5cqi, 38px); margin-top: 8px; }
.today-session-card.session-balanced .nums, .today-session-card.session-compact .nums { margin-top: 14px; padding-top: 12px; }
.today-session-card.session-balanced .bignum, .today-session-card.session-compact .bignum { font-size: clamp(26px, 9.5cqi, 40px); }
.today-session-card.session-compact .purpose[data-done-line] { font-size: 13px; }
.today-session-card.session-balanced .actions, .today-session-card.session-compact .actions { margin-top: 14px; }
.today-session-card.session-balanced .btn, .today-session-card.session-compact .btn { min-height: 42px; padding-inline: 16px; font-size: 13.5px; }
@container main (max-width: 420px) {
  .today-session-card .actions .btn { flex: 1 1 145px; }
  .today-session-card.session-compact .purpose[data-done-line] { display: none; }
}
@media (min-width: 600px) { .feature { padding: 26px 26px 22px; border-radius: 30px; } }
@container main (min-width: 600px) { .feature::before { right: -10px; top: 22px; transform: skewX(-28deg) scale(1.4); transform-origin: top right; } }
@container main (min-width: 880px) {
  .today-wrap { max-width: none; }
  .today-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: 22px; }
  .today-grid .side { position: sticky; top: 24px; }
  .feature { padding: 30px 30px 26px; border-radius: 32px; }
}
.verdict { display: flex; align-items: center; gap: 10px; }
.verdict .vi { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.verdict.keep .vi { background: var(--good-soft); color: var(--good); }
.verdict.proposal .vi, .verdict.pending .vi { background: var(--warn-soft); color: var(--warn); }
.verdict.rest .vi { background: var(--paper-2); color: var(--ink-2); }
.verdict h3 { font-size: 21px; }
.informs .summary { margin-top: 10px; font-size: 15px; color: var(--ink-2); }
.evidence { margin-top: 14px; display: grid; gap: 6px; }
.ev { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: start; padding: 11px 12px; border-radius: 14px; background: var(--paper); text-decoration: none; color: inherit; border: 1px solid transparent; transition: border-color .15s; }
:root[data-theme="dark"] .ev { background: var(--paper-2); }
a.ev:hover { border-color: var(--line-2); }
.ev .ico { margin-top: 1px; }
.ev.concern .ico { color: var(--warn); }
.ev.supports .ico { color: var(--good); }
.ev.neutral .ico { color: var(--ink-3); }
.ev .t { font-weight: 600; font-size: 13.5px; }
.ev .d { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; font-variant-numeric: tabular-nums; }
.ev .go { color: var(--ink-4); align-self: center; }
.missing { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--warn-ink); font-size: 13.5px; }
.missing ul { margin: 6px 0 0; padding-left: 18px; }
.missing a { color: inherit; font-weight: 600; }
.proposal { border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn-soft) 55%, var(--card)); }
.proposal { container-type: inline-size; min-width: 0; }
.proposal .move { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; margin-top: 12px; }
.proposal .slot { padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
@container (max-width: 300px) { .proposal .move { grid-template-columns: minmax(0, 1fr); } .proposal .move > span { justify-self: center; transform: rotate(90deg); } }
.proposal .slot .d { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; font-weight: 650; }
.checks { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; }
.checks li { display: flex; gap: 8px; align-items: center; }
.checks .ok { color: var(--good); }
.checks .no { color: var(--bad); }
.checks .na { color: var(--ink-3); }
.weekprev { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; }
.weekprev .c { padding: 6px 2px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); text-align: center; font-size: clamp(9px, 2.6cqi, 11px); min-height: 58px; min-width: 0; overflow-wrap: anywhere; }
.weekprev .c .dw { font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-size: 9.5px; }
.weekprev .c.hard { background: var(--karb-soft); border-color: transparent; }
.weekprev .c.changed { outline: 2px solid var(--warn); outline-offset: -1px; }
.weekprev .c .s { margin-top: 4px; line-height: 1.15; font-weight: 550; }
.ctx { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; margin-top: 12px; }
.ctx a { padding: 12px 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); text-decoration: none; color: inherit; }
:root[data-theme="dark"] .ctx a { background: var(--paper-2); }
.ctx .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); font-weight: 650; }
.ctx .v { font-family: var(--display); font-stretch: 106%; font-weight: 650; margin-top: 5px; font-size: 14.5px; line-height: 1.2; letter-spacing: -0.01em; }
.ctx .s { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

/* ───────── Workout page ───────── */
.pagehead { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.pagehead .grow h1 { margin-top: 3px; }
.pagehead .chip { flex: none; margin-top: 8px; }
.steps { display: grid; gap: 0; }
.step { display: grid; grid-template-columns: 4px 1fr; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step .sw { border-radius: 4px; }
.step .h { font-family: var(--display); font-stretch: 106%; font-weight: 650; letter-spacing: -0.01em; }
.step .t { color: var(--ink-2); margin-top: 2px; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.step .n { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.pvc-wrap { container-type: inline-size; }
.pvc { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--card); font-size: clamp(12.5px, 4cqi, 14.5px); }
.pvc > div { padding: 10px clamp(8px, 3cqi, 14px); border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; min-width: 0; display: flex; align-items: center; gap: 5px; }
.pvc > div:nth-child(-n+3) { border-top: 0; background: var(--paper-2); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 650; color: var(--ink-3); }
.pvc .k { color: var(--ink-3); font-size: 0.92em; }
.pvc .v { white-space: nowrap; }
.pvc .over { color: var(--warn); font-weight: 650; }
.pvc .over .ico { flex: none; }
.actionbar { display: flex; gap: 8px; flex-wrap: wrap; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--paper-2); font-size: 13.5px; color: var(--ink-2); }
.notice.coach { background: color-mix(in srgb, var(--ink) 6%, var(--card)); border-left: 3px solid var(--ink); }
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice.good { background: var(--good-soft); color: var(--good); }
.two-col { display: grid; gap: 16px; }
.two-col > * { min-width: 0; }
@container main (min-width: 880px) { .two-col { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; } }

/* ───────── Plan ───────── */
.plan-top { display: grid; gap: 10px; grid-template-columns: 1fr; }
@container main (min-width: 620px) { .plan-top { grid-template-columns: 1.2fr 1fr; } }
.plan-top > * { min-width: 0; }
.race { background: var(--inverse); color: var(--inverse-ink); border-color: var(--inverse); position: relative; overflow: hidden; }
.race::after { content: ''; position: absolute; right: -20px; bottom: -30px; width: 140px; height: 90px; opacity: .1; background: linear-gradient(var(--karb), var(--karb)) 20px 0 / 120px 16px no-repeat, linear-gradient(var(--karb), var(--karb)) 10px 32px / 110px 16px no-repeat, linear-gradient(var(--karb), var(--karb)) 0 64px / 100px 16px no-repeat; transform: skewX(-24deg); }
.race .eyebrow { color: var(--inverse-ink-2); }
.race .big { font-family: var(--display); font-stretch: 112%; font-weight: 700; font-size: 24px; line-height: 1.05; letter-spacing: -0.02em; margin-top: 8px; }
.agenda { display: grid; gap: 8px; }
.aday { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.aday.today { border-color: var(--karb); box-shadow: 0 0 0 1px var(--karb) inset; }
.aday .dl { text-align: center; }
.aday .dl .dw { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 650; color: var(--ink-3); }
.aday .dl .dn { font-family: var(--display); font-stretch: 105%; font-weight: 650; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sess { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 6px 0; }
.sess + .sess { border-top: 1px dashed var(--line); }
.sess .sw { width: 4px; align-self: stretch; border-radius: 4px; min-height: 34px; }
.sess .tt { font-weight: 600; }
.sess .grow { min-width: 0; }
.sess .chip { flex: none; }
@container main (max-width: 380px) { .sess .chip:not(.good):not(.bad):not(.warn):not(.ink) { display: none; } }
.sess .ss { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sess.skipped .tt, .sess.cancelled .tt { text-decoration: line-through; color: var(--ink-3); }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month .h { font-size: 10.5px; text-align: center; font-weight: 650; color: var(--ink-3); letter-spacing: .1em; text-transform: uppercase; padding-bottom: 4px; }
.month a { min-height: 64px; padding: 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: inherit; display: grid; align-content: start; gap: 4px; }
.month a.out { opacity: .4; }
.month a.today { border-color: var(--karb); }
.month .d { font-family: var(--display); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.month .bars { display: grid; gap: 2px; }
.month .bars i { display: block; height: 5px; border-radius: 3px; }
.month .bars i.planned { background: transparent !important; border: 1.5px solid currentColor; height: 6px; }
.month .bars i.skipped, .month .bars i.missed { background: repeating-linear-gradient(90deg, var(--ink-4) 0 3px, transparent 3px 5px) !important; }
@container main (min-width: 640px) { .month a { min-height: 88px; } .month .lbl { display: block; } }
.month a { min-width: 0; }
.month .lbl { display: none; font-size: 11px; line-height: 1.2; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ───────── Charts ───────── */
.chart svg { width: 100%; height: auto; }
.chart text { font-family: var(--sans); font-size: 9.5px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .axis { stroke: var(--line-2); }
.chart .grid { stroke: var(--line-2); stroke-dasharray: 2 4; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@container main (min-width: 640px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { min-width: 0; padding: 14px 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); container-type: inline-size; }
.kpi .v { font-family: var(--display); font-stretch: 96%; font-size: clamp(21px, 17cqi, 32px); white-space: nowrap; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.05; margin-top: 8px; }
.kpi .v small { font-family: var(--sans); font-size: 13px; margin-left: 3px; color: var(--ink-3); letter-spacing: 0; font-weight: 550; }
.kpi .s { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.kpi svg { max-width: 45%; height: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prog-grid { display: grid; gap: 14px; }
.prog-grid > * { min-width: 0; }
@container main (min-width: 760px) { .prog-grid { grid-template-columns: 1fr 1fr; } }

/* ───────── Messages ───────── */
.thread { display: grid; gap: 10px; }
.msg { max-width: 640px; padding: 12px 14px; border-radius: 18px 18px 18px 6px; background: var(--card); border: 1px solid var(--line); }
.msg.mine { margin-left: auto; background: var(--paper-2); border-radius: 18px 18px 6px 18px; }
.msg.coach { border-left: 3px solid var(--karb); }
.msg .who { font-size: 11.5px; font-weight: 650; color: var(--ink-3); display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.msg .att { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.composer { position: sticky; bottom: calc(86px + var(--safe-b)); margin-top: 16px; padding: 10px; border-radius: 22px; background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
@media (min-width: 960px) { .composer { bottom: 20px; } }
.composer textarea { border: 0; min-height: 60px; background: transparent; padding: 6px; width: 100%; resize: none; font-size: 16px; }
.composer textarea:focus { outline: none; }

/* ───────── Sheets / modals ───────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 10, 0.45); display: grid; align-items: end; animation: fade .15s ease; backdrop-filter: blur(2px); }
.sheet { background: var(--paper); border-radius: 28px 28px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); max-height: 92dvh; overflow: auto; animation: rise .22s cubic-bezier(.2,.8,.2,1); border-top: 1px solid var(--line); }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: -6px auto 12px; }
@media (min-width: 720px) {
  .sheet-backdrop { align-items: center; justify-items: center; }
  .sheet { width: min(640px, 92vw); border-radius: 28px; border: 1px solid var(--line); }
  .sheet.wide { width: min(980px, 94vw); }
  .sheet .grab { display: none; }
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 80; background: var(--inverse); color: var(--inverse-ink); padding: 12px 16px; border-radius: 14px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow); max-width: min(92vw, 520px); animation: rise .2s ease; }
@media (min-width: 960px) { .toast { bottom: 28px; } }
a.toast { display: block; text-decoration: none; cursor: pointer; }
.install-steps { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12.5px; margin: 2px 0; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.passkey-list { margin-top: 10px; }
.also > .ico { flex: none; }

/* ───────── Coach workspace ───────── */
.roster { display: grid; gap: 10px; }
@container main (min-width: 640px) { .roster { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; } }
.ath > * { min-width: 0; }
.ath { display: grid; gap: 12px; padding: 16px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.ath:hover { border-color: var(--line-2); transform: translateY(-1px); }
.ath .nm { font-family: var(--display); font-stretch: 112%; font-weight: 700; font-size: 19px; line-height: 1.05; letter-spacing: -0.02em; }
.ath .today { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--paper-2); }
.planner { display: grid; gap: 10px; }
@container main (min-width: 560px) { .planner { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
@container main (min-width: 1040px) { .planner { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; } }
.pday { min-width: 0; border-radius: 18px; background: var(--paper-2); border: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; align-content: start; min-height: 120px; }
.pday.today { border-color: var(--karb); }
.pday .hd { display: flex; justify-content: space-between; align-items: baseline; }
.pday .hd b { font-family: var(--display); font-stretch: 106%; font-weight: 650; font-size: 15px; }
.pcard { min-width: 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: grid; gap: 6px; }
.pcard.draft { border-style: dashed; border-color: var(--line-2); }
.pcard .t { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.pcard .s { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pcard .spread { flex-wrap: wrap; gap: 4px; }
.pcard .tools { display: flex; gap: 4px; }
.pcard .tools button { border: 0; background: var(--paper-2); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.addbtn { border: 1.5px dashed var(--line-2); background: transparent; border-radius: 12px; min-height: 40px; color: var(--ink-3); font-weight: 600; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.addbtn:hover { color: var(--ink); border-color: var(--ink-3); }
.publishbar { position: sticky; bottom: calc(86px + var(--safe-b)); z-index: 10; display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 14px 12px 18px; border-radius: 20px; background: var(--inverse); color: var(--inverse-ink); margin-top: 16px; box-shadow: var(--shadow); flex-wrap: wrap; font-size: 14px; }
@media (min-width: 960px) { .publishbar { bottom: 16px; } }
.lib-row { display: grid; grid-template-columns: 4px 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; color: inherit; }
.lib-row:hover .t { text-decoration: underline; text-underline-offset: 3px; }
.lib-row .sw { align-self: stretch; border-radius: 4px; }
.lib-row .t { font-weight: 600; }
.lib-row .s { font-size: 12.5px; color: var(--ink-3); }
.queue-item { display: grid; gap: 10px; min-width: 0; }
.queue-item > * { min-width: 0; }
.stepedit { display: grid; gap: 8px; }
.stepedit .se { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; align-items: end; padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.stepedit .se.rep { grid-template-columns: 1fr; border-color: var(--line-2); }
.stepedit .se .input { min-height: 40px; padding: 6px 10px; font-size: 15px; }
.stepedit label { font-size: 11px; color: var(--ink-3); font-weight: 650; display: grid; gap: 3px; }

.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(80% 60% at 100% 0%, color-mix(in srgb, var(--karb) 14%, transparent), transparent 60%), var(--paper); }
.signin .box { width: min(460px, 100%); }
.signin .lockup { width: 210px; margin-bottom: 28px; }
.signin h1 { font-size: clamp(32px, 8vw, 44px); font-stretch: 116%; font-weight: 750; letter-spacing: -0.04em; }
.who-card { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); cursor: pointer; width: 100%; text-align: left; color: inherit; transition: border-color .15s, transform .15s; }
.who-card:hover { border-color: var(--ink-3); transform: translateY(-1px); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ───────── Coach: invites and athlete setup ───────── */
.seg label { position: relative; display: inline-flex; }
.seg label input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label span { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 550; color: var(--ink-3); min-height: 34px; display: inline-flex; align-items: center; }
.seg label input:checked + span { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg label input:focus-visible + span { outline: 2px solid var(--karb); outline-offset: 1px; }
.list > .li.center, .list > .li[data-email] { align-items: center; }
.list > .li[data-email] .grow { min-width: 0; }
.list > .li[data-email] .small { overflow-wrap: anywhere; }
.setup { container: setup / inline-size; }
.form-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@container setup (min-width: 520px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span2 { grid-column: span 2; }
}
.calc { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--line); }
#vdot { margin-top: 8px; }
.tbl-wrap { overflow-x: auto; }
.setup-tbl { width: 100%; max-width: 560px; }
.code-in { font-size: 22px; letter-spacing: .3em; font-variant-numeric: tabular-nums; text-align: center; }
.athlete-tabs { scrollbar-width: none; }
.athlete-tabs::-webkit-scrollbar { display: none; }
.athlete-tabs .seg { overflow: visible; max-width: none; }
@container main (max-width: 400px) { .athlete-tabs .seg a { padding: 7px 10px; font-size: 12.5px; } }
.consent-points { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.consent-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.consent-points li svg { flex: none; margin-top: 3px; color: var(--good, var(--karb-ink)); }
.tick { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 14.5px; line-height: 1.45; cursor: pointer; }
.tick input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--ink); }
.tick a { color: var(--karb-ink); font-weight: 600; }
.legal-links { display: flex; gap: 8px; margin-top: 10px; color: var(--ink-3); }
.legal-links a { color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form > .field { flex: 1 1 170px; min-width: 0; }
.inline-form > .btn { flex: none; min-height: 46px; }
.setup-tbl td, .setup-tbl th { padding: 6px 8px; vertical-align: middle; }
.setup-tbl td:first-child, .setup-tbl th:first-child { padding-left: 0; }
.setup-tbl .input { min-height: 40px; padding: 8px 10px; font-variant-numeric: tabular-nums; max-width: 120px; }
.hr-zones summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; padding: 6px 0; }
.hr-zones summary::-webkit-details-marker { display: none; }
.hr-zones summary::before { content: '+'; font-weight: 700; color: var(--ink-3); width: 12px; }
.hr-zones[open] summary::before { content: '–'; }
div.field, fieldset.field { display: grid; gap: 6px; font-size: 13px; font-weight: 550; color: var(--ink-2); }

/* ───────── Legal pages (privacy.html, terms.html) ───────── */
.legal { max-width: 720px; margin: 0 auto; padding: 32px 22px 64px; }
.legal header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 28px; }
.legal header img { height: 36px; width: auto; }
.legal h1 { margin-bottom: 6px; }
.legal h2 { font-size: 20px; margin: 30px 0 10px; }
.legal p, .legal li { font-size: 15.5px; line-height: 1.6; color: var(--ink-2); }
.legal p + p, .legal ul + p { margin-top: 10px; }
.legal ul { padding-left: 20px; margin: 8px 0 0; }
.legal li + li { margin-top: 6px; }
.legal a { color: var(--karb-ink); text-underline-offset: 3px; }
.legal .updated { color: var(--ink-3); font-size: 14px; }
.legal .summary { margin-top: 18px; padding: 16px 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.legal mark.fill { background: var(--warn-soft); color: var(--warn-ink); padding: 0 4px; border-radius: 4px; }
.legal footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }

/* New version ready (the service worker downloaded an update) */
.update-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(88px + var(--safe-b)); z-index: 70; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 16px; border-radius: 18px; background: var(--inverse); color: var(--inverse-ink); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 550; animation: rise .22s cubic-bezier(.2,.8,.2,1);
}
.update-bar .btn { background: var(--karb); border-color: var(--karb); color: #fff; }
@media (min-width: 600px) { .update-bar { left: 50%; right: auto; width: 460px; transform: translateX(-50%); } }
@media (min-width: 960px) { .update-bar { bottom: 24px; } }
