/* Tab pills */
.tab {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #57534e; /* stone-600 */
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover {
    color: #1c1917; /* stone-900 */
}
.tab.active {
    color: #1c1917;
    border-bottom-color: #1c1917;
    font-weight: 500;
}

/* Card */
.card {
    background: white;
    border: 1px solid #e7e5e4; /* stone-200 */
    border-radius: 0.5rem;
    padding: 1.25rem;
}
.card h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: #78716c; /* stone-500 */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* Stats grid */
.stat-num {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1c1917;
    line-height: 1.1;
}
.stat-unit {
    font-size: 0.875rem;
    color: #78716c;
    margin-left: 0.25rem;
}
.stat-sub {
    font-size: 0.75rem;
    color: #a8a29e;
    margin-top: 0.25rem;
}

/* Activity row */
.activity-row {
    display: grid;
    grid-template-columns: 100px 90px 1fr 80px 90px 80px 60px;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f5f5f4; /* stone-100 */
    font-size: 0.875rem;
    align-items: center;
    cursor: pointer;
    transition: background 0.1s;
}
.activity-row:hover {
    background: #fafaf9; /* stone-50 */
}
.activity-row .sport {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
}
.activity-row .sport-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
}
.activity-row .num {
    font-variant-numeric: tabular-nums;
    color: #44403c;
}
.activity-row .secondary {
    color: #a8a29e;
    font-size: 0.8125rem;
}

/* Sport colors */
.sport-running       { color: #ea580c; } .sport-running       .sport-dot { background: #ea580c; }
.sport-treadmill     { color: #f97316; } .sport-treadmill     .sport-dot { background: #f97316; }
.sport-cycling       { color: #2563eb; } .sport-cycling       .sport-dot { background: #2563eb; }
.sport-road_biking   { color: #2563eb; } .sport-road_biking   .sport-dot { background: #2563eb; }
.sport-indoor_cycling{ color: #6366f1; } .sport-indoor_cycling.sport-dot { background: #6366f1; }
.sport-lap_swimming  { color: #0891b2; } .sport-lap_swimming  .sport-dot { background: #0891b2; }
.sport-open_water_swimming { color: #0d9488; } .sport-open_water_swimming .sport-dot { background: #0d9488; }
.sport-multi_sport   { color: #7c3aed; } .sport-multi_sport   .sport-dot { background: #7c3aed; }
.sport-walking       { color: #65a30d; } .sport-walking       .sport-dot { background: #65a30d; }
.sport-other         { color: #57534e; } .sport-other         .sport-dot { background: #a8a29e; }

/* Loading */
.loading { color: #a8a29e; padding: 2rem; text-align: center; }

/* Sport filter pills */
.sport-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border: 1px solid #e7e5e4;
    border-radius: 9999px;
    background: white;
    color: #57534e;
    cursor: pointer;
    transition: all 0.1s;
}
.sport-pill:hover { border-color: #a8a29e; }
.sport-pill.active {
    background: #1c1917;
    border-color: #1c1917;
    color: white;
}
.sport-pill.active .sport-pill-dot { background: white !important; }
.sport-pill-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
}

/* Sub-tabs (used inside Performance) */
.subtab {
    padding: 0.5rem 0;
    margin-right: 1.5rem;
    font-size: 0.875rem;
    color: #78716c;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}
.subtab:hover { color: #1c1917; }
.subtab.active {
    color: #1c1917;
    border-bottom-color: #1c1917;
    font-weight: 500;
}

/* Performance table — interval matrix */
.perf-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}
.perf-table th, .perf-table td {
    padding: 0.5rem 0.75rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.perf-table thead th {
    color: #78716c;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e7e5e4;
    text-align: right;
}
.perf-table th:first-child, .perf-table td:first-child { text-align: left; }
.perf-table tbody tr { border-bottom: 1px solid #f5f5f4; }
.perf-table .career-best {
    color: #ea580c;
    font-weight: 600;
}
.perf-table .career-best::after { content: ' ★'; color: #ea580c; }
.perf-table .empty-cell { color: #d6d3d1; }

/* Race-list row */
.race-row {
    display: grid;
    grid-template-columns: 100px 90px 1fr 90px 90px;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #f5f5f4;
    font-size: 0.875rem;
    align-items: center;
    cursor: pointer;
    transition: background 0.1s;
}
.race-row:hover { background: #fafaf9; }
.race-row .num { font-variant-numeric: tabular-nums; color: #44403c; }
.race-row:last-child { border-bottom: 0; }

/* PR card */
.pr-card {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
}
.pr-card .pr-label {
    font-size: 0.6875rem;
    color: #c2410c;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.pr-card .pr-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #9a3412;
    margin-top: 0.125rem;
}
.pr-card .pr-meta {
    font-size: 0.75rem;
    color: #c2410c;
    margin-top: 0.25rem;
}

/*
 * Contain Leaflet's stacking context. `.leaflet-container` is
 * position:relative with NO z-index, so its panes/controls (z-index up
 * to 1000 in leaflet.css) resolve in the ROOT stacking context and
 * paint OVER body-level overlays like #activity-modal (z-40) — the map
 * popup's "Open in Passus" then opens a modal the map covers, making the
 * compare drawer unusable. `isolation: isolate` gives #map-canvas its
 * own stacking context so all Leaflet z-indexes stay scoped to the map.
 */
#map-canvas {
    isolation: isolate;
}
