/* FitTrack V2 — mobile-first visual layer */
:root {
  --bg: #080b10;
  --bg2: #10151b;
  --bg3: #171d25;
  --bg4: #202833;
  --border: rgba(255,255,255,.085);
  --accent: #c8ff36;
  --accent2: #50d8ff;
  --accent3: #7d6cff;
  --text: #f6f8f5;
  --text2: #a1abb8;
  --text3: #697483;
  --green: #46e6a6;
  --orange: #ffb45c;
  --red: #ff667d;
  --purple: #a88cff;
  --card-radius: 22px;
  --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --shadow: 0 24px 80px rgba(0,0,0,.28);
}

html { background: var(--bg); scroll-behavior: smooth; }
body {
  background:
    radial-gradient(circle at 85% -10%, rgba(80,216,255,.08), transparent 30rem),
    radial-gradient(circle at -10% 38%, rgba(125,108,255,.055), transparent 32rem),
    var(--bg);
  letter-spacing: -.01em;
}
button, input, select, textarea { touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Brand and shell */
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #0b1007;
  font: 900 20px/1 var(--font-body); letter-spacing: -.08em;
  box-shadow: 0 0 0 5px rgba(200,255,54,.08);
}
.mobile-topbar, .mobile-nav { display: none; }
.app-shell { grid-template-columns: 248px minmax(0,1fr); }
.sidebar {
  padding: 22px 14px; background: rgba(12,16,22,.94);
  border-right: 1px solid var(--border); backdrop-filter: blur(22px);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 13px;
  padding: 4px 10px 24px; border: 0;
  color: var(--text); font: 800 18px/1 var(--font-body); letter-spacing: -.03em;
}
.sidebar-logo > span { padding: 0; border: 0; }
.sidebar-logo .brand-mark { color:#0b1007; font-size:20px; display:inline-flex; letter-spacing:-.08em; }
.sidebar-wordmark small {
  display: block; margin-top: 5px; color: var(--text3);
  font: 700 8px/1 var(--font-body); letter-spacing: .16em;
}
.nav-section { padding: 20px 0 0; }
.nav-label { padding: 0 12px 8px; color: var(--text3); font-weight: 700; letter-spacing: .16em; }
.nav-item {
  min-height: 48px; margin: 3px 0; padding: 11px 12px;
  border: 0; border-radius: 13px; font-size: 13px; font-weight: 650;
}
.nav-item:hover { background: rgba(255,255,255,.045); }
.nav-item.active {
  color: var(--text); background: rgba(200,255,54,.095); border: 0;
  box-shadow: inset 0 0 0 1px rgba(200,255,54,.12);
}
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon {
  width: 29px; height: 29px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; background: rgba(255,255,255,.045);
  font-size: 14px;
}
.sidebar-bottom { padding: 18px 10px 4px; border-color: var(--border); }
.sidebar-action { min-height: 38px; color: var(--text3); font-weight: 600; }
.main-content { padding: 32px clamp(24px,3vw,52px) 56px; max-width: 1580px; width: 100%; margin: 0 auto; }

/* Lock screen */
#lock-screen {
  background:
    linear-gradient(90deg, rgba(7,10,14,.96) 0%, rgba(7,10,14,.82) 48%, rgba(7,10,14,.7) 100%),
    url('dashboard-hero-v2.jpg') center/cover;
  gap: 30px;
}
#lock-screen::before {
  content: 'V2'; position: fixed; top: 24px; right: 26px;
  padding: 7px 10px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--text2); font: 700 10px/1 var(--font-body); letter-spacing: .14em;
}
.lock-logo {
  color: var(--text); font: 850 54px/1 var(--font-body); letter-spacing: -.07em;
  text-shadow: none;
}
.lock-logo::first-letter { color: var(--accent); }
.lock-sub { color: var(--text3); letter-spacing: .14em; font-weight: 700; }
.pin-dot { width: 13px; height: 13px; border-color: rgba(255,255,255,.18); }
.pin-dot.filled { box-shadow: 0 0 20px rgba(200,255,54,.42); }
.pin-key {
  width: 68px; height: 68px; background: rgba(22,28,36,.78);
  border-color: rgba(255,255,255,.1); backdrop-filter: blur(12px); font-weight: 700;
}
.pin-key:hover { border-color: rgba(200,255,54,.45); background: rgba(200,255,54,.08); }

