:root {
  --bg: #0b0f14;
  --bg-soft: #0f151d;
  --surface: #121922;
  --surface-2: #17212c;
  --surface-3: #1d2a37;
  --text: #e8edf2;
  --muted: #93a1b3;
  --muted-2: #6b7a8c;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --orange: #ff7a1a;
  --orange-2: #ffa45c;
  --orange-soft: rgba(255, 122, 26, 0.13);
  --lime: #b6f36a;
  --blue: #5cc8ff;
  --blue-soft: rgba(92, 200, 255, 0.12);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --red: #ff5c5c;
  --red-soft: rgba(255, 92, 92, 0.12);
  --purple: #c084fc;
  --purple-soft: rgba(192, 132, 252, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --sidebar-w: 238px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #f2f5f8;
  --bg-soft: #e9eef4;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eef3f8;
  --text: #101828;
  --muted: #5f6f82;
  --muted-2: #8b98a8;
  --line: rgba(16, 24, 40, 0.08);
  --line-strong: rgba(16, 24, 40, 0.16);
  --orange: #e9650e;
  --orange-2: #c95308;
  --orange-soft: rgba(233, 101, 14, 0.1);
  --blue-soft: rgba(29, 78, 216, 0.08);
  --green-soft: rgba(31, 122, 77, 0.1);
  --red-soft: rgba(180, 35, 24, 0.08);
  --purple-soft: rgba(126, 34, 206, 0.08);
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 82% -8%, rgba(255, 122, 26, 0.09), transparent 62%),
    radial-gradient(900px 520px at -10% 105%, rgba(92, 200, 255, 0.055), transparent 60%),
    var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="light"] body {
  background:
    radial-gradient(1000px 560px at 85% -8%, rgba(233, 101, 14, 0.07), transparent 62%),
    radial-gradient(800px 480px at -10% 105%, rgba(29, 78, 216, 0.05), transparent 60%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 0%, black, transparent 75%);
}

[data-theme="light"] body::before { opacity: 0.5; background-image: linear-gradient(rgba(16,24,40,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(16,24,40,.025) 1px, transparent 1px); }

::selection { background: var(--orange); color: #1a0d04; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }

.app-shell { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-w);
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 21, 29, 0.96), rgba(11, 15, 20, 0.96));
  backdrop-filter: blur(18px);
}
[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(247,249,251,.96)); }

.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--orange), #d95400);
  color: #1a0d04; font-weight: 900; font-size: 22px;
  box-shadow: 0 10px 26px rgba(255, 122, 26, 0.28);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-size: 18px; letter-spacing: 0.16em; font-weight: 900; }
.brand-copy small { font-size: 10px; letter-spacing: 0.28em; color: var(--muted); text-transform: uppercase; margin-top: 4px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 13.5px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.active { color: var(--orange); background: var(--orange-soft); }
.nav-item.active .icon { stroke-width: 2.1; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.mini-week {
  padding: 12px 13px; border-radius: 13px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px;
}
.mini-label { font-size: 10px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted-2); }
.mini-week strong { font-size: 13px; }
.mini-week small { color: var(--muted); font-size: 11px; }
.nav-settings { margin-top: 2px; }

/* ---------- main / topbar ---------- */
.main { width: calc(100% - var(--sidebar-w)); margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 20, 0.72);
  backdrop-filter: blur(18px);
}
[data-theme="light"] .topbar { background: rgba(242, 245, 248, 0.78); }
.topbar-title { min-width: 0; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 3px; }
.topbar h1 { font-size: 24px; letter-spacing: -0.03em; line-height: 1.1; font-weight: 800; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.week-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.week-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); transition: color .18s, border-color .18s, background .18s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }

.view { max-width: 1280px; margin: 0 auto; padding: 26px 30px 90px; outline: none; }

/* ---------- layout helpers ---------- */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 700; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.accent { color: var(--orange); }
.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; }

