:root {
  --bg: #07110d;
  --bg-2: #0c1712;
  --surface: rgba(17, 29, 23, 0.82);
  --surface-strong: #14221b;
  --surface-soft: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(66, 245, 123, 0.36);
  --text: #f4fff8;
  --muted: #a7b7ad;
  --muted-2: #708278;
  --accent: #42f57b;
  --accent-2: #22d3ee;
  --accent-dark: #063d20;
  --warning: #f8c14a;
  --danger: #ff6b7d;
  --success: #42f57b;
  --shadow: rgba(0, 0, 0, 0.45) 0 24px 80px;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --sidebar-width: 280px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

html, body {
  min-height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(66, 245, 123, 0.16), transparent 32rem),
    radial-gradient(circle at 80% 16%, rgba(34, 211, 238, 0.14), transparent 28rem),
    linear-gradient(135deg, #050806 0%, var(--bg) 45%, #081812 100%);
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(66, 245, 123, 0.55);
  outline-offset: 3px;
}

a { color: inherit; text-decoration: none; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100dvh; overflow: hidden; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 28px 18px;
  border-right: 1px solid var(--border);
  background: rgba(5, 12, 8, 0.72);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand { display: flex; align-items: center; gap: 12px; font-size: 21px; font-weight: 800; letter-spacing: -0.04em; }
.brand-mark { width: 44px; height: 44px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 16px 36px rgba(66, 245, 123, 0.24); }
.brand-mark svg { width: 24px; height: 24px; fill: #051008; }

.nav-list { display: grid; gap: 8px; }
.nav-link, .mobile-nav a {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  border-radius: 999px;
  padding: 12px 14px;
  font-weight: 700;
  transition: 180ms ease;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-soft); }
.nav-link.active { box-shadow: inset 0 0 0 1px var(--border); }
.nav-icon { width: 22px; height: 22px; display: inline-grid; place-items: center; flex: 0 0 22px; }
.nav-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.035));
}
.sidebar-card strong { display: block; margin: 6px 0; font-size: 18px; }
.sidebar-card span { color: var(--muted); font-size: 14px; line-height: 1.4; }

.main-content {
  min-width: 0;
  height: 100dvh;
  padding: 30px clamp(18px, 4vw, 56px) 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar { flex: 0 0 auto; display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 820px; margin-bottom: 0; font-size: clamp(34px, 5vw, 68px); line-height: 0.95; letter-spacing: -0.07em; }
h2 { margin-bottom: 0; font-size: clamp(24px, 3vw, 38px); line-height: 1; letter-spacing: -0.045em; }
h3 { margin-bottom: 8px; font-size: 18px; letter-spacing: -0.02em; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; margin-bottom: 24px; }
.app-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 4px 28px 2px;
  display: none;
  animation: panelFade 220ms ease both;
}
.app-panel.active { display: block; }
.app-panel.split-section.active { display: grid; }
.app-panel:focus { outline: none; }
.app-panel { scrollbar-width: thin; scrollbar-color: rgba(66,245,123,0.45) rgba(255,255,255,0.06); }
.app-panel::-webkit-scrollbar { width: 8px; }
.app-panel::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); border-radius: 999px; }
.app-panel::-webkit-scrollbar-thumb { background: rgba(66,245,123,0.45); border-radius: 999px; }
@keyframes panelFade {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.glass-card, .metric-card, .plan-card, .challenge-card, .competition-card {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}
.hero-card { min-height: 560px; border-radius: var(--radius-xl); padding: clamp(20px, 3vw, 34px); display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 30px; overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 360px; height: 360px; right: -110px; top: -130px; border-radius: 50%; background: radial-gradient(circle, rgba(66,245,123,0.26), transparent 64%); pointer-events: none; }
.hero-copy { align-self: end; max-width: 700px; position: relative; z-index: 1; }
.hero-copy h2 { font-size: clamp(34px, 5vw, 62px); line-height: 0.94; margin-bottom: 18px; }
.hero-copy p:not(.pill-label) { color: var(--muted); max-width: 620px; font-size: 18px; line-height: 1.55; }
.pill-label, .status-chip, .live-dot {
  width: fit-content;
  border: 1px solid var(--border-strong);
  background: rgba(66, 245, 123, 0.10);
  color: var(--accent);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}

.match-form, .dialog-card { position: relative; z-index: 1; display: grid; gap: 14px; align-self: center; padding: 18px; border-radius: var(--radius-lg); background: rgba(6, 14, 10, 0.72); border: 1px solid var(--border); }
label, legend { color: var(--text); font-size: 13px; font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
  padding: 12px 14px;
}
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.validation-box { margin: 0; border: 1px solid var(--border); border-radius: 18px; padding: 12px; display: grid; gap: 10px; }
.check-line { min-height: 28px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; }
.check-line input { width: 18px; min-height: 18px; accent-color: var(--accent); }
.form-hint { color: var(--muted); font-size: 13px; line-height: 1.4; margin: 0; }

.primary-btn, .ghost-btn, .seg-btn, .icon-btn {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  transition: 180ms ease;
}
.primary-btn { color: #041008; background: linear-gradient(135deg, var(--accent), var(--accent-2)); padding: 14px 20px; box-shadow: 0 18px 42px rgba(66, 245, 123, 0.22); }
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 24px 56px rgba(66, 245, 123, 0.28); }
.primary-btn.full { width: 100%; }
.ghost-btn, .seg-btn, .icon-btn { color: var(--text); background: rgba(255, 255, 255, 0.075); border: 1px solid var(--border); padding: 12px 16px; }
.ghost-btn:hover, .seg-btn:hover, .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.ghost-btn.small { min-height: 42px; }
.icon-btn { width: 48px; padding: 0; display: grid; place-items: center; }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }

