@font-face { font-family: Vazirmatn; font-weight: 400; font-display: swap; src: url(fonts/Vazirmatn-Regular.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 500; font-display: swap; src: url(fonts/Vazirmatn-Medium.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 700; font-display: swap; src: url(fonts/Vazirmatn-Bold.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 900; font-display: swap; src: url(fonts/Vazirmatn-Black.woff2) format("woff2"); }

:root {
  --bg: #0b0c10;
  --surface: #15171d;
  --surface-2: #1c1f27;
  --line: #262a33;
  --text: #f3f4f6;
  --muted: #8b91a0;
  --accent: #c8ff2e;
  --accent-ink: #0b0c10;
  --accent-soft: rgba(200, 255, 46, .12);
  --orange: #ff8a3d;
  --orange-soft: rgba(255, 138, 61, .14);
  --red: #ff4d5e;
  --red-soft: rgba(255, 77, 94, .14);
  --green: #3ddc97;
  --green-soft: rgba(61, 220, 151, .14);
  --radius: 18px;
  --tabbar: 68px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: Vazirmatn, Tahoma, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(120% 60% at 100% -10%, rgba(200, 255, 46, .10), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  direction: rtl;
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.num { font-feature-settings: "tnum"; }

/* ---------- layout ---------- */
.page { max-width: 560px; margin: 0 auto; padding: 16px; display: none; }
.page.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.topbar .hello { flex: 1; min-width: 0; }
.topbar .hello small { color: var(--muted); display: block; font-size: 13px; }
.topbar .hello b { font-size: 20px; font-weight: 900; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--surface-2) center/cover no-repeat; border: 2px solid var(--line);
  display: grid; place-items: center; font-weight: 900; color: var(--accent); overflow: hidden;
}
.avatar.lg { width: 104px; height: 104px; font-size: 36px; border: 3px solid var(--accent); }
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }

h2.section { font-size: 15px; font-weight: 700; color: var(--muted); margin: 22px 4px 10px; display: flex; justify-content: space-between; align-items: center; }
h2.section a { color: var(--accent); font-size: 13px; text-decoration: none; cursor: pointer; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.hero {
  background: linear-gradient(135deg, #1e2410 0%, #15171d 55%);
  border-color: rgba(200, 255, 46, .25);
  position: relative; overflow: hidden;
}
.card.hero::after {
  content: ""; position: absolute; width: 180px; height: 180px; left: -60px; top: -70px;
  background: radial-gradient(circle, rgba(200, 255, 46, .25), transparent 70%);
  pointer-events: none;
}
.hero .eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .5px; }
.hero h3 { margin: 2px 0 12px; font-size: 22px; font-weight: 900; line-height: 1.4; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-width: 0; }
.stat b { display: block; font-size: 22px; font-weight: 900; line-height: 1.3; }
.stat small { color: var(--muted); font-size: 12px; }
.stat.accent b { color: var(--accent); }
.stat.warn b { color: var(--orange); }
.stat.danger b { color: var(--red); }

/* ---------- exercises ---------- */
.ex-list { display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }
.ex {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 14px; text-decoration: none;
}
.ex .n { width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 900; font-size: 13px; flex: none; }
.ex .name { flex: 1; font-weight: 700; min-width: 0; }
.ex .name small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.ex .detail { background: var(--surface-2); border-radius: 10px; padding: 2px 10px; font-weight: 700; white-space: nowrap; font-size: 14px; }
.ex-header { font-weight: 900; color: var(--accent); margin: 8px 2px 0; font-size: 14px; }
.ex-note { color: var(--muted); font-size: 13px; margin: 0 4px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 10px; text-align: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 700; cursor: pointer;
  background: var(--surface-2); color: var(--text); transition: transform .1s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--green-soft); color: var(--green); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .btn { flex: 1; }
.done-badge { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--green); font-weight: 700; padding: 10px; }

/* ---------- chips & pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--orange-soft); color: var(--orange); }
.pill.danger { background: var(--red-soft); color: var(--red); }
.pill.muted { background: var(--surface-2); color: var(--muted); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  cursor: pointer; font-size: 14px; user-select: none;
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; cursor: pointer;
}
.item .body { flex: 1; min-width: 0; }
.item .body b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .body small { color: var(--muted); font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 4px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 11px 14px; outline: none; transition: border-color .2s;
}
.input:focus { border-color: var(--accent); }
textarea.input { min-height: 160px; resize: vertical; line-height: 1.9; }
.input.ltr { direction: ltr; text-align: left; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 11px; padding: 8px 4px; cursor: pointer; color: var(--muted); font-weight: 700; font-size: 14px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- profile ---------- */
.profile-head { text-align: center; padding: 8px 0 4px; }
.profile-head .avatar { margin: 0 auto 10px; position: relative; cursor: pointer; }
.profile-head .cam {
  position: relative; display: inline-block;
}
.profile-head .cam i {
  position: absolute; bottom: 12px; left: 2px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-style: normal; font-size: 16px;
  border: 3px solid var(--bg);
}
.profile-head h1 { font-size: 22px; font-weight: 900; margin: 0; }
.profile-head p { margin: 2px 0 0; color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kv div { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.kv small { color: var(--muted); font-size: 12px; display: block; }
.kv b { font-weight: 700; overflow-wrap: anywhere; }
.kv .wide { grid-column: span 2; }
.alert { border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.alert.warn { background: var(--orange-soft); color: var(--orange); }
.alert.danger { background: var(--red-soft); color: var(--red); }
.alert.ok { background: var(--green-soft); color: var(--green); }

/* ---------- payment ---------- */
.pay-card { text-align: center; }
.pay-card .amount { font-size: 30px; font-weight: 900; margin: 4px 0; }
.card-number {
  direction: ltr; font-size: 19px; letter-spacing: 2px; font-weight: 700; background: var(--surface-2);
  border-radius: 14px; padding: 12px; margin: 12px 0 6px; cursor: pointer; border: 1px dashed var(--line);
}
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0 4px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- chart ---------- */
.chart { width: 100%; height: 190px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2.5; }
.chart text { fill: var(--muted); font-size: 11px; font-family: Vazirmatn, sans-serif; }

/* ---------- receipts ---------- */
.receipt-img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 14px; background: #000; margin-bottom: 10px; }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(11, 12, 16, .82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar nav { max-width: 560px; margin: 0 auto; display: flex; justify-content: space-around; }
.tabbar button {
  border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 11px; font-weight: 700; padding: 4px 10px; cursor: pointer; position: relative; border-radius: 12px;
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.on { color: var(--accent); }
.tabbar .badge {
  position: absolute; top: 0; left: 8px; background: var(--red); color: #fff; border-radius: 99px;
  font-size: 10px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px;
}

/* ---------- sheet & toast ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40; display: none; }
.sheet-backdrop.open { display: block; animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88vh; overflow-y: auto;
  background: var(--bg); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(24px + env(safe-area-inset-bottom)); transform: translateY(105%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1); max-width: 560px; margin: 0 auto;
}
.sheet.open { transform: none; }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.toast {
  position: fixed; top: 16px; left: 50%; transform: translate(-50%, -150%); z-index: 60;
  background: var(--surface-2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 14px;
  transition: transform .3s; font-weight: 700; max-width: 90vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

.splash { min-height: 80vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.splash .logo { font-size: 56px; }
.splash h1 { font-weight: 900; margin: 8px 0; }
.splash p { color: var(--muted); }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 16px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin-bottom: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.hidden { display: none !important; }

/* ---------- program media ---------- */
.program-img { width: 100%; max-height: 520px; object-fit: contain; border-radius: 14px; background: #000; margin-bottom: 10px; display: block; position: relative; z-index: 1; }
.voice { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 8px 12px; margin-bottom: 10px; position: relative; z-index: 1; }
.voice audio { flex: 1; min-width: 0; height: 36px; }
#picks { margin-top: -4px; }

/* ---------- performance chart ---------- */
.chart .axis { stroke: var(--line); stroke-width: 1; }
.perf .perf-assigned { fill: var(--surface-2); stroke: var(--line); stroke-width: 1; }
.perf .perf-done { fill: var(--accent); }
.perf .perf-col:hover .perf-assigned { stroke: var(--muted); }
.perf-legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.perf-legend small { margin-inline-start: auto; }
.perf-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.perf-legend .sw.done { background: var(--accent); }
.perf-legend .sw.assigned { background: var(--surface-2); border: 1px solid var(--line); }
.perf .perf-col { cursor: pointer; }
.perf .perf-col.on .perf-assigned { stroke: var(--text); }
.perf-tip { font-size: 12px; color: var(--muted); text-align: center; min-height: 20px; }

/* ---------- exercise ticks & timer ---------- */
.ex.tickable { flex-wrap: wrap; row-gap: 8px; }
.ex.tickable .name { text-decoration: none; color: inherit; }
.ex .chk {
  width: 32px; height: 32px; border-radius: 50%; flex: none; cursor: pointer; font-weight: 900; font-size: 14px;
  border: 2px solid var(--accent); background: transparent; color: var(--accent); display: grid; place-items: center;
  transition: transform .12s ease, background .2s;
}
.ex .chk:active { transform: scale(.88); }
.ex.on { border-color: rgba(61, 220, 151, .45); background: var(--green-soft); }
.ex.on .chk { background: var(--green); border-color: var(--green); color: var(--accent-ink); }
.ex.on .name { opacity: .75; }
.ex.part { border-color: rgba(255, 138, 61, .45); background: var(--orange-soft); }
.ex.part .chk { background: var(--orange); border-color: var(--orange); color: var(--accent-ink); }
.ex.part .name small { color: var(--orange); font-weight: 700; }
.ex-tools { width: 100%; display: flex; gap: 6px; padding-inline-start: 44px; }
.ex-tools .btn.sm { padding: 5px 10px; font-size: 12px; background: rgba(255, 255, 255, .05); color: var(--muted); }
.ex-tools [data-timer] { color: var(--accent); background: var(--accent-soft); }
.timer-btn { padding: 3px 9px !important; font-size: 12px !important; color: var(--accent) !important; background: var(--accent-soft) !important; margin-inline-start: 4px; }
.ex-progress { margin: -4px 0 12px; position: relative; z-index: 1; }
.ex-progress .progress { margin: 0 0 4px; }
.ex-progress small { color: var(--muted); font-size: 12px; }
.timer { text-align: center; }
.timer h3 { margin: 2px 0 10px; }
.timer .ring { position: relative; width: 210px; height: 210px; margin: 14px auto; }
.timer .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer .ring circle { fill: none; stroke-width: 9; }
.timer .ring .bg { stroke: var(--surface-2); }
.timer .ring .fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke-dashoffset .25s linear; }
.timer .ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; font-weight: 900; direction: ltr; }
.timer .row { margin-bottom: 10px; }
.timer .adj .btn { color: var(--muted); }

/* ---------- nutrition, advice, coaches, analysis ---------- */
.meal { display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; }
.meal-head { font-weight: 900; color: var(--accent); margin-top: 6px; font-size: 14px; }
.meal-row { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; }
.meal-row b { color: var(--accent); flex: none; min-width: 64px; font-size: 14px; }
.meal-row span { flex: 1; }
.meal-line { color: var(--text); padding: 0 4px; font-size: 14px; }
.advice-text { white-space: pre-line; margin-bottom: 6px; }
.certs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cert { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; cursor: pointer; min-width: 0; }
.cert img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.cert span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.weeks { display: flex; gap: 8px; align-items: flex-end; height: 90px; margin: 0 0 14px; }
.weeks > div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.weeks i { display: block; width: 70%; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.weeks small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.note { border-inline-start: 3px solid var(--accent); }
#tabs button span { font-size: 11px; }

/* ---------- training sessions ---------- */
.session-row .time { flex: none; min-width: 52px; text-align: center; font-weight: 900; font-size: 17px; color: var(--accent); line-height: 1.2; }
.session-row .time small { display: block; font-size: 10px; font-weight: 500; color: var(--muted); }
.session-row.off, .session-card.off { opacity: .55; }
.session-row.off .time { color: var(--muted); text-decoration: line-through; }
.session-card { cursor: pointer; }
.session-when { font-weight: 700; margin-bottom: 4px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: none; }
.chip.att.present { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.chip.att.absent { background: var(--red-soft); color: var(--red); border-color: var(--red); }

/* ---------- web version ---------- */
.web-card { margin-top: 12px; }
.web-card p { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }
.splash.login p { line-height: 1.9; }
.splash.login .btn { margin-top: 6px; text-decoration: none; display: flex; justify-content: center; }
.steps { margin: 0 0 12px; padding-inline-start: 20px; line-height: 2.1; }
