/* ==========================================================================
   Calisthenics Workout Tracker — тёмная тема с фиолетовыми акцентами
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #0a0910;
  --surface: #14121c;
  --surface-2: #1b1826;
  --surface-3: #242033;
  --surface-4: #2e2942;
  --line: #262234;
  --line-2: #352f49;

  --text: #f2effa;
  --text-2: #bcb5cf;
  --muted: #8b84a1;

  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-3: #c4b5fd;
  --accent-deep: #6d28d9;
  --accent-wash: rgba(139, 92, 246, 0.14);
  --accent-wash-2: rgba(139, 92, 246, 0.24);
  --accent-glow: rgba(139, 92, 246, 0.35);
  --grad: linear-gradient(135deg, #7c3aed 0%, #9d6bff 100%);

  --good: #34d399;
  --good-wash: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --danger: #f87171;
  --danger-wash: rgba(248, 113, 113, 0.12);

  /* графики */
  --chart-line: #a78bfa;
  --chart-grid: #232032;
  --chart-axis: #3a3450;
  --heat-0: #1e1b2b;
  --heat-1: #3b2d6e;
  --heat-2: #5a3fb0;
  --heat-3: #8b5cf6;
  --heat-4: #c4b5fd;

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --tap: 48px;
  --tabbar-h: 68px;
  --sidebar-w: 248px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
a { color: var(--accent-2); text-decoration: none; }
svg { display: block; flex-shrink: 0; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--accent-wash-2); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }

/* ---------- каркас ---------- */
.shell { min-height: 100dvh; }
.main {
  padding: calc(16px + var(--safe-t)) 16px calc(var(--tabbar-h) + var(--safe-b) + 24px);
  max-width: 1040px;
  margin: 0 auto;
}
.sidebar { display: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(14, 12, 21, 0.86);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .01em;
  transition: color .15s;
}
.tab .tab-ico { width: 44px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background .2s; }
.tab.active { color: var(--text); }
.tab.active .tab-ico { background: var(--accent-wash-2); color: var(--accent-3); }

body.focus-mode .tabbar, body.focus-mode .sidebar { display: none; }
body.focus-mode .main { padding-bottom: calc(24px + var(--safe-b)); }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w);
    padding: 24px 14px; border-right: 1px solid var(--line); background: #0d0b14;
  }
  .main { margin-left: var(--sidebar-w); padding: 32px 40px 48px; max-width: calc(1040px + var(--sidebar-w)); }
  body.focus-mode .main { margin-left: 0; margin: 0 auto; }
  .side-item {
    display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 14px;
    border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; font-size: 15px;
    transition: background .15s, color .15s;
  }
  .side-item:hover { background: var(--surface-2); color: var(--text); }
  .side-item.active { background: var(--accent-wash); color: var(--accent-3); }
  .side-sep { height: 1px; background: var(--line); margin: 12px 8px; }
  .side-foot { margin-top: auto; padding: 0 8px; }
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 20px var(--accent-glow); }

