/* assets/css/app.css — RuteGPX.com Design System
   Apple-inspired design per DESIGN.md */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.374px;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: absolute; top: -999px; left: 8px; background: var(--ink); color: white; padding: 8px 16px; border-radius: 0 0 8px 8px; z-index: 9999; }
.skip-link:focus { top: 0; }

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Action Blue — sole interactive accent */
  --blue:          #0066cc;
  --blue-focus:    #0071e3;
  --blue-on-dark:  #2997ff;

  /* Surfaces */
  --canvas:        #ffffff;
  --parchment:     #f5f5f7;
  --pearl:         #fafafc;
  --tile-dark:     #272729;
  --tile-dark-2:   #2a2a2c;
  --tile-dark-3:   #252527;
  --nav-black:     #000000;

  /* Text */
  --ink:           #1d1d1f;
  --ink-80:        #333333;
  --ink-48:        #7a7a7a;
  --on-dark:       #ffffff;
  --on-dark-muted: #cccccc;

  /* Borders */
  --hairline:      #e0e0e0;
  --hairline-soft: rgba(0,0,0,0.04);
  --hairline-str:  #e0e0e0;
  --hairline-dark: rgba(255,255,255,0.12);
  --divider-soft:  rgba(0,0,0,0.04);

  /* Legacy aliases — map old MongoDB tokens → Apple tokens */
  --surface:       var(--parchment);
  --surface-soft:  var(--pearl);
  --surface-feat:  #e8f0fe;
  --teal-deep:     var(--tile-dark);
  --teal:          var(--tile-dark-2);
  --canvas-dark:   var(--tile-dark);

  /* Interactive — was MongoDB green, now Action Blue */
  --green:         var(--blue);
  --green-dark:    var(--blue);
  --green-mid:     #4a90d9;
  --green-soft:    #dce8fc;
  --on-primary:    #ffffff;

  /* Text grays */
  --slate:         var(--ink-80);
  --steel:         var(--ink-48);
  --stone:         var(--ink-48);
  --muted:         var(--ink-48);
  --charcoal:      var(--ink);

  /* Orange for code mockup */
  --orange:        #fa6e39;

  /* Radius scale (Apple) */
  --r-xs:   5px;
  --r-sm:   8px;
  --r-md:   11px;
  --r-lg:   18px;
  --r-xl:   18px;
  --r-xxl:  24px;
  --r-full: 9999px;

  /* Elevation — product imagery only, per DESIGN.md; no shadows on UI */
  --shadow-card:    none;
  --shadow-feat:    none;
  --shadow-modal:   0 20px 60px rgba(0,0,0,0.18);
}

/* ── Layout ───────────────────────────────────────────────── */
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 24px; }
.section-sm { padding: 48px 24px; }
.bg-surface { background: var(--parchment); }
.bg-teal { background: var(--tile-dark); color: var(--on-dark); }

/* ── Typography ───────────────────────────────────────────── */
h1 {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.28px;
}
h2 {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  font-size: clamp(26px, 3.5vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
}
h3 { font-size: clamp(20px, 2.5vw, 34px); font-weight: 600; line-height: 1.47; letter-spacing: -0.374px; }
h4 { font-size: clamp(17px, 2vw, 21px); font-weight: 600; line-height: 1.19; letter-spacing: 0.231px; }
p  { font-size: 17px; line-height: 1.47; letter-spacing: -0.374px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary, .btn-dark {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue); color: #ffffff;
  border: none; padding: 11px 22px; border-radius: var(--r-full);
  font-size: 17px; font-weight: 400; line-height: 1.47; letter-spacing: -0.374px;
  transition: background .15s, transform .1s;
}
.btn-primary:hover, .btn-dark:hover { background: var(--blue-focus); }
.btn-primary:active, .btn-dark:active { transform: scale(.95); }

.btn-secondary, .btn-outline-dark {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--blue);
  border: 1px solid var(--blue); padding: 11px 22px; border-radius: var(--r-full);
  font-size: 17px; font-weight: 400; letter-spacing: -0.374px;
  transition: background .15s, transform .1s;
}
.btn-outline-dark { color: var(--blue-on-dark); border-color: var(--blue-on-dark); }
.btn-secondary:hover { background: rgba(0,102,204,.06); }
.btn-outline-dark:hover { background: rgba(41,151,255,.08); }
.btn-secondary:active, .btn-outline-dark:active { transform: scale(.95); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--ink);
  border: none; padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 400; cursor: pointer; transition: background .15s;
}
.btn-ghost:hover { background: var(--parchment); }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
[disabled], .btn-primary:disabled { opacity: .5; pointer-events: none; }

