/* ---------- палитры: акцент для ночной (-d) и дневной (-l) темы ---------- */
:root, [data-palette="ocean"] { --acc-d: #5cc8ff; --ink-d: #03131d; --acc-l: #0a78c2; --ink-l: #fff; }
[data-palette="lime"] { --acc-d: #c8f560; --ink-d: #141a06; --acc-l: #4d8a06; --ink-l: #fff; }
[data-palette="coral"] { --acc-d: #ff8a65; --ink-d: #220c04; --acc-l: #d9502a; --ink-l: #fff; }
[data-palette="violet"] { --acc-d: #b49cff; --ink-d: #160b33; --acc-l: #6a4bd6; --ink-l: #fff; }
[data-palette="mint"] { --acc-d: #4ee6b0; --ink-d: #03170f; --acc-l: #0b8f63; --ink-l: #fff; }
[data-palette="gold"] { --acc-d: #ffc94d; --ink-d: #1f1500; --acc-l: #a87a00; --ink-l: #fff; }
[data-palette="rose"] { --acc-d: #ff7eb6; --ink-d: #2a0716; --acc-l: #cc3576; --ink-l: #fff; }

/* ---------- ночная тема (по умолчанию) ---------- */
:root {
  --bg: #0d1117; --card: #161b22; --card2: #1f252e; --line: #2a313c;
  --text: #edf1f5; --muted: #8b95a3;
  --accent: var(--acc-d); --accent-ink: var(--ink-d);
  --danger: #ff6b6b; --warn: #ffb547; --ok: #4ade80;
  --ic-b: #cdd5df; --ic-m: #485261; --ic-c: #7a8494; --ic-floor: #2a313c;
  --bm-sil: #252c36; --bm-idle: #333c48;
  --r: 16px; --tabh: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
/* ---------- дневная тема ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f8; --card: #fff; --card2: #eef1f5; --line: #e0e4ea;
    --text: #141820; --muted: #687280;
    --accent: var(--acc-l); --accent-ink: var(--ink-l);
    --ic-b: #3b4350; --ic-m: #b6bec9; --ic-c: #98a1ad; --ic-floor: #e0e4ea;
    --bm-sil: #e4e8ee; --bm-idle: #d2d8e0;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f5f8; --card: #fff; --card2: #eef1f5; --line: #e0e4ea;
  --text: #141820; --muted: #687280;
  --accent: var(--acc-l); --accent-ink: var(--ink-l);
  --ic-b: #3b4350; --ic-m: #b6bec9; --ic-c: #98a1ad; --ic-floor: #e0e4ea;
  --bm-sil: #e4e8ee; --bm-idle: #d2d8e0;
  color-scheme: light;
}
:root { --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums; overscroll-behavior-y: none;
}
body.noscroll { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: .4; cursor: default; }
a { color: var(--accent); text-decoration: none; }
svg { display: block; }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 12px 8px; }
.cap::first-letter { text-transform: uppercase; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.danger-t { color: var(--danger) !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: calc(56px + var(--safe-t)) 16px calc(var(--tabh) + var(--safe-b) + 24px); }
body.is-auth #app { padding-top: calc(32px + var(--safe-t)); padding-bottom: 32px; }

/* --- top bar --- */
#top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: calc(52px + var(--safe-t)); padding: var(--safe-t) 8px 0;
  display: flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
#top:empty { display: none; }
#top h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-logo { padding: 0 6px; }
.top-logo .logo { width: 30px; height: 30px; }
.top-act { display: flex; align-items: center; gap: 2px; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--text); font-size: 18px; }
.icon-btn:active { background: var(--card2); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.sm { width: 34px; height: 34px; font-size: 15px; color: var(--muted); }
.syncdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin: 0 6px; background: var(--muted); vertical-align: middle; }
.syncdot.ok { background: var(--ok); } .syncdot.pending { background: var(--warn); } .syncdot.off { background: var(--danger); }

/* --- tabs --- */
#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: center;
  padding-bottom: var(--safe-b); background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
#tabs:empty { display: none; }
#tabs button { flex: 1; max-width: 140px; height: var(--tabh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
#tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#tabs button.on { color: var(--accent); }

/* --- cards & lists --- */
.card { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
button.card:active { transform: scale(.985); }
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.list { display: flex; flex-direction: column; }
.sec { margin: 22px 4px 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.chev { color: var(--muted); font-size: 22px; line-height: 1; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.badge.red { background: rgba(255, 107, 107, .15); color: var(--danger); }
.pill { background: var(--accent-soft); color: var(--accent); border-radius: 14px; padding: 8px 12px; font-weight: 700; text-align: center; line-height: 1.15; font-size: 15px; }
.pill small { font-weight: 500; font-size: 11px; }
.empty { text-align: center; padding: 24px 18px; }
.empty h3 { margin: 6px 0; }
.empty .btn { margin-top: 10px; }

/* --- buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line); font-weight: 600; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.btn:active { filter: brightness(1.15); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.big { min-height: 54px; font-size: 17px; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; margin-bottom: 10px; }
.row2 { display: flex; gap: 10px; margin: 12px 0; }
.row2 .btn { flex: 1; }

/* --- forms --- */
.form label, .fld { display: block; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.form label small, .fld small { display: block; margin-top: 4px; font-size: 12px; }
input:not([type=checkbox]):not([type=radio]), select {
  display: block; width: 100%; margin-top: 6px; height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card2); color: var(--text); font-size: 17px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
.ferr { color: var(--danger); font-size: 14px; min-height: 0; margin: -4px 0 10px; }
.ferr:empty { display: none; }
.lbl { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.seg { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.seg label { flex: 1; margin: 0 !important; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 11px 6px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 14px; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.seg-btns { display: flex; background: var(--card2); border-radius: 12px; padding: 3px; gap: 3px; margin: 6px 0 10px; }
.seg-btns button { flex: 1; padding: 9px 4px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg-btns button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }

/* --- auth --- */
.brand { text-align: center; margin: 12px 0 22px; }
.brand .logo { width: 64px; height: 64px; margin: 0 auto 10px; }
.brand h1 { margin: 0; font-size: 28px; }
.brand p { margin: 4px 0 0; color: var(--muted); }
.auth-links { display: flex; justify-content: space-between; padding: 4px 6px; font-weight: 600; }
.reginfo { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.key-ic, .sum-ic { font-size: 44px; text-align: center; }
.key-box { font: 700 21px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; text-align: center; padding: 16px 8px; background: var(--card2); border: 2px dashed var(--accent); border-radius: 14px; user-select: all; -webkit-user-select: all; word-break: break-all; }

/* --- today --- */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 6px 2px 16px; }
.hello h2 { margin: 2px 0 0; font-size: 24px; }
.plan-card { display: flex; align-items: center; gap: 12px; }
.pc-main { flex: 1; min-width: 0; }
.pc-title { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.play { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 16px; flex: none; padding-left: 3px; }
.mini-ics { display: flex; gap: 4px; margin-top: 8px; align-items: center; }
.mini-ics span { width: 40px; height: 30px; background: var(--card2); border-radius: 8px; padding: 2px; }
.mini-ics em { font-style: normal; font-size: 12px; color: var(--muted); padding-left: 4px; }
.live { display: flex; align-items: center; gap: 12px; border-color: var(--accent); background: var(--accent-soft); }
.dot-live { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 0 rgba(255, 107, 107, .6); animation: pulse 1.6s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(255, 107, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); } }
.welcome-ic { width: 150px; margin: 0 auto 6px; }
.w-row { display: flex; align-items: center; gap: 12px; }
.date-badge { width: 48px; flex: none; text-align: center; background: var(--card2); border-radius: 12px; padding: 6px 0; line-height: 1.1; }
.date-badge b { display: block; font-size: 20px; }
.date-badge span { font-size: 12px; color: var(--muted); }
.body-q { display: flex; align-items: center; gap: 12px; }
.body-q .grow { display: flex; flex-direction: column; }
.tpl { display: flex; flex-direction: column; gap: 4px; }
.tpl-p { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 14px; }
.tpl-p .mini-ics { margin: 0; }
.tpl-p .mini-ics span { width: 30px; height: 23px; }

/* --- workout --- */
.w-head { padding: 10px 14px; }
.w-name { border: 0 !important; background: transparent !important; padding: 0 !important; height: 38px !important; margin: 0 !important; font-size: 21px !important; font-weight: 700; }
.w-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.big-t { font-size: 20px; font-weight: 700; }
.dt { height: 38px !important; width: auto !important; font-size: 15px !important; margin: 0 !important; }
.ex-card.complete { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ex-top { display: flex; align-items: center; gap: 12px; }
.ex-ic { width: 76px; height: 57px; flex: none; background: var(--card2); border-radius: 12px; padding: 3px; }
.ex-ic.sm { width: 60px; height: 45px; }
.ex-title { flex: 1; min-width: 0; }
.ex-title b { display: block; font-size: 16px; line-height: 1.25; }
.prev { font-size: 13px; margin: 10px 0 2px; padding: 7px 10px; background: var(--card2); border-radius: 10px; }
.hint { display: block; width: 100%; text-align: left; margin-top: 8px; padding: 9px 11px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; }
.sets { margin-top: 10px; }
.set { display: grid; grid-template-columns: 22px 1fr 1fr 48px; gap: 8px; align-items: center; padding: 5px 0; }
.set.one { grid-template-columns: 22px 1fr 48px; }
.set-h { font-size: 12px; color: var(--muted); padding: 0 0 2px; text-align: center; }
.set .n { color: var(--muted); font-weight: 700; text-align: center; }
.stp { display: flex; align-items: center; background: var(--card2); border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.stp .sb { width: 38px; height: 46px; flex: none; font-size: 22px; color: var(--muted); }
.stp .sb:active { background: var(--line); color: var(--text); }
.stp .sv { flex: 1; min-width: 0; width: 100%; height: 46px !important; margin: 0 !important; border: 0 !important; background: transparent !important; padding: 0 !important; text-align: center; font-size: 19px !important; font-weight: 700; }
.chk { width: 48px; height: 46px; border-radius: 12px; border: 2px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.chk svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.set.done .chk { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.set.done .stp { background: var(--accent-soft); border-color: transparent; }
.ex-foot { display: flex; gap: 8px; margin-top: 6px; }
.add-ex { border-style: dashed; }

#restbar {
  position: fixed; left: 50%; transform: translate(-50%, 140%); bottom: calc(var(--tabh) + var(--safe-b) + 10px); z-index: 25;
  width: min(528px, calc(100% - 24px)); height: 58px; border-radius: 18px; overflow: hidden;
  display: flex; align-items: center; gap: 6px; padding: 0 8px 0 16px; background: var(--card); border: 1px solid var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transition: transform .25s ease, visibility .25s; visibility: hidden;
}
#restbar.on { transform: translate(-50%, 0); visibility: visible; }
.rb-fill { position: absolute; inset: 0; background: var(--accent-soft); transform-origin: left; transition: transform .25s linear; }
#restbar > *:not(.rb-fill) { position: relative; }
.rb-l { color: var(--muted); font-size: 14px; }
.rb-t { flex: 1; font-size: 24px; }
#restbar button { height: 40px; min-width: 44px; padding: 0 8px; border-radius: 10px; background: var(--card2); font-weight: 700; font-size: 14px; }

/* --- plan editor --- */
.pi-act { display: flex; }
.pi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pf-l { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stp.sm .sb { width: 34px; height: 42px; }
.stp.sm .sv { height: 42px !important; font-size: 17px !important; }
.pf select { margin: 0; height: 44px; font-size: 15px; }

/* --- picker --- */
.pick-top { position: sticky; top: 0; background: var(--card); padding-bottom: 8px; z-index: 2; }
.search { margin-top: 0 !important; }
.chips-row { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.gchip { flex: none; padding: 8px 14px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.gchip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 4px 0 12px; }
.pick { position: relative; background: var(--card2); border: 2px solid transparent; border-radius: 14px; padding: 6px 8px 10px; text-align: left; display: flex; flex-direction: column; }
.pick .ic { width: 100%; height: auto; aspect-ratio: 4 / 3; }
.pick b { font-size: 14px; line-height: 1.2; margin-top: 4px; }
.pick small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick-n { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 800; display: grid; place-items: center; }
.pick-foot { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 10px 0 4px; background: var(--card); }
.pick-foot .grow { flex: 1; }
.icon-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.icon-pick label { margin: 0 !important; }
.icon-pick input { position: absolute; opacity: 0; }
.icon-pick span { display: block; background: var(--card2); border: 2px solid transparent; border-radius: 10px; padding: 2px; }
.icon-pick input:checked + span { border-color: var(--accent); }

/* --- SVG icons --- */
.ic { width: 100%; height: 100%; }
.ic line, .ic path { stroke-linecap: round; stroke-linejoin: round; fill: none; }
.ic .floor { stroke: var(--ic-floor); stroke-width: 1.5; }
.ic .mc line, .ic .mc path { stroke: var(--ic-m); }
.ic .mc rect, .ic .mc circle { fill: var(--ic-m); }
.ic .mc .hub { fill: var(--card2); }
.ic .cb line { stroke: var(--ic-c); stroke-width: 1.2; stroke-dasharray: 2.5 2; }
.ic .pb line { stroke: var(--ic-b); stroke-width: 6.5; }
.ic .pb .head { fill: var(--ic-b); }
.ic .pb .bk { opacity: .5; }
.ic .pb .hl { stroke: var(--accent); }
.ic .ar { stroke: var(--accent); stroke-width: 2; opacity: .9; }

/* --- progress --- */
.stats4 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.stats4 > div, .stats3 > div { display: flex; flex-direction: column; }
.stats4 b { font-size: 21px; margin: 2px 0; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin: 14px 0; }
.stats3 > div { background: var(--card2); border-radius: 12px; padding: 10px 4px; align-items: center; }
.stats3 b { font-size: 18px; }
.dl { font-size: 13px; font-weight: 700; color: var(--muted); }
.dl.up { color: var(--ok); } .dl.down { color: var(--danger); }
.hm-wrap { display: flex; gap: 6px; }
.hm-days { display: grid; grid-template-rows: repeat(7, 1fr); font-size: 10px; color: var(--muted); gap: 3px; }
.hm-days span { line-height: 1; display: flex; align-items: center; height: 100%; }
.hm { flex: 1; display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 3px; }
.hm i { aspect-ratio: 1; border-radius: 3px; background: var(--card2); }
.hm i.l1 { background: color-mix(in srgb, var(--accent) 60%, var(--card2)); }
.hm i.l2 { background: var(--accent); }
.hm i.fut { background: transparent; }
.trophy svg { width: 22px; height: 22px; fill: none; stroke: var(--warn); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pr-row, .ex-row, .hist-row, .inv-row, .user-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 0; border-top: 1px solid var(--line); }
.list-card { padding-top: 4px; padding-bottom: 4px; }
.list-card > :first-child, .card-h + .pr-row { border-top: 0; }
.pr-row .grow, .ex-row .grow, .inv-row .grow, .user-row .grow { display: flex; flex-direction: column; }
.mini-ic { width: 48px; height: 36px; flex: none; background: var(--card2); border-radius: 9px; padding: 2px; }
.spark { width: 72px; height: 26px; flex: none; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hist-row { font-size: 14px; }
.hist-row > .muted { width: 74px; flex: none; }
.ex-hero { text-align: center; }
.hero-ic { width: 220px; max-width: 80%; margin: 0 auto; }
.ex-hero h2 { margin: 6px 0 2px; font-size: 21px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); }
.chip.pri { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.chip.sm { font-size: 11px; padding: 1px 7px; }
.legend { margin-top: 10px; }
.source { margin-top: 10px; font-size: 12px; }
.stab { margin-top: 10px; }
.stab summary { cursor: pointer; }
.stab div { margin-top: 6px; line-height: 1.5; }
.chart { width: 100%; height: auto; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 10.5px; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .1; }
.chart .dot { fill: var(--card); stroke: var(--accent); stroke-width: 2; }
.chart .dot.last { fill: var(--accent); }
.chart .lbl-last { fill: var(--text); font-size: 12px; font-weight: 700; }
.chart-one { text-align: center; padding: 18px 0; }
.chart-one b { font-size: 30px; }
.body-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

/* --- settings --- */
.acc { display: flex; align-items: center; gap: 12px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 21px; font-weight: 800; flex: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 16px; }
.set-card { padding: 4px 14px; }
.tg { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.set-card > :first-child { border-top: 0; }
.tg > span { flex: 1; }
.tg small { display: block; color: var(--muted); font-size: 13px; }
.tg input { position: absolute; opacity: 0; pointer-events: none; }
.tg i { width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.tg i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.tg input:checked + i { background: var(--accent); }
.tg input:checked + i::after { transform: translateX(20px); }
.set-sub { padding: 4px 0 10px; }
.set-link { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 13px 0; border-top: 1px solid var(--line); text-align: left; font-weight: 500; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 10px; }
.kbd { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--card2); border: 1px solid var(--line); }

/* --- sheet --- */
#sheet { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#sheet.open { pointer-events: auto; }
.sh-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); animation: fade .2s; }
.sh-panel {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 6px 16px calc(16px + var(--safe-b)); animation: up .25s ease;
  overscroll-behavior: contain;
}
.sh-panel.tall { height: 88vh; }
.sh-grip { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 6px; }
.sh-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: -6px; background: var(--card); z-index: 3; padding: 4px 0; }
.sh-head h2 { margin: 0; font-size: 19px; }
.sh-body h2 { font-size: 20px; margin: 6px 0; }
.confirm-t { font-size: 18px; font-weight: 700; margin: 12px 0 6px; }
.menu { display: flex; flex-direction: column; padding-bottom: 6px; }
.menu button { text-align: left; padding: 15px 4px; border-top: 1px solid var(--line); font-size: 16px; }
.menu button:first-child { border-top: 0; }
.recs { background: var(--card2); border-radius: 14px; padding: 12px; margin-bottom: 14px; }
.recs .pr-row { border-color: var(--line); }
.qr { width: 240px; max-width: 80%; margin: 4px auto 10px; border-radius: 14px; overflow: hidden; }
.qr svg { width: 100%; height: auto; }
.qr-url { font-size: 13px; color: var(--muted); text-align: center; word-break: break-all; }
@keyframes up { from { transform: translate(-50%, 100%); } }
@keyframes fade { from { opacity: 0; } }

#toast {
  position: fixed; left: 50%; top: calc(64px + var(--safe-t)); transform: translate(-50%, -20px); z-index: 60; opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; transition: .25s;
  max-width: calc(100% - 32px); text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- v1.1: дневник, записи, карта мышц, техника, оформление ---------- */
.lang-sw { position: absolute; top: calc(14px + var(--safe-t)); right: 16px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 13px; }
body.is-auth #app { position: relative; }
.week { display: flex; align-items: center; gap: 2px; margin: 4px -6px 6px; }
.week-days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 5px; border-radius: 12px; color: var(--muted); font-size: 11px; text-transform: capitalize; }
.wd b { font-size: 17px; color: var(--text); }
.wd i { width: 5px; height: 5px; border-radius: 50%; }
.wd i.dot { background: var(--accent); }
.wd.today b { color: var(--accent); }
.wd.on { background: var(--accent); color: var(--accent-ink); }
.wd.on b { color: var(--accent-ink); }
.wd.on i.dot { background: var(--accent-ink); }
.wd i.ring { box-shadow: inset 0 0 0 1.5px var(--accent); }
.wd.on i.ring { box-shadow: inset 0 0 0 1.5px var(--accent-ink); }
.wd.fut:not(.on) b { color: var(--muted); }
.wd:disabled { opacity: .35; }
.plan-day { border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
.plan-day .row2 { margin-top: 12px; }
.pd-h { display: flex; justify-content: space-between; align-items: center; padding: 2px 0 4px; }
.pd-row { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line); }
.pd-h + .pd-row { border-top: 0; }
.pd-row .entry { border-top: 0; flex: 1; }
.pd-row.ok .entry-sum { color: var(--muted); }
.pd-row.ok .src { color: var(--accent); font-weight: 600; }
.pd-row .icon-btn svg { fill: none; }
.pd-foot { display: flex; justify-content: space-between; padding-top: 4px; border-top: 1px solid var(--line); }
.start-dp { margin-bottom: 12px; }
/* v1.2: объявление, состояние сервера */
.announce { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.status-card { display: flex; flex-direction: column; gap: 12px; }
.st-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-row .muted { flex: 1; }
.st-dot { width: 9px; height: 9px; border-radius: 50%; background: #2fbf71; box-shadow: 0 0 0 3px color-mix(in srgb, #2fbf71 25%, transparent); }
.st-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.st-tile { background: var(--card2); border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.st-tile b { font-size: 20px; }
.st-tile span { font-size: 11px; color: var(--muted); }
.st-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.st-list > div:first-child { border-top: 0; }
.st-list span { color: var(--muted); }
.st-list b { text-align: right; font-weight: 600; }
.st-ok { color: #2fbf71; } .st-warn { color: #e0a800; } .st-bad { color: #e5484d; }
textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font: inherit; font-size: 16px; outline: none; resize: vertical; }
textarea:focus { border-color: var(--accent); }
.day-h { display: flex; align-items: center; justify-content: space-between; margin: 10px 2px 10px; }
.day-h h2 { margin: 0; font-size: 22px; }
.entries { padding-top: 2px; padding-bottom: 2px; }
.entry { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 0; border-top: 1px solid var(--line); }
.list-card > .entry:first-child, .day-card-h + .entry { border-top: 0; }
.entry .grow { display: flex; flex-direction: column; gap: 1px; }
.entry b { font-size: 15.5px; line-height: 1.25; }
.entry-ic { width: 64px; height: 48px; flex: none; background: var(--card2); border-radius: 11px; padding: 2px; }
.entry-sum { font-size: 15px; font-weight: 600; color: var(--accent); }
.entry .src { font-size: 12px; color: var(--muted); }
.entry.compact { padding: 6px 0; gap: 10px; }
.entry.compact b { font-size: 14px; font-weight: 600; }
.entry.compact .entry-sum { font-size: 13px; }
.empty.slim { padding: 16px; }
.empty.slim p { margin: 0; }
.actions { margin-top: 0; }
.actions .btn svg, .play svg, .btn svg { fill: none; }
.btn [d^="M8 5.5"], .play svg path { fill: currentColor; stroke: none; }
.day-card { padding-top: 10px; padding-bottom: 8px; }
.day-card-h { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 2px 0 6px; text-align: left; }
.more { padding: 4px 0 2px 58px; }
.plan-card { padding: 12px 12px 12px 14px; }
.plan-card .pc-main { text-align: left; }
.play svg { width: 20px; height: 20px; }
.plan-pick { display: flex; align-items: center; gap: 10px; }
.plan-pick .mini-ics { margin-top: 6px; }
.start-list { background: var(--card2); border-radius: 14px; padding: 6px 10px; margin: 10px 0; max-height: 40vh; overflow-y: auto; }
.start-it { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 15px; }
.start-it .mini-ic { background: var(--card); }
.ent-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.ent-head b { font-size: 17px; }
.ent-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 8px; }
.ent-grid .stp .sb { width: 54px; height: 52px; font-size: 26px; }
.ent-grid .stp .sv { height: 52px !important; font-size: 22px !important; }
.ent-sets { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.ent-set { display: grid; grid-template-columns: 18px 1fr 1fr 34px; gap: 6px; align-items: end; }
.ent-set .n { color: var(--muted); font-weight: 700; padding-bottom: 14px; }
.ent-set .pf-l { font-size: 11px; }
.ent-set .stp .sb { width: 30px; }
.link-btn { display: block; color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 0 14px; }
.bodymap { width: 100%; max-width: 330px; height: auto; margin: 0 auto 6px; display: block; }
.bm-sil { fill: var(--bm-sil); }
.bm-r { fill: var(--bm-idle); stroke: var(--card); stroke-width: .6; stroke-linejoin: round; }
.bm-r.lv1 { fill: color-mix(in srgb, var(--accent) 45%, var(--bm-idle)); }
.bm-r.lv2 { fill: var(--accent); }
.bm-line { stroke: var(--card); stroke-width: .7; fill: none; }
.bm-t { fill: var(--muted); font-size: 9px; }
.tech ol { margin: 0 0 10px; padding-left: 22px; }
.tech li { margin-bottom: 6px; }
.mistakes { background: color-mix(in srgb, var(--warn) 12%, transparent); border-radius: 12px; padding: 10px 12px; }
.mistakes b { display: block; font-size: 14px; margin-bottom: 4px; color: var(--warn); }
.mistakes ul { margin: 0; padding-left: 18px; font-size: 14px; }
.mistakes li { margin-bottom: 3px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; padding: 8px 0 4px; }
.sw { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 2px solid transparent; }
.sw i { width: 26px; height: 26px; border-radius: 50%; background: var(--acc-d); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .sw i { background: var(--acc-l); } }
:root[data-theme="light"] .sw i { background: var(--acc-l); }
.sw.on { border-color: var(--accent); }

@media (min-width: 600px) {
  .pick-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