/* Global typography and controls */
.page-title {
  font: 760 clamp(38px,4.2vw,68px)/.96 var(--font-body);
  letter-spacing: -.065em; text-transform: none;
}
.page-title span { color: var(--accent); }
.page-subtitle { color: var(--text2); font-size: 13px; text-transform: capitalize; }
.page-header { margin-bottom: 26px; }
.card {
  background: linear-gradient(145deg, rgba(255,255,255,.024), transparent 55%), var(--bg2);
  border-color: var(--border); border-radius: var(--card-radius); padding: 22px;
  box-shadow: 0 1px 0 rgba(255,255,255,.025) inset;
}
.card-title { color: var(--text3); font-weight: 750; letter-spacing: .15em; }
.btn { min-height: 46px; border-radius: 14px; font-weight: 750; }
.btn-primary {
  background: var(--accent); color: #0b1007;
  box-shadow: 0 10px 30px rgba(200,255,54,.13);
}
.btn-primary:hover { background: #d7ff6b; box-shadow: 0 12px 34px rgba(200,255,54,.2); }
.btn-secondary, .timer-btn, .back-btn { background: var(--bg3); border-color: var(--border); }
.form-input, .form-select, .form-textarea {
  min-height: 48px; background: var(--bg3); border-color: var(--border); border-radius: 13px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: rgba(200,255,54,.65); }
.stat-chip { border-radius: 16px; border-color: var(--border); background: rgba(15,20,26,.78); }
.stat-chip .value { font-family: var(--font-body); font-weight: 780; letter-spacing: -.055em; }
.stat-chip .label { font-weight: 700; letter-spacing: .12em; }
.section-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; }
.section-heading h2 { font-size: 21px; letter-spacing: -.035em; }
.section-kicker { display:block; margin-bottom:5px; color:var(--text3); font-size:10px; font-weight:750; letter-spacing:.15em; text-transform:uppercase; }
.live-pill { padding:7px 10px; border:1px solid var(--border); border-radius:999px; color:var(--text2); font-size:10px; font-weight:700; }
.live-pill i { display:inline-block; width:6px; height:6px; margin-right:6px; border-radius:50%; background:var(--green); box-shadow:0 0 12px var(--green); }

