:root {
  --ink: #10243d;
  --ink-strong: #081629;
  --canvas: #eef4f8;
  --surface: #ffffff;
  --surface-alt: #f7fafc;
  --surface-dark: #0c1b30;
  --text: #122135;
  --muted: #607087;
  --border: rgba(16, 36, 61, 0.1);
  --shadow: 0 22px 60px rgba(16, 36, 61, 0.12);
  --cyan: #0ea5c6;
  --teal: #0f766e;
  --gold: #f59e0b;
  --orange: #f97316;
  --rose: #f43f5e;
  --sky: #38bdf8;
  --violet: #8b5cf6;
  --mint: #10b981;
  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 16px;
  --sans: "Avenir Next", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top right, rgba(14, 165, 198, 0.14), transparent 24%),
    linear-gradient(180deg, #f5f9fc, #edf4f8 34%, #eaf0f5 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 15%, rgba(249, 115, 22, 0.08), transparent 18%),
    linear-gradient(135deg, transparent 0 82%, rgba(255, 255, 255, 0.3) 82% 84%, transparent 84% 100%);
  opacity: 0.8;
}

.page-shell {
  width: min(1380px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0 80px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.95fr);
  gap: 24px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-panel,
.control-panel,
.summary-strip,
.surface-card,
.insight-card,
.run-card,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-panel {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border-radius: var(--radius-lg);
  animation: lift-in 560ms ease both;
}

.hero-copy {
  padding: 42px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent),
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 50%),
    linear-gradient(145deg, #10243d, #0d2036 46%, #0a1626 100%);
  color: #f3f8fb;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: auto -18% -16% auto;
  width: 58%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, 0.18);
  box-shadow: 0 0 0 24px rgba(125, 211, 252, 0.05), 0 0 0 48px rgba(125, 211, 252, 0.04);
}

.hero-copy h1 {
  margin: 16px 0 18px;
  max-width: 12ch;
  font-family: var(--serif);
  font-size: clamp(3rem, 5vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: -0.03em;
}

.hero-copy p {
  margin: 0;
  max-width: 60ch;
  color: rgba(243, 248, 251, 0.78);
  line-height: 1.7;
  font-size: 1.03rem;
}

.eyebrow,
.panel-kicker,
.metric-label,
.run-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 600;
}

.eyebrow,
.hero-copy .metric-label {
  color: rgba(156, 220, 255, 0.86);
}

.hero-badges {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-badges span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #f3f8fb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.hero-panel {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(244, 248, 251, 0.96)),
    linear-gradient(180deg, #ffffff, #edf4f8);
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(16, 36, 61, 0.1), transparent 38%),
    radial-gradient(circle at top center, rgba(14, 165, 198, 0.16), transparent 36%),
    linear-gradient(155deg, transparent 0 62%, rgba(16, 36, 61, 0.04) 62% 66%, transparent 66% 100%);
}

.hero-overlay {
  position: absolute;
  inset: 22px;
  border-radius: calc(var(--radius-lg) - 10px);
  background:
    linear-gradient(180deg, rgba(14, 165, 198, 0.08), transparent 42%),
    radial-gradient(circle at 50% 110%, rgba(16, 36, 61, 0.08), transparent 44%);
  border: 1px solid rgba(16, 36, 61, 0.06);
}

.inventory-card {
  position: relative;
  z-index: 1;
  padding: 30px;
  height: 100%;
  display: grid;
  align-content: end;
}

