:root {
  --bg: #0d0f10;
  --surface: #191d21;
  --raised: #252a2f;
  --line: #3b4249;
  --text: #f6f3ec;
  --mut: #bec4c8;
  --accent: #e1c58d;
  --on-accent: #151719;
  --accent-soft: rgba(225, 197, 141, .14);
  --accent-bg: #302b20;
  --green: #a8c5af;
  --red: #dda6a6;
  --blue: #9db9d7;
  --green-soft: #29382f;
  --red-soft: #3a292b;
  --blue-soft: #263441;
  --nav: #8f989f;
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.55; font-weight: 400;
  padding-bottom: calc(76px + var(--safe-b));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1 {
  font-size: 32px; line-height: 1.18; margin: 0 0 4px;
  font-weight: 600; letter-spacing: -.02em;
}
h2 { font-size: 20px; line-height: 1.3; margin: 0 0 10px; font-weight: 600; }
p { margin: 4px 0; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.mut { color: var(--mut); font-size: 15px; }
.small { font-size: 13px; }
.gold { color: var(--accent); }
.green { color: var(--green); }
.red { color: var(--red); }
.hidden { display: none !important; }

/* header */
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; padding-top: calc(12px + var(--safe-t));
  background: rgba(17, 19, 21, .9); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
#title { font-weight: 600; font-size: 20px; flex: 1; letter-spacing: -.01em; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  width: 44px; height: 44px; border-radius: 14px; font-size: 22px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:active { transform: scale(.95); }

/* main */
main { padding: 20px; max-width: 640px; margin: 0 auto; }
@media (max-width: 360px) { main { padding: 16px; } #topbar { padding-left: 16px; padding-right: 16px; } }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.card h2 { margin-top: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.pad { padding: 14px 0; }
.divider { border-top: 1px solid var(--line); margin: 14px 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--on-accent); border: none; border-radius: 14px;
  padding: 0 20px; min-height: 56px; font-size: 17px; font-weight: 600; cursor: pointer; width: 100%;
  letter-spacing: -.01em;
}
.btn:active { transform: scale(.98); opacity: .92; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.blue { background: var(--raised); color: var(--text); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid rgba(221, 166, 166, .4); }
.btn.sm { width: auto; min-height: 44px; padding: 0 16px; font-size: 15px; border-radius: 12px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* inputs */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 15px; color: var(--mut); margin-bottom: 8px; }
.input, select.input {
  width: 100%; background: var(--raised); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  font-size: 17px; font-family: inherit;
}
.input:focus { outline: none; border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid var(--line); background: var(--raised); color: var(--text);
  padding: 12px 16px; border-radius: 999px; font-size: 15px; cursor: pointer;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* bottom nav */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tab {
  flex: 1; background: none; border: none; color: var(--nav);
  padding: 10px 0 10px; font-size: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 56px;
}
.tab .t-ic { display: block; line-height: 0; padding: 4px 14px; border-radius: 999px; }
.tab .t-ic svg { width: 24px; height: 24px; display: block; flex: none; }
.tab.on { color: var(--accent); }
.tab.on .t-ic { background: var(--accent-bg); }
.tab:active { opacity: .7; }

/* sub-tabs (карточка клиента) */
.subtabs {
  display: flex; gap: 22px; margin: 4px 0 16px; overflow-x: auto;
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
  flex: 0 0 auto; text-align: center; padding: 12px 2px;
  background: none; border: none; color: var(--mut);
  font-size: 17px; font-weight: 600; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab.on { color: var(--text); border-bottom-color: var(--accent); }

/* lists */
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 12px; cursor: pointer;
}
.list-item .name { font-weight: 600; font-size: 20px; line-height: 1.3; letter-spacing: -.01em; }
.list-item .sub { color: var(--mut); font-size: 15px; margin-top: 2px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: 0 0 auto;
  background: var(--raised); color: var(--accent); font-weight: 600; font-size: 20px;
  display: flex; align-items: center; justify-content: center; letter-spacing: 0;
}
.chev { margin-left: auto; color: var(--mut); font-size: 20px; flex: 0 0 auto; }

/* карточка занятия (Сегодня) */
.session { flex-direction: column; align-items: stretch; gap: 14px; }
.s-main { display: flex; align-items: center; gap: 14px; }
.s-time {
  flex: 0 0 72px; display: flex; flex-direction: column; justify-content: center;
  padding-right: 4px;
}
.s-clock { font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.s-date { font-size: 13px; color: var(--mut); margin-top: 3px; }
.s-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.s-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.s-actions .btn { flex: 0 0 auto; }
.session.st-planned { border-left: 3px solid var(--blue); }
.session.st-done { border-left: 3px solid var(--green); }
.session.st-cancelled { border-left: 3px solid var(--red); }

/* exercise / workout */
.ex {
  border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px;
  background: var(--raised);
}
.ex .ex-top { display: flex; align-items: flex-start; gap: 12px; }
.ex .ex-name { font-weight: 600; flex: 1; font-size: 17px; }
.ex .ex-meta { color: var(--mut); font-size: 15px; margin-top: 3px; }
.tag {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  font-size: 13px; padding: 3px 9px; border-radius: 8px; margin-left: 6px; font-weight: 600;
}
.technique { font-size: 15px; color: var(--mut); margin-top: 10px; }
.technique li { margin: 4px 0; }
.mis-line { font-size: 15px; color: var(--red); margin-top: 8px; }

.set-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.set-row .input { padding: 11px 12px; font-size: 17px; text-align: center; font-variant-numeric: tabular-nums; }
.set-num { color: var(--mut); font-size: 15px; width: 24px; text-align: center; }
.set-del {
  border: 1px solid var(--line); background: transparent; color: var(--mut);
  width: 36px; height: 36px; border-radius: 10px; font-size: 18px; cursor: pointer;
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; line-height: 1;
}
.set-del:active { color: var(--red); border-color: var(--red); }
.set-logged { display: flex; align-items: center; gap: 10px; font-size: 17px; font-variant-numeric: tabular-nums; }
.set-logged .done-dot { color: var(--green); }

/* подписка */
.plan {
  display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--raised); cursor: pointer;
}
.plan:last-child { margin-bottom: 0; }
.plan.on { border-color: var(--accent); background: var(--accent-soft); }

/* library filter */
.groups { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.grp { padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--raised); color: var(--mut); font-size: 15px; cursor: pointer; }
.grp.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.search { margin-bottom: 14px; }

/* workout progress */
.progress { display: flex; gap: 6px; margin-bottom: 16px; }
.progress .seg { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.progress .seg.on { background: var(--accent); }

.empty { text-align: center; color: var(--mut); padding: 56px 20px; font-size: 16px; }
.empty .big { font-size: 44px; margin-bottom: 12px; }
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.badge.done { background: var(--green-soft); color: var(--green); border: 1px solid rgba(168, 197, 175, .35); }
.badge.todo { background: var(--blue-soft); color: var(--blue); border: 1px solid rgba(157, 185, 215, .35); }
.badge.cancel { background: var(--red-soft); color: var(--red); border: 1px solid rgba(221, 166, 166, .35); }

/* dashboard kpi */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.kpi { margin-bottom: 0; }
.kpi-v { font-size: 28px; font-weight: 600; margin: 6px 0 2px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
