:root {
  --bg: #0b0f17;
  --bg2: #121826;
  --card: #18202f;
  --card2: #1f2937;
  --line: #2a3547;
  --txt: #eef2f8;
  --muted: #9aa7bd;
  --brand: #ff4d2e;
  --brand2: #ff7849;
  --accent: #36d399;
  --ok: #34d399;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Cairo", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2436 0%, var(--bg) 55%);
  color: var(--txt);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
.muted { color: var(--muted); }

/* ---------- layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 20px clamp(14px, 3vw, 28px) 80px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(14px, 3vw, 28px);
  background: rgba(11, 15, 23, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo {
  font-weight: 900; letter-spacing: .5px; font-size: 20px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .logo .dot { width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 0 14px var(--brand); }

/* brand badge "CS" */
.cs-badge {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 9px; font-size: 13px; font-weight: 900; letter-spacing: .5px;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 4px 12px rgba(255, 77, 46, .35);
}

/* fixed corner watermark, present on every screen */
.watermark {
  position: fixed; bottom: 14px; inset-inline-start: 16px; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 13px; color: var(--muted);
  opacity: .55; pointer-events: none; user-select: none;
}
.watermark .cs-badge { width: 24px; height: 24px; font-size: 11px; border-radius: 7px; opacity: .9; }
@media (max-width: 560px) { .watermark { opacity: .4; font-size: 12px; } }
.topbar .spacer { flex: 1; }
.btn {
  border: 1px solid var(--line); background: var(--card2); color: var(--txt);
  padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  transition: .15s; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--brand); }