/* ---------- cards ---------- */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 19px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
[data-theme="light"] .card { background: var(--surface); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.card-head .link { white-space: nowrap; }
.card-title { font-size: 15px; font-weight: 750; letter-spacing: -0.01em; }
.card-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.card + .card { margin-top: 14px; }
.card-flat { background: var(--surface-2); box-shadow: none; }

.hero {
  position: relative; overflow: hidden;
  padding: 24px;
  border-radius: 22px;
  border: 1px solid rgba(255, 122, 26, 0.26);
  background:
    radial-gradient(520px 260px at 100% 0%, rgba(255, 122, 26, 0.2), transparent 62%),
    linear-gradient(135deg, rgba(255, 122, 26, 0.12), var(--surface) 58%);
}
.hero::after {
  content: ""; position: absolute; right: -40px; bottom: -70px;
  width: 230px; height: 230px; border-radius: 50%;
  border: 1px solid rgba(255, 122, 26, 0.18);
  box-shadow: 0 0 0 28px rgba(255, 122, 26, 0.045), 0 0 0 58px rgba(255, 122, 26, 0.025);
  pointer-events: none;
}
.hero-date { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--orange-2); font-weight: 700; }
.hero-title { font-size: clamp(26px, 3.2vw, 38px); line-height: 1.06; letter-spacing: -0.045em; font-weight: 850; margin-top: 8px; }
.hero-text { color: var(--muted); max-width: 560px; margin-top: 8px; font-size: 13px; }
.hero-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 5px 9px; border-radius: 8px; background: var(--orange-soft); color: var(--orange-2); font-weight: 650; }

