/* ── Reset & tokens ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #F7F4ED;
  --surface:   #FFFFFF;
  --nav:       #242136;
  --nav-hover: #2e2a47;
  --accent:    #2DC7BE;
  --accent-d:  #22a49d;
  --text:      #1A1830;
  --muted:     #6B7280;
  --border:    #E8E3DA;
  --success:   #10B981;
  --warning:   #F59E0B;
  --danger:    #EF4444;
  --radius:    12px;
  --sidebar-w: 228px;
  --shadow:    0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ── Landing page ────────────────────────────────────────── */
#landing {
  background: #fff;
  overflow: hidden;
}

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid #E5E7EB;
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
}

.landing-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #111827;
  font-size: 16px;
  font-weight: 600;
}
.landing-logo strong { color: #2DC7BE; }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* ── Auth modal ── */
.auth-modal { max-width: 400px; padding: 0; overflow: hidden; border-radius: 20px; }

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
}
.auth-modal-icon {
  width: 40px; height: 40px;
  background: rgba(45,199,190,0.10);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.auth-modal .modal-close {
  background: #F3F4F6 !important;
  color: #6B7280 !important;
  border-radius: 8px;
}
.auth-modal .modal-close:hover { background: #E5E7EB !important; }

.auth-mode-toggle {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: #6B7280;
}
.auth-mode-toggle button {
  background: none; border: none;
  color: #2DC7BE;
  font-size: 13px; font-weight: 600;
  cursor: pointer; margin-left: 4px;
  padding: 0;
}
.auth-mode-toggle button:hover { text-decoration: underline; }

/* ── Landing nav dropdown ── */
.landing-nav { position: relative; }
.nav-dropdown  { position: relative; }

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: background 0.15s, color 0.15s;
}
.nav-dropdown-toggle:hover { background: #F3F4F6; color: #111827; }
.nav-dropdown-toggle[aria-expanded="true"] { background: #F3F4F6; color: #111827; }

.nav-chevron {
  color: #9CA3AF;
  transition: transform 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.nav-dropdown-toggle[aria-expanded="true"] .nav-chevron { transform: rotate(180deg); }

/* Panel */
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  width: 270px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.03),
    0 4px 6px -2px rgba(0,0,0,0.06),
    0 16px 40px -8px rgba(0,0,0,0.14);
  padding: 8px;
  list-style: none;
  margin: 0;
  z-index: 100;
  /* Animate with visibility so transition works */
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-10px);
  transition:
    opacity 0.2s ease,
    transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.2s;
}
.nav-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Items */
.nav-dropdown-menu li a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 11px;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.13s;
}
.nav-dropdown-menu li a:hover { background: #F7F4ED; }

.nav-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(45,199,190,0.1);
  color: #2DC7BE;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.13s;
}
.nav-item-icon--contact {
  background: rgba(99,102,241,0.1);
  color: #6366F1;
}
.nav-dropdown-menu li a:hover .nav-item-icon { background: rgba(45,199,190,0.18); }
.nav-dropdown-menu li a:hover .nav-item-icon--contact { background: rgba(99,102,241,0.18); }

.nav-item-text { display: flex; flex-direction: column; gap: 2px; }
.nav-item-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.01em;
}
.nav-item-text span {
  display: block;
  font-size: 12px;
  color: #6B7280;
  line-height: 1.4;
}

.nav-divider {
  height: 1px;
  background: #F3F4F6;
  margin: 5px 0;
}

/* ── Screens hero ── */
.screens-hero {
  padding: 72px 40px 0;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.screens-headline {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 56px;
}

.hero-tag {
  display: inline-block;
  background: rgba(45,199,190,0.14);
  color: #2DC7BE;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.screens-headline h1 {
  font-size: clamp(32px, 4.5vw, 52px);
  font-weight: 800;
  color: #111827;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  text-wrap: balance;
}

.screens-headline p {
  font-size: 16px;
  color: #6B7280;
  line-height: 1.6;
  margin-bottom: 32px;
}

.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 11px; }

/* ── Screens canvas ── */
.screens-canvas {
  position: relative;
  height: 480px;
  margin: 0 -40px;
  background: #f9fafb;
}

.sc-device { position: absolute; }