.btn.brand { background: linear-gradient(135deg, var(--brand), var(--brand2)); border: none; color: #fff; }
.btn.ghost { background: transparent; }

/* ---------- login ---------- */
.login-shell { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; padding: 34px 30px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 4px; font-size: 26px; font-weight: 900; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 13px 14px; border-radius: 12px; font-size: 15px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--txt); font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--brand); }
.login-card .btn.brand { width: 100%; justify-content: center; padding: 13px; font-size: 16px; margin-top: 6px; }
.err { color: #ff8a7a; font-size: 13px; min-height: 18px; margin: 6px 2px 0; }
.badge-mark {
  width: 54px; height: 54px; border-radius: 14px; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  display: grid; place-items: center; font-weight: 900; font-size: 24px; color: #fff;
  box-shadow: 0 8px 24px rgba(255, 77, 46, .4);
}

/* ---------- hero / program picker ---------- */
.hero { padding: 8px 2px 24px; }
.hero h1 { font-size: clamp(24px, 4vw, 34px); margin: 6px 0 6px; font-weight: 900; }
.hero p { color: var(--muted); margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.prog-picker { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.chip-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chip-label { font-size: 12px; color: var(--muted); font-weight: 700; min-width: 64px; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 9px 16px; font-weight: 600; font-size: 14px; transition: .15s;
}
.chip.active { background: linear-gradient(135deg, var(--brand), var(--brand2)); border: none; color: #fff; }

/* equipment badge */
.equip {
  display: inline-block; margin-inline-start: 8px; font-size: 11px; font-weight: 700;
  color: var(--accent); background: rgba(54, 211, 153, .12); border: 1px solid rgba(54, 211, 153, .3);
  border-radius: 6px; padding: 2px 8px; vertical-align: middle;
}

/* ---------- day grid ---------- */
.section-title { font-size: 14px; color: var(--muted); margin: 26px 2px 12px; font-weight: 700; letter-spacing: .3px; }
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.day-card {
  background: linear-gradient(160deg, var(--card), var(--card2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  text-align: start; transition: .18s; position: relative; overflow: hidden;
}
.day-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); }
.day-card .wk { font-size: 12px; color: var(--brand2); font-weight: 700; }
.day-card .dy { font-size: 20px; font-weight: 900; margin: 4px 0 2px; }
.day-card .focus { font-size: 13px; color: var(--muted); }
.day-card .meta { margin-top: 14px; font-size: 12px; color: var(--muted); display: flex; gap: 12px; }
.day-card .meta b { color: var(--txt); }

/* ---------- day detail ---------- */
.back { margin: 4px 0 14px; }
.day-head h1 { font-size: clamp(22px, 4vw, 30px); margin: 0 0 4px; font-weight: 900; }
.day-head .focus { color: var(--muted); }
.circuit { margin-top: 22px; }
.circuit-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 12px 12px 0 0;
  background: linear-gradient(90deg, rgba(255,77,46,.14), transparent);
  border: 1px solid var(--line); border-bottom: none;
}
.circuit-head .ar { font-weight: 800; font-size: 16px; }
.circuit-head .en { color: var(--muted); font-size: 13px; }
.ex-list { border: 1px solid var(--line); border-radius: 0 0 12px 12px; overflow: hidden; }
.ex {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--card);
  transition: .15s; cursor: pointer; text-align: start; width: 100%; border-right: none; border-left: none;
}
.ex:last-child { border-bottom: none; }
.ex:hover { background: var(--card2); }
.ex .num {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--bg2); border: 1px solid var(--line); font-weight: 800; font-size: 13px; color: var(--brand2);
}
.ex .names .ar { font-weight: 700; font-size: 16px; }
.ex .names .en { color: var(--muted); font-size: 13px; }
.ex .right { display: flex; align-items: center; gap: 12px; }
.ex .reps { color: var(--txt); font-size: 13px; background: var(--bg2); padding: 6px 11px; border-radius: 8px; border: 1px solid var(--line); white-space: nowrap; }
.ex .play { color: var(--brand2); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.ex.novid .play { color: var(--muted); opacity: .5; }

/* ---------- video modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(4, 7, 12, .8); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 50; padding: 16px;
}
.modal {
  width: 100%; max-width: 820px; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow);
}
.modal .mhead { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal .mhead .ar { font-weight: 800; font-size: 18px; }
.modal .mhead .en { color: var(--muted); font-size: 13px; margin-top: 2px; }
.modal .mhead .mbrand {
  margin-inline-start: auto; display: flex; align-items: center; gap: 7px;
  font-weight: 800; font-size: 13px; color: var(--muted);
}
.modal .mhead .mbrand .cs-badge { width: 24px; height: 24px; font-size: 11px; border-radius: 7px; }
.modal .mhead .x {
  margin-inline-start: 14px; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--txt); font-size: 18px;
}
.modal .video { position: relative; padding-top: 56.25%; background: #000; }
.modal .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.modal .mfoot { padding: 12px 18px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
.modal .mfoot .reps { color: var(--txt); font-weight: 600; }
.modal .mfoot a { color: var(--brand2); text-decoration: none; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.spinner { display: inline-block; width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .ex { grid-template-columns: 38px 1fr; }
  .ex .right { grid-column: 2; justify-content: flex-start; margin-top: 6px; }
}

/* ===================== multi-user platform additions ===================== */
.lang-btn { min-width: 42px; font-weight: 800; }

/* progress ring */
.ring { display: block; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 5; }
.ring-fg { fill: none; stroke: url(#g); stroke: var(--brand); stroke-width: 5; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .5s ease; }
.ring-txt { fill: var(--txt); font-size: 14px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; }

/* program cards (trainee home) + trainee cards (coach roster) */
.prog-list { display: flex; flex-direction: column; gap: 12px; }
.prog-card, .trainee-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: start;
  background: linear-gradient(160deg, var(--card), var(--card2)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; transition: .16s;
}
.prog-card:hover, .trainee-card:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow); }
.trainee-card.off { opacity: .55; }
.pc-body, .tc-body { flex: 1; }
.pc-title, .tc-name { font-weight: 800; font-size: 18px; }
.pc-meta, .tc-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pc-go { font-size: 26px; color: var(--muted); }
.tag { font-size: 11px; color: var(--brand2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }

/* day cards with ring */
.day-card .dc-top { display: flex; align-items: center; gap: 12px; }
.day-card .focus { margin-top: 10px; }

/* exercise rows: [check][names][right] */
.ex { grid-template-columns: 44px 1fr auto; }
.ex .check {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--bg2); color: #fff; font-size: 16px; font-weight: 900; cursor: pointer; transition: .15s;
  display: grid; place-items: center;
}
.ex .check:hover { border-color: var(--brand); }
.ex.is-done .check { background: linear-gradient(135deg, var(--brand), var(--brand2)); border-color: transparent; }
.ex.is-done .names .ar { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.25); }
.ex .check:disabled { cursor: default; opacity: .6; }
.logline { color: var(--accent); font-size: 12px; margin-top: 4px; }
.logbtn { background: var(--bg2); border: 1px solid var(--line); color: var(--muted); border-radius: 8px;
  padding: 6px 11px; font-size: 12px; font-weight: 700; cursor: pointer; }
.logbtn:hover { border-color: var(--brand); color: var(--txt); }
.play.off { color: var(--muted); opacity: .5; font-size: 13px; }

/* inline log panel */
.logpanel { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.lp-field { display: flex; flex-direction: column; gap: 4px; }
.lp-field label { font-size: 11px; color: var(--muted); }
.lp-field input { width: 80px; padding: 8px 10px; border-radius: 8px; background: var(--card);
  border: 1px solid var(--line); color: var(--txt); font-family: inherit; font-size: 14px; }
.btn.sm { padding: 8px 14px; font-size: 13px; } .btn.xs { padding: 5px 11px; font-size: 12px; }

/* day header with ring */
.day-head { display: flex; align-items: center; gap: 16px; padding: 6px 2px 4px; }

/* coach tabs */
.tabs { display: flex; gap: 8px; margin: 6px 0 4px; }
.tab { background: var(--card); border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
  padding: 8px 18px; font-weight: 700; font-size: 14px; cursor: pointer; }
.tab.active { background: linear-gradient(135deg, var(--brand), var(--brand2)); border: none; color: #fff; }

/* progress bars (trainee detail) */
.pbar-row { margin: 10px 0; }
.pbar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.pbar { height: 9px; background: var(--bg2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.pbar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand2)); border-radius: 99px; }
.assign-row, .manage-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; align-items: center; }
.sel { padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line);
  color: var(--txt); font-family: inherit; font-size: 14px; min-width: 180px; }