/* ---------- страница ---------- */
.page { animation: page-in .25s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; min-height: 48px; }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; flex: 1; min-width: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; font-weight: 500; margin-top: 2px; }
.page-head .grow { flex: 1; min-width: 0; }
.page-head .grow h1 {
  font-size: clamp(22px, 6.4vw, 28px); overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.section-head .link { color: var(--accent-2); font-weight: 600; font-size: 14px; padding: 8px 0; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px;
}
.card.pad-0 { padding: 0; }
.card.tight { padding: 14px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.card-sub { color: var(--muted); font-size: 13px; }
.card.accent {
  background: radial-gradient(120% 140% at 0% 0%, rgba(139, 92, 246, .28) 0%, rgba(139, 92, 246, .06) 55%, transparent 100%), var(--surface);
  border-color: rgba(139, 92, 246, .35);
}
.card.clickable { cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.card.clickable:hover { border-color: var(--line-2); }
.card.clickable:active { transform: scale(.99); }

.grid { display: grid; gap: 12px; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.grid > *, .grid-2 > *, .tiles > * { min-width: 0; }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.hidden { display: none !important; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.good { color: var(--good); } .danger-text { color: var(--danger); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: var(--r);
  font-weight: 700; font-size: 15px; letter-spacing: .005em; white-space: nowrap;
  background: var(--surface-3); color: var(--text);
  transition: transform .08s, background .15s, opacity .15s, box-shadow .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:hover { background: var(--surface-4); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 8px 24px -8px var(--accent-glow); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.outline { background: transparent; border: 1px solid var(--line-2); }
.btn.outline:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger-wash); color: var(--danger); }
.btn.danger:hover { background: rgba(248, 113, 113, .2); }
.btn.good { background: var(--good-wash); color: var(--good); }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: var(--r-sm); }
.btn.lg { height: 56px; font-size: 16px; padding: 0 24px; }
.btn.xl { height: 68px; font-size: 19px; border-radius: var(--r-lg); padding: 0 28px; }
.btn.block { width: 100%; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center;
  color: var(--text-2); background: transparent; transition: background .15s, color .15s, transform .08s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.filled { background: var(--surface-2); }
.icon-btn.filled:hover { background: var(--surface-3); }
.icon-btn.danger { color: var(--danger); }

/* ---------- чипы, бейджи, сегменты ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex-shrink: 0; height: 38px; padding: 0 16px; border-radius: 19px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
  font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent-wash-2); border-color: rgba(167, 139, 250, .55); color: var(--accent-3); }
.chip.add { border-style: dashed; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px;
  border-radius: 12px; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.accent { background: var(--accent-wash-2); color: var(--accent-3); }
.badge.good { background: var(--good-wash); color: var(--good); }
.badge.warn { background: rgba(251, 191, 36, .12); color: var(--warn); }

.segmented {
  display: flex; padding: 4px; gap: 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line);
}
.segmented button {
  flex: 1; height: 42px; border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, color .15s;
}
.segmented button.active { background: var(--surface-4); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset; }
.segmented.lg button { height: 52px; font-size: 15px; }

/* ---------- списки ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); width: 100%; text-align: left; transition: background .12s;
}
.list-item:last-child { border-bottom: 0; }
button.list-item:hover, a.list-item:hover, .list-item.clickable:hover { background: var(--surface-2); }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 650; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-ico {
  width: 42px; height: 42px; border-radius: 13px; background: var(--surface-3); color: var(--accent-2);
  display: grid; place-items: center; flex-shrink: 0;
}
.list-item .li-end { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-shrink: 0; font-size: 14px; }
.group-label { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 4px 10px; }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: .01em; }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; height: 52px; padding: 0 16px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line-2); outline: none;
  font-size: 16px; transition: border-color .15s, background .15s;
}
.textarea { height: auto; min-height: 92px; padding: 14px 16px; resize: vertical; line-height: 1.45; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); background: var(--surface-3); }
.input::placeholder, .textarea::placeholder { color: #6c6582; }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%238b84a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 520px) { .form-row.stack-sm { grid-template-columns: minmax(0, 1fr); gap: 18px; } }

.switch-row { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row .sr-body { flex: 1; min-width: 0; }
.switch-row .sr-title { font-weight: 650; }
.switch-row .sr-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.switch { position: relative; width: 52px; height: 32px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 16px; background: var(--surface-4); transition: background .2s; pointer-events: none; }
.switch .track::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: #d8d2e8; transition: transform .2s var(--ease), background .2s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- степпер ---------- */
.stepper { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.stepper .st-btn {
  width: 52px; height: 52px; border-radius: 16px; background: var(--surface-3); color: var(--text);
  display: grid; place-items: center; transition: background .12s, transform .08s;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.stepper .st-btn:hover { background: var(--surface-4); }
.stepper .st-btn:active { transform: scale(.93); background: var(--accent-wash-2); }
.stepper .st-val { text-align: center; min-width: 0; cursor: text; border-radius: 14px; padding: 2px 4px; }
.stepper .st-num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stepper .st-unit { font-size: 12px; color: var(--muted); font-weight: 600; }
.stepper input.st-input {
  width: 100%; text-align: center; background: var(--surface-3); border: 1px solid var(--accent); border-radius: 12px;
  font-size: 26px; font-weight: 800; height: 52px; outline: none; font-variant-numeric: tabular-nums;
}
.stepper.xl { gap: 14px; }
.stepper.xl .st-btn { width: 76px; height: 76px; border-radius: 24px; }
.stepper.xl .st-num { font-size: 68px; }
.stepper.xl .st-unit { font-size: 14px; }
.stepper.xl input.st-input { font-size: 56px; height: 86px; border-radius: 20px; }
.stepper.lg .st-btn { width: 64px; height: 64px; border-radius: 20px; }
.stepper.lg .st-num { font-size: 40px; }
.stepper.lg input.st-input { font-size: 34px; height: 64px; }
@media (max-width: 360px) {
  .stepper.xl .st-btn { width: 64px; height: 64px; }
  .stepper.xl .st-num { font-size: 56px; }
}

/* ---------- плитки статистики ---------- */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-width: 0; }
.tile .t-label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.tile .t-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; line-height: 1.1; }
.tile .t-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.tile .t-delta { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.tile .t-delta.up { color: var(--good); }
.hero-num { font-size: 52px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }

/* ---------- метры/прогресс ---------- */
.meter { height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 5px; background: var(--grad); transition: width .5s var(--ease); }
.meter.done > span { background: var(--good); }

/* ---------- неделя ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week .wd { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.week .wd .dot {
  width: 100%; max-width: 44px; aspect-ratio: 1; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px;
}
.week .wd.on .dot { background: var(--grad); border-color: transparent; box-shadow: 0 6px 16px -6px var(--accent-glow); }
.week .wd.today { color: var(--text); }
.week .wd.today .dot { border-color: var(--accent-2); }
.week .wd.plan:not(.on) .dot { border-style: dashed; border-color: var(--accent-2); }

/* ---------- пустые состояния ---------- */
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .e-ico { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent-2); }
.empty h3 { color: var(--text); font-size: 18px; margin-bottom: 6px; }
.empty p { max-width: 360px; margin: 0 auto 18px; font-size: 14.5px; }

/* ---------- шит/модалка ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(5, 4, 10, .62);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in .18s ease;
}
.backdrop.closing { animation: fade-out .18s ease forwards; }
.sheet {
  width: 100%; max-width: 640px; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding-bottom: var(--safe-b);
  animation: sheet-up .28s var(--ease);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .5);
}
.backdrop.closing .sheet { animation: sheet-down .2s ease forwards; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-4); margin: 10px auto 0; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 8px 20px; flex-shrink: 0; }
.sheet-head h3 { flex: 1; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.sheet-body { padding: 8px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 20px 16px; display: flex; gap: 10px; border-top: 1px solid var(--line); flex-shrink: 0; }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: var(--r-xl); border-bottom: 1px solid var(--line-2); max-height: 86dvh; animation: pop-in .22s var(--ease); }
  .backdrop.closing .sheet { animation: fade-out .15s ease forwards; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 18px; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- тосты ---------- */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); pointer-events: none; padding: 0 16px;
}
body.focus-mode .toasts { bottom: calc(16px + var(--safe-b)); }
body.focus-mode.resting .toasts { bottom: calc(112px + var(--safe-b)); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; min-height: 52px; max-width: 520px; width: 100%;
  padding: 8px 8px 8px 16px; border-radius: var(--r); background: #2a2540; border: 1px solid var(--line-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5); font-weight: 600; font-size: 15px;
  animation: toast-in .25s var(--ease);
}
.toast.out { animation: fade-out .2s ease forwards; }
.toast .t-ico { color: var(--accent-2); }
.toast .t-ico.good { color: var(--good); }
.toast .t-msg { flex: 1; min-width: 0; padding: 6px 0; }
.toast .btn { height: 40px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- офлайн ---------- */
.net-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; font-size: 12.5px; font-weight: 700; background: rgba(251, 191, 36, .12); color: var(--warn); }

/* ---------- баннер активной тренировки ---------- */
.live-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 18px; border-radius: var(--r-lg);
  background: var(--grad); color: #fff; box-shadow: 0 14px 34px -14px var(--accent-glow); cursor: pointer;
}
.live-banner .lb-title { font-weight: 800; font-size: 16px; }
.live-banner .lb-sub { font-size: 13px; opacity: .85; font-variant-numeric: tabular-nums; }
.live-banner .lb-go { margin-left: auto; height: 46px; padding: 0 18px; border-radius: 14px; background: rgba(255, 255, 255, .18); font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); animation: pulse 1.6s infinite; flex-shrink: 0; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }

.live-mini {
  position: fixed; left: 12px; right: 12px; z-index: 45;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px);
  display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 8px 0 18px;
  border-radius: 18px; background: var(--grad); color: #fff; font-weight: 750; font-size: 15px;
  box-shadow: 0 14px 34px -12px var(--accent-glow);
  animation: toast-in .25s var(--ease);
}
.live-mini .lm-go { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .18); display: grid; place-items: center; }
body.focus-mode .live-mini { display: none; }
body.has-live .main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 92px); }
body.has-live .toasts { bottom: calc(var(--tabbar-h) + var(--safe-b) + 76px); }
@media (min-width: 900px) {
  .live-mini { left: auto; right: 28px; bottom: 24px; width: 340px; }
  body.has-live .main { padding-bottom: 100px; }
  body.has-live .toasts { bottom: 90px; }
}
.net-float { position: fixed; top: calc(10px + var(--safe-t)); right: 12px; z-index: 50; }
@media (min-width: 900px) { .net-float { display: none; } }