/* Icon buttons */
.icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  background: transparent; color: var(--ink-48); font-size: 16px; transition: .15s;
}
.icon-btn:hover { background: var(--parchment); color: var(--ink); }
.icon-btn-success { color: #006b35; border-color: #d1f0df; }
.icon-btn-success:hover { background: #e3f9ec; }
.icon-btn-danger { color: #c0392b; border-color: #fce8e8; }
.icon-btn-danger:hover { background: #fce8e8; }

/* ── NAV ──────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 1000;
  background: var(--nav-black);
  height: 44px; display: flex; align-items: center; padding: 0 24px; gap: 8px;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--on-dark); white-space: nowrap;
  letter-spacing: -0.12px;
}
.nav-logo-icon {
  width: 28px; height: 28px; background: transparent;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nav-links { display: flex; gap: 2px; flex: 1; margin-left: 20px; }
.nav-link {
  padding: 4px 10px; border-radius: var(--r-full); font-size: 12px; font-weight: 400;
  color: rgba(255,255,255,0.72); letter-spacing: -0.12px; transition: .15s;
}
.nav-link:hover, .nav-link.active { color: var(--on-dark); background: rgba(255,255,255,0.1); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-label { display: inline; }

/* Avatar dropdown */
.nav-avatar-wrap { position: relative; }
.nav-avatar {
  width: 30px; height: 30px; border-radius: var(--r-full);
  background: var(--blue); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; border: none; overflow: hidden;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); min-width: 220px;
  box-shadow: var(--shadow-modal); padding: 8px 0; z-index: 200;
}
.nav-dropdown-header { padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.nav-dropdown-header strong { display: block; font-size: 14px; color: var(--ink); font-weight: 600; }
.nav-dropdown-header small { font-size: 13px; color: var(--ink-48); }
.nav-dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  font-size: 14px; color: var(--ink-80); transition: background .1s; letter-spacing: -0.224px;
}
.nav-dropdown-item:hover { background: var(--parchment); color: var(--ink); }
.nav-dropdown-item i { font-size: 16px; }
.nav-dropdown-danger { color: #c0392b; }
.nav-dropdown-divider { height: 1px; background: var(--hairline); margin: 4px 0; }

/* Mobile hamburger */
.nav-hamburger {
  display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 6px;
}
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--on-dark); border-radius: 2px; transition: .2s; }
.nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.mobile-nav {
  display: none; position: fixed; top: 44px; left: 0; right: 0; bottom: 0;
  background: var(--parchment); z-index: 999; overflow-y: auto; padding: 0;
  transform: translateX(-100%); transition: transform .28s cubic-bezier(.32,.72,0,1);
}
.mobile-nav.open { transform: translateX(0); }
/* Force column layout — prevents <a> items from going inline */
.mobile-nav nav {
  display: flex; flex-direction: column; min-height: 100%;
}

/* Section label */
.mnav-label {
  display: block; padding: 20px 20px 8px;
  font-size: 11px; font-weight: 600; color: var(--ink-48);
  text-transform: uppercase; letter-spacing: 0.6px;
}

/* Nav item row — explicit block + flex to prevent inline */
.mnav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; box-sizing: border-box;
  padding: 12px 16px 12px 20px;
  font-size: 17px; font-weight: 400; color: var(--ink);
  background: var(--canvas); border-bottom: 1px solid var(--hairline);
  letter-spacing: -0.374px; transition: background .1s; text-decoration: none;
}
.mnav-item:active { background: var(--parchment); }

/* Colored icon square */
.mnav-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; border-radius: 8px; line-height: 1;
}

/* Chevron */
.mnav-arrow { margin-left: auto; color: var(--ink-48); font-size: 13px; flex-shrink: 0; }

/* Danger */
.mnav-danger { color: #c0392b; }
.mnav-danger .mnav-arrow { display: none; }

/* Separator between groups */
.mnav-sep { display: block; height: 12px; background: var(--parchment); flex-shrink: 0; }

/* Auth buttons block */
.mnav-auth {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px; background: var(--parchment); margin-top: auto;
}
.mnav-signin {
  display: block; text-align: center; font-size: 15px;
  color: var(--ink-48); letter-spacing: -0.374px;
}
.mnav-signin strong { color: var(--blue); font-weight: 600; }

/* Logged-in user greeting */
.mnav-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; background: var(--canvas); border-bottom: 1px solid var(--hairline);
}
.mnav-user-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--blue); color: white; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.mnav-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mnav-user-name  { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -0.374px; }
.mnav-user-email { font-size: 12px; color: var(--ink-48); letter-spacing: -0.12px; margin-top: 1px; }

/* Legacy compat */
.mobile-nav-link  { display: block; padding: 14px 20px; font-size: 17px; color: var(--ink); border-bottom: 1px solid var(--hairline); letter-spacing: -0.374px; background: var(--canvas); }
.mobile-nav-divider { display: block; height: 12px; background: var(--parchment); }
.mobile-nav-cta   { color: var(--blue); font-weight: 600; }
.mobile-nav-danger { color: #c0392b; }

.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 98; }
.mobile-overlay.open { display: block; }

/* ── PROMO BANNER ─────────────────────────────────────────── */
.promo-banner {
  background: var(--tile-dark-2); color: var(--on-dark);
  text-align: center; padding: 10px 16px; font-size: 14px; font-weight: 400;
  letter-spacing: -0.224px;
}
.promo-link { color: var(--blue-on-dark); text-decoration: underline; }

