:root {
  --bg: #090b13;
  --panel: #111526;
  --panel-soft: #161b2d;
  --line: #262d45;
  --text: #f1f5ff;
  --muted: #94a0c0;
  --blue: #6e84ff;
  --purple: #915bff;
  --green: #19d38a;
  --orange: #ff9448;
  --danger: #ff5e7a;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at 20% 10%, #121a32, var(--bg));
  color: var(--text);
}
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

#login-screen {
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-bg-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
}
.login-bg-glow--a { background: var(--purple); top: -120px; left: -60px; }
.login-bg-glow--b { background: var(--green); right: -100px; bottom: -120px; }

.login-card {
  width: min(980px, 92vw);
  background: rgba(16, 21, 38, .9);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 2rem;
  padding: 2rem;
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 1;
}
.brand-chip {
  display: inline-flex;
  background: linear-gradient(120deg, #5f76ff, #9a66ff);
  padding: .45rem .8rem;
  border-radius: 999px;
  font-weight: 700;
}
.brand-block h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); margin-bottom: 1rem; }
.brand-block p { color: var(--muted); line-height: 1.6; max-width: 42ch; }

.form-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
label { font-size: .85rem; color: #cdd5f6; }
input {
  background: #0f1323;
  border: 1px solid #2c3552;
  border-radius: var(--radius-md);
  padding: .85rem .9rem;
  color: var(--text);
}
input:focus { outline: 2px solid #6479ff66; }

button {
  border: 0;
  border-radius: var(--radius-md);
  padding: .8rem 1rem;
  font-weight: 700;
  cursor: pointer;
}
#login-button {
  margin-top: .8rem;
  background: linear-gradient(130deg, #5f76ff, #8a5eff);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
}
.btn-loader {
  width: 15px;
  height: 15px;
  border: 2px solid #fff9;
  border-right-color: transparent;
  border-radius: 50%;
  display: none;
  animation: spin .8s linear infinite;
}
.loading .btn-loader { display: inline-block; }
.loading .btn-text { opacity: .7; }
.error-message { min-height: 1.4rem; color: var(--danger); }

#app-screen { width: 100%; }
.sidebar {
  width: 250px;
  border-right: 1px solid var(--line);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #0f1322;
}
.sidebar-brand h2 { margin: 0; }
.sidebar-brand p { margin-top: .3rem; color: var(--muted); font-size: .9rem; }
#main-nav { display: grid; gap: .55rem; margin-top: 1.2rem; }
.nav-item {
  background: transparent;
  color: #d7defa;
  text-align: left;
  border: 1px solid transparent;
}
.nav-item.active { background: #1b2340; border-color: #384474; color: #fff; }
.sidebar-footer { display: grid; gap: .45rem; color: var(--muted); }

.content { flex: 1; padding: 1.2rem 1.5rem 2rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.eyebrow { margin: 0; color: var(--muted); font-size: .85rem; }
.topbar h1 { margin: .25rem 0; }
.topbar-actions { display: flex; gap: .6rem; }
.primary-btn { background: linear-gradient(130deg, #5f76ff, #8a5eff); color: white; }
.ghost-btn { background: #1a2139; border: 1px solid #32406c; color: #dce4ff; }
.ghost-btn.small { padding: .42rem .66rem; font-size: .8rem; }

.view { display: none; gap: 1rem; }
.view.active { display: grid; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 1rem; }
.status-card {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.status-title { margin: 0; color: var(--muted); font-size: .82rem; }
.status-value { margin: .3rem 0; }

.panel {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.weekly-strip { display: grid; grid-template-columns: repeat(7, minmax(168px, 1fr)); gap: .8rem; overflow-x: auto; }
.day-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #121936;
  padding: .8rem;
  display: grid;
  gap: .55rem;
  min-width: 168px;
}
.day-card.strength { box-shadow: inset 0 0 0 1px #6b80ff55; }
.day-card.running { box-shadow: inset 0 0 0 1px #17c27d55; }
.badge { font-size: .75rem; padding: .18rem .45rem; border-radius: 999px; }
.badge.strength { background: #3d4fc460; color: #cdd5ff; }
.badge.running { background: #1ca26a44; color: #b8ffd9; }
.badge.topset { background: #ad5f2138; color: #ffd2b3; }
.day-card h4 { margin: 0; }
.day-card p { margin: 0; color: #b9c4e8; font-size: .84rem; }
.day-card footer { display: flex; justify-content: space-between; align-items: center; }
.status.done { color: #7ef0bc; }
.status.pending { color: #c9d4ff; }

.workout-grid { display: grid; gap: .9rem; }
.workout-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; }
.progressbar {
  width: 240px;
  height: 10px;
  background: #232d4e;
  border-radius: 999px;
  overflow: hidden;
}
.progressbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--purple)); }
.exercise-card {
  background: #111831;
  border: 1px solid #2b365d;
  border-radius: var(--radius-md);
  padding: .9rem;
}
.exercise-card header { display: flex; justify-content: space-between; gap: .8rem; }
.exercise-tag { background: #213055; padding: .3rem .6rem; border-radius: 999px; font-size: .75rem; color: #d5e0ff; }
.exercise-sub { color: var(--muted); margin-top: .2rem; }

.set-row {
  display: grid;
  grid-template-columns: 22px 1.2fr repeat(3, minmax(58px, .5fr)) 92px;
  gap: .45rem;
  align-items: center;
  margin: .4rem 0;
}
.set-row .set-type { font-size: .82rem; color: #d5dfff; }
.set-row input[type='number'] {
  padding: .45rem .35rem;
  border-radius: 8px;
  border: 1px solid #364267;
  background: #0e152b;
  color: #dfe8ff;
}
.rest-chip {
  font-size: .75rem;
  text-align: center;
  padding: .35rem;
  border-radius: 999px;
  background: #29345c;
}
.rest-chip.top { background: #6d451f; color: #ffd4b7; }

.running-layout { display: grid; gap: 1rem; }
.run-card {
  background: #10231f;
  border: 1px solid #214c43;
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.run-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.run-title { margin: 0; }
.timeline { margin-top: .85rem; display: grid; gap: .45rem; }
.block {
  background: #173830;
  border: 1px solid #2b5e53;
  border-radius: 10px;
  padding: .55rem .7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.timer-row { display: flex; gap: .7rem; margin-top: .7rem; }
.timer-pill {
  background: #173730;
  border: 1px solid #2c5d53;
  border-radius: 999px;
  padding: .45rem .7rem;
  font-size: .82rem;
}

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 960px) {
  .login-card { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