.metric-stack { display: grid; gap: 18px; }
.metric-card { border-radius: var(--radius-lg); padding: 22px; min-height: 160px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-card span, .metric-card small { color: var(--muted); font-weight: 700; }
.metric-card strong { font-size: 42px; letter-spacing: -0.06em; }
.metric-card.accent { background: linear-gradient(135deg, rgba(66,245,123,0.9), rgba(34,211,238,0.88)); color: #041008; }
.metric-card.accent span, .metric-card.accent small { color: rgba(4, 16, 8, 0.68); }

.content-grid, .split-section { margin-top: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.section-heading.compact { align-items: start; margin-bottom: 16px; }
.segmented { display: flex; gap: 8px; padding: 5px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); }
.seg-btn { min-height: 38px; padding: 8px 12px; color: var(--muted); }
.seg-btn.active { color: #041008; background: var(--accent); }
.cards-grid, .challenge-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plan-card, .challenge-card, .competition-card { border-radius: var(--radius-lg); padding: 18px; }
.plan-card { display: grid; gap: 14px; }
.card-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.sport-badge, .level-badge { border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.sport-badge { color: var(--accent); background: rgba(66,245,123,0.10); }
.level-badge { color: #d8fff1; background: rgba(255,255,255,0.08); }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-weight: 700; font-size: 13px; }
.meta-row span { padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,0.06); }
.card-actions { display: flex; gap: 8px; }
.card-actions button { flex: 1; min-height: 42px; }

.split-section { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr); gap: 16px; }
.route-panel, .tracker-panel { border-radius: var(--radius-xl); padding: 20px; }
.map-card { overflow: hidden; border-radius: 24px; border: 1px solid var(--border); background: #101915; }
.map-card svg { display: block; width: 100%; height: auto; }
.route-list { display: grid; gap: 10px; margin-top: 12px; }
.route-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px; border-radius: 18px; background: rgba(255,255,255,0.06); }
.route-item p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.route-item strong:last-child { color: var(--accent); }
.tracker-panel { display: grid; align-content: start; gap: 18px; }
.tracker-panel-wide { max-width: 720px; margin: 0 auto; width: 100%; min-height: min(700px, calc(100dvh - 180px)); align-content: center; }
.live-dot { color: var(--muted); border-color: var(--border); background: rgba(255,255,255,0.06); }
.live-dot.active { color: var(--accent); border-color: var(--border-strong); background: rgba(66,245,123,0.1); }
.tracking-circle { position: relative; width: min(260px, 100%); margin: 8px auto; aspect-ratio: 1; display: grid; place-items: center; }
.tracking-circle svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.track-bg, .track-progress { fill: none; stroke-width: 14; }
.track-bg { stroke: rgba(255,255,255,0.08); }
.track-progress { stroke: url(#routeGradient); stroke-linecap: round; stroke-dasharray: 477; stroke-dashoffset: 477; transition: 300ms ease; }
.tracking-circle div { text-align: center; }
.tracking-circle strong { display: block; font-size: 48px; letter-spacing: -0.06em; }
.tracking-circle span { color: var(--muted); font-weight: 800; }
.tracking-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tracking-stats span { padding: 12px; border-radius: 18px; background: rgba(255,255,255,0.06); text-align: center; }
.tracking-stats strong { display: block; }
.tracking-stats small { color: var(--muted); font-weight: 700; }

.challenge-card { display: grid; gap: 12px; }
.progress-bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.challenge-footer { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; font-size: 14px; }
.competition-list { display: grid; gap: 12px; }
.competition-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; }
.competition-card p { color: var(--muted); margin-bottom: 0; }

.create-dialog { width: min(560px, calc(100vw - 28px)); border: 0; padding: 0; background: transparent; color: var(--text); }
.create-dialog::backdrop { background: rgba(0,0,0,0.64); backdrop-filter: blur(10px); }
.dialog-card { padding: 22px; box-shadow: var(--shadow); }

.mobile-nav { display: none; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 18px 14px 92px; }
  .hero-grid, .hero-card, .split-section { grid-template-columns: 1fr; }
  .metric-stack { grid-template-columns: repeat(3, 1fr); }
  .hero-card { min-height: unset; }
  .cards-grid, .challenge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-nav {
    position: fixed;
    z-index: 10;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(5, 12, 8, 0.82);
    backdrop-filter: blur(22px);
    box-shadow: var(--shadow);
  }
  .mobile-nav a { min-height: 56px; flex-direction: column; justify-content: center; gap: 3px; padding: 6px; font-size: 11px; }
  .mobile-nav a.active { color: #041008; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 26px rgba(66, 245, 123, 0.24); }
  .mobile-nav a.active small { color: rgba(4, 16, 8, 0.72); }
  .mobile-nav small { color: var(--muted); font-weight: 800; }
}

@media (max-width: 720px) {
  .main-content { padding-inline: 14px; padding-top: 16px; }
  .topbar, .section-heading, .competition-card { align-items: stretch; flex-direction: column; }
  .topbar { gap: 12px; margin-bottom: 12px; }
  .topbar .eyebrow { margin-bottom: 4px; }
  .topbar h1 { font-size: 28px; line-height: 0.98; letter-spacing: -0.055em; }
  .topbar .ghost-btn { width: 100%; min-height: 44px; }
  .app-panel { padding-bottom: 18px; }
  .hero-grid { gap: 12px; margin-bottom: 18px; }
  .hero-card { padding: 18px; border-radius: 26px; }
  .hero-copy { align-self: start; }
  .hero-copy h2 { font-size: 34px; }
  .hero-copy p:not(.pill-label) { font-size: 16px; }
  .form-row, .metric-stack, .cards-grid, .challenge-grid, .tracking-stats { grid-template-columns: 1fr; }
  .metric-card { min-height: 112px; }
  .tracker-panel-wide { min-height: min(640px, calc(100dvh - 170px)); }
  .segmented { overflow-x: auto; border-radius: 18px; }
  .seg-btn { white-space: nowrap; }
  .card-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}


/* Commercial polish additions */
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.search-pill {
  min-width: min(340px, 42vw);
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.075);
  color: var(--muted);
}
.search-pill input {
  min-height: 0;
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
}
.icon-only {
  width: 48px;
  padding: 0;
  position: relative;
  display: grid;
  place-items: center;
}
.notification-dot {
  position: absolute;
  top: 11px;
  right: 11px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 107, 125, 0.14);
}
.primary-btn.compact { min-height: 48px; padding-inline: 18px; }
.metric-stack { grid-template-columns: 1fr; }
.metric-card.premium {
  background:
    linear-gradient(135deg, rgba(248,193,74,0.16), rgba(66,245,123,0.06)),
    rgba(255,255,255,0.06);
}
.validation-score {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.055);
}
.validation-score span,
.host-row span { color: var(--muted); font-weight: 700; font-size: 13px; }
.validation-score strong { font-size: 24px; letter-spacing: -0.04em; }
.mini-progress,
.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.mini-progress span,
.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.business-grid,
.insight-grid,
.challenge-layout,
.competition-layout {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.business-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.business-card,
.insight-card,
.route-side,
.leaderboard,
.commercial-card {
  border-radius: var(--radius-lg);
  padding: 18px;
}
.business-card,
.insight-card {
  background: rgba(255,255,255,0.055);
  border: 1px solid var(--border);
}
.business-card p,
.insight-card p,
.route-side p,
.commercial-card p,
.detail-body { color: var(--muted); line-height: 1.55; }
.business-card .nav-icon,
.insight-card .nav-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  margin-bottom: 14px;
  color: var(--accent);
  background: rgba(66,245,123,0.10);
}
.host-row,
.price-row,
.leader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.host-row,
.price-row {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.055);
}
.price-row { margin-top: 10px; }
.price-row span { color: var(--accent); font-weight: 900; }
.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.feature-list span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255,255,255,0.055);
  font-size: 12px;
  font-weight: 800;
}
.feature-list.compact { margin: 0; }
.route-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.route-rich {
  align-items: start;
  border: 1px solid transparent;
}
.route-rich:hover,
.premium-card:hover,
.challenge-rich:hover,
.competition-rich:hover,
.business-card:hover,
.insight-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.premium-card,
.challenge-rich,
.competition-rich,
.business-card,
.insight-card,
.route-rich {
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.tracking-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.insight-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.challenge-layout { grid-template-columns: minmax(0, 1fr) 360px; }
.competition-layout { grid-template-columns: minmax(0, 1fr) 360px; }
.leaderboard,
.commercial-card,
.route-side { align-self: start; }
.leader-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  grid-template-areas:
    'rank name points'
    'rank tag points';
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.leader-row span { grid-area: rank; color: var(--accent); font-weight: 900; }
.leader-row strong { grid-area: name; }
.leader-row small { grid-area: tag; color: var(--muted); font-weight: 700; }
.leader-row b { grid-area: points; align-self: center; }
.detail-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}
.detail-dialog::backdrop { background: rgba(0,0,0,0.66); backdrop-filter: blur(12px); }
.detail-card { position: relative; }
.detail-close { position: absolute; top: 14px; right: 14px; }
.detail-body ul { padding-left: 18px; color: var(--muted); line-height: 1.6; }
.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: min(520px, calc(100vw - 28px));
  padding: 14px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(6, 14, 10, 0.92);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
