/* Triatlet. Мир продукта: бортик бассейна, дорожки, табло сплитов, стартовый номер.
   Токены — единственный источник цвета; компоненты ниже только ссылаются на них. */
:root {
  --deck: #f5f8fa;          /* фон: кафель бортика */
  --surface: #ffffff;       /* клетки, панели */
  --surface-2: #eef3f6;     /* лёгкий подъём: сплиты, выбранное */
  --ink: #1e2733;           /* неопрен: текст, главная кнопка */
  --ink-2: #5b6775;
  --ink-3: #677382;
  --lane: rgba(20, 35, 50, 0.10);   /* разметка дорожки */
  --lane-soft: rgba(20, 35, 50, 0.06);
  --water: #1a7a96;         /* акцент: действия, сегодня, выбранное */
  --water-wash: rgba(31, 143, 176, 0.10);
  --finish: #268057;        /* выполнено */
  --finish-wash: rgba(46, 156, 106, 0.14);
  --buoy: #a4611d;          /* внимание */
  --buoy-wash: rgba(217, 130, 43, 0.14);
  --alarm: #c2413f;         /* ошибка */
  --alarm-wash: rgba(194, 65, 63, 0.12);
  --z1: #a7b2bd; --z2: #58b3c9; --z3: #e3b23c; --z4: #e07a2f; --z5: #cf3f3f; --z6: #a62e2e; --z7: #7b3fa0;
  --sport-run: #9b5a45; --sport-bike: #2a6fb5; --sport-swim: #12818f; --sport-gym: #6a7380; --sport-other: #5b6b7c;  /* шапки плиток по видам */
  --font-ui: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --font-num: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --deck: #0f141a; --surface: #161d25; --surface-2: #1c2530; --ink: #e8edf2; --ink-2: #a9b4c0; --ink-3: #818c97;
    --lane: rgba(255, 255, 255, 0.12); --lane-soft: rgba(255, 255, 255, 0.07);
    --water: #46b1d2; --water-wash: rgba(70, 177, 210, 0.16); --finish: #45b483; --finish-wash: rgba(69, 180, 131, 0.18);
    --buoy: #efa050; --buoy-wash: rgba(239, 160, 80, 0.18); --alarm: #e06663; --alarm-wash: rgba(224, 102, 99, 0.16);
    --z1: #6c7781; --z2: #4aa6bd; --z3: #d8ad46; --z4: #d9772f; --z5: #d14c4c; --z6: #b34545; --z7: #a57bc0;
    --sport-run: #a8664f; --sport-bike: #377aba; --sport-swim: #18818e; --sport-gym: #6d7683; --sport-other: #6a7a8c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --deck: #0f141a; --surface: #161d25; --surface-2: #1c2530; --ink: #e8edf2; --ink-2: #a9b4c0; --ink-3: #818c97;
  --lane: rgba(255, 255, 255, 0.12); --lane-soft: rgba(255, 255, 255, 0.07);
  --water: #46b1d2; --water-wash: rgba(70, 177, 210, 0.16); --finish: #45b483; --finish-wash: rgba(69, 180, 131, 0.18);
  --buoy: #efa050; --buoy-wash: rgba(239, 160, 80, 0.18); --alarm: #e06663; --alarm-wash: rgba(224, 102, 99, 0.16);
  --z1: #6c7781; --z2: #4aa6bd; --z3: #d8ad46; --z4: #d9772f; --z5: #d14c4c; --z6: #b34545; --z7: #a57bc0;
  --sport-run: #a8664f; --sport-bike: #377aba; --sport-swim: #18818e; --sport-gym: #6d7683; --sport-other: #6a7a8c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--deck); color: var(--ink); font: 14px/1.45 var(--font-ui); -webkit-font-smoothing: antialiased; }
a { color: var(--water); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 18px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 500; color: var(--ink-3); }
p { margin: 0; }
code { font-family: var(--font-num); font-size: 0.92em; }
pre { margin: 0; font: 12px/1.5 var(--font-num); white-space: pre-wrap; word-break: break-word; }
:focus-visible { outline: 2px solid var(--water); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline-row { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; vertical-align: middle; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.measure { max-width: 64ch; }

/* ----- каркас ----- */
.app { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.rail { min-width: 0; border-right: 1px solid var(--lane); padding: 20px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-weight: 600; font-size: 15px; color: var(--ink); }
.brand small { display: block; color: var(--ink-3); font-weight: 400; font-size: 12px; }
.rail-group h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.rail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rail-list a, .rail-list button { width: 100%; text-align: left; background: none; border: 0; border-radius: 4px; padding: 7px 8px; display: flex; align-items: center; gap: 10px; color: var(--ink-2); text-decoration: none; }
.rail-list a:hover { background: var(--surface-2); text-decoration: none; }
.rail-list .is-active { background: var(--water-wash); color: var(--ink); font-weight: 500; }
.rail-list .note { margin-left: auto; font-size: 11px; color: var(--ink-3); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.rail-foot a, .rail-foot button { color: inherit; background: none; border: 0; padding: 0; text-align: left; }
.rail-foot .who { color: var(--ink-3); font-size: 12px; word-break: break-all; }
.mark { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink-3); flex: none; }
.mark.approved { background: var(--finish); border-color: var(--finish); }
.mark.draft { border-color: var(--buoy); }
.mark.empty { border-style: dashed; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.bar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 14px 24px; border-bottom: 1px solid var(--lane); }
.bar .sub { color: var(--ink-3); font-size: 13px; }
.sections { margin-left: auto; display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: 6px; padding: 2px; }
.sections a { border-radius: 4px; padding: 5px 12px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.sections a:hover { text-decoration: none; color: var(--ink); }
.sections .is-active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--lane); }
.subnav { display: flex; gap: 2px 18px; flex-wrap: wrap; padding: 10px 24px 0; font-size: 13px; }
.subnav a { color: var(--ink-2); padding-bottom: 8px; border-bottom: 2px solid transparent; text-decoration: none; }
.subnav .is-active { color: var(--ink); border-color: var(--ink); font-weight: 500; }
.content { padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 20px; flex: 1; }
.weeknav { display: inline-flex; align-items: center; gap: 4px; }
.weeknav a.arrow { background: var(--surface); border: 1px solid var(--lane); border-radius: 4px; width: 28px; height: 28px; display: inline-grid; place-items: center; color: var(--ink-2); text-decoration: none; }
.weeknav a.arrow:hover { border-color: var(--ink-3); }
.weeknav .range { padding: 0 10px; font-weight: 500; }
.weeknav a.small { margin-left: 6px; }

/* ----- кнопки и формы ----- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--lane); background: var(--surface); border-radius: 4px; padding: 7px 14px; font-weight: 500; text-decoration: none; color: var(--ink); transition: background 150ms, border-color 150ms; }
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--ink); color: var(--deck); border-color: var(--ink); }
.btn-primary:hover { opacity: 0.9; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-quiet { background: none; border: 0; color: var(--ink-2); padding: 0; font-weight: 400; }
.btn-quiet:hover { color: var(--ink); text-decoration: underline; }
.btn-danger { color: var(--alarm); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span, label.lbl { font-size: 12px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, .select, .textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--lane); border-radius: 4px; padding: 7px 10px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input.num, .textarea.num { font-family: var(--font-num); font-size: 13px; }
.input-sm, .select-sm { padding: 4px 8px; font-size: 13px; }
.textarea { line-height: 1.5; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 3px; }
.check .hint { display: block; font-size: 12px; color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.seg { display: inline-flex; border: 1px solid var(--lane); border-radius: 4px; overflow: hidden; background: var(--surface); }
.seg label { padding: 5px 12px; font-size: 13px; color: var(--ink-2); cursor: pointer; border-left: 1px solid var(--lane); position: relative; }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg input:checked + span { color: var(--ink); font-weight: 500; }
.seg label:has(input:checked) { background: var(--water-wash); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--water); outline-offset: -2px; }
.seg label:has(input:disabled) { color: var(--ink-3); cursor: default; }

/* ----- поверхности, списки, бейджи ----- */
.pane { border: 1px solid var(--lane); border-radius: 6px; background: var(--surface); padding: 14px 16px; min-width: 0; }
.pane.is-source { border-color: var(--water); box-shadow: inset 0 0 0 1px var(--water); }
.pane > h3 { margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; }
.list { border: 1px solid var(--lane); border-radius: 6px; background: var(--surface); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--lane-soft); color: inherit; text-decoration: none; }
.list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-row .title { font-weight: 500; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 3px; background: var(--surface-2); color: var(--ink-2); }
.tag.ok { background: var(--finish-wash); color: var(--finish); }
.tag.warn { background: var(--buoy-wash); color: var(--buoy); }
.tag.err { background: var(--alarm-wash); color: var(--alarm); }
.tag.water { background: var(--water-wash); color: var(--water); }
.notice { border: 1px solid var(--lane); border-radius: 6px; padding: 10px 14px; font-size: 13px; background: var(--surface); white-space: pre-wrap; }
.notice.ok { border-color: var(--finish); background: var(--finish-wash); }
.notice.warn { border-color: var(--buoy); background: var(--buoy-wash); }
.notice.err { border-color: var(--alarm); background: var(--alarm-wash); }
.notice code { font-size: 12px; }
.pre { border: 1px solid var(--lane); border-radius: 6px; background: var(--surface); padding: 10px 12px; max-height: 32rem; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--lane); }
.table td { padding: 6px 10px; border-bottom: 1px solid var(--lane-soft); vertical-align: top; }
.table .c { text-align: center; }
.table .num { white-space: nowrap; }
.table .total td { border-top: 1px solid var(--lane); font-weight: 500; }
details.disclosure > summary { cursor: pointer; list-style: none; color: var(--ink-2); font-size: 13px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "›"; display: inline-block; width: 12px; transition: transform 150ms; }
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.disclosure > :not(summary) { margin-top: 8px; }
.prose { max-width: 72ch; line-height: 1.55; }
.prose h1 { font-size: 18px; margin: 20px 0 8px; } .prose h2 { font-size: 15px; margin: 18px 0 6px; } .prose h3 { font-size: 14px; color: var(--ink); margin: 14px 0 4px; }
.prose p { margin: 8px 0; } .prose ul, .prose ol { margin: 8px 0; padding-left: 20px; } .prose li { margin: 2px 0; }
.prose hr { border: 0; border-top: 1px solid var(--lane); margin: 14px 0; }
.prose table { border-collapse: collapse; margin: 12px 0; font-size: 13px; }

/* ----- лента недели ----- */
.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--lane); border-radius: 0 0 6px 6px; background: var(--surface); overflow: hidden; }
.strip.is-plain { border-radius: 6px; }
.day { position: relative; border-left: 1px solid var(--lane); min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; transition: background 150ms; }
.day-link { position: absolute; inset: 0; z-index: 0; }  /* у тренера весь день выбирает день; карточки-ссылки — поверх */
a.wcard { position: relative; z-index: 1; display: block; color: inherit; text-decoration: none; transition: box-shadow 150ms, transform 150ms; }
a.wcard:hover { text-decoration: none; box-shadow: 0 2px 8px rgba(20, 35, 50, 0.16); transform: translateY(-1px); }
button.wcard { position: relative; z-index: 1; display: block; width: 100%; padding: 0; font: inherit; color: inherit; cursor: pointer; }  /* план: по клику — задание */
button.wcard:hover { box-shadow: 0 2px 8px rgba(20, 35, 50, 0.16); }
.wpop { width: min(560px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; padding: 16px 18px; border: 1px solid var(--lane); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: 0 8px 30px rgba(20, 35, 50, 0.25); }
.wpop::backdrop { background: rgba(20, 35, 50, 0.3); }
.wpop-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font-size: 16px; cursor: pointer; }
.wpop-x:hover { background: var(--surface-2); color: var(--ink); }
.wpop .ttl { padding-right: 36px; }
.wpop-fc { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; margin-top: 6px; font-size: 13px; }
.wpop .wcard-zones { margin-top: 8px; }
.wpop-z { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 2px; }
.day:first-child { border-left: 0; }
.day:has(> .day-link):hover { background: var(--surface-2); }
.day.is-selected { background: var(--water-wash); box-shadow: inset 0 0 0 1px var(--water); }
.day-head { display: flex; align-items: baseline; gap: 6px; padding: 10px 10px 6px; border-bottom: 1px solid var(--lane-soft); }
.day-head .dow { font-weight: 500; font-size: 13px; }
.day-head .dom { color: var(--ink-3); font-size: 12px; }
.day.is-today .day-head { border-top: 2px solid var(--water); padding-top: 8px; }
.day.is-today .dow { color: var(--water); }
.day-head .flag { margin-left: auto; font-size: 11px; color: var(--water); }
.day-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.day-rest { color: var(--ink-3); font-size: 12px; padding: 8px 0; }
/* плитка тренировки: сверху вид спорта и название, ниже от левого края — время, характеристики, полоска */
.day.is-out { opacity: 0.45; }
/* плитка тренировки (как календарь intervals.icu): шапка цвета вида — значок, время, дистанция; параметры; зоны; название */
.wcard { --sc: var(--sport-other); border: 1px solid var(--lane); border-radius: 6px; overflow: hidden; background: var(--surface); text-align: center; font-size: 12px; line-height: 1.35; font-variant-numeric: tabular-nums; box-shadow: 0 1px 2px rgba(20, 35, 50, 0.06); }
.wcard.s-run { --sc: var(--sport-run); } .wcard.s-bike { --sc: var(--sport-bike); } .wcard.s-swim { --sc: var(--sport-swim); } .wcard.s-gym { --sc: var(--sport-gym); }
.wcard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; padding: 4px 8px; background: var(--sc); color: #fff; font-size: 13px; font-weight: 500; }
.wcard-head .ico { width: 16px; height: 16px; }
.wcard-head .t { flex: 1; }
.wcard-head .d { font-weight: 400; opacity: 0.95; white-space: nowrap; margin-left: auto; }
.wcard-body { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px 4px; }
.wcard-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 6px; font-weight: 500; }
.wcard-line > span { white-space: nowrap; }
.wcard-line .hr { color: var(--alarm); }
.wcard-line .pw { color: var(--z7); }
.wcard-load { font-weight: 600; }
.wcard-rpe { color: var(--ink-2); }
.wcard-byplan { color: var(--finish); font-weight: 500; }
.wcard-zones { display: flex; width: 100%; height: 10px; margin-top: 4px; border-radius: 2px; overflow: hidden; background: var(--lane-soft); }
.wcard-zones > i { display: block; height: 100%; }
.wcard-foot { padding: 4px 8px 0; margin-bottom: 6px; border-top: 1px dashed var(--lane-soft); color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wcard.is-plan { background: transparent; border: 1.5px dashed var(--sc); box-shadow: none; }
.wcard.is-plan .wcard-head { background: transparent; color: var(--sc); }
.wcard.is-plan .wcard-foot { border-top: 0; color: var(--ink); }
.wcard.is-missed { border-color: var(--buoy); }
.wcard.is-missed .wcard-head { color: var(--buoy); }
.day-well { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 8px; padding: 4px 6px 0; font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.day-well > span { white-space: nowrap; }
.day-well .hrv { color: var(--alarm); }
.day-well .steps { color: var(--finish); }
.day.is-today { background: var(--surface-2); }
/* итоги над неделей */
.wk { display: flex; flex-wrap: wrap; border: 1px solid var(--lane); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--surface-2); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.wk-cell { display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 6px 12px; border-right: 1px solid var(--lane-soft); }
.wk-cell b { color: var(--ink); font-weight: 600; }
.wk-cell small { color: var(--ink-3); }
.wk-id { font-size: 14px; font-weight: 600; color: var(--ink); }
.wk-id small { font-size: 11px; font-weight: 400; white-space: nowrap; }
.wk-id a { color: inherit; }
.wk-cell .ctl { color: var(--water); } .wk-cell .atl { color: var(--z7); }
.wk-sport { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; }
.wk-sport .ico { grid-row: span 3; width: 18px; height: 18px; }
.wk-zones { flex-direction: row; gap: 12px; align-items: center; }
.wk-zones > span { display: flex; flex-direction: column; align-items: center; }
.ico { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.ico-lg { width: 20px; height: 20px; }
.ico.s-run { color: var(--sport-run); } .ico.s-bike { color: var(--sport-bike); } .ico.s-swim { color: var(--sport-swim); } .ico.s-gym { color: var(--sport-gym); } .ico.s-other { color: var(--sport-other); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.legend i { display: inline-block; width: 18px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 6px; }
.legend .lg-plan { border: 1.5px dashed var(--ink-3); }
.legend .lg-missed { border: 1.5px dashed var(--buoy); }
.legend .lg-zones { background: linear-gradient(90deg, var(--z1) 0 20%, var(--z2) 20% 55%, var(--z3) 55% 75%, var(--z4) 75% 90%, var(--z5) 90%); }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 24px; padding-top: 14px; border-top: 1px solid var(--lane); scroll-margin-top: 12px; }
.detail:target { box-shadow: -3px 0 0 var(--water); }
.detail-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.detail .span { grid-column: 1 / -1; }
.item + .item { border-top: 1px solid var(--lane-soft); margin-top: 10px; padding-top: 10px; }
.item .ttl { font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
.item .ttl .num { margin-left: auto; color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.item pre { margin-top: 6px; color: var(--ink-2); }
.item .task { margin-top: 6px; white-space: pre-wrap; font-size: 13px; }
.wedit { margin-top: 8px; } .wedit > summary { cursor: pointer; color: var(--water); width: max-content; } .wedit[open] > summary { margin-bottom: 8px; }  /* правка тренировки */
.wedit textarea { width: 100%; resize: vertical; }
.wcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 220px)); gap: 10px; }  /* «Выполнено» под неделей — карточки как в плитках */
.actions { margin-top: auto; border-top: 1px solid var(--lane); padding: 12px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); position: sticky; bottom: 0; z-index: 2; }
.actions .meta { color: var(--ink-2); font-size: 13px; margin-right: auto; }
.actions details { display: contents; }
.actions details > summary { list-style: none; }
.actions details > summary::-webkit-details-marker { display: none; }
.actions details > form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; padding-top: 10px; border-top: 1px solid var(--lane-soft); }