/* ---------- режим тренировки ---------- */
.ses { max-width: 640px; margin: 0 auto; }
.ses-top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.ses-top .ses-name { flex: 1; min-width: 0; text-align: center; }
.ses-top .ses-name .n { font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ses-top .ses-name .clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.ses-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.ses-strip::-webkit-scrollbar { display: none; }
.ses-pill {
  flex-shrink: 0; scroll-snap-align: center; display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text-2); font-weight: 650; font-size: 14px; max-width: 220px;
}
.ses-pill .p-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ses-pill .p-count { font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.ses-pill.active { background: var(--accent-wash-2); border-color: rgba(167, 139, 250, .6); color: var(--text); }
.ses-pill.done .p-count { color: var(--good); }
.ses-pill.add { border-style: dashed; color: var(--accent-2); }

.ses-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 20px 18px; }
.ses-ex-name { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.ses-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ses-setno { margin-top: 18px; text-align: center; font-weight: 700; color: var(--text-2); font-size: 15px; }
.ses-setno b { color: var(--text); }
.ses-prev { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.ses-value { margin: 18px 0 8px; }
.ses-weight { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.ses-weight .lbl { text-align: center; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ses-watch { display: flex; justify-content: center; margin-top: 6px; }
.ses-watch .btn { min-width: 220px; }
.ses-watch .btn.running { background: var(--danger-wash); color: var(--danger); }
.ses-log { margin-top: 20px; }
.ses-log .btn { height: 76px; font-size: 20px; border-radius: 24px; }

.sets { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.set-row {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 8px 8px 14px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line); width: 100%; text-align: left;
}
.set-row:hover { border-color: var(--line-2); }
.set-row .s-no { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--text-2); flex-shrink: 0; }
.set-row .s-val { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.set-row .s-val small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.set-row .s-w { font-weight: 700; color: var(--accent-3); font-size: 15px; }
.set-row .s-pr { color: var(--warn); }
.set-row.planned { background: transparent; border-style: dashed; color: var(--muted); }
.set-row.planned .s-val { color: var(--muted); font-weight: 700; }

.ses-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.rest {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: rgba(20, 17, 30, .96); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line-2); animation: sheet-up .25s var(--ease);
}
.rest-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.rest .r-label { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rest .r-time { font-size: 40px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.rest .r-bar { height: 4px; border-radius: 2px; background: var(--surface-4); overflow: hidden; margin-top: 8px; max-width: 640px; margin-left: auto; margin-right: auto; }
.rest .r-bar span { display: block; height: 100%; background: var(--grad); transition: width 1s linear; }
.rest .btn { height: 52px; min-width: 60px; padding: 0 14px; }
.rest.done { background: rgba(52, 33, 92, .97); }
.rest.done .r-time { color: var(--accent-3); }
body.resting .main { padding-bottom: 140px; }

/* ---------- графики ---------- */
.chart { position: relative; width: 100%; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.chart svg { width: 100%; overflow: visible; }
.chart .ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid-l { stroke: var(--chart-grid); stroke-width: 1; }
.chart .base-l { stroke: var(--chart-axis); stroke-width: 1; }
.chart .ln { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-line); opacity: .1; }
.chart .dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.chart .bar { fill: var(--accent); transition: fill .12s; }
.chart .bar.dim { fill: #4c3a86; }
.chart .bar.hot { fill: var(--accent-3); }
.chart .xh { stroke: var(--text-2); stroke-width: 1; opacity: .5; }
.chart .end-lbl { fill: var(--text); font-size: 12px; font-weight: 700; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; padding: 8px 12px; border-radius: 12px;
  background: #2a2540; border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  font-size: 13px; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); opacity: 0; transition: opacity .1s;
}
.chart-tip.on { opacity: 1; }
.chart-tip .tv { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-tip .tl { color: var(--muted); font-size: 12px; margin-top: 1px; }
.chart-empty { height: 160px; display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; padding: 0 20px; border: 1px dashed var(--line-2); border-radius: var(--r); }

.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 12px; font-size: 14px; }
.hbar .hb-l { color: var(--text-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .hb-track { height: 14px; position: relative; }
.hbar .hb-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .hb-v { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

.heat { padding-bottom: 4px; min-height: 140px; }
.heat svg { overflow: visible; }
.heat .cell { rx: 3; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); justify-content: flex-end; margin-top: 8px; }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

details.data-table { margin-top: 12px; }
details.data-table summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; }
details.data-table summary::-webkit-details-marker { display: none; }
details.data-table table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13.5px; }
details.data-table td, details.data-table th { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
details.data-table th { color: var(--muted); font-weight: 600; }
details.data-table td:last-child, details.data-table th:last-child { text-align: right; }

/* ---------- справка ---------- */
.help-item { border-bottom: 1px solid var(--line); }
.help-item:last-child { border-bottom: 0; }
.help-item summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px; min-height: 60px; font-weight: 650;
}
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
.help-item[open] summary .chev { transform: rotate(180deg); }
.help-body { padding: 0 16px 18px; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.help-body p { margin: 0 0 10px; }
.help-body ul, .help-body ol { margin: 0 0 10px; padding-left: 20px; }
.help-body li { margin-bottom: 6px; }
.help-body b { color: var(--text); }
.help-body .note { background: var(--accent-wash); border-radius: 12px; padding: 10px 14px; color: var(--text-2); font-size: 14px; }

/* ---------- разное ---------- */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; text-align: right; }

.steps { counter-reset: st; display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step::before {
  counter-increment: st; content: counter(st); width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--accent-wash-2); color: var(--accent-3); font-weight: 800; font-size: 14px;
}
.step .s-t { font-weight: 700; } .step .s-d { color: var(--muted); font-size: 14px; }

.tpl-card { display: flex; flex-direction: column; gap: 12px; }
.tpl-card .tc-head { display: flex; align-items: flex-start; gap: 12px; }
.tpl-card .tc-name { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.tpl-card .tc-ex { color: var(--muted); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.item-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
.item-card .ic-head { display: flex; align-items: center; gap: 8px; }
.item-card .ic-name { flex: 1; font-weight: 750; font-size: 16px; min-width: 0; }
.item-card .ic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 12px; }
.item-card .ic-grid .label { display: block; text-align: center; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
@media (max-width: 420px) {
  .item-card .ic-grid .stepper .st-btn { width: 44px; height: 44px; }
  .item-card .ic-grid .stepper .st-num { font-size: 22px; }
}

.search { position: relative; }
.search .input { padding-left: 46px; }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

.pr-row { display: flex; align-items: center; gap: 12px; }
.weekday-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday-chips .chip { padding: 0; justify-content: center; height: 44px; border-radius: 14px; }

.danger-zone { border-color: rgba(248, 113, 113, .25); }

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