.inventory-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.inventory-grid article {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(16, 36, 61, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.inventory-grid strong {
  display: block;
  font-size: 1rem;
}

.inventory-grid p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.control-panel {
  position: sticky;
  top: 20px;
  border-radius: var(--radius-lg);
  padding: 28px;
  animation: lift-in 640ms ease both;
}

.panel-header h2,
.summary-strip h2,
.section-header h2,
.empty-state h2 {
  margin: 8px 0 10px;
  font-size: 1.78rem;
}

.panel-header p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.upload-form {
  margin-top: 24px;
  display: grid;
  gap: 18px;
}

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

.field span {
  font-size: 0.92rem;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(16, 36, 61, 0.1);
  background: var(--surface-alt);
  color: var(--text);
  font: inherit;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.field-file input {
  padding: 18px 16px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(14, 165, 198, 0.4);
  box-shadow: 0 0 0 4px rgba(14, 165, 198, 0.12);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.time-input-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.time-separator {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
  padding-bottom: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--cyan), #0284c7);
  box-shadow: 0 14px 28px rgba(14, 165, 198, 0.22);
}

.secondary-button {
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #edf4f8);
  border: 1px solid rgba(16, 36, 61, 0.1);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.dashboard {
  min-width: 0;
}

.empty-state {
  min-height: 540px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 38px;
  animation: lift-in 760ms ease both;
}

.empty-state p {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.hidden {
  display: none;
}

.dashboard-content {
  display: grid;
  gap: 22px;
}

.summary-strip,
.surface-card {
  border-radius: var(--radius-lg);
  padding: 28px;
  animation: lift-in 520ms ease both;
}

.highlight-grid,
.pace-grid,
.run-grid {
  display: grid;
  gap: 16px;
}

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

.highlight-card {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f6fafc);
  border: 1px solid rgba(16, 36, 61, 0.08);
}

.metric-label,
.run-date,
.panel-kicker {
  color: var(--cyan);
}

.highlight-card strong {
  display: block;
  margin: 8px 0 8px;
  font-size: 1.45rem;
}

.highlight-card p {
  margin: 0;
  color: var(--muted);
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.insight-card {
  border-radius: var(--radius-md);
  padding: 24px;
  animation: lift-in 560ms ease both;
}

.threshold-card {
  background:
    radial-gradient(circle at top right, rgba(14, 165, 198, 0.12), transparent 36%),
    linear-gradient(145deg, #10243d, #0d1d31 52%, #0b1827);
  color: #f4f9fb;
}

.threshold-card .panel-kicker {
  color: rgba(156, 220, 255, 0.82);
}

.threshold-card .muted,
.threshold-card p {
  color: rgba(244, 249, 251, 0.78);
}

.threshold-card h3 {
  margin: 16px 0 8px;
  font-size: clamp(2rem, 3.6vw, 3.1rem);
}

.fitness-stat {
  margin-top: 18px;
}

.fitness-stat strong {
  display: block;
  font-size: 3rem;
  line-height: 1;
  color: var(--ink);
}

.fitness-stat span {
  color: var(--muted);
}

.fitness-row {
  margin-top: 16px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid rgba(16, 36, 61, 0.08);
}

.zone-list {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.zone-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-alt);
  border: 1px solid rgba(16, 36, 61, 0.08);
}

.zone-item div {
  display: grid;
  gap: 4px;
}

.zone-purpose {
  color: var(--muted);
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 20px;
}

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

.pace-card {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(16, 36, 61, 0.08);
  background: linear-gradient(180deg, #ffffff, #f6fafc);
}

.pace-swatch {
  background: var(--sky);
}

.pace-body {
  padding: 18px;
}

.pace-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 1.52rem;
}

.rep-label {
  margin: 0 0 6px;
  color: var(--ink);
  font-weight: 600;
}

.pace-body .muted {
  margin: 0;
}

.chart-panel {
  border-radius: 24px;
  padding: 16px;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 20%),
    linear-gradient(160deg, #10243d, #0c1b30 46%, #081629);
}

#pace-histogram {
  width: 100%;
  height: auto;
  display: block;
}

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

.run-card {
  border-radius: var(--radius-md);
  padding: 22px;
}

.run-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.run-header h3 {
  margin: 10px 0 0;
  font-size: 1.25rem;
}

.run-device {
  color: var(--muted);
  max-width: 170px;
  text-align: right;
}

.run-metrics {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-pill {
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-alt);
  border: 1px solid rgba(16, 36, 61, 0.08);
}

.metric-pill strong {
  display: block;
  margin-top: 6px;
}

.status {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(14, 165, 198, 0.08);
  border: 1px solid rgba(14, 165, 198, 0.12);
  color: var(--ink);
}

.status.error {
  color: #8a1d35;
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.14);
}

@keyframes lift-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .highlight-grid,
  .insight-grid,
  .pace-grid,
  .run-grid,
  .run-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 24px, 100%);
    padding-top: 16px;
  }

  .hero-copy,
  .inventory-card,
  .control-panel,
  .summary-strip,
  .surface-card,
  .insight-card,
  .run-card,
  .empty-state {
    padding: 20px;
  }

  .field-grid,
  .inventory-grid,
  .highlight-grid,
  .insight-grid,
  .pace-grid,
  .run-grid,
  .run-metrics {
    grid-template-columns: 1fr;
  }

  .section-header,
  .run-header {
    flex-direction: column;
    align-items: start;
  }

  .hero-copy h1 {
    max-width: none;
    font-size: 2.9rem;
  }
}