/* ----- календарь истории, карточки метрик ----- */
.scroll-x { overflow-x: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13px; }
.zb { display: grid; gap: 4px; max-width: 640px; } .zb + .zb { margin-top: 12px; } .zb-head { margin-bottom: 2px; }
.zb-row { display: grid; grid-template-columns: 2.6em 1fr 9em; align-items: center; gap: 10px; font-size: 13px; }
.zb-z { color: var(--ink-3); } .zb-v { text-align: right; color: var(--ink-2); white-space: nowrap; }
.zb-track { height: 12px; border-radius: 3px; background: var(--lane-soft); overflow: hidden; } .zb-track i { display: block; height: 100%; border-radius: 3px; }
.zb-track .z1 { background: var(--z1); } .zb-track .z2 { background: var(--z2); } .zb-track .z3 { background: var(--z3); } .zb-track .z4 { background: var(--z4); }
.zb-track .z5 { background: var(--z5); } .zb-track .z6 { background: var(--z6); } .zb-track .z7 { background: var(--z7); }
.zb-track .ss { background: repeating-linear-gradient(135deg, var(--z3) 0 4px, var(--z4) 4px 8px); }  /* sweet spot — часть Z3–Z4 */
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--lane); border-radius: 6px; padding: 12px 14px; background: var(--surface); color: inherit; text-decoration: none; }
a.tile:hover { border-color: var(--ink-3); text-decoration: none; }
.tile .lbl { font-size: 12px; color: var(--ink-3); } .tile .val { font-size: 18px; font-weight: 500; margin-top: 2px; }

