:root {
  color-scheme: light;
  --bg: #eef3f6;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-muted: #f5f8fa;
  --ink: #0e1621;
  --muted: #697784;
  --subtle: #8b98a5;
  --outline: #dbe4ea;
  --outline-strong: #c9d5de;
  --shadow: 0 24px 70px rgba(30, 45, 61, 0.12);
  --shadow-soft: 0 12px 36px rgba(30, 45, 61, 0.08);
  --brand: #91d957;
  --brand-strong: #63be35;
  --blue: #5187ff;
  --cyan: #49b7c9;
  --violet: #a794ff;
  --amber: #f0a43a;
  --rose: #f06989;
  --dark-card: #17191d;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07090d;
  --surface: rgba(18, 22, 27, 0.84);
  --surface-solid: #11161c;
  --surface-muted: #171d24;
  --ink: #f1f5f7;
  --muted: #a0acb8;
  --subtle: #768391;
  --outline: #26313b;
  --outline-strong: #35424f;
  --shadow: 0 26px 74px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 16px 38px rgba(0, 0, 0, 0.28);
  --brand: #b5f267;
  --brand-strong: #83dc46;
  --blue: #7ca4ff;
  --cyan: #61d2e2;
  --violet: #b8aaff;
  --amber: #ffc261;
  --rose: #ff7a9b;
  --dark-card: #0f1115;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 8%, rgba(145, 217, 87, 0.24), transparent 28rem),
    radial-gradient(circle at 82% 14%, rgba(81, 135, 255, 0.16), transparent 32rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--outline);
  background: color-mix(in srgb, var(--surface-solid) 72%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--brand), #dfffa5);
  color: #11180c;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list a {
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.nav-list a:hover,
.nav-list a.active {
  background: var(--ink);
  color: var(--surface-solid);
}

:root[data-theme="dark"] .nav-list a:hover,
:root[data-theme="dark"] .nav-list a.active {
  background: #f5f7f9;
  color: #10141a;
}

.side-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--outline);
  border-radius: 18px;
  background: var(--surface-muted);
}

.side-card strong,
.side-card p {
  display: block;
  margin: 6px 0 0;
}

.side-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.workspace {
  width: min(1500px, 100%);
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.topbar h1,
.auth-card h2,
.command-panel h2,
.panel h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

.topbar h1 {
  font-size: clamp(34px, 4vw, 56px);
  line-height: 0.96;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip,
.legend-dot {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.legend-dot::before {
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.legend-dot.recovery {
  color: var(--brand-strong);
}

.legend-dot.sleep {
  color: var(--cyan);
}

.legend-dot.activity {
  color: var(--rose);
}

.mini-legend {
  display: flex;
  gap: 8px;
}

.apple-button,
.secondary-button,
.icon-button,
.login-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.apple-button,
.login-form button {
  padding: 0 20px;
  background: var(--brand);
  color: #12170f;
}

.secondary-button,
.icon-button {
  border: 1px solid var(--outline);
  background: var(--surface-solid);
  color: var(--ink);
}

.secondary-button {
  padding: 0 18px;
}

.icon-button {
  width: 42px;
}

.auth-card,
.panel,
.stat,
.command-panel {
  border: 1px solid var(--outline);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 22px;
  align-items: start;
  margin-bottom: 18px;
  padding: 22px;
}

.auth-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

details {
  padding: 14px;
  border: 1px solid var(--outline);
  border-radius: 18px;
  background: var(--surface-muted);
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 900;
}

.login-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.login-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.login-form div {
  display: flex;
  gap: 8px;
}

input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--outline);
  border-radius: 14px;
  background: var(--surface-solid);
  color: var(--ink);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.command-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px;
  padding: 24px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-solid) 82%, transparent), color-mix(in srgb, var(--brand) 18%, var(--surface-solid))),
    var(--surface-solid);
}

.hero-copy h2 {
  max-width: 720px;
  font-size: clamp(32px, 4.2vw, 68px);
  line-height: 0.95;
}

.hero-copy p:last-child {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.gauge-wrap {
  display: grid;
  place-items: center;
}

.gauge {
  display: grid;
  width: 210px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface-solid) 0 57%, transparent 58%),
    conic-gradient(var(--brand) calc(var(--score) * 1%), var(--outline) 0);
  box-shadow: inset 0 0 0 1px var(--outline), var(--shadow-soft);
}

.gauge span {
  font-size: 54px;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.gauge small {
  display: block;
  margin-top: -42px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.hero-signals {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.signal-tile {
  padding: 14px;
  border: 1px solid var(--outline);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-solid) 70%, transparent);
}

.signal-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.signal-tile strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 25px;
}

.insights {
  display: grid;
  gap: 10px;
}

.insight {
  padding: 14px;
  border: 1px solid var(--outline);
  border-radius: 18px;
  background: var(--surface-muted);
}

.insight strong {
  display: block;
  margin-bottom: 4px;
}

.insight p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.stats,
.dashboard-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.stats {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.stat {
  min-height: 146px;
  padding: 18px;
}

.stat-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 950;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 7px;
  font-size: clamp(24px, 2.5vw, 36px);
  letter-spacing: -0.05em;
}

.stat small {
  display: block;
  margin-top: 8px;
  color: var(--subtle);
  font-weight: 750;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.wide {
  grid-column: 1 / -1;
}

.chart {
  min-height: 250px;
}

.chart svg,
.bar-chart svg {
  display: block;
  width: 100%;
}

.chart-grid-line {
  stroke: var(--outline);
  stroke-width: 1;
}

.chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bar-chart {
  min-height: 250px;
}

.body-systems {
  display: grid;
  gap: 10px;
}

.system-row {
  display: grid;
  grid-template-columns: 104px 1fr auto;
  gap: 12px;
  align-items: center;
}

.system-row span {
  color: var(--muted);
  font-weight: 850;
}

.system-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--outline);
}

.system-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--cyan));
}

.system-row strong {
  min-width: 56px;
  text-align: right;
}

#workouts-section {
  margin-top: 18px;
}

.text-link {
  color: var(--blue);
  font-weight: 900;
  text-decoration: none;
}

.workouts {
  display: grid;
  gap: 10px;
}

.workout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(92px, max-content));
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--outline);
  border-radius: 18px;
  background: var(--surface-muted);
}

.workout strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workout span {
  color: var(--muted);
  font-weight: 800;
}

.empty {
  padding: 22px;
  border: 1px dashed var(--outline-strong);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--outline);
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(max-content, 1fr));
    overflow-x: auto;
  }

  .side-card {
    margin-top: 0;
  }

  .hero-grid,
  .auth-card,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .command-panel,
  .stats,
  .hero-signals {
    grid-template-columns: 1fr;
  }

  .gauge-wrap {
    justify-content: start;
  }

  .workout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .sidebar {
    padding: 18px;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

  .login-form div,
  .topbar-actions {
    flex-direction: column;
    width: 100%;
  }

  .apple-button,
  .secondary-button,
  .icon-button,
  .login-form button {
    width: 100%;
  }

  .workout,
  .system-row {
    grid-template-columns: 1fr;
  }

  .system-row strong {
    text-align: left;
  }
}
