:root {
  color-scheme: dark;
  --bg:#10120f;
  --sidebar:#141612;
  --surface:#191b17;
  --elevated:#20231c;
  --border:#32352d;
  --text:#f3f4ed;
  --muted:#abb0a3;
  --accent:#defb54;
  --accent-ink:#20270b;
  --radius:16px;
  font: 15px/1.5 "Inter", "Segoe UI", system-ui, sans-serif;
  background:var(--bg);
  color:var(--text);
  font-synthesis:none;
}
* { box-sizing:border-box; }
body { margin:0; min-width:300px; }
button, input, select, textarea { font:inherit; }
button,a { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { cursor:wait; opacity:.68; }
a { color:inherit; text-decoration:none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
h1,h2,h3,p,figure { margin:0; }
h1 { font-size:clamp(32px,4vw,47px); letter-spacing:-.055em; line-height:1.04; }
h2 { font-size:19px; letter-spacing:-.026em; line-height:1.2; }
h3 { font-size:16px; }
svg { flex:none; vertical-align:middle; }
[hidden] { display:none !important; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.muted { color:var(--muted); }
.loading { padding:36px; }

.shell { display:grid; grid-template-columns:222px minmax(0,1fr); min-height:100dvh; }
.sidebar { position:sticky; top:0; height:100dvh; display:flex; flex-direction:column; padding:24px 15px; background:var(--sidebar); border-right:1px solid #292c24; }
.brand { display:flex; align-items:center; gap:10px; white-space:nowrap; font-weight:850; letter-spacing:-.045em; font-size:16px; }
.sidebar .brand { margin:0 2px 39px; }
.brand-mark { display:grid; place-items:center; border-radius:10px; width:36px; height:36px; background:var(--accent); color:var(--accent-ink); }
.brand-mark svg { fill:currentColor; stroke:none; }
.brand-accent { color:var(--accent); }
.sidebar nav,.side-bottom { display:grid; gap:6px; }
.side-bottom { margin-top:auto; border-top:1px solid #2b2e26; padding-top:15px; }
.nav-item { display:flex; align-items:center; gap:12px; text-align:left; padding:12px; min-height:46px; color:var(--muted); background:transparent; border:1px solid transparent; border-radius:9px; font-weight:620; font-size:13px; }
.nav-item:hover { color:var(--text); background:#24271e; }
.nav-item.active { color:var(--accent); background:#293019; border-color:#3a4522; }
.main { min-width:0; }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:73px; border-bottom:1px solid #292c24; padding:12px clamp(20px,3.1vw,45px); }
.current-page { font-size:14px; font-weight:700; }
.top-actions, .header-date { display:flex; align-items:center; gap:9px; }
.top-actions { gap:18px; }
.header-date { color:var(--muted); font-size:13px; }
.header-date::first-letter { text-transform:uppercase; }
.mobile-brand,.mobile-nav { display:none; }
.content { max-width:1470px; padding:27px clamp(20px,3.1vw,45px) 55px; margin:auto; }
.btn { display:inline-flex; justify-content:center; align-items:center; gap:8px; min-height:41px; padding:9px 15px; border-radius:9px; border:1px solid var(--border); background:var(--elevated); color:var(--text); font-weight:690; font-size:13px; white-space:nowrap; }
.btn:hover { background:#2e3227; border-color:#515748; }
.btn.primary { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); font-weight:800; }
.btn.primary:hover { background:#efff99; border-color:#efff99; }
.btn.ghost { background:transparent; }
.btn.ghost:hover { background:var(--elevated); }
.btn.small { min-height:36px; padding:6px 10px; }
.btn.icon-btn { min-height:41px; min-width:41px; padding:0; background:transparent; color:var(--muted); }
.btn.icon-btn:hover { color:var(--text); background:var(--elevated); }
.btn.danger { color:#ffb2ae; border-color:#65403c; background:transparent; }
.btn.danger:hover { background:#432a29; }
.text-btn { display:inline-flex; align-items:center; gap:4px; flex-direction:row-reverse; min-height:40px; background:none; padding:3px 0; border:0; color:var(--accent); font-size:13px; font-weight:700; white-space:nowrap; }
.text-btn:hover { text-decoration:underline; }
.hero { display:flex; align-items:center; min-height:314px; position:relative; overflow:hidden; isolation:isolate; border-radius:var(--radius); border:1px solid #343b2b; background:#1c2118; padding:32px 40px; }
.hero::before { content:""; position:absolute; inset:0; z-index:-1; background:linear-gradient(90deg,#1c2118 0%,#1c2118 29%,#1c2118c9 45%,#151b1060 65%,#13150f19 100%),url('/hero.jpg') right 39% / max(74%, 480px) auto no-repeat; }
.hero h1 { font-size:clamp(48px,6.15vw,92px); line-height:.92; letter-spacing:-.077em; font-weight:860; margin:12px 0 15px; }
.hero h1 span { color:var(--accent); }
.hero p { color:#c4c9ba; max-width:390px; font-size:14px; }
.eyebrow { display:inline-flex; gap:7px; align-items:center; font-size:11px; font-weight:760; letter-spacing:.105em; text-transform:uppercase; }
.lime { color:var(--accent); }
.hero-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:20px; }
.hero-secondary { background:#252a20b8; border-color:#4d5445; }
.stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin:18px 0; }
.card { border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); min-width:0; }
.stat { padding:15px 16px; }
.stat header { display:flex; align-items:center; gap:8px; color:#c9cdc0; font-size:12px; font-weight:650; min-height:34px; }
.stat-icon,.tile { width:36px; height:36px; display:grid; place-items:center; flex:none; border-radius:9px; }
.lime-bg { color:#dbf76e; background:#2b351b; }
.blue-bg { color:#9ad7f4; background:#23333b; }
.orange-bg { color:#f3bd80; background:#3a2c1f; }
.purple-bg { color:#d3b9fb; background:#342a43; }
.stat strong { display:block; font-size:clamp(27px,3vw,38px); font-weight:780; letter-spacing:-.055em; line-height:1.15; margin-top:10px; }
.stat small { font-size:13px; color:#aeb4a6; letter-spacing:0; font-weight:650; }
.stat p { color:var(--muted); font-size:12px; margin-top:4px; }
.dashboard-grid,.training-grid { display:grid; grid-template-columns:minmax(0,1.48fr) minmax(0,1fr); gap:16px; }
.training-grid { align-items:start; }
.dash-side { display:grid; gap:14px; }
.panel { padding:20px; }
.section-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:13px; }
.section-head p,.page-heading p { color:var(--muted); margin-top:4px; font-size:13px; }
.section-head p::first-letter { text-transform:uppercase; }
.row-list { display:grid; }
.item-row { display:flex; gap:11px; align-items:center; padding:11px 0; min-height:62px; border-bottom:1px solid #31342b; }
.item-row:last-child { border-bottom:0; padding-bottom:0; }
.item-row:first-child { padding-top:3px; }
.tile { width:40px; height:40px; }
.row-main { flex:1; min-width:0; display:grid; gap:1px; overflow-wrap:anywhere; }
.row-main strong { font-size:14px; font-weight:720; }
.row-main span { font-size:12px; color:var(--muted); }
.empty { border:1px dashed #454a3b; border-radius:11px; color:var(--muted); background:#151712; padding:17px; font-size:13px; }
.habit-list { display:grid; }
.habit-row { display:flex; align-items:center; gap:9px; min-height:39px; border-bottom:1px solid #2c3027; cursor:pointer; position:relative; font-size:13px; }
.habit-row:last-child { border-bottom:0; }
.habit-symbol { color:#bbca96; width:25px; }
.habit-check { opacity:0; position:absolute; width:27px; height:27px; right:0; margin:0; cursor:pointer; }
.habit-box { margin-left:auto; display:grid; place-items:center; width:21px; height:21px; border:1px solid #53594a; border-radius:6px; color:transparent; }
.habit-check:focus-visible + .habit-box { outline:2px solid var(--accent); outline-offset:3px; }
.habit-check:checked + .habit-box { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
.week-strip { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:4px; }
.day-dot { text-align:center; color:var(--muted); font-size:11px; border-radius:7px; padding:3px 1px; min-width:0; }
.day-dot strong { display:block; color:var(--text); font-size:14px; }
.day-dot.current { background:#2c3224; }
.day-dot.done strong { color:var(--accent); }
.activity { margin-top:17px; }
.page-heading { display:flex; justify-content:space-between; align-items:center; gap:15px; margin:5px 0 23px; }
.segmented { display:flex; gap:6px; flex-wrap:wrap; margin:0 0 13px; }
.segmented button { min-height:39px; padding:6px 10px; color:var(--muted); background:none; border:1px solid var(--border); border-radius:8px; font-size:13px; }
.segmented button[aria-pressed=true] { background:#303b20; color:var(--accent); border-color:#526030; }
.plan ol { padding-left:20px; margin:14px 0 0; }
.plan li { padding:6px 0; }
.plan li::marker { color:var(--accent); font-weight:700; }
.plan span { display:block; color:var(--muted); font-size:13px; }
.progress-stats { grid-template-columns:repeat(3,minmax(0,1fr)); }
.trend-options { display:flex; gap:8px; }
.trend-exercise { width:min(100%,360px); margin:0 0 12px; }
.chart-wrap { margin:12px 0 8px; }
canvas { display:block; width:100%; height:230px; }
.chart-data { color:var(--muted); font-size:13px; }
summary { cursor:pointer; }
.compare-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.compare-grid .empty { margin-top:10px; }
.photo-preview { margin-top:10px; }
.photo-preview img,.full-photo { display:block; width:100%; height:clamp(150px,31vw,420px); object-fit:contain; background:#121410; border:1px solid var(--border); border-radius:10px; }
.photo-preview figcaption { margin-top:6px; display:flex; justify-content:flex-end; }
.vertical-links { display:grid; gap:8px; margin:14px 0; }
.vertical-links a { justify-content:flex-start; white-space:normal; }
.data-panel p { margin:10px 0; }
.account { display:flex; justify-content:space-between; align-items:center; }

.login { display:grid; place-items:center; min-height:100dvh; padding:20px; background:linear-gradient(90deg,#10120fed,#171c1192),url('/hero.jpg') right center/cover no-repeat; }
.login-panel { width:min(100%,430px); border:1px solid var(--border); background:#181c15; padding:clamp(20px,5vw,42px); border-radius:18px; }
.login-panel h1 { margin:25px 0 9px; }
.login-panel p { color:var(--muted); }
.login form { display:grid; gap:13px; margin-top:22px; }
.login form button { justify-content:space-between; }
.field { min-width:0; display:grid; align-content:start; gap:5px; color:#d9dccf; font-size:13px; font-weight:630; }
input:not([type=checkbox]),select,textarea { width:100%; min-width:0; min-height:41px; background:#11150f; color:var(--text); padding:7px 10px; border:1px solid #414639; border-radius:8px; font-size:14px; }
input[type=checkbox] { accent-color:var(--accent); }
input[type=file] { padding:7px; }
textarea { resize:vertical; }
.form-error,.login-panel .form-error { color:#ffb2ae; font-size:13px; }
.stack-form { display:grid; gap:13px; }
.panel .stack-form { margin-top:14px; }
.panel .stack-form > button { justify-self:start; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.form-grid.three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.form-actions { display:flex; flex-wrap:wrap; gap:10px; justify-content:flex-end; margin-top:7px; }
.form-actions .danger { margin-right:auto; }
dialog { width:min(710px,calc(100% - 28px)); max-height:calc(100dvh - 28px); color:var(--text); background:var(--surface); border:1px solid #494f3e; border-radius:17px; padding:0; overflow:auto; overscroll-behavior:contain; }
dialog::backdrop { background:#050703ad; }
body:has(dialog[open]) { overflow:hidden; }
.modal-head { z-index:2; position:sticky; top:0; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px 18px; background:var(--surface); border-bottom:1px solid var(--border); }
.modal-content { padding:18px; }
.modal-content > p { color:var(--muted); }
.modal-content > h3 { margin-top:16px; }
.quick-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.btn.quick { justify-content:flex-start; min-height:53px; white-space:normal; text-align:start; }
.btn.quick svg,.timer svg { color:var(--accent); }
.exercise-list,.detail-exercises { display:grid; gap:10px; }
.exercise { display:grid; gap:9px; border:1px solid var(--border); border-radius:11px; padding:11px; }
.exercise-head { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:end; gap:7px; }
.check-field { display:flex; align-items:center; gap:3px; min-height:40px; font-size:12px; white-space:nowrap; }
.check-field input { width:17px; height:17px; }
.exercise > .btn { justify-self:start; }
.set-table { display:grid; gap:5px; }
.set-line,.set-labels { display:grid; grid-template-columns:40px repeat(3,minmax(0,1fr)) 39px; gap:5px; align-items:center; }
.set-labels { color:var(--muted); font-size:12px; }
.set-line > span { padding-left:3px; }
.set-line input { padding:6px; }
.set-line .btn { min-width:38px; }
.timer { display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
.timer span { min-width:65px; font-weight:720; font-variant-numeric:tabular-nums; }
.previous { color:#c5d69f; font-size:12px; }
.programme { border-radius:9px; background:#242d1a; padding:10px 13px; }
.programme ol { padding-left:20px; margin:5px 0 0; }
.programme li { color:#d3ddc4; font-size:13px; }
.record-detail { display:grid; gap:12px; }
.record-detail > p,.detail-exercises small { color:var(--muted); }
.detail-exercises ol { padding-left:21px; margin:0; }
.details-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0; }
.details-grid div { background:#131611; border:1px solid var(--border); border-radius:9px; padding:10px; }
.details-grid dt { color:var(--muted); font-size:12px; }
.details-grid dd { margin:1px 0 0; font-weight:750; }
.note { white-space:pre-wrap; overflow-wrap:anywhere; }
.toast { position:fixed; right:20px; bottom:20px; z-index:3; max-width:min(360px,calc(100vw - 40px)); border:1px solid #4a5538; border-radius:11px; background:#272f1d; color:var(--text); padding:10px 14px; box-shadow:0 5px 22px #08090480; }

.heading-actions { display:flex; flex-wrap:wrap; gap:8px; }
.filter-field { max-width:320px; margin-bottom:14px; }
.catalog-browser { min-width:0; }
.modal-content > .catalog-browser { margin-top:13px; }
.catalog-controls { display:grid; grid-template-columns:minmax(0,1.6fr) repeat(2,minmax(0,1fr)); gap:12px; }
.catalog-count { margin:12px 0 9px; font-size:13px; }
.catalog-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.catalog-grid > .empty { grid-column:1/-1; }
.catalog-card { overflow:hidden; display:flex; flex-direction:column; }
.catalog-card-content { display:flex; flex:1; align-items:flex-start; flex-direction:column; gap:5px; padding:13px; }
.catalog-card-content h2 { font-size:16px; overflow-wrap:anywhere; }
.catalog-card-content p { color:var(--muted); font-size:12px; }
.catalog-card-content .btn { margin-top:auto; }
.exercise-photo { display:block; width:100%; aspect-ratio:3/2; background-color:#34372f; background-size:300% 300%; background-repeat:no-repeat; }
.sheet-machines { background-image:url('/catalog-machines.jpg'); }
.sheet-dumbbells { background-image:url('/catalog-dumbbells.jpg'); }
.sheet-barbody { background-image:url('/catalog-barbody.jpg'); }
.sheet-cardio { background-image:url('/catalog-cardio.jpg'); }
.photo-0 { background-position:0 0; }
.photo-1 { background-position:50% 0; }
.photo-2 { background-position:100% 0; }
.photo-3 { background-position:0 50%; }
.photo-4 { background-position:50% 50%; }
.photo-5 { background-position:100% 50%; }
.photo-6 { background-position:0 100%; }
.photo-7 { background-position:50% 100%; }
.photo-8 { background-position:100% 100%; }
.sheet-machines.photo-3 { background-image:url('/catalog-curl-femoral.jpg'); background-size:cover; background-position:center; }
.mini-photo { flex:none; width:70px; border-radius:7px; }
.exercise-name { display:flex; align-items:end; gap:8px; min-width:0; }
.exercise-name .field { flex:1; }
.exercise-name > span:empty { display:none; }
.timed-check { min-height:27px; }
.timed-sets :is(.set-line,.set-labels) { grid-template-columns:40px repeat(2,minmax(0,1fr)) 39px; }
.step-summary { padding:12px 0 0; margin-top:12px; border-top:1px solid var(--border); }
.steps-line { display:flex; gap:8px; align-items:center; }
.step-progress { display:block; block-size:6px; inline-size:100%; margin-top:10px; border:0; border-radius:999px; overflow:hidden; accent-color:var(--accent); }
.step-progress::-webkit-progress-bar { background:var(--border); }
.step-progress::-webkit-progress-value { background:var(--accent); }
.step-progress::-moz-progress-bar { background:var(--accent); }
.weekly-steps-total { margin-bottom:8px; }
.weekly-steps > div { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:16px; border-top:1px solid var(--border); padding:6px 0; }
.modal-content > .catalog-browser .catalog-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }

@media(max-width:1050px) {
  .shell { grid-template-columns:179px minmax(0,1fr); }
  .sidebar { padding-inline:10px; }
  .brand { font-size:14px; gap:7px; }
  .stats { gap:9px; }
  .stat { padding:11px; }
  .panel { padding:15px; }
}
@media(max-width:810px) {
  .shell { display:block; }
  .sidebar,.current-page { display:none; }
  .mobile-brand { display:block; }
  .mobile-nav { display:flex; position:fixed; z-index:4; inset:auto 0 0; justify-content:space-around; background:var(--sidebar); border-top:1px solid var(--border); padding:3px 4px max(3px,env(safe-area-inset-bottom)); }
  .mobile-nav .nav-item { display:grid; justify-items:center; gap:2px; text-align:center; font-size:10px; padding:4px; min-height:52px; min-width:54px; }
  .content { padding-bottom:calc(80px + env(safe-area-inset-bottom)); }
  .toast { bottom:calc(70px + env(safe-area-inset-bottom)); }
}
@media(max-width:580px) {
  .topbar { min-height:63px; padding:10px 13px; }
  .header-date { display:none; }
  .content { padding:13px 12px 80px; }
  .hero { min-height:270px; padding:20px 17px; }
  .hero::before { background:linear-gradient(90deg,#1c2118 1%,#1c2118e6 35%,#1c21186a 88%),url('/hero.jpg') 65% center/cover no-repeat; }
  .hero h1 { font-size:clamp(47px,11vw,61px); }
  .hero p { max-width:250px; }
  .stats { grid-template-columns:repeat(2,minmax(0,1fr)); margin:12px 0; }
  .progress-stats { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .progress-stats .stat { padding:8px; }
  .progress-stats .stat header { flex-direction:column; align-items:flex-start; gap:4px; }
  .progress-stats .stat strong { font-size:25px; }
  .progress-stats .stat small { font-size:11px; }
  .dashboard-grid,.training-grid { grid-template-columns:minmax(0,1fr); gap:12px; }
  .activity { margin-top:12px; }
  .page-heading { gap:10px; flex-wrap:wrap; margin:7px 0 15px; }
  .trend-panel .section-head { flex-wrap:wrap; }
  .exercise-head { grid-template-columns:minmax(0,1fr) auto; }
  .exercise-head .exercise-name { grid-column:span 2; }
  .exercise-head .icon-btn { justify-self:end; }
  .form-grid { gap:8px; }
  .modal-content { padding:12px; }
  .set-line,.set-labels { grid-template-columns:26px repeat(3,minmax(0,1fr)) 39px; }
  .timed-sets :is(.set-line,.set-labels) { grid-template-columns:26px repeat(2,minmax(0,1fr)) 39px; }
  .catalog-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
  .catalog-controls { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .catalog-controls .field:first-child { grid-column:1/-1; }
  .catalog-card-content { padding:9px; }
  .catalog-card-content h2 { font-size:14px; }
}