/* ----- вход ----- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.login-or { display: flex; align-items: center; gap: 10px; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--lane); }
.login-tg { width: 100%; }
.qr { align-self: center; background: #fff; padding: 6px; border-radius: 6px; line-height: 0; }
.qr svg { display: block; max-width: 100%; height: auto; }
.login-card .code { font: 500 22px/1 var(--font-num); letter-spacing: 0.4em; text-align: center; padding: 12px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--lane); flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; overflow: visible; }
  .rail-group h3, .rail-foot .who, .brand small { display: none; }
  .rail-group { flex: 1 1 100%; min-width: 0; overflow-x: auto; }
  .rail-list { flex-direction: row; width: max-content; }
  .rail-list a { white-space: nowrap; padding: 5px 8px; }
  .rail-foot { margin-top: 0; flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
  .bar, .subnav, .content, .actions { padding-left: 16px; padding-right: 16px; }
  .strip { grid-template-columns: 1fr; }
  /* итоги недели — сеткой в две колонки: flex при переносе давал ряды разной ширины и висящие границы */
  .wk { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--lane); overflow: hidden; }
  .wk-cell { border-right: 0; background: var(--surface-2); } .wk-sport, .wk-zones { justify-content: start; }
  .wk-zones, .wk-cell:last-child:nth-child(odd), .wk-cell:nth-child(odd):has(+ .wk-zones) { grid-column: 1 / -1; }
  .day { border-left: 0; border-top: 1px solid var(--lane); }
  .day:first-child { border-top: 0; }
  .splits { grid-template-columns: repeat(2, 1fr); }
  .split.total { grid-column: 1 / -1; }
  .detail, .form-grid { grid-template-columns: 1fr; }
  .sections { margin-left: 0; max-width: 100%; overflow-x: auto; }  /* пять вкладок тренера шире телефона — листаются, страница не ездит вбок */
  .sections a { padding: 5px 6px; font-size: 13px; white-space: nowrap; }
  .main { min-height: 0; }  /* рельса сверху: 100vh у контента — лишняя прокрутка на коротких страницах */
  .actions { position: static; }  /* липкий футер с формой «Собрать» занимал четверть экрана */
  .list-row > .grow { flex-basis: 100%; }  /* метки и кнопки — строкой ниже, а не поверх email */
  /* день без карточек — одной строкой: дата и сон/пульс; «нет тренировки» и так видно (месяц был ~9000 px) */
  .app .day.is-empty { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 8px 10px; }
  .app .day.is-empty .day-head { border: 0; padding: 0; }
  .app .day.is-empty.is-today { box-shadow: inset 0 2px var(--water); }
  .app .day.is-empty .day-well { padding: 0; justify-content: flex-start; }
  .app .day.is-empty .day-body, .app .day.is-empty .day-rest { padding: 0; flex: none; }
  .app .day.is-empty .is-none { display: none; }
}