/* Phone frame */
.phone-frame {
  background: #1A1730;
  border-radius: 28px;
  border: 2px solid rgba(0,0,0,0.08);
  box-shadow: 0 20px 56px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.10);
  overflow: hidden;
  position: relative;
  width: 168px;
}
.phone-frame.phone-sm { width: 140px; }
.phone-notch {
  width: 48px; height: 14px;
  background: #C8CDD2;
  border-radius: 0 0 10px 10px;
  margin: 0 auto 0;
  position: relative; z-index: 2;
}
.phone-screen {
  background: #DEE2E6;
  padding: 8px 10px 12px;
}
.ph-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ph-greeting { font-size: 11px; font-weight: 600; color: #111827; }
.ph-avatar { width: 22px; height: 22px; border-radius: 50%; background: #2DC7BE; font-size: 10px; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; }
.ph-hero-img { height: 70px; background: linear-gradient(135deg, #2DC7BE 0%, #5B9BD5 50%, #4A90A4 100%); border-radius: 10px; margin-bottom: 8px; }
.ph-goal-card { background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.ph-goal-days { font-size: 28px; font-weight: 800; color: #2DC7BE; line-height: 1; }
.ph-goal-label { font-size: 9px; color: #6B7280; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.ph-goal-name { font-size: 11px; font-weight: 600; color: #111827; }
.ph-goal-date { font-size: 9px; color: #9CA3AF; }
.ph-section-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #6B7280; margin-bottom: 6px; }
.ph-session { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 8px; padding: 8px 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.ph-session-icon { font-size: 16px; }
.ph-session-name { font-size: 11px; font-weight: 600; color: #111827; }
.ph-session-meta { font-size: 9px; color: #9CA3AF; }
.ph-session-badge { margin-left: auto; background: rgba(45,199,190,.18); color: #2DC7BE; font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
/* calendar in phone */
.ph-cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.ph-cal-day { background: rgba(255,255,255,0.6); border-radius: 5px; padding: 4px 3px; text-align: center; }
.ph-today { border: 1px solid rgba(45,199,190,0.5); background: #fff; }
.ph-cal-dn { font-size: 8px; font-weight: 600; color: #6B7280; margin-bottom: 2px; }
.ph-today .ph-cal-dn { color: #2DC7BE; }
.ph-cal-chip { font-size: 7px; font-weight: 600; background: rgba(45,199,190,.2); color: #2DC7BE; border-radius: 3px; padding: 1px 2px; }
.ph-amber { background: rgba(245,158,11,.15) !important; color: #D97706 !important; }
.ph-purple { background: rgba(139,92,246,.15) !important; color: #A78BFA !important; }

/* Mini browser frame */
.mini-browser-frame {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 16px 48px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
}
.mbf-chrome {
  background: #1A1733; height: 28px;
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mbf-dots { display: flex; gap: 4px; }
.mbf-dots span { width: 8px; height: 8px; border-radius: 50%; }
.mbf-dots span:nth-child(1){background:#ff5f57}
.mbf-dots span:nth-child(2){background:#febc2e}
.mbf-dots span:nth-child(3){background:#28c840}
.mbf-url { background: rgba(255,255,255,.05); border-radius: 4px; padding: 2px 8px; font-size: 9px; color: #5C5878; flex:1; max-width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mbf-body { display:flex; background:#DEE2E6; height:220px; overflow:hidden; }
.mbf-sidebar { width: 38px; background: #C8CDD2; border-right: 1px solid rgba(0,0,0,.06); display:flex; flex-direction:column; align-items:center; padding:8px 0; gap:3px; }
.mbf-logo-dot { width:22px; height:22px; background:#2DC7BE; border-radius:5px; margin-bottom:6px; }
.mbf-nav-item { width:26px; height:22px; border-radius:6px; background:rgba(255,255,255,.04); }
.mbf-active { background:rgba(45,199,190,.2) !important; }
.mbf-content { flex:1; padding:12px; overflow:hidden; font-family:inherit; }
.mbf-stats { display:flex; gap:6px; margin-bottom:10px; }
.mbf-stat { flex:1; background:#fff; border:1px solid rgba(0,0,0,.07); border-radius:6px; padding:7px 8px; }
.mbf-n { font-size:16px; font-weight:700; color:#111827; line-height:1; }
.mbf-l { font-size:8px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:#6B7280; margin-top:2px; }
.mbf-label { font-size:8px; font-weight:700; letter-spacing:.07em; text-transform:uppercase; color:#6B7280; margin-bottom:6px; }
.mbf-row { display:flex; justify-content:space-between; align-items:center; padding:5px 6px; border-radius:5px; font-size:10px; }
.mbf-row:nth-child(odd){background:rgba(255,255,255,.5)}
.mbf-rn { color:#111827; font-weight:500; font-size:10px; }
.mbf-rm { color:#6B7280; font-size:9px; }
.mbf-rb { font-size:8px; font-weight:600; padding:2px 6px; border-radius:8px; background:rgba(0,0,0,.07); color:#6B7280; white-space:nowrap; }
.mbf-teal { background:rgba(45,199,190,.14) !important; color:#2DC7BE !important; }
.mbf-amber { background:rgba(245,158,11,.14) !important; color:#D97706 !important; }
.mbf-ath-row { display:flex; align-items:center; gap:6px; padding:5px 6px; border-radius:5px; }
.mbf-ath-row:nth-child(odd){background:rgba(255,255,255,.5)}
.mbf-av { width:20px; height:20px; border-radius:50%; font-size:9px; font-weight:700; color:#fff; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.mbf-prog-title { font-size:11px; font-weight:700; color:#111827; margin-bottom:8px; }
.mbf-session-block { border:1px solid rgba(0,0,0,.08); border-radius:7px; overflow:hidden; margin-bottom:6px; background:#fff; }
.mbf-session-head { padding:5px 8px; background:rgba(0,0,0,.04); border-bottom:1px solid rgba(0,0,0,.06); font-size:9px; font-weight:600; color:#111827; display:flex; align-items:center; gap:5px; }
.mbf-ex { display:flex; justify-content:space-between; padding:4px 8px; border-bottom:1px solid rgba(0,0,0,.05); font-size:9px; }
.mbf-ex:last-child { border:none; }
.mbf-exn { color:#374151; font-weight:500; }

/* positions — inline style rotate is combined via CSS var trick */
.sc-topleft { top: 20px; left: 4%; }
.sc-topright { top: 10px; right: 4%; }
.sc-center { top: 50%; left: 50%; margin-left: -84px; margin-top: -200px; transform: rotate(-2deg); }
.sc-botleft { bottom: 0; left: 12%; }
.sc-botright { bottom: 10px; right: 8%; }

.sc-browser { width: 300px; }

/* ── Feature pills ── */
.feature-pills {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 48px 40px 64px;
  max-width: 900px;
  margin: 0 auto;
  border-top: 1px solid #E5E7EB;
}

.feat-pill {
  display: flex; align-items: center; gap: 12px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 180px; flex: 1; max-width: 220px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow .15s, border-color .15s;
}
.feat-pill:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.10); border-color: #D1D5DB; }
.feat-pill-icon { width: 36px; height: 36px; border-radius: 9px; background: rgba(45,199,190,0.12); color: #2DC7BE; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.feat-pill-title { font-size: 13px; font-weight: 700; color: #111827; margin-bottom: 2px; }
.feat-pill-desc { font-size: 11.5px; color: #9CA3AF; line-height: 1.4; }

/* ── App layout ──────────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--nav);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 12px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 15px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
}
.sidebar-logo strong { color: var(--accent); }
.sidebar-logo--upload {
  position: relative;
  cursor: pointer;
}
.coach-logo-img {
  max-height: 40px;
  max-width: 140px;
  object-fit: contain;
  border-radius: 4px;
}
.logo-upload-hint {
  display: none;
  position: absolute;
  inset: 0 0 20px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  letter-spacing: .04em;
}
.sidebar-logo--upload:hover .logo-upload-hint { display: flex; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}
.nav-link:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.85); }
.nav-link.active { background: rgba(45,199,190,0.18); color: var(--accent); }
.nav-link svg { flex-shrink: 0; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.coach-chip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-radius: 8px;
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background .15s;
}
.coach-chip:hover { background: rgba(255,255,255,.07); }
.coach-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.coach-info { display: flex; flex-direction: column; min-width: 0; }
.coach-info span:first-child { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coach-info span:last-child  { font-size: 11px; color: rgba(255,255,255,0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Main content ────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

#view {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 28px 60px;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.03em; }
.page-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Stat cards ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 32px; font-weight: 800; color: var(--text); letter-spacing: -0.03em; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.card-body  { padding: 20px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr.clickable-row:hover td { background: var(--bg); }
tr:hover td { background: rgba(0,0,0,0.02); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-teal    { background: rgba(45,199,190,0.12); color: var(--accent-d); }
.badge-amber   { background: rgba(245,158,11,0.12); color: #B45309; }
.badge-green   { background: rgba(16,185,129,0.12); color: #065F46; }
.badge-purple  { background: rgba(139,92,246,0.12); color: #5B21B6; }
.badge-muted   { background: var(--border); color: var(--muted); }

/* ── Forms ───────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.error-text { color: var(--danger); font-size: 12.5px; margin-bottom: 10px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary  { background: var(--nav); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-teal     { background: var(--accent); color: #fff; }
.btn-teal:hover { background: var(--accent-d); }
.btn-ghost    { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-ghost.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-ghost-outline { background: transparent; color: #374151; border: 1.5px solid #D1D5DB; }
.btn-ghost-outline:hover { background: #F9FAFB; border-color: #9CA3AF; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn-full     { width: 100%; justify-content: center; }
.btn-sm       { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.btn-icon:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: var(--bg) !important; color: var(--muted) !important; }
.modal-close:hover { color: var(--text) !important; }
.modal-body {
  padding: 20px;
  overflow-y: auto;
}
.modal.modal-wide { max-width: 840px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--nav);
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13.5px;
  font-weight: 500;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  animation: slideUp 0.2s ease;
}
.toast.toast-success { background: var(--success); }
.toast.toast-error   { background: var(--danger); }
@keyframes slideUp { from { transform: translateX(-50%) translateY(12px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

.ai-chip {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  padding: 4px 11px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.ai-chip:hover { border-color: var(--accent); color: var(--accent); background: rgba(45,199,190,0.06); }

/* ── Upload area ─────────────────────────────────────────── */
.upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--accent); background: rgba(45,199,190,0.04); }
.upload-icon { color: var(--muted); margin-bottom: 10px; }
.upload-text { font-size: 13px; color: var(--muted); }
.upload-text strong { color: var(--accent); }

/* ── Video grid ──────────────────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.video-card:hover { box-shadow: var(--shadow); }
.video-thumb {
  aspect-ratio: 16/9;
  background: var(--nav);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.3);
  position: relative;
  overflow: hidden;
}
.video-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
}
.video-thumb .play-icon {
  position: absolute;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.video-info { padding: 12px 14px; }
.video-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-meta  { font-size: 11px; color: var(--muted); }

/* ── Program builder ─────────────────────────────────────── */
.session-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.session-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.session-head .session-title { flex: 1; font-size: 13px; font-weight: 600; }
.ex-list { padding: 0; }
.ex-row {
  display: grid;
  grid-template-columns: 1fr 60px 60px 60px 28px;
  gap: 8px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ex-row:last-child { border-bottom: none; }
.ex-row input { padding: 5px 8px; font-size: 13px; }
.add-ex-row { padding: 10px 14px; }

/* ── Athlete detail ──────────────────────────────────────── */
.athlete-grid { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.athlete-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.athlete-avatar-lg {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.athlete-name { font-size: 17px; font-weight: 700; }
.athlete-email { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Calendar / Schedule ─────────────────────────────────── */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.day-header-cell {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0;
}
.schedule-cell {
  min-height: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
}
.schedule-cell .cell-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.schedule-cell.today { border-color: var(--accent); }
.schedule-cell.today .cell-date { color: var(--accent); }
.session-chip {
  background: rgba(45,199,190,0.10);
  border: 1px solid rgba(45,199,190,0.22);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 11px;
  margin-bottom: 5px;
}
.session-chip--click {
  cursor: grab;
  transition: background .12s, transform .1s, opacity .12s;
}
.session-chip--click:hover {
  background: rgba(45,199,190,0.22);
  transform: translateY(-1px);
}
.chip-dragging {
  opacity: 0.35;
  transform: scale(0.96);
  pointer-events: none;
}
.schedule-cell.drag-over {
  background: rgba(45,199,190,0.08);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}
.chip-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}
.chip-name {
  font-weight: 700;
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.chip-delete-btn {
  flex-shrink: 0;
  display: none;
  background: none;
  border: none;
  padding: 0 2px;
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 3px;
  margin-left: auto;
}
.chip-delete-btn:hover { color: #e05; background: rgba(200,0,50,.08); }
.session-chip:hover .chip-delete-btn { display: inline-block; }
.chip-type-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.chip-type-strength  { background: rgba(91,155,213,0.2);  color: #3a7ab5; }
.chip-type-cardio    { background: rgba(45,199,190,0.2);  color: var(--accent-d); }
.chip-type-mobility  { background: rgba(156,106,222,0.2); color: #7c4dba; }
.chip-type-rest      { background: rgba(120,120,120,0.15); color: var(--muted); }
.sched-ex-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sched-ex-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--muted);
}
.sched-ex-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.sched-ex-detail {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── Program expand ─────────────────────────────────────── */
.prog-card-header { display:flex; align-items:center; gap:10px; }
.prog-card-header:hover .card-title { color: var(--accent); }
.prog-expand { border-top: 1px solid var(--border); }
.prog-expand-body { padding: 4px 0 8px; }
.prog-week-group { margin-bottom: 4px; }
.prog-week-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
  padding: 10px 16px 4px;
}
.prog-sess-item {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}
.prog-sess-item:last-child { border-bottom: none; }
.prog-sess-hd {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.prog-sess-name { font-weight: 600; font-size: 13px; }
.prog-sess-day  { font-size: 12px; color: var(--muted); }
.prog-sess-meta { font-size: 12px; color: var(--accent); font-weight: 600; }
.prog-ex-list { display: flex; flex-direction: column; gap: 2px; padding-left: 4px; }
.prog-ex-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; font-size: 12px; color: var(--muted);
}
.prog-ex-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.prog-ex-detail { flex-shrink: 0; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* ── Session inline edit panel ───────────────────────────── */
.sess-edit-panel {
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.sess-edit-inner {
  padding: 12px 16px 14px;
}

/* ── Mini calendar ───────────────────────────────────────── */
.mini-cal { display: inline-block; }
.mc-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; gap: 8px;
}
.mc-grid {
  display: grid; grid-template-columns: repeat(7, 32px); gap: 2px;
}
.mc-head {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: var(--muted); text-align: center; padding: 4px 0;
}
.mc-day {
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; transition: background .1s;
}
.mc-day:hover { background: rgba(45,199,190,0.15); }
.mc-today { font-weight: 700; color: var(--accent); }
.mc-sel {
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 700;
}

/* ── Misc ────────────────────────────────────────────────── */
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.35; }
.empty-state p { font-size: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}
progress { width: 100%; height: 6px; border-radius: 4px; overflow: hidden; border: none; }
progress::-webkit-progress-bar { background: var(--bg); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
.upload-progress { margin-top: 12px; }

/* ── Mobile top bar ──────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 150;
  background: var(--nav);
  padding: 11px 16px;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mobile-topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.mobile-topbar-logo strong { color: var(--accent); }

/* ── Sidebar overlay ─────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  /* App layout: stack vertically */
  #app { flex-direction: column; }

  /* Sidebar: slide-in drawer */
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: -260px;
    width: var(--sidebar-w);
    z-index: 200;
    display: flex;
    transition: left 0.25s ease;
    height: 100vh;
  }
  .sidebar.open { left: 0; }

  /* Show mobile top bar */
  .mobile-topbar { display: flex; }

  /* Main area */
  .main { min-height: calc(100vh - 48px); }
  #view { padding: 16px 12px 48px; }

  /* Forms */
  .field-row, .field-row-3 { grid-template-columns: 1fr; }

  /* Athlete / client page */
  .athlete-grid { grid-template-columns: 1fr; }

  /* Schedule: 3 columns instead of 7 */
  .schedule-grid { grid-template-columns: repeat(3, 1fr); }

  /* Page header: stack buttons below title */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header .actions { flex-wrap: wrap; }

  /* Cards: tighter padding */
  .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card-body   { padding: 14px; }

  /* Program card header: wrap buttons */
  .prog-card-header .actions { flex-wrap: wrap; }

  /* Program session header: let elements wrap */
  .prog-sess-hd { flex-wrap: wrap; row-gap: 4px; }
  .prog-sess-hd .btn { flex-shrink: 0; }

  /* Exercise rows in session edit: scroll */
  .se-ex-row { min-width: 480px; }
  #view [id^="se-exlist-"] { overflow-x: auto; padding-bottom: 4px; }

  /* Session edit panel: single column date range */
  .sess-edit-inner [style*="display:flex;gap:8px;margin-top:8px"] { flex-direction: column; }

  /* Mini calendar: full width cells */
  .mc-grid { grid-template-columns: repeat(7, 1fr); }
  .mc-day  { width: auto; min-width: 0; }

  /* Charts: don't overflow */
  svg[viewBox] { max-width: 100%; }

  /* Toast: smaller on mobile */
  .toast { max-width: calc(100vw - 32px); font-size: 13px; }

  /* Stat grid: two columns */
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* Modal: full width */
  .modal-overlay { padding: 12px; }
  .modal, .modal.modal-wide { max-width: 100%; }
}