.recent-row { display: flex; gap: 12px; justify-content: space-between; align-items: center;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 7px; background: var(--card); font-size: 13px; }
.recent-row .sm { font-size: 11px; }

/* invites */
.invite-form { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.invite-row { display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--card); }
.invite-row.used { opacity: .6; } .invite-row.new { border-color: var(--brand); }
.iv-main { min-width: 0; flex: 1; }
.iv-link { font-family: ui-monospace, monospace; font-size: 13px; color: var(--brand2); word-break: break-all; }
.iv-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }

@media (max-width: 560px) {
  .ex { grid-template-columns: 40px 1fr; }
  .ex .right { grid-column: 2; justify-content: flex-start; margin-top: 8px; }
  .sel { min-width: 140px; flex: 1; }
}

/* ===================== coach status report ===================== */
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 2px 18px; }
.report-head h1 { font-size: clamp(22px, 4vw, 30px); margin: 0 0 4px; font-weight: 900; }
.status-badge { font-size: 13px; font-weight: 800; padding: 3px 12px; border-radius: 999px; vertical-align: middle; margin-inline-start: 8px; }
.status-badge.active { background: rgba(54,211,153,.16); color: var(--accent); border: 1px solid rgba(54,211,153,.4); }
.status-badge.slipping { background: rgba(255,176,32,.16); color: #ffb020; border: 1px solid rgba(255,176,32,.4); }
.status-badge.inactive { background: rgba(255,77,46,.16); color: var(--brand2); border: 1px solid rgba(255,77,46,.4); }
.status-badge.new { background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 6px; }
.metric { background: linear-gradient(160deg, var(--card), var(--card2)); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; text-align: center; }
.metric .mv { font-size: 26px; font-weight: 900; }
.metric .ml { font-size: 12px; color: var(--muted); margin-top: 4px; }

.findings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.fcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.fcard.s { border-top: 3px solid var(--accent); } .fcard.w { border-top: 3px solid #ffb020; } .fcard.i { border-top: 3px solid #4aa3ff; }
.fc-title { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.findings { list-style: none; margin: 0; padding: 0; }
.findings li { font-size: 13px; line-height: 1.5; padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--txt); }
.findings li:last-child { border-bottom: none; }

.prog-block { margin-bottom: 22px; }
.legend { font-size: 12px; color: var(--muted); margin: 8px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lg { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-inline-start: 8px; }
.lg.done { background: var(--accent); } .lg.partial { background: #ffb020; } .lg.none { background: var(--line); }
.daychips { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; margin-top: 8px; }
.daychip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 6px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card2); cursor: pointer; transition: .14s;
  min-width: 0; overflow: hidden; }
.daychip .dc-wd { font-size: 12px; font-weight: 800; white-space: nowrap; } .daychip .dc-frac { font-size: 11px; color: var(--muted); }
.daychip.done { border-color: rgba(54,211,153,.5); background: rgba(54,211,153,.12); }
.daychip.partial { border-color: rgba(255,176,32,.5); background: rgba(255,176,32,.1); }
.daychip.sel { outline: 2px solid var(--brand); }
.daychip:hover { transform: translateY(-2px); }

.day-detail:empty { display: none; }
.day-detail { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.dd-head { padding: 10px 14px; font-weight: 800; font-size: 14px; background: var(--card2); border-bottom: 1px solid var(--line); }
.dd-sec-t { padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--brand2); background: rgba(255,77,46,.06); }
.dd-ex { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.dd-ex .dd-i { font-weight: 900; text-align: center; }
.dd-ex.done .dd-i { color: var(--accent); }
.dd-ex.miss { opacity: .5; } .dd-ex.miss .dd-i { color: var(--muted); }
.dd-ex .dd-l { font-size: 12px; color: var(--accent); }

@media (max-width: 720px) { .findings-grid { grid-template-columns: 1fr; } .metrics { grid-template-columns: repeat(2, 1fr); } }