/* страница тренировки — как TIMELINE в intervals.icu */
.act-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 20px; }
.act-icon { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.act-badge { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--lane); }
.act-badge .ico { width: 30px; height: 30px; }
.act-badge.s-run { color: var(--sport-run); } .act-badge.s-bike { color: var(--sport-bike); } .act-badge.s-swim { color: var(--sport-swim); } .act-badge.s-gym { color: var(--sport-gym); }
.act-nav { display: flex; gap: 16px; font-size: 20px; line-height: 1; }
.act-nav a { color: var(--ink); text-decoration: none; } .act-nav span { color: var(--lane); }
.act-hero .when { font-size: 13px; color: var(--ink-2); }
.act-hero .big { display: flex; gap: 18px; font-size: 20px; font-variant-numeric: tabular-nums; }
.act-col { margin: 0; display: grid; gap: 1px; font-size: 12px; font-variant-numeric: tabular-nums; }
.act-col > div { display: flex; justify-content: flex-end; gap: 6px; }
.act-col dt { color: var(--ink-2); }
.act-col dd { margin: 0; font-weight: 600; }
.act-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.act-name { font-weight: 500; }
.chip { border: 1px solid var(--lane); border-radius: 12px; padding: 1px 9px; font-size: 12px; background: var(--surface); font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-ach { color: var(--alarm); font-size: 13px; }
.act-note { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; }
.act-map { height: 340px; border: 1px solid var(--lane); border-radius: 6px; background: var(--surface); z-index: 0; }
.act-map .leaflet-tile-pane { filter: saturate(.45) brightness(.92); }  /* приглушаем подложку — трек ярче, как на карточке бота */
@media (max-width: 640px) { .act-map { height: 260px; } }
.tl { position: relative; display: grid; grid-template-columns: 62px minmax(0, 1fr); min-width: 720px; border: 1px solid var(--lane); border-radius: 6px; background: var(--surface); overflow: hidden; font-variant-numeric: tabular-nums; }
.tl-corner { display: flex; flex-direction: column; justify-content: flex-start; padding: 6px; font-size: 12px; border-bottom: 1px solid var(--lane-soft); }
.tl-corner small { color: var(--ink-3); font-size: 10.5px; }
.tl-band { position: relative; height: 86px; border-bottom: 1px solid var(--lane-soft); }
.tl-iv { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; font-size: 11px; line-height: 1.3; white-space: nowrap; border-left: 1px solid var(--lane); }
.tl-iv:first-child { border-left: 0; }
.tl-iv.is-rest { background: var(--surface-2); }
.tl-iv .dur { color: var(--ink); font-weight: 500; } .tl-iv .pace { color: var(--water); } .tl-iv .pw { color: var(--z7); }
.tl-iv .hr { color: var(--alarm); } .tl-iv .z { color: var(--ink); } .tl-iv .pct { color: var(--z7); }
.tl-axis { position: relative; height: 64px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding: 1px 6px 1px 18px; font-size: 10.5px; color: var(--ink-3); border-bottom: 1px solid var(--lane-soft); }
.tl-axis .cur { font-size: 12px; font-weight: 600; }
.tl-name { position: absolute; left: 2px; top: 0; bottom: 0; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: 10.5px; color: var(--ink-3); overflow: hidden; white-space: nowrap; }
.tl-svg { display: block; width: 100%; height: 64px; border-bottom: 1px solid var(--lane-soft); }
.tl-axis-sm { height: 20px; justify-content: center; }
.tl-scale { position: relative; height: 20px; font-size: 10.5px; color: var(--ink-3); border-bottom: 1px solid var(--lane-soft); }
.tl-scale.tl-time { border-bottom: 0; }
.tl-scale span { position: absolute; top: 3px; transform: translateX(-50%); }
.tl-over { position: absolute; left: 62px; right: 0; top: 0; bottom: 0; pointer-events: none; }
.tl-over .edge { position: absolute; top: 0; bottom: 40px; border-left: 1px solid var(--lane); }
.tl-over .rest { position: absolute; top: 86px; bottom: 40px; background: var(--lane-soft); }
.tl-over .cross { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--ink-2); }