/* ── HERO ─────────────────────────────────────────────────── */
.hero {
  background: var(--tile-dark); padding: 80px 24px 96px;
  text-align: center; position: relative; overflow: hidden;
}
.hero::before { display: none; }
.hero-inner { max-width: 900px; margin: 0 auto; position: relative; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.8);
  padding: 4px 14px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 400; letter-spacing: 0.5px;
  margin-bottom: 24px;
}
.hero h1 { color: var(--on-dark); max-width: 760px; margin: 0 auto 20px; }
.hero-accent { color: var(--blue-on-dark); }
.hero-sub { font-size: 21px; font-weight: 400; color: var(--on-dark-muted); max-width: 560px; margin: 0 auto 40px; line-height: 1.47; letter-spacing: 0.231px; }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 48px; justify-content: center; margin-top: 64px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat-num { font-size: clamp(24px, 3vw, 36px); font-weight: 600; color: var(--on-dark); letter-spacing: -0.374px; }
.hero-stat-label { font-size: 14px; color: var(--on-dark-muted); margin-top: 4px; letter-spacing: -0.224px; }

/* Hero code mockup */
.hero-code {
  background: var(--tile-dark-3); border-radius: var(--r-lg); padding: 20px 24px;
  max-width: 460px; margin: 48px auto 0; text-align: left;
  border: 1px solid rgba(255,255,255,0.1);
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 13px; letter-spacing: 0;
}
.code-line { display: flex; gap: 8px; margin-bottom: 6px; line-height: 1.6; }
.code-line:last-child { margin-bottom: 0; }
.c-green  { color: var(--blue-on-dark); }
.c-teal   { color: #7ecfb3; }
.c-orange { color: #fa6e39; }
.c-muted  { color: var(--on-dark-muted); }

/* ── SEARCH ───────────────────────────────────────────────── */
.search-section { background: var(--canvas); padding: 28px 24px; border-bottom: 1px solid var(--hairline); }
.search-bar { display: flex; gap: 10px; align-items: center; max-width: 900px; margin: 0 auto 16px; }
.search-wrap { flex: 1; position: relative; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-48); font-size: 18px; pointer-events: none; }
.search-input {
  width: 100%; height: 44px; border: 1px solid var(--hairline); border-radius: var(--r-full);
  padding: 0 20px 0 44px; font-size: 17px; font-family: inherit; letter-spacing: -0.374px;
  color: var(--ink); background: var(--canvas); outline: none; transition: border .15s;
}
.search-input:focus { border: 2px solid var(--blue); }
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration { -webkit-appearance: none; display: none; }
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; max-width: 900px; margin: 0 auto; }
.filter-tab {
  padding: 6px 16px; border-radius: var(--r-full); font-size: 14px; font-weight: 400;
  border: 1px solid var(--hairline); color: var(--ink-48); background: transparent;
  letter-spacing: -0.224px; transition: .15s; white-space: nowrap;
}
.filter-tab:hover { border-color: var(--ink); color: var(--ink); }
.filter-tab.active, .filter-tab[aria-current="page"] { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }

/* ── SECTION HEADERS ─────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.section-title { font-size: clamp(22px, 3vw, 34px); font-weight: 600; color: var(--ink); letter-spacing: -0.374px; }
.section-link { color: var(--blue); font-size: 17px; font-weight: 400; display: flex; align-items: center; gap: 4px; white-space: nowrap; letter-spacing: -0.374px; }

/* ── GPX CARDS ────────────────────────────────────────────── */
.gpx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.gpx-card {
  background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  overflow: hidden; transition: border-color .2s;
}
.gpx-card:hover { border-color: var(--ink-48); }

.gpx-card-link { display: block; }
.gpx-card-thumb {
  height: 160px; background: #001520; position: relative;
  overflow: hidden;
}
.gpx-card-thumb > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: fill; display: block;
  transition: transform .4s ease;
}
.gpx-card:hover .gpx-card-thumb > img { transform: scale(1.03); }
.gpx-card-badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.gpx-card-badges-right { position: absolute; bottom: 10px; right: 10px; display: flex; gap: 6px; }
.gpx-card-body { padding: 16px; }
.gpx-card-title { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 8px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; letter-spacing: -0.224px; }
.gpx-card-meta { display: flex; gap: 12px; flex-wrap: wrap; }
.gpx-meta-item { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-48); letter-spacing: -0.12px; }
.gpx-card-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--hairline); padding: 10px 16px; }
.gpx-card-author { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-80); letter-spacing: -0.12px; text-decoration: none; }
.gpx-card-author:hover span { text-decoration: underline; }
.gpx-card-stat { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-48); }
.gpx-card-stats { display: flex; align-items: center; gap: 12px; }
.author-avatar { width: 24px; height: 24px; border-radius: var(--r-full); object-fit: cover; }
.author-dot {
  width: 24px; height: 24px; border-radius: var(--r-full);
  background: var(--blue); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700;
}