button:disabled { cursor: not-allowed; }

@media (min-width: 1121px) {
  .metric-stack { grid-template-columns: 1fr; }
}

@media (max-width: 1120px) {
  .business-grid,
  .insight-grid,
  .challenge-layout,
  .competition-layout { grid-template-columns: 1fr; }
  .search-pill { min-width: min(100%, 520px); flex: 1 1 260px; }
}

@media (max-width: 720px) {
  .topbar-actions { width: 100%; display: grid; grid-template-columns: 56px minmax(0, 1fr) 86px; }
  .search-pill { grid-column: 1 / -1; min-width: 0; }
  .topbar-actions .ghost-btn:not(.icon-only),
  .topbar-actions .primary-btn { width: auto; white-space: nowrap; }
  .topbar-actions #openCreatePlan { min-width: 0; }
  .metric-stack { grid-template-columns: 1fr; }
  .business-grid,
  .insight-grid { grid-template-columns: 1fr; }
  .tracking-actions { grid-template-columns: 1fr; }
  .toast { bottom: 104px; border-radius: 22px; }
}

/* Functional account/profile layer */
.auth-dialog,
.profile-dialog {
  width: min(680px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.profile-dialog { width: min(860px, calc(100vw - 28px)); }
.auth-dialog::backdrop,
.profile-dialog::backdrop { background: rgba(0,0,0,0.66); backdrop-filter: blur(12px); }
.auth-card { gap: 12px; }
.profile-card { position: relative; max-height: min(82dvh, 820px); overflow-y: auto; padding: 24px; }
.profile-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; padding-right: 54px; }
.profile-hero p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-weight: 700; }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #041008;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(66,245,123,0.18);
}
.avatar.big { width: 74px; height: 74px; border-radius: 24px; font-size: 28px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.profile-stats span { padding: 14px; border-radius: 18px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); text-align: center; }
.profile-stats strong { display: block; font-size: 26px; letter-spacing: -0.05em; }
.profile-stats small { color: var(--muted); font-weight: 800; }
.profile-section { margin-top: 18px; }
.profile-section h3 { margin-bottom: 10px; }
.profile-list { display: grid; gap: 10px; }
.timeline-item,
.mini-card,
.friend-row {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.055);
  padding: 12px;
}
.timeline-item { display: grid; gap: 3px; }
.timeline-item span { color: var(--accent); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; }
.timeline-item small,
.mini-card span,
.mini-card small,
.friend-row span,
.empty-copy { color: var(--muted); font-weight: 700; line-height: 1.45; }
.mini-card { display: grid; gap: 5px; }
.friend-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.ghost-btn.full { width: 100%; }
.danger-action { margin-top: 18px; color: var(--danger); }
.signed-in { background: linear-gradient(135deg, rgba(66,245,123,0.9), rgba(34,211,238,0.86)); color: #041008; }

@media (max-width: 720px) {
  .profile-card { max-height: 86dvh; padding: 20px; }
  .profile-hero { align-items: flex-start; padding-right: 46px; }
  .profile-stats { grid-template-columns: 1fr; }
  .friend-row { grid-template-columns: auto 1fr; }
  .friend-row button { grid-column: 1 / -1; width: 100%; }
}

/* Groups and challenge creation polish */
.section-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.group-list-block {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}
.group-list-block .eyebrow { margin-top: 6px; }
.group-card {
  gap: 8px;
}
.group-card button {
  margin-top: 4px;
  width: 100%;
}
.auth-card,
#createDialog .dialog-card,
#challengeDialog .dialog-card,
#groupDialog .dialog-card {
  max-height: min(86dvh, 760px);
  overflow-y: auto;
}

@media (max-width: 720px) {
  .section-actions { width: 100%; }
  .section-actions button { flex: 1; }
}
