:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e2e8f0;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --bg: #f1f5f9;
  --sidebar: #0b1220;
  --sidebar-soft: #111c31;
  --primary: #059669;
  --primary-dark: #047857;
  --primary-soft: #d1fae5;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --violet: #7c3aed;
  --violet-soft: #ede9fe;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .05);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .14);
  --sidebar-w: 252px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button, input, select, textarea { font: inherit; }
img, svg { vertical-align: middle; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 1.65rem; letter-spacing: -.03em; }
h2 { font-size: 1.2rem; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
.icon { flex: 0 0 auto; }

/* ------------------------------------------------------------------ */
/* Sidebar                                                             */
/* ------------------------------------------------------------------ */
.admin-layout { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background:
    radial-gradient(circle at 20% 0%, rgba(5, 150, 105, .18), transparent 34%),
    linear-gradient(180deg, #0b1220 0%, #0e1729 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  z-index: 120;
  border-right: 1px solid rgba(148, 163, 184, .12);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  padding: 4px 8px 18px;
}
.brand:hover { color: #fff; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #10b981);
  color: #fff;
  box-shadow: 0 8px 18px rgba(5, 150, 105, .35);
}
.brand strong { display: block; font-size: 1.1rem; letter-spacing: -.02em; line-height: 1.1; }
.brand small { display: block; font-size: .64rem; color: #7d8ca3; letter-spacing: .12em; text-transform: uppercase; margin-top: 3px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.nav-label {
  margin: 18px 10px 6px;
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 10px;
  color: #a9b7ca;
  font-weight: 550;
  font-size: .86rem;
  transition: background .15s, color .15s, transform .15s;
}
.nav-item:hover { color: #fff; background: rgba(148, 163, 184, .09); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(5, 150, 105, .28), rgba(5, 150, 105, .08));
  box-shadow: inset 2px 0 0 #10b981;
}
.nav-item.active .icon { color: #34d399; }
.sidebar-footer { margin-top: auto; padding-top: 18px; }
.sidebar-note {
  display: flex;
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(148, 163, 184, .13);
  border-radius: 11px;
  background: rgba(148, 163, 184, .05);
  color: #8fa0b7;
  font-size: .72rem;
  margin-bottom: 10px;
}
.sidebar-note strong { color: #cbd5e1; display: block; font-size: .74rem; margin-bottom: 2px; }
.sidebar-note p { margin: 0; line-height: 1.4; }
.version { margin: 12px 4px 0; font-size: .68rem; color: #55657c; }
.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------------ */
/* Main / layout                                                       */
/* ------------------------------------------------------------------ */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 28px clamp(18px, 3vw, 42px) 22px;
  display: flex;
  flex-direction: column;
}
.public-main { margin-left: 0; padding-top: 24px; max-width: 1240px; margin-right: auto; margin-left: auto; }
.mobile-topbar { display: none; }
.footer {
  margin-top: auto;
  padding-top: 34px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-light);
  font-size: .72rem;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ */
/* Public header                                                       */
/* ------------------------------------------------------------------ */
.public-topbar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px clamp(18px, 3vw, 42px) 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-public { color: var(--ink); padding: 0; }
.brand-public:hover { color: var(--ink); }
.brand-public small { color: var(--muted-light); }
.public-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.athlete-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .78rem;
  font-weight: 650;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ */
/* Page header                                                         */
/* ------------------------------------------------------------------ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); max-width: 720px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .64rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 7px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
  margin-bottom: 9px;
}
.back-link:hover { color: var(--primary-dark); }

/* ------------------------------------------------------------------ */
/* Buttons, badges, chips                                              */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 14px;
  font-weight: 650;
  font-size: .8rem;
  cursor: pointer;
  transition: .16s ease;
  background: var(--surface);
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 5px 14px rgba(5, 150, 105, .25); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #1d4ed8; color: #fff; }
.btn-outline { border-color: var(--line); background: var(--surface); color: var(--ink-soft); }
.btn-outline:hover { border-color: #cbd5e1; background: var(--surface-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(148, 163, 184, .12); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-soft-danger { background: var(--red-soft); color: var(--red); }
.btn-soft-danger:hover { background: #fecaca; color: #991b1b; }
.btn-sm { padding: 6px 10px; font-size: .74rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .02em;
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-green { background: var(--primary-soft); color: #047857; border-color: #a7f3d0; }
.badge-blue { background: var(--blue-soft); color: #1d4ed8; border-color: #bfdbfe; }
.badge-amber { background: var(--amber-soft); color: #92400e; border-color: #fde68a; }
.badge-red { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }
.badge-violet { background: var(--violet-soft); color: #5b21b6; border-color: #ddd6fe; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
}
.chip strong { color: var(--ink-soft); }

/* ------------------------------------------------------------------ */
/* Cards / stats                                                       */
/* ------------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, .85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}
.card-head h3 { margin: 0; font-size: .92rem; letter-spacing: -.01em; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: .75rem; }
.card-body { padding: 18px 20px 20px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 12px;
}
.section-title h2 { margin: 0; font-size: 1.02rem; }
.section-title .muted { font-size: .76rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, .85);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -20px -35px auto;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: .5;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.stat-label { color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .11em; font-weight: 800; }
.stat-icon {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  position: relative; z-index: 1;
}
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.violet { background: var(--violet-soft); color: var(--violet); }
.stat-value { font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; color: var(--ink); position: relative; z-index: 1; }
.stat-value small { font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.stat-sub { font-size: .7rem; color: var(--muted); margin-top: 3px; position: relative; z-index: 1; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.metric {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 76px;
}
.metric:nth-child(4n) { border-right: 0; }
.metric-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; }
.metric-value { font-size: 1.08rem; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.metric-value small { font-size: .66rem; color: var(--muted); font-weight: 600; }
.metric-sub { font-size: .68rem; color: var(--muted-light); margin-top: 2px; }

/* ------------------------------------------------------------------ */
/* Layout grids                                                        */
/* ------------------------------------------------------------------ */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .85fr); gap: 18px; align-items: start; }
.grid-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 12px; }
.chart-card h4 { margin: 0 0 2px; font-size: .78rem; letter-spacing: .01em; }
.chart-card p { margin: 0 0 10px; color: var(--muted); font-size: .7rem; }
.chart-box { position: relative; height: 280px; min-height: 220px; }
.chart-box.tall { height: 340px; }
.chart-box.short { height: 220px; }

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  background: var(--surface);
}
table.data thead th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 800;
  text-align: left;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data tbody td {
  padding: 11px 13px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--ink-soft);
  vertical-align: middle;
}
table.data tbody tr:hover { background: #f8fafc; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .strong { color: var(--ink); font-weight: 750; }
.table-title { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--ink); }
.table-title:hover { color: var(--primary-dark); }
.table-actions { display: flex; gap: 5px; justify-content: flex-end; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: .76rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.pagination-links { display: flex; gap: 5px; }
.pagination-links a, .pagination-links span {
  min-width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface);
  padding: 0 8px;
}
.pagination-links .active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.pagination-links .disabled { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */
.form-card { max-width: 860px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: .72rem; font-weight: 750; color: var(--ink-soft); margin-bottom: 5px; }
.field .hint { font-size: .68rem; color: var(--muted-light); margin-top: 4px; }
.field input, .field select, .field textarea, .input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .13);
}
.field textarea { min-height: 90px; resize: vertical; }
.form-actions { display: flex; gap: 9px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.filter-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filter-form .field { min-width: 130px; }
.filter-form .field.grow { flex: 1; min-width: 190px; }
.filter-form .field label { font-size: .64rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.filter-form .btn { height: 38px; }
.checkbox { width: 16px; height: 16px; accent-color: var(--primary); }

/* ------------------------------------------------------------------ */
/* Flash / empty / alerts                                              */
/* ------------------------------------------------------------------ */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: .8rem;
  animation: slideIn .2s ease;
}
.flash-success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.flash-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.flash-info { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
.flash span { flex: 1; }
.flash-close { border: 0; background: transparent; color: currentColor; cursor: pointer; opacity: .65; padding: 2px; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } }
.toast-stack {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  font-size: .78rem;
  transition: opacity .25s;
  max-width: 300px;
}
.toast-success { border-left: 3px solid #34d399; }
.toast-error { border-left: 3px solid #f87171; }
.empty {
  text-align: center;
  padding: 42px 20px;
  color: var(--muted);
}
.empty-icon {
  width: 54px; height: 54px;
  margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted-light);
}
.empty h3 { margin: 0 0 4px; color: var(--ink-soft); font-size: .95rem; }
.empty p { margin: 0 auto 14px; max-width: 420px; font-size: .8rem; }
.alert {
  display: flex;
  gap: 10px;
  padding: 13px 15px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: .8rem;
}
.alert-amber { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-blue { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert strong { display: block; margin-bottom: 2px; }
.muted { color: var(--muted); }
.small { font-size: .74rem; }
.mono { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ */
/* Tabs                                                                */
/* ------------------------------------------------------------------ */
.tabs { display: flex; gap: 5px; border-bottom: 1px solid var(--line); margin: 20px 0 18px; overflow-x: auto; }
.tab-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 13px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } }

.detail-section { margin-top: 26px; scroll-margin-top: 20px; }
.detail-section .section-title { margin-bottom: 12px; }
.section-jump {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px;
  position: sticky; top: 8px; z-index: 6;
  background: rgba(246,248,250,.94); backdrop-filter: blur(6px);
  padding: 8px 4px; border-radius: 10px;
}
.section-jump .chip { text-decoration: none; }

/* ------------------------------------------------------------------ */
/* Zones / efforts                                                    */
/* ------------------------------------------------------------------ */
.zone-list { display: flex; flex-direction: column; gap: 9px; }
.zone-row { display: grid; grid-template-columns: 44px 1fr 58px; gap: 10px; align-items: center; font-size: .74rem; }
.zone-name { font-weight: 800; color: var(--ink-soft); }
.zone-bar { height: 9px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.zone-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }
.zone-time { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.zone-z1 { background: #94a3b8; } .zone-z2 { background: #22c55e; } .zone-z3 { background: #eab308; }
.zone-z4 { background: #f97316; } .zone-z5 { background: #ef4444; } .zone-z6 { background: #dc2626; }
.zone-z7 { background: #7c3aed; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .7rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.effort-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.effort {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  text-align: center;
}
.effort small { display: block; color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
.effort strong { display: block; font-size: 1rem; margin-top: 2px; }

/* ------------------------------------------------------------------ */
/* Map / player                                                       */
/* ------------------------------------------------------------------ */
.map-shell { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
#map, .activity-map { height: 520px; width: 100%; background: #e2e8f0; }
.map-overlay {
  position: absolute;
  top: 14px; left: 14px;
  z-index: 500;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  min-width: 190px;
}
.map-overlay .live-title { font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 800; margin-bottom: 7px; }
.live-row { display: flex; justify-content: space-between; gap: 18px; font-size: .76rem; padding: 3px 0; border-bottom: 1px solid #f1f5f9; }
.live-row:last-child { border-bottom: 0; }
.live-row span { color: var(--muted); }
.live-row b { font-variant-numeric: tabular-nums; color: var(--ink); }
.player {
  position: absolute;
  bottom: 14px; left: 14px; right: 14px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, .9);
  color: #fff;
  border-radius: 12px;
  padding: 9px 12px;
  backdrop-filter: blur(8px);
}
.player button {
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.player input[type=range] { flex: 1; accent-color: #34d399; }
.player select {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 7px;
  padding: 5px 6px;
  font-size: .72rem;
}
.player .progress-label { font-size: .7rem; color: #cbd5e1; min-width: 36px; text-align: right; }
.map-legend {
  position: absolute;
  right: 14px; bottom: 70px;
  z-index: 500;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: .66rem;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.map-legend .legend { gap: 8px; }

/* ------------------------------------------------------------------ */
/* Upload                                                             */
/* ------------------------------------------------------------------ */
.upload-hero {
  background:
    radial-gradient(circle at 88% 10%, rgba(37, 99, 235, .16), transparent 30%),
    radial-gradient(circle at 10% 90%, rgba(5, 150, 105, .16), transparent 34%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(22px, 4vw, 38px);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.upload-hero h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); max-width: 720px; letter-spacing: -.04em; }
.upload-hero p { color: var(--muted); max-width: 680px; margin-bottom: 0; }
.upload-card { max-width: 760px; margin: 0 auto; }
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 30px 20px;
  text-align: center;
  background: var(--surface-soft);
  cursor: pointer;
  transition: .18s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: #ecfdf5; }
.dropzone .dz-icon {
  width: 54px; height: 54px;
  margin: 0 auto 10px;
  display: grid; place-items: center;
  border-radius: 15px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.dropzone strong { display: block; font-size: .92rem; }
.dropzone small { color: var(--muted); font-size: .74rem; }
.file-list { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: .76rem;
}
.file-row .file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.file-row .file-status { color: var(--muted); font-size: .7rem; }
.file-row.success { border-color: #a7f3d0; background: #ecfdf5; }
.file-row.error { border-color: #fecaca; background: #fef2f2; }
.file-row.duplicate { border-color: #fde68a; background: #fffbeb; }
.progress { height: 7px; border-radius: 99px; background: #e2e8f0; overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.upload-result { margin-top: 16px; }
.link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
}
.link-box input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: .72rem;
  outline: none;
  min-width: 0;
}
.portal-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.portal-hero h1 { margin-bottom: 3px; }
.portal-hero p { margin: 0; color: var(--muted); }
.avatar {
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #10b981);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------------ */
/* Activity detail                                                    */
/* ------------------------------------------------------------------ */
.activity-head { margin-bottom: 16px; }
.activity-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.activity-title { font-size: clamp(1.35rem, 3vw, 1.85rem); margin: 0; letter-spacing: -.035em; }
.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 18px;
}
.summary-item { padding: 14px 16px; border-right: 1px solid var(--line); }
.summary-item:last-child { border-right: 0; }
.summary-item small { display: block; font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; }
.summary-item strong { display: block; font-size: 1.18rem; margin-top: 3px; letter-spacing: -.02em; }
.summary-item strong span { font-size: .7rem; color: var(--muted); font-weight: 600; }
.notes-box {
  white-space: pre-wrap;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  font-size: .8rem;
  color: var(--ink-soft);
}
.data-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.data-toolbar .muted { font-size: .72rem; }

/* ------------------------------------------------------------------ */
/* Login                                                              */
/* ------------------------------------------------------------------ */
.login-wrap {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
  padding: 30px 18px;
}
.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
}
.login-card .brand { color: var(--ink); padding: 0 0 16px; }
.login-card .brand small { color: var(--muted); }
.login-card h1 { font-size: 1.35rem; margin-bottom: 4px; }
.login-card p { color: var(--muted); font-size: .8rem; }
.login-card .field { margin: 16px 0; }
.login-card .btn { width: 100%; }

/* ------------------------------------------------------------------ */
/* Compare                                                            */
/* ------------------------------------------------------------------ */
.compare-heads { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.compare-card { border-top: 4px solid var(--blue); }
.compare-card.b { border-top-color: var(--amber); }
.compare-metric { font-size: .78rem; color: var(--muted); }
.compare-metric strong { color: var(--ink); }

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 110;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; padding-top: 14px; }
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 0 14px;
  }
  .mobile-brand { font-weight: 800; letter-spacing: -.02em; }
  .grid-charts, .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .metric:nth-child(4n) { border-right: 1px solid var(--line); }
  .metric:nth-child(3n) { border-right: 0; }
  .public-main { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 620px) {
  .page-head { flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .filter-form .field { flex: 1; min-width: 120px; }
  .summary-item { border-right: 0; border-bottom: 1px solid var(--line); }
  #map, .activity-map { height: 400px; }
  .map-overlay { padding: 9px 10px; min-width: 160px; }
  .player { flex-wrap: wrap; }
  .player input[type=range] { order: 3; flex-basis: 100%; }
  .compare-heads { grid-template-columns: 1fr; }
  .tabs { gap: 0; }
  .tab-btn { padding: 9px 9px; font-size: .72rem; }
  .footer { flex-direction: column; }
}
@media print {
  .sidebar, .public-topbar, .mobile-topbar, .page-actions, .tabs, .player, .footer, .flash-stack { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card, .chart-card, .stat-card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
