:root {
  --ink: #101725;
  --muted: #68748a;
  --line: rgba(16, 23, 37, 0.12);
  --blue: #063b8f;
  --blue-2: #0b6ee8;
  --green: #12c981;
  --orange: #fc4c02;
  --yellow: #ffd84d;
  --red: #ef4444;
  --surface: #ffffff;
  --bg: #f4f7fb;
  --shadow: 0 24px 70px rgba(6, 59, 143, 0.14);
  --radius: 8px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eef3f7 0, #f7f8fa 420px),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.auth-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(6, 59, 143, 0.94), rgba(16, 23, 37, 0.92)),
    radial-gradient(circle at 20% 10%, rgba(18, 201, 129, 0.25), transparent 30%),
    #101725;
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  align-items: center;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}
.login-hero { color: #fff; }
.auth-brand img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  background: transparent;
  margin-bottom: 32px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.login-hero h1 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 0.96;
}
.login-hero p { max-width: 620px; color: rgba(255,255,255,.78); font-size: 1.05rem; }
.login-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.login-stats span {
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: rgba(255,255,255,.08);
}
.login-stats strong { display: block; color: #fff; font-size: 1.5rem; }
.auth-panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 34px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.72);
}
.auth-panel h1, .auth-panel h2 { margin: 0 0 8px; font-size: 2rem; }
.muted, .hint { color: var(--muted); }
.login-card {
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--green), var(--blue-2), var(--orange));
}
.auth-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.auth-card-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: var(--radius);
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
}
.auth-card-mark img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  background: transparent;
}
.stack-form { display: grid; gap: 15px; margin: 22px 0 14px; }
.stack-form label { display: grid; gap: 8px; font-weight: 800; }
.password-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: #fff;
}
input:focus, select:focus {
  outline: 3px solid rgba(18, 201, 129, .18);
  border-color: rgba(18, 201, 129, .72);
}
.password-input-wrap {
  position: relative;
  display: block;
}
.password-input-wrap input { padding-right: 48px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  display: grid;
  place-items: center;
}
.password-toggle:hover,
.password-toggle.is-active {
  background: #eef3f7;
  color: var(--ink);
}
.contract-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: var(--ink);
  font-size: .92rem;
  line-height: 1.45;
}
.contract-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--green);
}
.contract-link {
  display: inline;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
  text-decoration: underline;
}
.contract-modal[hidden] { display: none; }
.contract-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: 20px;
}
.contract-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 23, 37, .72);
}
.contract-modal-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(980px, 100%);
  height: min(760px, calc(100vh - 40px));
  overflow: hidden;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.contract-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.contract-modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
}
.contract-modal-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}
.contract-modal-dialog iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.btn-primary, .btn-google, .btn-secondary-auth, .link-button, .button-row button, .route-card button, .social-actions button {
  border: 0;
  border-radius: var(--radius);
  padding: 13px 16px;
  font-weight: 800;
}
.social-actions button.is-liked { color: #c4323f; background: #fff0f1; }
.social-actions button:disabled { cursor: wait; opacity: .62; }
.btn-primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  background: var(--green);
  color: #062217;
}
.btn-primary:hover { filter: brightness(.97); }
.btn-primary.compact { padding: 10px 14px; align-items: center; }
.btn-google {
  width: 100%;
  min-height: 48px;
  background: #fff;
  color: var(--ink);
  margin-top: 0;
  border: 1px solid rgba(16, 23, 37, .2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-google span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: .82rem;
  line-height: 1;
}
.btn-google:hover { background: #f8fafc; border-color: rgba(16, 23, 37, .34); }
.btn-secondary-auth {
  display: inline-flex;
  justify-content: center;
  width: 100%;
  margin-top: 10px;
  background: #eef3f7;
  color: var(--ink);
}
.btn-secondary-auth:hover { background: #e2e8f0; }
.auth-inline-link {
  display: inline-flex;
  width: fit-content;
  color: var(--blue);
  font-weight: 800;
  font-size: .9rem;
}
.auth-inline-link:hover { color: var(--blue-2); text-decoration: underline; }
.auth-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 800;
}
.auth-separator::before,
.auth-separator::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}
.auth-card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .94rem;
}
.auth-status {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: .86rem;
  text-align: center;
}
.alert-error {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
}
.alert-account-exists {
  border: 1px solid #fecaca;
  background: #fff7ed;
  color: #9a3412;
}
.alert-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--orange);
  color: #fff;
  font-size: .9rem;
  font-weight: 900;
}
.alert-action:hover {
  background: #d63f00;
  text-decoration: none;
}
.alert-success { padding: 12px; border-radius: var(--radius); background: #dcfae6; color: #087443; font-weight: 700; }

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: #101725;
  color: #fff;
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-weight: 900;
}
.side-brand img { width: 46px; height: 46px; object-fit: contain; background: transparent; }
.side-brand span { color: var(--green); }
.side-nav { display: grid; gap: 4px; padding-top: 10px; }
.side-nav-label {
  margin: 15px 12px 5px;
  color: rgba(255,255,255,.42);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
}
.side-nav a, .logout-form button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 14px;
  color: rgba(255,255,255,.78);
  background: transparent;
  text-align: left;
  font-weight: 700;
}
.side-nav a i {
  width: 22px;
  color: rgba(255,255,255,.56);
  font-size: 1.05rem;
  text-align: center;
}
.side-nav a.active, .side-nav a:hover, .logout-form button:hover {
  background: rgba(18, 201, 129, 0.16);
  color: #fff;
}
.side-nav a.active {
  box-shadow: inset 3px 0 0 var(--green);
}
.side-nav a.active i { color: var(--green); }
.logout-form {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.main-area { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 28px;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.topbar span { display: block; color: var(--muted); font-size: .85rem; }
.icon-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.top-user { display: flex; align-items: center; gap: 10px; }
.top-user img { width: 42px; height: 42px; border-radius: 50%; }
.profile-photo-trigger {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.profile-photo-trigger img { display: block; object-fit: cover; }
.profile-photo-trigger:focus-visible { outline: 3px solid var(--blue-2); outline-offset: 3px; }
.content { padding: 28px; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1; }

.metric-grid, .card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.metric-card, .panel, .run-card, .person-card, .challenge-card, .route-card, .goal-card, .equipment-card, .profile-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(16, 23, 37, 0.06);
}
.metric-card { padding: 18px; min-height: 130px; display: grid; align-content: space-between; }
.metric-card i { color: var(--blue-2); font-size: 1.4rem; }
.metric-card span { color: var(--muted); font-weight: 700; }
.metric-card strong { display: block; font-size: 1.8rem; line-height: 1; }
.metric-card.accent { background: linear-gradient(135deg, var(--ink), #222b3b); color: #fff; }
.metric-card.accent span { color: rgba(255,255,255,.7); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.panel { padding: 18px; }
.panel h2, .run-card h2, .person-card h2, .challenge-card h2, .route-card h2, .goal-card h2, .equipment-card h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}
.bar-list { display: grid; gap: 14px; }
.bar-list div { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
progress { width: 100%; height: 10px; accent-color: var(--green); grid-column: 1 / -1; }

.feed-list { display: grid; gap: 18px; max-width: 860px; }
.run-card { padding: 18px; }
.run-card-head { display: flex; align-items: center; gap: 12px; }
.run-card-head img, .person-card img, .profile-hero img { width: 52px; height: 52px; border-radius: 50%; }
.run-card-head span { display: block; color: var(--muted); }
.run-card-head em, .badge {
  margin-left: auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(18, 201, 129, .14);
  color: #08764c;
  font-style: normal;
  font-weight: 800;
  font-size: .8rem;
}
.badge.big { font-size: .92rem; margin-left: 0; }
.run-stats, .mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.run-stats span, .mini-stats span {
  padding: 12px;
  border-radius: var(--radius);
  background: #f3f6fa;
  color: var(--muted);
  font-size: .82rem;
}
.run-stats strong, .mini-stats strong { display: block; color: var(--ink); font-size: 1rem; }
.fake-map {
  overflow: hidden;
  min-height: 160px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(6,59,143,.08) 1px, transparent 1px),
    linear-gradient(rgba(6,59,143,.08) 1px, transparent 1px),
    #eaf2f8;
  background-size: 34px 34px;
}
.fake-map svg { width: 100%; height: 180px; display: block; }
.map-street { fill: none; stroke: rgba(16,23,37,.16); stroke-width: 18; stroke-linecap: round; }
.map-route { fill: none; stroke: var(--green); stroke-width: 7; stroke-linecap: round; }
.map-start { fill: var(--blue-2); }
.map-end { fill: var(--red); }
.route-map-panel { overflow: hidden; }
.route-map-shell {
  position: relative;
  overflow: hidden;
  min-height: 340px;
  border-radius: var(--radius);
  background: #dfe8ef;
  border: 1px solid rgba(16, 23, 37, 0.08);
}
.route-map {
  width: 100%;
  height: 340px;
  min-height: 340px;
  background: #dfe8ef;
}
.route-map .maplibregl-ctrl-group {
  border: 0;
  box-shadow: 0 10px 24px rgba(16, 23, 37, 0.18);
}
.route-map .maplibregl-ctrl-group button { width: 34px; height: 34px; }
.route-map .maplibregl-ctrl-attrib {
  color: #52616f;
  font-size: 10px;
}
.route-map-shell-compact,
.route-map-shell-compact .route-map {
  min-height: 190px;
  height: 190px;
  border-radius: 0;
  border: 0;
}
.run-card .route-map-shell {
  margin-top: 18px;
  border-radius: var(--radius);
}
.run-card .route-map-shell-compact,
.run-card .route-map-shell-compact .route-map {
  height: 240px;
  min-height: 240px;
}
.route-map-empty {
  position: absolute;
  inset: auto 14px 14px 14px;
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  box-shadow: 0 12px 28px rgba(16, 23, 37, 0.12);
}
.route-map-empty strong { color: var(--ink); }
.route-map-fallback {
  background:
    linear-gradient(90deg, rgba(16,23,37,.06) 1px, transparent 1px),
    linear-gradient(rgba(16,23,37,.06) 1px, transparent 1px),
    #e6eef4;
  background-size: 42px 42px;
}
.route-map-fallback svg { width: 100%; height: 100%; display: block; }
.route-bg-road {
  fill: none;
  stroke: rgba(255,255,255,.88);
  stroke-width: 24;
  stroke-linecap: round;
}
.route-bg-road.thin { stroke-width: 16; opacity: .82; }
.route-line-fallback {
  fill: none;
  stroke: var(--green);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 10px rgba(16,23,37,.18));
}
.run-hero-panel {
  display: grid;
  grid-template-columns: minmax(320px, .86fr) minmax(420px, 1.14fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}
.run-hero-copy,
.run-hero-map {
  border-radius: var(--radius);
  border: 1px solid rgba(16, 23, 37, 0.1);
  box-shadow: 0 18px 48px rgba(16, 23, 37, 0.08);
}
.run-hero-copy {
  display: grid;
  align-content: space-between;
  min-height: 420px;
  padding: 24px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(16, 23, 37, .98), rgba(39, 48, 62, .96)),
    #101725;
}
.run-hero-copy .eyebrow { color: var(--orange); }
.run-hero-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: .98;
}
.run-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 18px 0 22px;
}
.run-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  color: rgba(255,255,255,.76);
  background: rgba(255,255,255,.06);
  font-size: .85rem;
  font-weight: 700;
}
.run-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.run-hero-stats div {
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
}
.run-hero-stats span {
  display: block;
  margin-bottom: 7px;
  color: rgba(255,255,255,.68);
  font-weight: 800;
  font-size: .78rem;
  text-transform: uppercase;
}
.run-hero-stats strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
}
.run-hero-map {
  overflow: hidden;
  background: #dfe8ef;
}
.run-hero-map .route-map-shell,
.run-hero-map .route-map {
  min-height: 420px;
  height: 420px;
  border: 0;
  border-radius: 0;
}
.performance-grid {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}
.performance-grid .metric-card {
  min-height: 116px;
}
.analysis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: 18px;
  margin-bottom: 18px;
}
.analysis-layout .wide {
  grid-row: span 1;
}
.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.panel-title-row .eyebrow { margin-bottom: 4px; }
.panel-title-row h2 { margin: 0; }
.chart-panel canvas {
  width: 100%;
  height: 260px;
  max-height: 260px;
}
.pace-block-chart {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  min-height: 300px;
}
.pace-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 0 34px;
  color: var(--muted);
  font-weight: 800;
}
.pace-plot {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  padding: 8px 6px 32px;
  border-left: 1px solid rgba(16, 23, 37, .08);
  background:
    linear-gradient(180deg, rgba(16, 23, 37, .04) 1px, transparent 1px),
    #fff;
  background-size: 100% 25%;
}
.pace-bg-shape {
  position: absolute;
  inset: 12px 6px 32px 0;
  opacity: .55;
  background:
    linear-gradient(160deg, transparent 0 8%, rgba(16, 23, 37, .08) 9% 18%, transparent 19% 26%, rgba(16, 23, 37, .06) 27% 38%, transparent 39% 48%, rgba(16, 23, 37, .07) 49% 66%, transparent 67% 100%);
  clip-path: polygon(0 74%, 6% 15%, 12% 62%, 18% 88%, 26% 62%, 31% 72%, 37% 45%, 44% 66%, 50% 38%, 57% 70%, 64% 52%, 71% 30%, 78% 70%, 86% 58%, 93% 77%, 100% 60%, 100% 100%, 0 100%);
}
.pace-average-line {
  position: absolute;
  left: 0;
  right: 6px;
  top: var(--avg-top);
  z-index: 3;
  border-top: 2px dashed rgba(6, 59, 143, .72);
}
.pace-average-line span {
  position: absolute;
  right: 0;
  bottom: 5px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .86);
  color: var(--blue);
  font-size: .72rem;
  font-weight: 900;
}
.pace-bars {
  position: relative;
  z-index: 2;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(34px, 1fr);
  align-items: end;
  gap: 4px;
  height: 100%;
}
.pace-bar-wrap {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 22px;
  align-items: end;
  min-width: 0;
  height: 100%;
}
.pace-bar {
  width: 100%;
  height: var(--bar-height);
  min-height: 14px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #0066d9, #82b7ea);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32);
}
.pace-bar-wrap:nth-child(even) .pace-bar {
  background: linear-gradient(180deg, #1678df, #9cc5ef);
}
.pace-bar-wrap span {
  align-self: end;
  padding-top: 7px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  text-align: center;
}
.pace-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--muted);
  font-weight: 800;
}
.zones-panel {
  background: #101725;
  color: #fff;
}
.zones-panel .eyebrow { color: var(--orange); }
.zones-panel h2 { color: #fff; }
.zone-list { display: grid; gap: 14px; }
.zone-row {
  display: grid;
  grid-template-columns: 82px 1fr 54px;
  gap: 12px;
  align-items: center;
}
.zone-row strong {
  display: block;
  color: var(--zone-color);
  font-size: 1.1rem;
}
.zone-row span {
  color: rgba(255,255,255,.68);
  font-size: .82rem;
  font-weight: 700;
}
.zone-meter {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
}
.zone-meter span {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: var(--zone-color);
}
.zone-row em {
  color: #fff;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}
.split-table td:first-child strong {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: var(--orange);
}
.route-match-list {
  display: grid;
  gap: 12px;
}
.route-match-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(360px, 1.35fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}
.route-match-card.is-top {
  border-color: rgba(252, 76, 2, .34);
  background: linear-gradient(135deg, rgba(252, 76, 2, .08), #fff 42%);
}
.route-match-card.is-rp {
  border-color: rgba(18, 201, 129, .42);
  background: linear-gradient(135deg, rgba(18, 201, 129, .12), #fff 44%);
}
.route-match-main {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 5px;
}
.route-match-label {
  color: var(--orange);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
}
.route-match-main strong {
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.2;
}
.route-match-main p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}
.route-match-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 8px;
}
.route-match-stats div {
  min-height: 74px;
  padding: 10px;
  border: 1px solid rgba(16, 23, 37, .08);
  border-radius: var(--radius);
  background: #fff;
}
.route-match-stats span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}
.route-match-stats strong {
  display: block;
  font-size: clamp(1rem, 2.2vw, 1.34rem);
  line-height: 1.05;
}
.route-match-callout,
.route-match-note {
  grid-column: 1 / -1;
  padding: 11px 12px;
  border-radius: var(--radius);
  font-weight: 800;
}
.route-match-callout {
  background: #101725;
  color: #fff;
}
.route-match-card.is-rp .route-match-callout {
  background: var(--green);
  color: #062217;
}
.route-match-note {
  background: #eef4fb;
  color: var(--muted);
}
.social-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.social-actions button { background: #eef4fb; color: var(--ink); }
.comments { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; color: var(--muted); }
.comments.spacious { border: 0; padding: 0; }

.filters, .search-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: .84rem; text-transform: uppercase; }
.link-button { display: inline-flex; background: var(--ink); color: #fff; padding: 9px 12px; white-space: nowrap; }

.person-card, .challenge-card, .route-card, .goal-card, .equipment-card { padding: 18px; }
.person-card img { width: 64px; height: 64px; }
.person-card p, .route-card p, .challenge-card p, .goal-card p, .equipment-card p { color: var(--muted); }
.button-row { display: flex; gap: 8px; }
.button-row button, .route-card button { flex: 1; background: #eef4fb; }
.challenge-card i, .goal-card i, .equipment-card i { color: var(--blue-2); font-size: 1.7rem; }
.highlight-list p, .compact-run {
  border-bottom: 1px solid var(--line);
  margin: 0;
  padding: 12px 0;
}
.compact-run { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.compact-run strong { color: var(--ink); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: #fff; font-weight: 800; }
.medal { font-weight: 900; color: var(--blue); }
.chip-list { display: flex; flex-wrap: wrap; gap: 10px; }
.chip-list span, .warning {
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255, 216, 77, .28);
  font-weight: 800;
}
.warning { display: inline-block; margin-top: 12px; color: #8a4b00; }
.profile-hero { display: flex; gap: 20px; align-items: center; padding: 24px; margin-bottom: 18px; }
.profile-hero img { width: 104px; height: 104px; }
.profile-photo-trigger-large { flex: 0 0 auto; }
.profile-photo-modal[hidden] { display: none; }
.profile-photo-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
}
.profile-photo-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 17, 31, 0.72);
}
.profile-photo-dialog {
  position: relative;
  width: min(440px, 100%);
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(8, 17, 31, 0.35);
}
.profile-photo-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.profile-photo-dialog-head h2 { margin: 0; font-size: 1.15rem; }
.profile-photo-preview {
  display: block;
  width: min(300px, 82vw);
  aspect-ratio: 1;
  margin: 0 auto 18px;
  border-radius: 50%;
  object-fit: cover;
  background: #edf2f6;
}
.profile-photo-change { width: 100%; justify-content: center; }
.profile-photo-help,
.profile-photo-status {
  margin: 10px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
}
.profile-photo-status.is-error { color: #b42318; }
.profile-photo-status.is-success { color: #087a50; }
body.has-modal { overflow: hidden; }
.settings-alert { margin-bottom: 18px; }
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding: 24px;
  border: 1px solid #f0a6a6;
  border-radius: var(--radius);
  background: #fff7f7;
}
.danger-zone h2 { margin: 0 0 8px; font-size: 1.2rem; }
.danger-zone p { max-width: 720px; margin-bottom: 0; color: var(--muted); }
.danger-zone .eyebrow { margin-bottom: 6px; color: #b42318; }
.danger-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.danger-button { border: 0; background: #b42318; color: #fff; }
.danger-button:disabled { cursor: not-allowed; opacity: .45; }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.delete-profile-modal[hidden] { display: none; }
.delete-profile-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 20px;
}
.delete-profile-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8,17,31,.74);
}
.delete-profile-dialog {
  position: relative;
  width: min(480px, 100%);
  padding: 24px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 70px rgba(8,17,31,.35);
}
.delete-profile-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #fee4e2;
  color: #b42318;
  font-size: 1.3rem;
}
.delete-profile-dialog h2 { margin: 0 0 10px; font-size: 1.35rem; }
.delete-profile-dialog > p { color: var(--muted); line-height: 1.55; }
.delete-profile-dialog form { display: grid; gap: 10px; margin-top: 20px; }
.delete-profile-dialog label { font-size: .88rem; }
.delete-profile-dialog input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 13px;
  font: inherit;
  text-transform: uppercase;
}
.delete-profile-dialog input:focus {
  border-color: #b42318;
  outline: 3px solid rgba(180,35,24,.12);
}
.delete-profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}
.profile-hero h1 { margin: 0; font-size: 2.6rem; }
.profile-hero p { color: var(--muted); max-width: 720px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.toggle { display: block; margin: 12px 0; font-weight: 700; }
.toggle input { width: auto; margin-right: 8px; }
code { background: #eef4fb; padding: 2px 6px; border-radius: 6px; }

@media (max-width: 940px) {
  .auth-shell { grid-template-columns: 1fr; }
  .login-hero h1 { font-size: 2.6rem; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 20;
    left: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    width: 280px;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .icon-button { display: inline-grid; place-items: center; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 14px; }
  .grid-2 { grid-template-columns: 1fr; }
  .run-hero-panel,
  .analysis-layout,
  .performance-grid,
  .route-match-card { grid-template-columns: 1fr; }
  .run-hero-copy { min-height: 360px; }
}

@media (max-width: 620px) {
  .auth-panel { padding: 22px; }
  .auth-card-head { align-items: flex-start; }
  .password-label-row { align-items: flex-start; flex-direction: column; gap: 6px; }
  .top-user div { display: none; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .delete-profile-actions { display: grid; }
  .page-head, .profile-hero { align-items: flex-start; flex-direction: column; }
  .compact-run { display: block; }
  .route-match-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pace-block-chart { grid-template-columns: 44px minmax(0, 1fr); }
  .pace-bars { grid-auto-columns: minmax(28px, 1fr); }
  .pace-average-line span { display: none; }
  table { min-width: 720px; }
}
