:root {
  --bg: #06080c;
  --bg-panel: #07090d;
  --card: #13171e;
  --card-2: #11151c;
  --inset: #0e1218;
  --line: rgba(255, 255, 255, 0.06);
  --accent: #5b9bff;
  --accent-2: #4f8bf9;
  --green: #2fd28b;
  --amber: #f4b740;
  --red: #fb6b66;
  --violet: #7c5bff;
  --orange: #fb8a3c;
  --grey: #3a4350;
  --fg: #f3f6fa;
  --fg-dim: #8b95a4;
  --fg-mut: #6b7686;
  --fg-faint: #5a6472;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}
body {
  font-family: "Geist", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--fg);
}
::selection {
  background: rgba(79, 139, 249, 0.35);
}

.app {
  width: 100%;
  max-width: 468px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg-panel);
  position: relative;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

/* ---- top + tab bars ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 14px 18px 12px;
  background: rgba(7, 9, 13, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.brand b {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #eef2f7;
}
.brand span {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-faint);
}
.status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px 6px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.status .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}
.status.warn {
  background: rgba(244, 183, 64, 0.12);
  border: 1px solid rgba(244, 183, 64, 0.3);
  color: #f4d08a;
}
.status.warn .dot {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}
.status.ok {
  background: rgba(47, 210, 139, 0.12);
  border: 1px solid rgba(47, 210, 139, 0.3);
  color: #6ee3ad;
}
.status.ok .dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.tabbar {
  position: sticky;
  top: 51px;
  z-index: 19;
  padding: 10px 18px;
  background: rgba(7, 9, 13, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #11151c;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 13px;
}
.tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--fg-mut);
  transition: all 0.2s;
}
.tab.active {
  background: #1f2733;
  color: var(--fg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ---- sections + cards ---- */
.section {
  padding: 8px 16px 48px;
  display: none;
  flex-direction: column;
  gap: 14px;
}
.section.active {
  display: flex;
  animation: riseUp 0.4s ease both;
}

.ranges {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 2px 2px 0;
}
.range-btn {
  padding: 5px 11px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--fg-mut);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.range-btn.active {
  border-color: rgba(79, 139, 249, 0.4);
  background: rgba(79, 139, 249, 0.14);
  color: var(--accent);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
}
.card.accent {
  background: linear-gradient(165deg, #161d28, #11151c);
  border-color: rgba(79, 139, 249, 0.16);
  position: relative;
  overflow: hidden;
}
.card.hero {
  background: linear-gradient(165deg, #16202c, #11151c);
  border-color: rgba(79, 139, 249, 0.2);
  position: relative;
  overflow: hidden;
}
.card.note-card {
  background: linear-gradient(165deg, #141a24, #10141b);
  border-color: rgba(79, 139, 249, 0.18);
}

.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #7a8696;
}
.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.big {
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.unit {
  font-size: 13px;
  color: var(--fg-dim);
  font-weight: 600;
}
.sub {
  font-size: 11.5px;
  color: var(--fg-dim);
}
.muted {
  color: var(--fg-faint);
}
.tnum {
  font-variant-numeric: tabular-nums;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.inset {
  background: var(--inset);
  border-radius: 12px;
  padding: 12px;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px 11px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.chip .k {
  font-size: 10px;
  color: var(--fg-mut);
  font-weight: 600;
}
.chip .v {
  font-size: 12px;
  color: #e6ebf2;
  font-weight: 700;
}

.callout {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 11.5px;
  line-height: 1.45;
}
.callout.blue {
  background: rgba(91, 155, 255, 0.09);
  border: 1px solid rgba(91, 155, 255, 0.18);
  color: #aebfd6;
}
.callout.amber {
  background: rgba(244, 183, 64, 0.08);
  border: 1px solid rgba(244, 183, 64, 0.18);
  color: #e8cd97;
}
.callout.red {
  background: rgba(251, 107, 102, 0.08);
  border: 1px solid rgba(251, 107, 102, 0.16);
  color: #e6a9a6;
}

/* ---- bars / charts ---- */
.bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}
.bar {
  flex: 1;
  min-width: 0;
  border-radius: 3px 3px 1px 1px;
}
.goalline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--grey);
}
.legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.legend .item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend .sw {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}
.legend span {
  font-size: 10.5px;
  color: #7a8696;
}
svg {
  display: block;
  overflow: visible;
}

.track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: #0c0f15;
  overflow: hidden;
}
.track > div {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #3f7df0, #5b9bff);
}

.ringwrap {
  position: relative;
  flex: none;
}
.ringwrap .center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty {
  padding: 18px 16px;
  border: 1.5px dashed #39414d;
  border-radius: 14px;
  text-align: center;
  background: rgba(244, 183, 64, 0.04);
}
.empty .t {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.02em;
}

.workout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.workout:last-child {
  border-bottom: none;
}
.src-tag {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
}
.src-tag.fitbit {
  color: #7fb0ff;
  background: rgba(79, 139, 249, 0.12);
}
.src-tag.apple {
  color: #9aa6b5;
  background: rgba(255, 255, 255, 0.06);
}

.screen {
  padding: 60px 24px;
  text-align: center;
  color: var(--fg-dim);
}
.screen input {
  width: 100%;
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--inset);
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
}
.screen button {
  margin-top: 12px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: var(--accent-2);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

@keyframes riseUp {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .section.active {
    animation: none;
  }
}