/* Dashboard */
.dashboard-hero {
  min-height: 430px; position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(28px,4vw,52px); margin-bottom: 22px; border-radius: 30px;
  background:
    linear-gradient(90deg, rgba(7,10,14,.96) 0%, rgba(7,10,14,.82) 38%, rgba(7,10,14,.2) 78%),
    linear-gradient(0deg, rgba(7,10,14,.9) 0%, transparent 44%),
    url('dashboard-hero-v2.jpg') 66% center/cover no-repeat;
  border: 1px solid rgba(255,255,255,.1); box-shadow: var(--shadow);
}
.dashboard-hero::after {
  content:''; position:absolute; inset:0; z-index:-1; pointer-events:none;
  background:linear-gradient(110deg, transparent 55%, rgba(80,216,255,.08));
}
.hero-content { max-width: 540px; }
.hero-eyebrow { display:flex; align-items:center; gap:9px; color:var(--text2); font-size:10px; font-weight:750; letter-spacing:.11em; text-transform:uppercase; }
.hero-eyebrow span { color:var(--accent); }
.hero-eyebrow i { width:3px; height:3px; border-radius:50%; background:var(--text3); }
.dashboard-hero .page-header { margin: 22px 0 12px; }
.dashboard-hero .page-title { max-width: 440px; color:#fff; }
.dashboard-hero .page-subtitle { margin-top:12px; color:rgba(255,255,255,.62); }
.hero-copy { max-width: 410px; color:rgba(255,255,255,.68); font-size:14px; line-height:1.55; }
.hero-cta { margin-top: 22px; min-width: 180px; justify-content: space-between; }
.hero-cta b { font-size:20px; font-weight:500; }
.hero-stats { width: min(760px, 100%); gap: 8px; margin-top: 30px; }
.hero-stats .stat-chip {
  min-height: 82px; padding: 13px 15px; gap:2px;
  border-color: rgba(255,255,255,.1); background: rgba(8,12,16,.54); backdrop-filter: blur(15px);
}
.hero-stats .stat-chip .value { font-size: 25px; color: var(--text); }
.hero-stats .stat-chip.accent .value { color:var(--accent); }
.hero-stats .stat-chip.blue .value { color:var(--accent2); }
.hero-stats .stat-chip.green .value { color:var(--green); }
.hero-stats .stat-chip.orange .value { color:var(--orange); }
.hero-stats .stat-chip .sub { font-size:10px; }
.hero-stats .stat-chip .label { font-size:8px; }
.dashboard-layout { display:grid; grid-template-columns:minmax(0,1.7fr) minmax(280px,.72fr); gap:22px; align-items:start; }
.dashboard-primary, .dashboard-secondary { display:grid; gap:22px; }
.suggestion-card {
  padding: 18px 20px; background: linear-gradient(105deg, rgba(200,255,54,.09), rgba(80,216,255,.035)), var(--bg2);
  border-color: rgba(200,255,54,.16);
}
.suggestion-card .card-title { margin-bottom: 11px; }
.week-card .chart-wrap { height: 200px; }
.quick-card button {
  width:100%; min-height:51px; display:flex; align-items:center; justify-content:space-between;
  padding:0 4px; background:none; border:0; border-top:1px solid var(--border);
  color:var(--text); font:650 13px/1 var(--font-body); cursor:pointer;
}
.quick-card button b { color:var(--text3); font-size:18px; transition:transform .2s,color .2s; }
.quick-card button:hover b { color:var(--accent); transform:translateX(3px); }
.recovery-card { padding: 22px; }
.recovery-visual {
  min-height: 500px; height: clamp(500px,43vw,620px); border-radius: 18px;
  background: radial-gradient(circle at 50% 20%, #202a34 0%, #10161d 48%, #090d12 100%);
  border-color: var(--border);
}
.recovery-metric strong { font-family:var(--font-body); font-weight:780; letter-spacing:-.05em; }

/* Workout experience */
.top-bar { margin-bottom:22px; }
.timer-bar {
  position:sticky; top:12px; z-index:30; padding:10px; border:1px solid var(--border);
  border-radius:18px; background:rgba(10,14,19,.82); backdrop-filter:blur(18px); box-shadow:0 12px 34px rgba(0,0,0,.22);
}
.timer-display { min-height:48px; padding:8px 15px; background:rgba(255,255,255,.045); }
.timer-display .timer-val { color:var(--accent); font-size:24px; }
.timer-btn { min-height:44px; border-radius:12px; }
.timer-btn.finish { background:var(--accent); border-color:var(--accent); color:#0b1007; }
.workout-mode-row { gap:8px; }
.workout-mode { min-height:58px; border-radius:14px; }
.workout-mode:hover, .workout-mode.active { color:var(--text); background:rgba(200,255,54,.09); border-color:rgba(200,255,54,.44); }
.muscle-choice-card { border-radius:16px; background:var(--bg3); }
.muscle-choice-card.active { border-color:rgba(200,255,54,.72); background:linear-gradient(135deg,rgba(200,255,54,.13),rgba(255,255,255,.025)); }
.muscle-choice-icon { border-radius:12px; }
.muscle-choice-pct { font-family:var(--font-body); font-weight:780; letter-spacing:-.05em; }
.wk-card { border-radius:20px; background:var(--bg2); border-color:var(--border); margin-bottom:14px; }
.wk-card.all-done { border-color:rgba(70,230,166,.6); box-shadow:inset 0 0 0 1px rgba(70,230,166,.09); }
.wk-head { min-height:96px; gap:14px; padding:13px; }
.wk-visual {
  width:78px; height:70px; position:relative; overflow:hidden; flex:0 0 auto;
  border-radius:14px; background:var(--bg3); border:1px solid var(--border);
}
.wk-visual img { width:100%; height:100%; object-fit:cover; display:block; }
.wk-visual span {
  position:absolute; left:6px; top:6px; width:22px; height:22px; border-radius:7px;
  display:flex; align-items:center; justify-content:center; background:rgba(8,11,16,.82);
  color:var(--accent); font:750 10px/1 var(--font-mono); backdrop-filter:blur(5px);
}
.wk-title h3 { font-size:16px; letter-spacing:-.025em; }
.wk-tag { border-radius:999px; }
.wk-actions { align-self:flex-start; }
.wk-btn { width:36px; height:36px; border-radius:11px; }
.wk-history { background:rgba(255,255,255,.025); }
.wk-suggestion { border-radius:12px; background:rgba(200,255,54,.055); border-color:rgba(200,255,54,.14); }
.wk-set-input { min-height:48px; border-radius:12px; font-size:15px; }
.wk-set-check { width:44px; height:44px; border-radius:12px; }
.wk-set-check.checked { background:var(--green); border-color:var(--green); }
.wk-set-ctrl-btn { min-height:40px; border-radius:11px; }
.effort-btn { min-height:42px; border-radius:11px; }
.finish-workout-panel { border-radius:22px; border-color:rgba(200,255,54,.23); background:linear-gradient(135deg,rgba(200,255,54,.1),rgba(80,216,255,.035)),var(--bg2); }
.finish-workout-time strong { color:var(--accent); font-family:var(--font-mono); }
.wk-add-card { min-height:82px; border-radius:18px; }

/* Library, history and data views */
.exercise-card-grid { grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); }
.exercise-card { min-height:240px; border-radius:18px; padding:17px; background:var(--bg3); }
.exercise-visual { width:74px; height:64px; padding:0; overflow:hidden; border-radius:13px; background:color-mix(in srgb,var(--muscle-color) 10%,var(--bg3)); }
.exercise-visual img { width:100%; height:100%; object-fit:cover; }
.exercise-title { font-size:16px; letter-spacing:-.025em; }
.detail-chip { min-height:40px; border-radius:12px; }
.log-entry { border-radius:18px; background:var(--bg2); }
.modal-overlay { background:rgba(3,5,8,.76); backdrop-filter:blur(12px); }
.modal { border-radius:24px; border-color:var(--border); box-shadow:var(--shadow); }
#toast { border-radius:14px; background:rgba(20,27,35,.94); backdrop-filter:blur(15px); }

@media (max-width: 1180px) {
  .dashboard-layout { grid-template-columns: minmax(0,1.4fr) minmax(250px,.7fr); }
  .hero-stats { width:100%; }
}

@media (max-width: 900px) {
  body { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .mobile-topbar {
    height:68px; position:fixed; inset:0 0 auto; z-index:180; padding:0 16px;
    display:flex; align-items:center; justify-content:space-between;
    background:rgba(8,11,16,.82); border-bottom:1px solid var(--border); backdrop-filter:blur(20px);
  }
  .mobile-brand { display:flex; align-items:center; gap:10px; color:var(--text); font-size:14px; font-weight:800; letter-spacing:-.03em; }
  .mobile-brand .brand-mark { width:34px; height:34px; border-radius:11px; font-size:17px; }
  .mobile-brand small { padding:4px 6px; border-radius:999px; background:rgba(200,255,54,.1); color:var(--accent); font-size:8px; letter-spacing:.1em; }
  .mobile-lock { width:38px; height:38px; margin-right:50px; border-radius:12px; border:1px solid var(--border); background:var(--bg3); color:var(--text2); font-size:19px; }
  .hamburger { top:14px; right:16px; left:auto; z-index:210; background:var(--bg3); border-color:var(--border); }
  .app-shell { display:block; min-height:100dvh; }
  .sidebar { width:min(84vw,320px); left:auto; right:-340px; z-index:200; padding:82px 16px 24px; transition:right .3s ease; box-shadow:-24px 0 70px rgba(0,0,0,.4); }
  .sidebar.open { left:auto; right:0; }
  .sidebar-logo { display:none; }
  .sidebar-overlay { z-index:190; background:rgba(2,4,7,.7); backdrop-filter:blur(4px); }
  .main-content { max-width:none; min-height:100dvh; padding:86px 16px 24px; overflow:visible; }
  .mobile-nav {
    position:fixed; z-index:160; left:10px; right:10px; bottom:calc(8px + env(safe-area-inset-bottom));
    min-height:66px; display:grid; grid-template-columns:repeat(5,1fr); align-items:center;
    padding:6px; border:1px solid rgba(255,255,255,.1); border-radius:22px;
    background:rgba(19,25,32,.9); box-shadow:0 18px 50px rgba(0,0,0,.46); backdrop-filter:blur(24px);
  }
  .mobile-nav-item {
    height:54px; min-width:0; border:0; border-radius:16px; background:none; color:var(--text3);
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  }
  .mobile-nav-item span { font:700 21px/1 var(--font-body); letter-spacing:-.08em; }
  .mobile-nav-item small { font:650 9px/1 var(--font-body); }
  .mobile-nav-item.active { background:rgba(200,255,54,.1); color:var(--accent); }
  .dashboard-hero { min-height:590px; padding:26px 22px 20px; background-position:64% center; border-radius:26px; }
  .dashboard-hero::before {
    content:''; position:absolute; inset:0; z-index:-1;
    background:linear-gradient(180deg,rgba(7,10,14,.86) 0%,rgba(7,10,14,.3) 42%,rgba(7,10,14,.95) 76%);
  }
  .hero-content { max-width:72%; }
  .dashboard-hero .page-title { font-size:clamp(42px,11vw,60px); }
  .hero-copy { font-size:13px; }
  .hero-stats { grid-template-columns:repeat(2,1fr); margin-top:auto; gap:7px; }
  .hero-stats .stat-chip { min-height:76px; }
  .dashboard-layout { grid-template-columns:1fr; }
  .dashboard-secondary { grid-template-columns:1fr; }
  .suggestion-card { order:-1; }
  .recovery-visual { min-height:440px; height:440px; overflow:hidden; }
  .recovery-stage { position:absolute; inset:0; min-width:0; height:auto; }
  .timer-bar { top:76px; }
  .top-bar { display:none; }
  .page > .page-title { margin-top:4px !important; }
  .page-title { font-size:40px; }
  .workout-muscle-grid {
    display:flex; gap:10px; overflow-x:auto; scroll-snap-type:x mandatory;
    margin-inline:-22px; padding:0 22px 8px; scrollbar-width:none;
  }
  .workout-muscle-grid::-webkit-scrollbar { display:none; }
  .workout-muscle-card {
    flex:0 0 190px; min-height:168px; padding:10px; scroll-snap-align:start;
    grid-template-columns:1fr auto; grid-template-rows:96px auto;
  }
  .workout-muscle-card .muscle-choice-icon { width:100%; height:96px; grid-column:1/-1; }
  .workout-muscle-card .muscle-choice-pct { font-size:20px; }
  .modal-overlay { padding:0; align-items:flex-end; }
  .modal { width:100%; max-height:90dvh; padding:24px 18px calc(24px + env(safe-area-inset-bottom)); border-radius:26px 26px 0 0; }
  #toast { bottom:calc(92px + env(safe-area-inset-bottom)); left:16px; right:16px; max-width:none; }
}

@media (max-width: 600px) {
  .dashboard-hero { min-height:560px; padding:23px 18px 17px; background-position:66% center; }
  .hero-content { max-width:82%; }
  .hero-copy { max-width:270px; }
  .hero-cta { min-width:170px; min-height:50px; }
  .hero-stats .stat-chip { padding:11px 13px; }
  .hero-stats .stat-chip .value { font-size:23px; }
  .card { padding:18px; }
  .section-heading h2 { font-size:19px; }
  .live-pill { display:none; }
  .suggestion-card #today-suggestion > div { align-items:flex-start !important; flex-wrap:wrap; }
  .suggestion-card #today-suggestion .btn { margin-left:64px !important; margin-top:-4px; }
  .recovery-card { padding:14px; }
  .recovery-visual { min-height:390px; height:390px; }
  .recovery-metrics { top:16px; left:15px; right:15px; }
  .recovery-metric strong { font-size:27px; }
  .workout-mode-row { grid-template-columns:repeat(3,1fr); }
  .workout-mode { min-height:70px; padding:8px 5px; flex-direction:column; gap:4px; font-size:11px; }
  .timer-bar { display:grid; grid-template-columns:1fr 1fr 1fr; gap:7px; }
  .timer-display { grid-column:1/-1; justify-content:center; }
  .timer-btn { padding:8px 5px; font-size:11px; }
  .wk-head { display:grid; grid-template-columns:66px minmax(0,1fr); align-items:start; }
  .wk-visual { width:66px; height:68px; }
  .wk-actions { grid-column:1/-1; justify-self:stretch; display:grid; grid-template-columns:repeat(3,1fr); width:100%; }
  .wk-btn { width:auto; height:40px; }
  .wk-history { margin:12px 12px 0; }
  .wk-history-stats { grid-template-columns:1fr 1fr; }
  .wk-history-stat:last-child { grid-column:1/-1; }
  .wk-suggestion { margin:9px 12px 0; }
  .wk-sets { padding:12px; }
  .wk-set-row, .wk-set-header { grid-template-columns:22px 1fr 14px 1fr 44px; gap:5px; }
  .wk-effort { margin-inline:12px; }
  .effort-row { grid-template-columns:repeat(3,1fr); }
  .finish-workout-panel { padding:17px; }
  .finish-workout-time strong { font-size:26px; }
  .grid-4 { gap:9px; }
  .stat-chip { padding:14px; }
  .stat-chip .value { font-size:30px; }
  .exercise-card-grid { grid-template-columns:1fr; }
  .page-header .flex { width:100%; }
  .page-header .flex .form-select { flex:1; width:auto !important; }
  #page-exercises .card > .flex { display:grid; grid-template-columns:1fr 1fr; }
  #page-exercises #ex-search { grid-column:1/-1; max-width:none !important; }
  #page-exercises .form-select { width:100% !important; }
  .chart-wrap { height:210px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