.stat { padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .13em; color: var(--muted-2); font-weight: 650; }
.stat-value { font-size: 27px; line-height: 1.05; font-weight: 800; letter-spacing: -0.04em; margin-top: 8px; }
.stat-value small { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.stat-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 11.5px; color: var(--muted); }
.stat-accent { position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 4px; background: var(--orange); }
.stat { position: relative; overflow: hidden; }
.stat.orange .stat-accent { background: var(--orange); }
.stat.blue .stat-accent { background: var(--blue); }
.stat.green .stat-accent { background: var(--green); }
.stat.purple .stat-accent { background: var(--purple); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 650; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.pill.orange { background: var(--orange-soft); color: var(--orange-2); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.purple { background: var(--purple-soft); color: var(--purple); }

/* ---------- buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 15px; border-radius: 11px; border: 1px solid transparent;
  font-weight: 700; font-size: 12.5px; line-height: 1.2;
  transition: transform .15s ease, background .18s ease, border-color .18s ease, opacity .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(145deg, var(--orange), #e9650e); color: #1a0d04; box-shadow: 0 8px 22px rgba(255, 122, 26, 0.2); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn-soft:hover { background: var(--surface-3); }
.btn-danger { background: var(--red-soft); border-color: rgba(255, 92, 92, 0.22); color: var(--red); }
.btn-sm { padding: 7px 10px; border-radius: 9px; font-size: 11.5px; }
.btn-lg { padding: 13px 19px; border-radius: 13px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { color: var(--orange-2); font-weight: 650; font-size: 12px; }
.link:hover { text-decoration: underline; }

.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 11.5px; font-weight: 650;
  transition: all .16s ease;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.active { color: #1a0d04; background: var(--orange); border-color: var(--orange); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }

.field { display: flex; flex-direction: column; gap: 5px; }
.label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.input, .select, textarea.input {
  width: 100%; padding: 10px 12px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); outline: none;
  transition: border-color .16s, box-shadow .16s;
  min-height: 40px;
}
[data-theme="light"] .input, [data-theme="light"] .select, [data-theme="light"] textarea.input { background: var(--surface-2); }
.input:focus, .select:focus, textarea.input:focus { border-color: rgba(255, 122, 26, .65); box-shadow: 0 0 0 3px var(--orange-soft); }
.input::placeholder { color: var(--muted-2); }
.input-sm { padding: 8px 8px; text-align: center; min-height: 36px; font-size: 12.5px; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
textarea.input { min-height: 78px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-note { font-size: 11px; color: var(--muted); }

.checkline { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.checkline input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--orange); }
.checkline.done { background: var(--green-soft); border-color: rgba(74, 222, 128, .2); }

/* ---------- progress ---------- */
.progress { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--orange-2)); transition: width .3s ease; }
.progress.blue > span { background: linear-gradient(90deg, #2f9bd6, var(--blue)); }
.progress.green > span { background: linear-gradient(90deg, #2f9e61, var(--green)); }
.progress.purple > span { background: linear-gradient(90deg, #8b5cf6, var(--purple)); }
.progress-row { display: flex; flex-direction: column; gap: 5px; }
.progress-row .between { font-size: 11.5px; }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .85fr); gap: 14px; align-items: start; }
.dash-stack { display: flex; flex-direction: column; gap: 14px; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric-strip .stat-value { font-size: 23px; }
.quick-weight { display: flex; gap: 8px; align-items: end; }
.quick-weight .input { max-width: 100px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-button { width: 100%; background: transparent; border: 0; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.list-button:hover { background: var(--surface-2); border-radius: 10px; padding-left: 8px; padding-right: 8px; margin-left: -8px; margin-right: -8px; }
.list-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.list-icon.orange { background: var(--orange-soft); color: var(--orange-2); }
.list-icon.green { background: var(--green-soft); color: var(--green); }
.list-main { min-width: 0; flex: 1; }
.list-title { font-size: 12.5px; font-weight: 650; }
.list-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.list-end { text-align: right; font-size: 11px; color: var(--muted); white-space: nowrap; }

.week-line { display: flex; gap: 6px; margin-top: 10px; }
.week-dot { height: 6px; flex: 1; border-radius: 99px; background: var(--surface-3); }
.week-dot.done { background: var(--orange); }
.week-dot.current { background: var(--orange-2); box-shadow: 0 0 0 3px var(--orange-soft); }

/* ---------- workout ---------- */
.day-select { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.day-card { padding: 15px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .18s, transform .18s; color: inherit; font: inherit; text-align: left; width: 100%; }
.day-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.day-card.active { border-color: rgba(255, 122, 26, .45); background: linear-gradient(180deg, var(--orange-soft), var(--surface)); }
.day-card .day-short { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted-2); font-weight: 700; }
.day-card .day-name { font-size: 15px; font-weight: 750; margin-top: 5px; }
.day-card .day-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.day-card .day-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-bottom: 10px; }
.day-dot.blue { background: var(--blue); } .day-dot.green { background: var(--green); } .day-dot.purple { background: var(--purple); }

.exercise-card { padding: 17px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.exercise-card + .exercise-card { margin-top: 10px; }
.exercise-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.exercise-name { font-size: 14px; font-weight: 750; }
.exercise-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.exercise-note { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.exercise-prev { font-size: 11px; color: var(--muted-2); margin-top: 6px; }
.exercise-prev strong { color: var(--muted); }
.set-labels, .set-row { display: grid; grid-template-columns: 34px 110px 86px 86px 38px; gap: 6px; align-items: center; max-width: 520px; }
.set-labels { margin-top: 12px; font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 700; }
.set-labels span { text-align: center; }
.set-row { padding: 5px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-num { text-align: center; font-size: 11px; color: var(--muted-2); font-weight: 700; }
.set-check { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--bg-soft); color: var(--muted-2); display: grid; place-items: center; }
.set-check:hover { border-color: var(--orange); color: var(--orange); }
.set-row.done { opacity: .62; }
.set-row.done .set-check { background: var(--green); border-color: var(--green); color: #06210f; }
.set-row.done .input { border-color: transparent; background: transparent; }
.set-hint { font-size: 11px; color: var(--orange-2); margin-top: 6px; }
.set-hint strong { color: var(--text); }

.test-box { border: 1px solid rgba(255, 122, 26, .28); background: var(--orange-soft); border-radius: 14px; padding: 14px; margin-top: 10px; }
.test-box h4 { font-size: 13px; margin-bottom: 4px; }
.test-box p { font-size: 11.5px; color: var(--muted); }
.test-box .form-grid { margin-top: 10px; }

.workout-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.workout-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.finish-bar { position: sticky; bottom: 14px; z-index: 15; display: flex; gap: 9px; justify-content: flex-end; padding: 11px; margin-top: 18px; border: 1px solid var(--line); border-radius: 15px; background: rgba(18, 25, 34, .86); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
[data-theme="light"] .finish-bar { background: rgba(255,255,255,.9); }
.finish-bar .grow { font-size: 11.5px; color: var(--muted); }
.draft-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border-radius: 12px; background: var(--orange-soft); border: 1px solid rgba(255,122,26,.24); margin-bottom: 12px; font-size: 12px; }

/* ---------- program ---------- */
.program-week { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.program-week:last-child { border-bottom: 0; }
.week-num { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-3); font-size: 11px; font-weight: 750; color: var(--muted); }
.program-week.active .week-num { background: var(--orange); color: #1a0d04; }
.program-week .pw-title { font-size: 12.5px; font-weight: 650; }
.program-week .pw-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.tm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.tm-card { padding: 13px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.tm-card .label { margin-bottom: 5px; }
.tm-card .input { background: var(--bg); }
.program-day { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.program-day + .program-day { margin-top: 10px; }
.pd-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pd-name { font-size: 15px; font-weight: 750; }
.pd-ex { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 11.5px; }
.pd-ex:first-of-type { border-top: 0; }
.pd-ex .ex-dose { color: var(--orange-2); font-weight: 650; white-space: nowrap; }

/* ---------- body / charts ---------- */
.chart-card { padding: 17px; }
.chart { width: 100%; height: 210px; margin-top: 4px; }
.chart text { font-family: var(--font); fill: var(--muted-2); font-size: 9px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .area { fill: url(#areaGradient); opacity: .5; }
.chart .line { fill: none; stroke: var(--orange); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line.blue { stroke: var(--blue); }
.chart .dot { fill: var(--surface); stroke: var(--orange); stroke-width: 2; }
.chart .dot.blue { stroke: var(--blue); }
.chart-empty { height: 180px; display: grid; place-items: center; color: var(--muted); font-size: 12px; border: 1px dashed var(--line); border-radius: 12px; margin-top: 10px; }
.body-latest { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.body-latest .stat { padding: 13px; }
.body-latest .stat-value { font-size: 21px; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.data-table th { text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 700; padding: 8px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 8px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.num { text-align: right; }
.data-table .row-actions { display: flex; gap: 5px; justify-content: flex-end; }
.mini-btn { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: inline-grid; place-items: center; }
.mini-btn:hover { color: var(--red); border-color: var(--red); }

/* ---------- nutrition ---------- */
.macro-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.macro-card { padding: 13px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); }
.macro-card .label { font-size: 9.5px; }
.macro-card .macro-val { font-size: 19px; font-weight: 800; letter-spacing: -.03em; margin-top: 5px; }
.macro-card .macro-val small { font-size: 10px; font-weight: 500; color: var(--muted); }
.macro-card .progress { margin-top: 8px; height: 5px; }
.macro-card .macro-sub { font-size: 10px; color: var(--muted); margin-top: 5px; }
.date-nav { display: flex; align-items: center; gap: 8px; }
.date-nav .date-label { font-size: 12px; font-weight: 650; min-width: 100px; text-align: center; }
.meal { padding: 15px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.meal + .meal { margin-top: 9px; }
.meal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.meal-title { font-size: 12.5px; font-weight: 700; }
.meal-total { font-size: 10.5px; color: var(--muted); }
.food-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 9px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 11.5px; }
.food-row:first-of-type { border-top: 0; }
.food-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.food-grams { color: var(--muted); font-size: 10.5px; }
.food-kcal { color: var(--text); font-weight: 650; font-size: 11px; }
.food-del { width: 24px; height: 24px; border: 0; background: transparent; color: var(--muted-2); display: grid; place-items: center; border-radius: 6px; }
.food-del:hover { color: var(--red); background: var(--red-soft); }
.water-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.water-cup { width: 26px; height: 30px; border-radius: 6px 6px 9px 9px; border: 1px solid var(--line-strong); background: var(--bg-soft); }
.water-cup.full { background: var(--blue-soft); border-color: rgba(92,200,255,.4); }
.supp-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.supp-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 11.5px; }
.supp-item input { width: 17px; height: 17px; accent-color: var(--orange); flex: 0 0 auto; }
.supp-item .supp-dose { color: var(--muted); font-size: 10px; margin-left: auto; white-space: nowrap; }
.food-picker { max-height: 58vh; overflow: auto; margin-top: 10px; }
.food-pick { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; font: inherit; text-align: left; width: 100%; cursor: pointer; }
.food-pick:hover { background: var(--surface-2); }
.food-pick:last-child { border-bottom: 0; }
.food-pick .fp-name { font-size: 12px; font-weight: 600; }
.food-pick .fp-macros { font-size: 10px; color: var(--muted); margin-top: 2px; }
.food-pick .fp-kcal { font-size: 11px; color: var(--orange-2); font-weight: 700; }

/* ---------- empty / callout ---------- */
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty .empty-icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted-2); }
.empty h3 { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.empty p { font-size: 12px; max-width: 340px; margin: 0 auto; }
.callout { padding: 13px 14px; border-radius: 13px; border: 1px solid rgba(255,122,26,.2); background: var(--orange-soft); font-size: 11.5px; color: var(--muted); }
.callout strong { color: var(--text); }
.callout.blue { border-color: rgba(92,200,255,.2); background: var(--blue-soft); }
.callout.green { border-color: rgba(74,222,128,.2); background: var(--green-soft); }
.callout.red { border-color: rgba(255,92,92,.2); background: var(--red-soft); }
.callout + .callout { margin-top: 8px; }

/* ---------- modal / toast / timer ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3, 6, 10, .68); backdrop-filter: blur(8px); animation: fadeIn .16s ease; }
.modal { width: min(580px, 100%); max-height: 88vh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); padding: 21px; animation: popIn .18s ease; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { font-size: 18px; letter-spacing: -.02em; }
.modal-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.modal-close { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.toast-root { position: fixed; right: 18px; bottom: 154px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 36px)); }
.toast { padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-3); color: var(--text); font-size: 12px; box-shadow: var(--shadow); animation: slideUp .2s ease; }
.toast.green { border-color: rgba(74,222,128,.3); background: linear-gradient(180deg, var(--green-soft), var(--surface-3)); }
.toast.red { border-color: rgba(255,92,92,.3); background: linear-gradient(180deg, var(--red-soft), var(--surface-3)); }
.timer-bar { position: fixed; right: 18px; bottom: 86px; z-index: 60; display: flex; align-items: center; gap: 14px; padding: 11px 13px; border-radius: 14px; border: 1px solid rgba(255,122,26,.3); background: var(--surface-3); box-shadow: var(--shadow); }
.timer-bar[hidden] { display: none; }
.timer-copy { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.timer-copy strong { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.timer-actions { display: flex; gap: 5px; }
.timer-bar.done { border-color: rgba(74,222,128,.4); }

/* ---------- bottom nav ---------- */
.bottom-nav { display: none; }

/* ---------- animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view > * { animation: fadeIn .24s ease both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .dash-grid { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .sidebar { display: none; }
  .main { width: 100%; margin-left: 0; }
  .topbar { padding: 13px 16px; }
  .topbar h1 { font-size: 21px; }
  .week-pill { display: none; }
  .view { padding: 18px 16px 104px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    align-items: stretch; justify-content: space-around;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    background: rgba(11, 15, 20, .9); backdrop-filter: blur(18px);
    border-top: 1px solid var(--line);
  }
  [data-theme="light"] .bottom-nav { background: rgba(255,255,255,.92); }
  .bottom-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 2px; border-radius: 10px; color: var(--muted-2); font-size: 9.5px; font-weight: 650; }
  .bottom-item .icon { width: 21px; height: 21px; }
  .bottom-item.active { color: var(--orange); background: var(--orange-soft); }
  .timer-bar { bottom: calc(150px + env(safe-area-inset-bottom)); right: 12px; left: 12px; justify-content: space-between; }
  .toast-root { bottom: calc(218px + env(safe-area-inset-bottom)); }
  .finish-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .grid-4, .body-latest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-select { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-height: 92vh; border-radius: 22px 22px 0 0; padding: 20px 17px calc(20px + env(safe-area-inset-bottom)); width: 100%; }
  .hero { padding: 20px; }
  .hero::after { right: -80px; bottom: -100px; }
}

@media (max-width: 620px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .macro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .tm-grid { grid-template-columns: 1fr; }
  .body-latest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .set-labels, .set-row { grid-template-columns: 26px minmax(56px, 1fr) minmax(46px, .8fr) minmax(46px, .8fr) 34px; gap: 4px; max-width: none; }
  .set-check { width: 28px; height: 28px; }
  .set-labels { font-size: 8.5px; }
  .topbar-actions .icon-btn#theme-toggle { display: none; }
  .card { padding: 15px; border-radius: 16px; }
  .hero-title { font-size: 28px; }
  .hero-actions .btn { flex: 1; }
  .day-select { gap: 8px; }
  .day-card { padding: 12px; }
  .supp-list { grid-template-columns: 1fr; }
  .food-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .food-grams { display: none; }
  .dash-stack .card { margin-top: 0; }
  .exercise-card { padding: 14px; }
  .finish-bar { flex-wrap: wrap; }
  .finish-bar .grow { flex-basis: 100%; }
  .finish-bar .btn { flex: 1; }
  .date-nav .date-label { min-width: 84px; }
}

@media (max-width: 380px) {
  .metric-strip { grid-template-columns: 1fr 1fr; gap: 7px; }
  .stat-value { font-size: 21px; }
  .macro-grid { gap: 7px; }
  .bottom-item { font-size: 8.5px; }
}

/* ---------- print ---------- */
@media print {
  .sidebar, .topbar, .bottom-nav, .timer-bar, .toast-root, .finish-bar, .btn, .icon-btn { display: none !important; }
  .main { width: 100%; margin: 0; }
  .view { padding: 0; }
  body { background: #fff; color: #000; }
  .card { break-inside: avoid; border-color: #ddd; box-shadow: none; }
}

/* ---------- auth ---------- */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(900px 600px at 50% -10%, rgba(255, 122, 26, 0.12), transparent 60%),
    var(--bg);
  overflow-y: auto;
}
.auth-card {
  width: min(430px, 100%);
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 46px; height: 46px; font-size: 24px; }
.auth-brand strong { display: block; font-size: 17px; letter-spacing: .12em; }
.auth-brand small { display: block; font-size: 10px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; margin-top: 3px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line); margin-bottom: 18px; }
.auth-tabs button { border: 0; background: transparent; color: var(--muted); padding: 9px; border-radius: 9px; font-weight: 700; font-size: 12px; }
.auth-tabs button.active { background: var(--surface-3); color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-form .btn { margin-top: 5px; }
.auth-error { padding: 10px 12px; border-radius: 10px; background: var(--red-soft); border: 1px solid rgba(255,92,92,.25); color: var(--red); font-size: 12px; margin-bottom: 12px; }
.auth-invite { padding: 10px 12px; border-radius: 10px; background: var(--orange-soft); border: 1px solid rgba(255,122,26,.25); color: var(--orange-2); font-size: 12px; margin-bottom: 12px; }
.auth-note { font-size: 11px; color: var(--muted); margin-top: 14px; line-height: 1.5; }
body.auth-open .bottom-nav, body.auth-open .timer-bar, body.auth-open .toast-root { display: none !important; }
body.auth-open .app-shell { display: none; }
.coach-only { display: none !important; }
body.is-coach .coach-only { display: flex !important; }
.coach-badge { display: inline-flex; align-items: center; gap: 6px; }
.coach-list { display: flex; flex-direction: column; gap: 8px; }
.coach-row { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.coach-row .grow { min-width: 0; }
.coach-name { font-size: 13px; font-weight: 700; }
.coach-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.invite-box { display: flex; gap: 7px; align-items: center; margin-top: 10px; }
.invite-box .input { font-size: 11px; }
.auth-logout { margin-top: 12px; }
#user-pill { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 620px) {
  #user-pill { display: none !important; }
}