/* форма в «Аналитике» — та же сетка, что TIMELINE тренировки: CTL/ATL, TSB по зонам, нагрузка по неделям */
.fit .tl-axis:not(.tl-axis-sm), .fit .fit-svg { height: 96px; } .fit .tl-axis.fit-main, .fit .fit-svg.fit-main { height: 150px; }  /* FORM_H */
.fit .tl-corner, .fit-marks { height: 36px; } .fit .tl-corner { padding: 4px 6px; }
.fit-marks { position: relative; border-bottom: 1px solid var(--lane-soft); font-size: 11px; color: var(--ink-3); }
.fit-marks span, .fit-peak { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.fit-marks span { bottom: 3px; } .fit-marks .row2 { bottom: 18px; } .fit-marks .race { color: var(--alarm); font-weight: 500; }
.fit-marks .end, .fit-peak.end { transform: translateX(-100%); } .fit-marks .start, .fit-peak.start { transform: none; }
.fit-peak { margin-top: -22px; font-size: 11px; font-weight: 500; color: var(--water); background: var(--surface); padding: 0 3px; border-radius: 3px; }
.fit-peak::after { content: ""; position: absolute; left: 50%; top: 19px; width: 7px; height: 7px; margin-left: -4px; border-radius: 50%; background: var(--water); }
.fit-peak.end::after { left: 100%; } .fit-peak.start::after { left: 0; }
.fit .ln { fill: none; stroke-width: 1.8; } .fit .ln.plan { stroke-dasharray: 6 4; }
.fit .ln.ctl { stroke: var(--water); stroke-width: 2.6; } .fit .ln.atl { stroke: var(--z7); } .fit .ln.tsb { stroke: var(--ink); stroke-width: 2; }
.fit .ln.zero { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.fit .z-loss, .legend .lg-loss { fill: color-mix(in srgb, var(--buoy) 28%, transparent); background: color-mix(in srgb, var(--buoy) 28%, transparent); }
.fit .z-fresh, .legend .lg-fresh { fill: color-mix(in srgb, var(--water) 28%, transparent); background: color-mix(in srgb, var(--water) 28%, transparent); }
.fit .z-grey { fill: color-mix(in srgb, var(--ink-3) 10%, transparent); }
.fit .z-opt, .legend .lg-opt { fill: color-mix(in srgb, var(--finish) 30%, transparent); background: color-mix(in srgb, var(--finish) 30%, transparent); }
.fit .z-risk, .legend .lg-risk { fill: color-mix(in srgb, var(--alarm) 32%, transparent); background: color-mix(in srgb, var(--alarm) 32%, transparent); }
.fit .ln.load { stroke: var(--ink-2); stroke-width: 1.6; }
.fit-dot, .legend .lg-load.peak { position: absolute; width: 9px; height: 9px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--buoy); border: 1.5px solid var(--surface); }
.legend .lg-load { height: 2px; background: var(--ink-2); } .legend .lg-load.peak { position: static; margin: 0 4px 0 6px; vertical-align: -1px; }
.fit-window, .legend .lg-window { background: color-mix(in srgb, var(--finish) 16%, transparent); }
.fit-window { position: absolute; top: 36px; bottom: 20px; border-left: 1px solid var(--finish); border-right: 1px solid var(--finish); }
.fit-marks .form { color: var(--finish); font-weight: 600; } .fit-mark.form { border-left: 2px solid var(--finish); }
.fit[data-hl] .ln:not(.zero) { opacity: 0.22; } .fit .ln { transition: opacity 120ms, stroke-width 120ms; }
.fit[data-hl="ctl"] .ln.ctl, .fit[data-hl="atl"] .ln.atl, .fit[data-hl="load"] .ln.load, .fit[data-hl="tsb"] .ln.tsb { opacity: 1; stroke-width: 3.6; }
.fit[data-hl^="z-"] rect { opacity: 0.25; } .fit[data-hl^="z-"] .ln.tsb { opacity: 1; } .fit .fit-svg rect { transition: opacity 120ms; }
.fit[data-hl="z-fresh"] .z-fresh { opacity: 1; fill: color-mix(in srgb, var(--water) 60%, transparent); }
.fit[data-hl="z-opt"] .z-opt { opacity: 1; fill: color-mix(in srgb, var(--finish) 60%, transparent); }
.fit[data-hl="z-risk"] .z-risk { opacity: 1; fill: color-mix(in srgb, var(--alarm) 60%, transparent); }
#fit-legend [data-k]:hover { color: var(--ink); }
.fit-tip { position: absolute; z-index: 3; transform: translate(10px, -130%); padding: 3px 7px; border-radius: 4px; background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 500; white-space: nowrap; }
.fit-tip.left { transform: translate(calc(-100% - 10px), -130%); }
.fit .cur.ctl { color: var(--water); } .fit .cur.atl { color: var(--z7); } .fit .cur.tsb { color: var(--ink); } .fit .cur.load { color: var(--ink-3); }
.fit-mark { position: absolute; top: 36px; bottom: 20px; border-left: 1px dashed var(--ink-3); } .fit-mark.race { border-left: 2px solid var(--alarm); }
.legend .lg-ctl { height: 3px; background: var(--water); } .legend .lg-atl { height: 2px; background: var(--z7); } .legend .lg-window { border: 1px solid var(--finish); }

/* история атлета — как «📋 История» в боте */
.seg-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.seg-tabs a { padding: 4px 10px; border: 1px solid var(--lane); border-radius: 14px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.seg-tabs a.is-active { background: var(--water-wash); border-color: var(--water); color: var(--ink); }
.hist-day { border: 1px solid var(--lane); border-radius: 6px; background: var(--surface); padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.hist-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; font-size: 13px; color: var(--ink-2); padding-bottom: 4px; border-bottom: 1px solid var(--lane-soft); }
.hist-head b { color: var(--ink); }
.hist-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; font-size: 13.5px; }
.hist-item a { color: inherit; } .hist-item a:hover { color: var(--water); }