/* Badge kecil di pojok avatar untuk role admin/moderator — reusable di card, uploader-card, nav avatar */
.avatar-badge-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.role-badge {
  position: absolute; bottom: -2px; right: -2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 8px; line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.badge-ultra { background: #e74c3c; color: white; }
.badge-dark { background: rgba(0,0,0,.55); color: white; backdrop-filter: blur(4px); }
.badge-icon { font-size: 15px; margin-left: 4px; vertical-align: middle; }
.badge-icon-verified { color: var(--blue); }
.badge-icon-premium  { color: var(--orange); }

/* Difficulty badges */
.diff-easy-badge    { background: #e3f9ec; color: #006b35; }
.diff-medium-badge  { background: #fff3cd; color: #856404; }
.diff-hard-badge    { background: #ffe0cc; color: #c0392b; }
.diff-extreme-badge { background: #fce8e8; color: #a31515; }

/* Difficulty pills */
.diff-pill    { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--r-full); font-size: 12px; font-weight: 600; }
.diff-easy    { background: #e3f9ec; color: #006b35; }
.diff-medium  { background: #fff3cd; color: #856404; }
.diff-hard    { background: #ffe0cc; color: #c0392b; }
.diff-extreme { background: #fce8e8; color: #a31515; }

/* Status pills */
.status-pill      { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-full); font-size: 12px; font-weight: 600; }
.status-active    { background: #e3f9ec; color: #006b35; }
.status-pending   { background: #fff3cd; color: #856404; }
.status-banned    { background: #fce8e8; color: #a31515; }
.status-published { background: #e3f9ec; color: #006b35; }
.status-rejected  { background: #fce8e8; color: #a31515; }
.status-flagged   { background: #fff3cd; color: #856404; }
.status-deleted   { background: #f3f4f6; color: #6b7280; }

/* ── FEATURED CARDS ───────────────────────────────────────── */
.featured-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.featured-card {
  background: var(--tile-dark); border-radius: var(--r-lg); padding: 32px;
  color: var(--on-dark); position: relative; overflow: hidden; transition: opacity .2s;
}
.featured-card::after { display: none; }
.featured-card:nth-child(2) { background: var(--tile-dark-2); }
.featured-card:hover { opacity: .88; }
.featured-card-label { font-size: 12px; font-weight: 400; letter-spacing: 0.5px; text-transform: uppercase; color: var(--on-dark-muted); margin-bottom: 12px; }
.featured-card-title {
  display: block; font-size: 21px; font-weight: 600; line-height: 1.19; margin-bottom: 16px;
  color: var(--on-dark); letter-spacing: 0.231px;
}
.featured-card-title:hover { text-decoration: underline; }
.featured-card-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--on-dark-muted); letter-spacing: -0.224px; }
.featured-card-meta span { display: flex; align-items: center; gap: 4px; }

/* Stretched link pattern */
.stretched-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }

/* ── DETAIL PAGE ──────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; padding: 16px 24px; font-size: 14px; color: var(--ink-48); letter-spacing: -0.224px; }
.breadcrumb a { color: var(--blue); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .ti-chevron-right { font-size: 12px; }

.detail-hero { background: var(--tile-dark); padding: 48px 24px; color: var(--on-dark); }
.detail-hero-inner { max-width: 1000px; margin: 0 auto; }
.detail-badges { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-title { font-size: clamp(26px, 4vw, 48px); font-weight: 600; letter-spacing: -0.28px; margin-bottom: 16px; color: var(--on-dark); }
.detail-meta { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 32px; }
.detail-meta-item { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--on-dark-muted); letter-spacing: -0.224px; }
.detail-meta-item strong { color: var(--on-dark); font-weight: 600; }
.detail-btns { display: flex; gap: 10px; flex-wrap: wrap; }

.detail-body { padding: 40px 24px; }
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 40px; max-width: 1000px; }
.detail-section { margin-bottom: 48px; }
.detail-section-title { font-size: 22px; font-weight: 600; margin-bottom: 20px; color: var(--ink); letter-spacing: -0.374px; }
.detail-desc { font-size: 17px; color: var(--ink-80); line-height: 1.65; margin-bottom: 24px; letter-spacing: -0.374px; }

/* Stats mini cards */
.stats-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-mini { background: var(--parchment); border-radius: var(--r-lg); padding: 16px; text-align: center; }
.stat-mini.highlight { background: #e8f0fe; border: 1px solid rgba(0,102,204,.2); }
.stat-mini-val { font-size: 22px; font-weight: 600; color: var(--ink); letter-spacing: -0.374px; }
.stat-mini.highlight .stat-mini-val { color: var(--blue); }
.stat-mini-label { font-size: 12px; color: var(--ink-48); margin-top: 4px; letter-spacing: -0.12px; }

/* Chart box */
.chart-box { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 24px; margin-bottom: 20px; }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--hairline); }
.segments-table, .ws-table, .admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.segments-table th, .ws-table th, .admin-table th {
  text-align: left; padding: 10px 16px;
  background: var(--parchment); font-weight: 600; color: var(--ink-48); font-size: 13px;
  border-bottom: 1px solid var(--hairline); white-space: nowrap; letter-spacing: -0.224px;
}
.segments-table td, .ws-table td, .admin-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--hairline); color: var(--ink);
  font-size: 14px; letter-spacing: -0.224px;
}
.segments-table tr:last-child td, .ws-table tr:last-child td, .admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--parchment); }
.seg-name { font-weight: 600; }

/* WS badge */
.ws-badge {
  width: 34px; height: 34px; background: #e3f9ec; color: #006b35;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}

/* Sidebar */
.detail-sidebar { display: flex; flex-direction: column; gap: 20px; }
.sidebar-card { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 20px; }
.sidebar-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 14px; color: var(--ink); letter-spacing: -0.374px; }
.uploader-row { display: flex; align-items: center; gap: 12px; }
.author-avatar-lg { width: 44px; height: 44px; border-radius: var(--r-full); object-fit: cover; }
.author-dot-lg {
  width: 44px; height: 44px; border-radius: var(--r-full);
  background: var(--blue); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600;
}
.tech-list { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.tech-list dt { color: var(--ink-48); font-weight: 600; float: left; min-width: 100px; }
.tech-list dd { color: var(--ink); margin-left: 110px; }
.related-list { display: flex; flex-direction: column; gap: 2px; }
.related-item { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--r-sm); transition: background .1s; }
.related-item:hover { background: var(--parchment); }
.related-info { flex: 1; min-width: 0; }
.related-title { display: block; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.224px; }
.related-meta { font-size: 12px; color: var(--ink-48); letter-spacing: -0.12px; }

/* ── AUTH ─────────────────────────────────────────────────── */
.auth-page { min-height: calc(100vh - 44px); display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--parchment); }
.auth-box { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 48px 40px; width: min(440px, 100%); }
.auth-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-box h1 { font-size: 28px; text-align: center; margin-bottom: 8px; letter-spacing: -0.28px; }
.auth-sub { text-align: center; font-size: 17px; color: var(--ink-48); margin-bottom: 28px; line-height: 1.47; letter-spacing: -0.374px; }
.google-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 52px; border: 1px solid var(--hairline); border-radius: var(--r-full);
  font-size: 17px; font-weight: 400; color: var(--ink); background: var(--canvas);
  cursor: pointer; transition: background .15s; text-decoration: none; font-family: inherit;
  letter-spacing: -0.374px;
}
.google-btn:hover { background: var(--parchment); }
.google-icon { width: 20px; height: 20px; flex-shrink: 0; }
.auth-divider { text-align: center; font-size: 14px; color: var(--ink-48); margin: 20px 0; position: relative; }
.auth-divider span { background: var(--canvas); padding: 0 12px; position: relative; z-index: 1; }
.auth-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--hairline); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footer-text, .auth-legal { text-align: center; font-size: 14px; color: var(--ink-48); margin-top: 16px; letter-spacing: -0.224px; }
.auth-legal a, .auth-footer-text a { color: var(--blue); }

/* ── FORMS ────────────────────────────────────────────────── */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -0.224px; }
.form-input, .form-select, .form-textarea {
  height: 44px; border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: 0 16px; font-size: 17px; font-family: inherit; color: var(--ink);
  background: var(--canvas); outline: none; transition: border .15s; width: 100%;
  letter-spacing: -0.374px;
}
.form-textarea { height: auto; padding: 12px 16px; resize: vertical; min-height: 100px; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border: 2px solid var(--blue); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-between { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.form-section { margin-top: 24px; display: flex; flex-direction: column; gap: 20px; }
.form-check-row { display: flex; flex-direction: column; gap: 10px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.form-hint { font-size: 12px; color: var(--ink-48); letter-spacing: -0.12px; }
.required { color: #c0392b; }
.checkbox-label { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--ink-80); cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; }
.password-wrap { position: relative; }
.password-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--ink-48); font-size: 18px; }
.link-sm { font-size: 14px; color: var(--blue); }

/* ── UPLOAD PAGE ──────────────────────────────────────────── */
.upload-page { padding: 40px 24px; max-width: 1200px; margin: 0 auto; }
.upload-grid { display: grid; grid-template-columns: 1fr 320px; gap: 40px; }
.page-header { padding: 48px 24px; }
.page-header h1 { color: var(--on-dark); margin-bottom: 8px; }
.page-header p { color: var(--on-dark-muted); font-size: 17px; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--hairline); border-radius: var(--r-lg);
  padding: 40px; text-align: center; cursor: pointer; transition: .2s;
  background: var(--parchment); position: relative;
}
.drop-zone.drag-over { border-style: solid; border-color: var(--blue); background: #e8f0fe; }
.drop-zone-input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop-zone-icon { font-size: 40px; color: var(--ink-48); margin: 0 auto 12px; display: block; }
.drop-zone-title { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 4px; letter-spacing: -0.374px; }
.drop-zone-sub { font-size: 14px; color: var(--ink-48); }
.drop-zone-browse { color: var(--blue); text-decoration: underline; cursor: pointer; }
.drop-zone-hint { font-size: 12px; color: var(--ink-48); margin-top: 8px; }
.drop-zone-selected { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--blue); }
.drop-zone-selected i { font-size: 28px; color: var(--blue); }
.remove-file-btn { background: none; border: 1px solid var(--hairline); border-radius: var(--r-full); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--ink-48); margin-left: auto; }
.file-size-label { font-size: 12px; color: var(--ink-48); }

/* Progress bar */
.upload-progress { margin-top: 16px; }
.progress-bar { height: 6px; background: var(--hairline); border-radius: var(--r-full); overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; background: var(--blue); border-radius: var(--r-full); transition: width .3s ease; }

/* Tip list */
.tip-list { display: flex; flex-direction: column; gap: 8px; }
.tip-list li { font-size: 14px; color: var(--ink-80); padding-left: 16px; position: relative; letter-spacing: -0.224px; }
.tip-list li::before { content: '·'; position: absolute; left: 0; color: var(--blue); font-weight: 700; }
.upload-sidebar { display: flex; flex-direction: column; gap: 20px; }

/* ── ADMIN LAYOUT ─────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 44px); }
.admin-sidebar { background: var(--parchment); border-right: 1px solid var(--hairline); padding: 20px 12px; }
.admin-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 400; color: var(--ink-48); cursor: pointer;
  margin-bottom: 2px; border: none; background: transparent; transition: .15s; width: 100%;
  letter-spacing: -0.224px;
}
.admin-nav-item:hover { background: var(--pearl); color: var(--ink); }
.admin-nav-item.active { background: #e8f0fe; color: var(--blue); }
.admin-nav-item i { font-size: 18px; flex-shrink: 0; }
.admin-sidebar-divider { height: 1px; background: var(--hairline); margin: 12px 0; }
.nav-badge { background: #e74c3c; color: white; border-radius: var(--r-full); padding: 1px 7px; font-size: 11px; font-weight: 600; margin-left: auto; }
.admin-content { padding: 40px 48px; background: var(--canvas); overflow: auto; }
.admin-page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.admin-page-header h1 { font-size: 28px; margin-bottom: 4px; letter-spacing: -0.28px; }
.admin-page-header p { font-size: 17px; color: var(--ink-48); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.kpi-card { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 20px 24px; }
.kpi-card.featured { background: #e8f0fe; border: 2px solid rgba(0,102,204,.2); }
.kpi-card.kpi-warn { border-color: #fa6e39; background: #fff8f5; }
.kpi-label { font-size: 14px; font-weight: 400; color: var(--ink-48); margin-bottom: 8px; letter-spacing: -0.224px; }
.kpi-val { font-size: 30px; font-weight: 600; color: var(--ink); letter-spacing: -0.374px; }
.kpi-card.featured .kpi-val { color: var(--blue); }
.kpi-sub { font-size: 12px; color: var(--ink-48); margin-top: 4px; letter-spacing: -0.12px; }
.kpi-sub a { color: var(--blue); }
.chart-card { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 24px; }
.chart-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 16px; color: var(--ink); letter-spacing: -0.374px; }
.table-card { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 24px; }
.table-card-head { padding: 16px 20px; border-bottom: 1px solid var(--hairline); display: flex; align-items: center; justify-content: space-between; }
.table-card-head h3 { font-size: 17px; font-weight: 600; color: var(--ink); }

/* ── ALERTS ───────────────────────────────────────────────── */
.alert { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 20px; letter-spacing: -0.224px; }
.alert-success { background: #e3f9ec; color: #006b35; border: 1px solid rgba(0,107,53,.15); }
.alert-error   { background: #fce8e8; color: #a31515; border: 1px solid rgba(192,57,43,.15); }

/* ── TOAST ────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--on-dark);
  padding: 14px 20px; border-radius: var(--r-lg); font-size: 14px; font-weight: 400;
  box-shadow: var(--shadow-modal);
  animation: slide-in .25s ease forwards;
  max-width: 360px; letter-spacing: -0.224px;
}
.toast i { color: var(--blue-on-dark); font-size: 18px; flex-shrink: 0; }
.toast.toast-error i { color: #e74c3c; }
.toast.toast-success i { color: var(--blue-on-dark); }
@keyframes slide-in { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.show { display: flex; }

/* ── MODAL (native <dialog>) ──────────────────────────────── */
.modal-dialog {
  border: none; border-radius: var(--r-lg); padding: 0;
  max-width: min(560px, 95vw); width: 100%;
  box-shadow: var(--shadow-modal);
  margin: auto;
  max-height: 90dvh; overflow-y: auto;
}
.modal-dialog::backdrop { background: rgba(0,0,0,.5); }
.modal-inner { padding: 32px 36px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h2 { font-size: 21px; font-weight: 600; letter-spacing: 0.231px; }
.modal-close { background: none; border: 1px solid var(--hairline); border-radius: var(--r-sm); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--ink-48); font-size: 18px; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }
@media (max-width: 479px) {
  .modal-dialog { max-width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; margin: auto auto 0; max-height: 92dvh; }
  .modal-inner  { padding: 24px 20px; }
}

/* ── CTA BANNER ───────────────────────────────────────────── */
.cta-banner { background: var(--tile-dark); padding: 80px 24px; text-align: center; }
.cta-inner { max-width: 600px; margin: 0 auto; }
.cta-banner h2 { color: var(--on-dark); margin-bottom: 16px; }
.cta-banner p { color: var(--on-dark-muted); font-size: 21px; font-weight: 400; margin-bottom: 40px; line-height: 1.47; letter-spacing: 0.231px; }
.cta-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── FOOTER ───────────────────────────────────────────────── */
.footer { background: var(--parchment); border-top: 1px solid var(--hairline); padding: 64px 24px 40px; }
.footer-inner { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 40px; }
.footer-brand .footer-logo { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.footer-brand p { font-size: 12px; color: var(--ink-80); line-height: 1.65; max-width: 240px; letter-spacing: -0.12px; }
.footer-social { display: flex; gap: 16px; margin-top: 16px; }
.footer-social a { color: var(--ink-48); font-size: 20px; transition: color .15s; }
.footer-social a:hover { color: var(--ink); }
.footer-col h3 { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 16px; letter-spacing: -0.224px; }
.footer-link { display: block; font-size: 17px; color: var(--ink-48); padding: 1px 0; transition: color .15s; line-height: 2.41; letter-spacing: 0; }
.footer-link:hover { color: var(--blue); }
.footer-bottom { max-width: 1240px; margin: 24px auto 0; padding-top: 20px; border-top: 1px solid var(--hairline); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-48); flex-wrap: wrap; gap: 8px; letter-spacing: -0.12px; }
.heart { color: #e74c3c; }

/* ── PAGINATION ───────────────────────────────────────────── */
.pagination { margin-top: 40px; }
.pagination ul { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pagination li a {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-sm);
  border: 1px solid var(--hairline); font-size: 14px; font-weight: 400; color: var(--ink-48); transition: .15s;
}
.pagination li a:hover { background: var(--parchment); color: var(--ink); }
.pagination li.active a { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }

/* ── BREADCRUMB ───────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; padding: 14px 0; flex-wrap: wrap; }

/* ── PROFILE PAGE ─────────────────────────────────────────── */
.profile-header { background: var(--tile-dark); padding: 48px 24px; }
.profile-avatar-row { display: flex; align-items: center; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.profile-avatar-big {
  width: 72px; height: 72px; border-radius: var(--r-full);
  background: var(--blue); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 600;
  flex-shrink: 0;
}
.profile-avatar-big img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-full); }
.profile-info h2 { color: var(--on-dark); margin-bottom: 4px; }
.profile-info p { color: var(--on-dark-muted); font-size: 17px; }
.profile-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.profile-stat { text-align: center; }
.profile-stat-num { font-size: 22px; font-weight: 600; color: var(--on-dark); letter-spacing: -0.374px; }
.profile-stat-label { font-size: 14px; color: var(--on-dark-muted); letter-spacing: -0.224px; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--hairline); margin-bottom: 28px; overflow-x: auto; }
.tab-item { padding: 12px 20px; font-size: 17px; font-weight: 400; color: var(--ink-48); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: .15s; white-space: nowrap; letter-spacing: -0.374px; }
.tab-item.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── MISC ─────────────────────────────────────────────────── */
.required-legend { font-size: 12px; color: var(--ink-48); margin-bottom: 4px; letter-spacing: -0.12px; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1023px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .mobile-nav { display: block; }
  .nav-label { display: none; }
  .nav-avatar-wrap { display: none; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    display: flex; flex-direction: row; align-items: center; gap: 4px;
    padding: 10px 12px; overflow-x: auto; border-right: none;
    border-bottom: 1px solid var(--hairline);
  }
  .admin-sidebar nav { display: flex; flex-direction: row; gap: 4px; }
  .admin-nav-item { width: auto; white-space: nowrap; margin-bottom: 0; }
  .admin-sidebar-divider { width: 1px; height: 24px; margin: 0 4px; }
  .admin-content { padding: 24px 20px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

/* ── 767px: tablet portrait ───────────────────────────────── */
@media (max-width: 767px) {
  .nav { height: 58px; padding: 0 16px; }
  .nav-logo { font-size: 16px; }
  .nav-logo-icon { width: 32px; height: 32px; }
  .nav-avatar { width: 36px; height: 36px; font-size: 14px; }
  .nav-hamburger { padding: 10px; }
  .nav-hamburger span { width: 24px; height: 2.5px; }

  /* Reduce container & section padding — eliminates double-margin on mobile */
  .container { padding-left: 16px; padding-right: 16px; }
  .section { padding: 56px 0; }
  .search-section { padding-left: 0; padding-right: 0; }

  /* Promo */
  .promo-banner { font-size: 13px; padding: 8px 16px; line-height: 1.6; }

  /* Hero */
  .hero { padding: 48px 20px 56px; }
  .hero h1 { font-size: 34px; }
  .hero-sub { font-size: 17px; margin-bottom: 32px; }
  .hero-stats { gap: 24px; margin-top: 48px; }
  .hero-code { display: none; }

  /* Search — horizontal scroll tabs */
  .search-section { padding-top: 20px; padding-bottom: 16px; }
  .filter-tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; scroll-snap-type: x mandatory; padding-bottom: 4px;
    margin: 0 -16px; padding-left: 16px; padding-right: 16px;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tab { flex-shrink: 0; scroll-snap-align: start; }

  /* GPX cards */
  .gpx-card-thumb  { height: 140px; }
  .gpx-card-body   { padding: 12px 14px; }
  .gpx-card-footer { padding: 8px 14px; }
  .gpx-card-title  { font-size: 14px; }
  .gpx-card-meta   { gap: 8px; }

  /* Featured */
  .featured-grid { grid-template-columns: 1fr; }
  .featured-card { padding: 24px; }

  /* Sections */
  .section-header { margin-bottom: 24px; }

  /* Layout */
  .chart-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-sidebar { display: none; }
  .upload-grid { grid-template-columns: 1fr; }
  .upload-sidebar { display: none; }
  .form-row-2 { grid-template-columns: 1fr; }

  /* Footer */
  .footer-inner { grid-template-columns: 1fr; }
  .footer-col { display: none; }
  .footer { padding: 40px 16px 28px; }

  /* Auth */
  .auth-box { padding: 32px 20px; }

  /* Admin */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-stats { gap: 16px; }
}

/* ── 640px: phone (wide) — 2-col grid ────────────────────── */
@media (max-width: 640px) {
  .gpx-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .gpx-card-thumb { height: 120px; }
  .gpx-card-title { font-size: 13px; }
  .gpx-card-meta  { display: none; }
}

/* ── 479px: small phone ───────────────────────────────────── */
@media (max-width: 479px) {
  .container { padding-left: 12px; padding-right: 12px; }
  .section { padding: 40px 0; }
  .search-section { padding-top: 16px; padding-bottom: 12px; }
  .promo-banner { font-size: 12px; }

  /* Hero */
  .hero { padding: 40px 16px 48px; }
  .hero h1 { font-size: 28px; line-height: 1.1; }
  .hero-eyebrow { font-size: 11px; margin-bottom: 16px; }
  .hero-sub { font-size: 17px; margin-bottom: 28px; }
  .hero-btns { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-btns a { justify-content: center; text-align: center; }

  /* Stats — 2×2 grid with hairlines */
  .hero-stats {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0; margin-top: 32px;
    border: 1px solid rgba(255,255,255,.12); border-radius: 16px; overflow: hidden;
  }
  .hero-stat {
    padding: 16px 12px; text-align: center;
    border-right: 1px solid rgba(255,255,255,.12);
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  .hero-stat:nth-child(even) { border-right: none; }
  .hero-stat:nth-child(3),
  .hero-stat:nth-child(4)   { border-bottom: none; }
  .hero-stat-num   { font-size: 20px; }
  .hero-stat-label { font-size: 11px; margin-top: 2px; }

  /* Search */
  .search-section { padding: 16px 16px 12px; }
  .search-bar { flex-direction: column; gap: 8px; }
  .search-wrap { width: 100%; }
  .search-bar .btn-primary { width: 100%; justify-content: center; }

  /* Filter tabs */
  .filter-tabs { gap: 6px; }
  .filter-tab { font-size: 13px; padding: 5px 13px; }

  /* Featured cards */
  .featured-grid { gap: 12px; }
  .featured-card { padding: 20px; }
  .featured-card-label { font-size: 11px; margin-bottom: 8px; }
  .featured-card-title { font-size: 17px; margin-bottom: 12px; }
  .featured-card-meta { font-size: 12px; gap: 10px; }

  /* Section header */
  .section-header { margin-bottom: 16px; }
  .section-title { font-size: 21px; letter-spacing: 0.231px; }
  .section-link { font-size: 14px; }

  /* GPX grid — single column */
  .gpx-grid { grid-template-columns: 1fr; gap: 10px; }
  .gpx-card-thumb { height: auto; aspect-ratio: 2/1; }
  .gpx-card-body  { padding: 12px 14px; }
  .gpx-card-title { font-size: 15px; }
  .gpx-card-meta  { display: flex; gap: 8px; }

  /* CTA */
  .cta-banner { padding: 48px 16px; }
  .cta-btns { flex-direction: column; align-items: stretch; gap: 10px; }
  .cta-btns a { text-align: center; justify-content: center; }

  /* Misc */
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
  .detail-btns { flex-direction: column; }
  .detail-meta { gap: 10px; }
}

/* ── Mobile utilities ─────────────────────────────────────── */
.hide-mobile { display: inline; }
.show-mobile { display: none; }
@media (max-width: 479px) {
  .hide-mobile { display: none; }
  .show-mobile { display: inline-flex; align-items: center; }
  .nav { padding: 0 12px; gap: 4px; }
  .nav-logo span { font-size: 13px; }
  .btn-secondary { padding: 6px 12px; font-size: 13px; }
  .btn-primary   { padding: 7px 14px; font-size: 14px; }
  .section { padding: 28px 0; }
  .section-title { font-size: 20px; }
}

/* ── Z-INDEX OVERRIDES ────────────────────────────────────── */
.nav { z-index: 9999 !important; }
.mobile-nav { z-index: 9998 !important; }
.mobile-overlay { z-index: 9997 !important; }
.leaflet-top { z-index: 800 !important; }
.leaflet-bottom { z-index: 800 !important; }
.leaflet-pane { z-index: 400 !important; }
.leaflet-tile-pane { z-index: 200 !important; }
.leaflet-overlay-pane { z-index: 400 !important; }
.leaflet-marker-pane { z-index: 600 !important; }
.leaflet-popup-pane { z-index: 700 !important; }
.leaflet-control { z-index: 800 !important; }
