:root {
  --bg:        #0f0f0f;
  --surface:   #181818;
  --surface2:  #222222;
  --border:    #2a2a2a;
  --text:      #e8e8e8;
  --muted:     #888;
  /* The interface's blue. It was #fc4c02 — Strava's own orange — from the days when
     this was a Strava client; the application has several sources now, and its colour
     is the one its charts already use. #3b82f6 for text and fills, a deeper #2563eb
     (the logo's blue) for hover, so a button darkens instead of fading. */
  --accent:    #3b82f6;
  --accent-h:  #2563eb;
  --radius:    10px;
  --font:      'Inter', 'Segoe UI', system-ui, sans-serif;
  /* chart palette */
  --chart-bg:       transparent;
  --chart-axis:     #2a2a2a;
  --chart-split:    #1a1a1a;
  /* The activity charts' horizontal lines (m/h, min/km, km/h): read on the dark panel. */
  --chart-grid:     #3a3a3a;
  --chart-label:    #666;
  --chart-tip-bg:   #181818;
  --chart-tip-bdr:  #2a2a2a;
  --chart-tip-text: #e8e8e8;
  --chart-tip-muted:#888;
  --chart-pointer:  #444;
  --chart-ap-bg:    #1e1e1e;
  --chart-elev:     #a8774c;   /* a replay's elevation profile: brown, lighter on the dark */
}

.theme-light {
  --bg:        #f3f4f6;
  --surface:   #ffffff;
  --surface2:  #e9ecef;
  --border:    #d1d5db;
  --text:      #111827;
  --muted:     #6b7280;
  /* chart palette */
  --chart-bg:       transparent;
  --chart-axis:     #d1d5db;
  --chart-split:    #cfd4da;
  --chart-grid:     #cfd4da;
  --chart-label:    #9ca3af;
  --chart-tip-bg:   #ffffff;
  --chart-tip-bdr:  #d1d5db;
  --chart-tip-text: #111827;
  --chart-tip-muted:#6b7280;
  --chart-pointer:  #9ca3af;
  --chart-elev:     #8B5E3C;
  --chart-ap-bg:    #f3f4f6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

/* ── NAV ── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
}

/* The mark and the word are one logo: --accent is that same blue now. */
.nav-logo img { display: block; border-radius: 7px; }
.nav-logo-text span { color: var(--accent); }

.nav-links { display: flex; gap: 1.5rem; font-size: .875rem; color: var(--muted); }
.nav-links a:hover { color: var(--text); }

/* ── HERO ── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 1rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero h1 span { color: var(--accent); }

.hero p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 420px;
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

/* ── BUTTONS ── */
/* Same trap as `.account-state[hidden]`: a class that sets `display` beats the browser's
   own rule for the `hidden` attribute. Here for EVERY button rather than for the one that
   was caught — `hidden` has to mean hidden. */
.btn[hidden] { display: none; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(59,130,246,.35);
}

.btn-primary:hover {
  background: var(--accent-h);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59,130,246,.45);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--surface2); }

/* ── MAIN LAYOUT ── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── STATS BAR ── */
.stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1.25rem;
  flex: 1;
  min-width: 140px;
}

.stat-card .label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .25rem;
}

.stat-card .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

/* Compact variant, used on the activity page. Those cards are context, not the
   subject — the charts and the map are — so they get less room than on /stats or
   /activities where the same figures ARE the content. Scoped to a modifier rather
   than shrinking .stat-card, which four pages share. */
/* The head: the sport, the title, its "…", the date — nothing else. The description and
   the figures are the "Aperçu" tab's (or under the head, on a page without tabs): the
   other tabs start right under the title. */
.activity-head .activity-title { min-width: 0; }
.activity-head .activity-title h1 { margin-bottom: .15rem; }
/* The overview: the figures under the description, from the left, sized to their content. */
.act-overview .stats-bar { margin: .5rem 0 0; justify-content: flex-start; }
.act-overview .stats-bar-compact .stat-card { flex: 0 0 auto; }

/* One frame around everything that belongs to the selection: its elevation profile
   (present only while a selection is) and the metric panels, which are zoomed to it.
   The overview profile sits outside — it is the only chart still showing the whole
   activity, and the border is what says so. */
.selection-block {
  position: relative;          /* anchor for #sel-cursor */
  margin-top: .5rem;
  padding: .5rem 0 .25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.chart-flex #zone-chart { flex: 1 1 auto; min-width: 0; }

/* The continuous crosshair. Sits above the canvases, ignores the mouse, and matches
   the dashed pointer ECharts draws inside the grids so the two read as one line. */
/* Small boxes on the map page: the heatmap's zoom badge, the Traces tile-debug toggle. */
.map-box {
  padding: .15rem .4rem; background: var(--surface); color: var(--muted);
  font-size: .7rem; font-variant-numeric: tabular-nums; line-height: 1.5;
  border-radius: 4px; white-space: nowrap; text-align: right;
}

.tile-debug { display: flex; align-items: center; gap: .3rem; cursor: pointer; }
.tile-debug input { margin: 0; }

/* Colour key for the map's "Traces" mode — same visual weight as .map-box, which sits
   opposite it. Built client-side from the families actually drawn. */
.map-legend {
  padding: .3rem .5rem; background: var(--surface); color: var(--muted);
  font-size: .72rem; line-height: 1.6; border-radius: 4px;
  display: flex; flex-direction: column; gap: .1rem;
}
.map-legend span { display: flex; align-items: center; white-space: nowrap; }
.map-legend i {
  display: inline-block; width: 9px; height: 3px; border-radius: 2px; margin-right: .4rem;
}
.map-legend b {
  margin-left: auto; padding-left: .8rem; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.map-legend .none { opacity: .45; }           /* a family with nothing in view */
.map-legend .total {
  border-top: 1px solid var(--border); margin-top: .15rem; padding-top: .2rem; color: var(--text);
}

#sel-cursor {
  position: absolute; top: 0; bottom: 0; width: 0;
  border-left: 1px dashed var(--chart-pointer);
  display: none; pointer-events: none; z-index: 2;
}

.stats-bar-compact { gap: .5rem; }
.stats-bar-compact .stat-card { padding: .5rem .75rem; min-width: 96px; }
.stats-bar-compact .stat-card .label { font-size: .62rem; letter-spacing: .04em; margin-bottom: .1rem; }
.stats-bar-compact .stat-card .value { font-size: 1.05rem; }
/* The unit suffixes are inline-styled at .9rem in the template, which is now larger
   than the value itself — pull them back into proportion. */
.stats-bar-compact .stat-card .value span { font-size: .72rem !important; }

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.toolbar h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}

.toolbar-right { display: flex; align-items: center; gap: .75rem; }

select {
  appearance: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .45rem .9rem;
  border-radius: 7px;
  font-size: .875rem;
  cursor: pointer;
}

select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── TABLE ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

tbody td {
  padding: .75rem 1rem;
  color: var(--text);
  white-space: nowrap;
}

.td-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .2rem .55rem;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 500;
}

.td-muted { color: var(--muted); }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  transition: all .15s;
}

.pag-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}

.pag-btn {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.pag-btn:hover { background: var(--surface2); border-color: var(--border); }

.pag-dots { color: var(--muted); cursor: default; }

/* ── NAV ACTIVE & PROFILE ── */
.nav-links a.nav-active { color: var(--accent); }

.nav-profile { margin-left: 0; }

/* ── LANG SWITCH ── */
.lang-switch {
  display: flex;
  gap: .25rem;
}

.lang-btn {
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .45rem;
  border-radius: 5px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all .15s;
}

.lang-btn:hover   { color: var(--text); border-color: var(--border); }
.lang-active      { color: var(--accent) !important; border-color: var(--accent) !important; }

/* ── DROPDOWN ── */
.dropdown { position: relative; }

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 8px;
  transition: background .15s;
}
.dropdown-toggle:hover { background: var(--surface2); }

.dropdown-arrow { font-size: .65rem; color: var(--muted); }

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 200;
}

.dropdown.open .dropdown-menu { display: block; }

.dropdown-menu a {
  display: block;
  padding: .65rem 1rem;
  font-size: .875rem;
  color: var(--text);
  transition: background .1s;
}
.dropdown-menu a:hover { background: var(--surface2); }

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: .25rem 0;
}

.dropdown-lang-active { color: var(--accent) !important; }

.dropdown-theme-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .65rem 1rem;
  font-size: .875rem;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background .1s;
}
.dropdown-theme-btn:hover { background: var(--surface2); }

/* ── PROFILE PAGE ── */
.profile-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 480px;
}

.profile-card-pic {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.profile-card-name { font-size: 1.2rem; font-weight: 700; margin-bottom: .2rem; }
.profile-card-username { font-size: .85rem; margin-bottom: .4rem; }
.profile-card-meta { font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }

.badge-premium {
  display: inline-block;
  margin-top: .5rem;
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 5px;
}

.profile-pic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.profile-name {
  font-size: .875rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; word-break: break-word; }
.text-muted { color: var(--muted); font-size: .9rem; }

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 480px;
}

.card-info { font-size: .875rem; color: var(--muted); }

.status-msg { font-size: .875rem; color: var(--accent); min-height: 1.2em; }
.sector-error { font-size: .875rem; color: #ef4444; font-weight: 600; margin: .25rem 0 0; }
.sector-error[hidden] { display: none; }

/* ── PROGRESS BAR ── */
.progress-wrap {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-bottom: .5rem;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .6s ease;
  min-width: 2px;
}

.progress-label {
  font-size: .75rem;
  color: var(--muted);
  text-align: right;
  margin-bottom: 1rem;
}

/* ── CLICKABLE ROWS ── */
.tr-link, .tr-link td { cursor: pointer; }
.tr-link:hover { background: var(--surface2); }
.tr-link:hover td:first-child { border-left: 3px solid var(--accent); }

/* ── ACTIVITY DETAIL ── */
.back-link {
  display: inline-flex;
  align-items: center;
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: .75rem;
  padding: .25rem 0;
  min-height: 32px;
}
.back-link:hover { color: var(--text); }

/* ── STATS PAGE ── */
.stats-section-nav {
  display: flex;
  gap: .375rem;
  flex-wrap: wrap;            /* seven sections: they wrap on a phone */
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .75rem;
}

.stats-section-btn {
  padding: .35rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s;
}

.stats-section-btn:hover { color: var(--text); }

.stats-section-btn.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.stats-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.stats-controls .stats-toggle { margin-bottom: 0; }

.stats-toggle {
  display: flex;
  gap: .375rem;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .25rem;
  width: fit-content;
}

.stats-toggle-btn {
  padding: .4rem 1.1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  transition: background .15s, color .15s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
}

.stats-toggle-btn:hover { color: var(--text); }

.stats-toggle-btn.active {
  background: var(--surface2);
  color: var(--text);
}

.chart-tool-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .75rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.chart-tool-btn:hover   { color: var(--text); border-color: var(--border); }
.chart-tool-btn.active  { border-color: var(--accent); color: var(--accent); }

.stats-metric-cycle {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.stats-metric-cycle:hover { border-color: var(--border); color: var(--accent); }

.stats-year-selector {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  margin-bottom: 1.25rem;
}

.stats-year-btn {
  padding: .3rem .85rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: border-color .15s, color .15s;
}

.stats-year-btn:hover { color: var(--text); border-color: var(--border); }

.stats-year-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

#map {
  width: 100%;
  height: 380px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

#map:fullscreen { height: 100vh; border-radius: 0; }
/* An "i" beside a figure (templates/activity/activity.html, info): what is behind it, at once
   on hover and on a tap (focus). */
.info-i { position: relative; display: inline-grid; place-items: center; width: 1.05em; height: 1.05em;
          margin-left: .2em; border-radius: 50%; border: 1px solid currentColor; font: italic 700 .85em/1 Georgia, serif;
          text-transform: none; letter-spacing: 0; color: var(--muted); cursor: help; vertical-align: .05em;
          pointer-events: auto; }
.info-i:hover, .info-i:focus { color: var(--accent); outline: none; }
.info-i:hover::after, .info-i:focus::after {
  /* Opening to the right of its "i": centred on it, it ran off the pane's (or the map's)
     left edge — the "i"s are near the start of their line. */
  content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: -.4em;
  z-index: 1200; width: max-content; max-width: 260px; padding: .4rem .6rem; border-radius: 6px;
  background: var(--chart-tip-bg); color: var(--text); border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,.25); font: 400 .78rem/1.35 var(--font); white-space: normal; }
/* The sector kept (activity_sectors.js, pick): its row picked out in the list. */
#sectors-list tr.is-kept td { background: color-mix(in srgb, var(--accent) 16%, transparent); }
/* The key figures over the activity's map: one thin line, centred between the zoom (left)
   and the layers (right), above the tiles and under the controls; clicks pass through. */
#map .map-stats { position: absolute; top: 10px; left: 56px; right: 56px; z-index: 650;
                  display: flex; justify-content: center; pointer-events: none; }
#map .map-stats { flex-wrap: wrap; gap: .25rem .9rem; margin: 0 auto; width: fit-content;
                  max-width: calc(100% - 112px); padding: .3rem .8rem; border-radius: 8px;
                  background: color-mix(in srgb, var(--surface) 88%, transparent);
                  border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,.2);
                  color: var(--text); font-size: .85rem; font-weight: 600; white-space: nowrap; }
#map .map-stats small { color: var(--muted); font-weight: 400; font-size: .72rem; }
/* The replay's controls take the top of the map (replay_player.showOnMap): the figures go
   just under them, both read — and once it is started, playing or paused ("started", from
   the first play to the ✕), they make way altogether: the map is the race's. */
#map:has(.replay-onmap:not([hidden])) .map-stats { top: 54px; }
#map:has(.replay-onmap.started:not([hidden])) .map-stats { display: none; }
/* By the MAP's width, not the window's: the divider dragged, a phone — one line always,
   the least needed figures left out first. */
#map { container-type: inline-size; }
@container (max-width: 560px) { #map .map-stats-rate, #map .map-stats-total { display: none; } }
@container (max-width: 400px) { #map .map-stats-climb { display: none; } }
/* Another page's map in the same layout (templates/sectors/sector.html): #map's look. */
/* A table wider than its pane, the divider dragged: scrolled in it, not under the map. */
#sector-efforts, #route-list, #route-pick, #sectors-list { overflow-x: auto; }
.split-map { width: 100%; height: 340px; border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden; }

/* Activity layout — mobile-first: stacked column, map on top.
   Becomes a two-column (charts left / map right) split on wide screens only. */
.page-wide { max-width: 1700px; }
.activity-split { display: flex; flex-direction: column; gap: 1.25rem; }
/* Base state: no divider while the layout is stacked (map above charts) — there is
   no horizontal split to drag. Declared BEFORE the min-width block on purpose: a
   media query adds no specificity, so an identical selector placed after it would
   win at every width and hide the handle for good. */
.activity-split .split-handle { display: none; }
.activity-split .split-right { order: -1; }   /* map above charts when stacked */

@media (min-width: 1025px) {
  .activity-split { flex-direction: row; align-items: flex-start; }
  .activity-split .split-left  { flex: 1 1 0; min-width: 0; order: 0; }
  /* Held just below the site's sticky nav (56 px), and its map the height of the window
     left under it: it used to stick at 1rem — its top under the nav — and to be the whole
     window tall, its bottom out of sight (6 October). */
  .activity-split .split-right {
    flex: 1 1 0; min-width: 0; order: 0;
    position: sticky; top: calc(56px + 1rem);
  }
  .activity-split .split-right #map,
  .activity-split .split-right .split-map { height: calc(100vh - 56px - 2rem); }
  /* Shorter while replaying similar routes (static/activity_route.js, roomForReplay):
     the replay's chart and controls are what the eye follows. */
  .activity-split.route-replaying .split-right #map { height: 70vh; }

  /* Draggable divider. The grab area is deliberately wider than the visible line —
     a 2 px target is a 2 px target whatever it looks like. */
  .activity-split .split-handle {
    display: block; flex: 0 0 12px; align-self: stretch;
    position: relative; cursor: col-resize;
    touch-action: none;            /* pointer events, not page scrolling */
  }
  .activity-split .split-handle::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
    width: 2px; margin-left: -1px; border-radius: 1px;
    background: var(--border); transition: background .15s;
  }
  .activity-split .split-handle:hover::before,
  .activity-split .split-handle:focus-visible::before,
  .activity-split .split-handle.dragging::before { background: #3b82f6; width: 3px; }
  .activity-split .split-handle:focus-visible { outline: none; }
}


/* While dragging, stop the pointer from selecting chart labels and map text. */
body.split-dragging { user-select: none; cursor: col-resize; }

#chart {
  width: 100%;
  height: 180px;
  margin-top: 1rem;
}

.zone-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid #3b82f6;
  border-radius: var(--radius);
  padding: .6rem 1rem;
  margin-top: .75rem;
  font-size: .875rem;
  flex-wrap: wrap;
}

.zone-label { color: #3b82f6; font-weight: 600; }
.zone-item  { display: flex; gap: .4rem; }
.zone-key   { color: var(--muted); }
.zone-val   { color: var(--text); font-weight: 600; }
.zone-clear {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 .25rem;
}
.zone-clear:hover { color: var(--text); }

.charts-container { margin-top: .75rem; }
.chart-flex { display: flex; align-items: stretch; }
/* The sector profile shares the activity's .chart-flex to put a cursor-readout column beside
   the chart. But the replay inserts its Temps|Vitesse toggle right before the chart
   (replay_player.showCurveToggle) — i.e. as a child of this flex, where align-items:stretch
   blew it up to the chart's full height. Pull it out of the flow (absolute) so it sits above
   the row at its natural size; reserve space for it only once it exists (:has). */
.sector-profile-flex { position: relative; }
.sector-profile-flex:has(> .replay-curve) { padding-top: 2.1rem; }
.sector-profile-flex > .replay-curve { position: absolute; top: 0; left: 0; margin: 0; }
.chart-flex #chart, .chart-flex #chart-elev { flex: 1 1 auto; min-width: 0; }
/* One value column per chart — they can no longer be a single overlay now that the
   zone profile sits between the two instances. */
.cv-col { position: relative; flex: 0 0 70px; width: 70px; }
.cv-row {
  position: absolute;
  right: 6px;
  left: 0;
  transform: translateY(-50%);
  text-align: right;
  pointer-events: none;
}
.cv-val  { font-size: .95rem; font-weight: 700; color: var(--text); line-height: 1.15; }
.cv-unit { font-size: .68rem; color: var(--muted); }
.cv-slope { font-size: .82rem; font-weight: 600; color: var(--text); line-height: 1.15; margin-top: .35rem; }
.cv-vam  { font-size: .82rem; font-weight: 600; color: #8B5E3C; line-height: 1.15; margin-top: .35rem; }
/* Cursor position (distance and elapsed time), under the elevation readout.
   tabular-nums matters here: with proportional digits the numbers jitter sideways as
   the cursor sweeps, which is exactly when you are trying to read them. */
.cv-x {
  /* Same size and weight as .cv-slope just above it — the column reads as one block,
     and only the colour separates a position from a measurement. */
  font-size: .82rem; font-weight: 600; color: var(--muted); line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.cv-x-last { padding-bottom: .3rem; margin-bottom: .45rem; border-bottom: 1px solid var(--border); }
.charts-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}
.toolbar-label { color: var(--muted); font-size: .8rem; }

/* Metric show/hide chips */
.metric-toggles { display: flex; flex-wrap: wrap; gap: .4rem; }
.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
}
.metric-chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; opacity: .35; }
.metric-chip.active { color: var(--text); border-color: var(--border); }
.metric-chip.active .chip-dot { opacity: 1; }
.metric-chip:not(.active) { opacity: .55; text-decoration: line-through; }
.metric-chip:hover { background: var(--surface2); }
.axis-toggle-group { display: flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
/* Activity page tabs: Charts | Profiles (static/activity_profiles.js). */
.act-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: .75rem; }
.act-tabs button {
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: .45rem .9rem; color: var(--muted); font: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer;
}
.act-tabs button:hover { color: var(--text); }
.act-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.profiles .hist-rank {
  margin-left: .6rem; font-size: .78rem; font-weight: 600; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.profiles .hist-select {
  margin-left: .5rem; padding: .1rem .3rem; font-size: .8rem; font-weight: 400;
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 4px;
}
.profiles .profile-title { font-size: .85rem; font-weight: 600; color: var(--muted); margin: 1rem 0 .25rem; }
.profiles .profile-chart { width: 100%; height: 300px; }
.profiles [hidden] { display: none !important; }

.axis-btn {
  background: none;
  border: none;
  color: var(--muted);
  padding: .25rem .75rem;
  font-size: .8rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.axis-btn:not(:last-child) { border-right: 1px solid var(--border); }
.axis-btn.active { background: #3b82f6; color: #fff; }
.axis-btn:not(.active):hover { background: var(--surface2); color: var(--text); }

.fs-btn {
  width: 30px;
  height: 30px;
  font-size: 1rem;
  background: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1rem;
  gap: 1rem;
}
.empty-state--small { padding: 2rem 1rem; }

.empty-icon { font-size: 3rem; line-height: 1; }

.empty-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.empty-text {
  color: var(--muted);
  font-size: .95rem;
  max-width: 380px;
  line-height: 1.6;
}


/* ── SEARCH INPUT ── */
.search-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .45rem .9rem;
  border-radius: 7px;
  font-size: .875rem;
  width: 180px;
  font-family: var(--font);
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-input::placeholder { color: var(--muted); }

/* ── MAP PAGE ── */
/* Wider than the other pages and no title: the map takes the room. A column filling the
   viewport under the nav, so the map gets whatever the toolbar leaves — one row on a
   desktop, two or three once it wraps on a phone. */
.page-map {
  max-width: none; padding-block: 1rem;
  display: flex; flex-direction: column;
  height: calc(100dvh - 56px);
}

/* Controls glued to the top of the map: one block, toolbar then map. */
.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  padding: .5rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.map-toolbar-form, .map-toolbar-end {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem .75rem;
}
.map-toolbar .btn { padding: .4rem 1rem; }
.map-toolbar .btn[hidden] { display: none; }   /* .btn is inline-flex, which beats [hidden] */

/* Mode switch: two exclusive buttons joined into one control. */
.map-modes {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.map-modes button {
  padding: .4rem .9rem;
  background: var(--surface2);
  color: var(--muted);
  border: none;
  font: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer;
}
.map-modes button + button { border-left: 1px solid var(--border); }
.map-modes button:hover { color: var(--text); }
.map-modes button.on { background: var(--accent); color: #fff; cursor: default; }
.map-modes button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.map-count {
  font-size: .875rem;
  color: var(--muted);
}

#map-view {
  width: 100%;
  height: 100%;
  min-height: 300px;
  border-radius: 0 0 var(--radius) var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.btn-primary:disabled { opacity: .45; cursor: default; }

/* ── ACCOUNT STATE (bandeau de toutes les pages, templates/_account_state.html) ── */
/* `display: flex` on a class beats the `hidden` attribute, whose `display: none` comes
   from the browser's own stylesheet — so the banner stayed visible, empty, on an IDLE
   account. The same line is on `.btn` below, for the Cancel button it also caught. */
.account-state[hidden] { display: none; }
.account-state {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin: 0 0 1rem; padding: .6rem .9rem;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); background: var(--card, transparent);
  font-size: .85rem; color: var(--text);
}
/* A state that also FORBIDS something (a destructive button) says so in its colour. */
.account-state-reserved { border-left-color: #f59e0b; }
.account-state-dot {
  width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent);
  animation: account-state-pulse 1.6s ease-in-out infinite;
}
.account-state-reserved .account-state-dot { background: #f59e0b; }
.account-state-text { flex: 1 1 auto; }
.account-state-cancel { padding: .3rem .6rem; font-size: .78rem; }
/* On its own line under the state: the way to go faster (_account_state.html). */
.account-state-hint { flex: 1 0 100%; color: var(--muted); }
.account-state-hint[hidden] { display: none; }
.account-state-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.account-state-link:hover { color: var(--accent-h); text-decoration: underline; }
@keyframes account-state-pulse { 50% { opacity: .25; } }
/* The reason a button is greyed, under it (account.html). */
.danger-zone-busy { font-size: .78rem; color: #f59e0b; margin-top: .5rem; }
@media (prefers-reduced-motion: reduce) {
  .account-state-dot { animation: none; }
}

/* ── SIMILAR ROUTE tab (templates/activity/activity.html) ── */
.route-nostop { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
/* Which activities run, ticked in the list. */
.route-table td.pick { width: 1.6rem; text-align: center; }
.route-table input[type="checkbox"] { accent-color: var(--accent); }
/* The legend, on the map: one line per activity, in the colour its marker wears. */
.route-legend { background: var(--surface); padding: .4rem .55rem; border-radius: 6px;
                border: 1px solid var(--border); font-size: .75rem; line-height: 1.5;
                box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.route-legend b { display: block; font-size: .7rem; color: var(--muted); font-weight: 600;
                  text-transform: uppercase; letter-spacing: .03em; }
.route-legend span.dot { display: inline-block; width: .55rem; height: .55rem;
                         border-radius: 50%; margin-right: .35rem; }
.route-legend-date { color: var(--muted); }
.route-legend-note { color: var(--muted); font-size: .7rem; max-width: 15rem; margin-top: .25rem;
                     line-height: 1.3; }
/* "Nothing to replay", when a selection cannot be replayed. */
.route-standings { margin-top: .6rem; font-size: .8rem; color: var(--muted); }
.route-table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: 1rem; }
.route-table th { text-align: left; font-weight: 600; color: var(--muted); padding: .35rem .5rem; }
.route-table td { padding: .35rem .5rem; border-top: 1px solid var(--border); }
.route-table a { color: var(--accent); text-decoration: none; }
.route-table a:hover { text-decoration: underline; }
/* This activity among the others: the same blue as its bucket in the histogram. */
.route-table tr.route-mine td { background: rgba(59, 130, 246, .12); font-weight: 600; }
/* The tip over a replay's profile: each pass's gap to the reference (static/replay_gaps.js,
   the similar routes' and a sector's). */
.gap-tip { position: absolute; top: 6px; z-index: 5; pointer-events: none; white-space: nowrap;
  background: var(--chart-tip-bg); border: 1px solid var(--chart-tip-bdr); color: var(--chart-tip-text);
  border-radius: 6px; padding: .35rem .55rem; font-size: .75rem; line-height: 1.45; }
.gap-tip[hidden] { display: none; }
.gap-tip .dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%;
  vertical-align: middle; }
/* A table so names, values and watts line up in columns (ReplayGaps.showTip). */
.gap-tip-place { font-weight: 700; margin-bottom: .1rem; }
.gap-tip table { border-collapse: collapse; }
.gap-tip td { padding: .02rem 0; vertical-align: middle; }
.gap-tip td:first-child { padding-right: .35rem; }
.gap-tip-n { padding-right: .5rem; }
.gap-tip-date { color: var(--muted); font-size: .7rem; padding-right: .6rem; }
.gap-tip-v { text-align: right; font-weight: 600; }
.gap-tip-w { text-align: right; font-weight: 600; color: var(--muted); padding-left: .55rem; }
.gap-tip-ref { color: var(--muted); font-size: .7rem; padding-left: .55rem; }
/* The activity's "…" menu: download, delete (templates/activity/activity.html). */
/* The title and its "…", side by side; the name may wrap, the button stays at its right. */
.act-title-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.act-sport { flex: none; display: inline-flex; align-items: center; gap: .3rem; }
.act-title-row .back-link { margin-bottom: 0; flex: none; }
.act-title-row h1 { margin: 0; min-width: 0; }
.act-menu { position: relative; flex: none; margin-top: .2rem; }
.act-menu-btn { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px;
                padding: .15rem .7rem; cursor: pointer; font-size: 1.1rem; line-height: 1.2; }
.act-menu-btn:hover { border-color: var(--accent); }
.act-menu-list { position: absolute; right: 0; top: calc(100% + .3rem); z-index: 1100; min-width: 11rem;
                 background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
                 box-shadow: 0 4px 14px rgba(0,0,0,.25); padding: .3rem 0; }
.act-menu-list[hidden] { display: none; }
.act-menu-list > a, .act-menu-list > button { display: block; width: 100%; text-align: left; background: none;
                 border: none; padding: .45rem .9rem; font-size: .88rem; color: var(--text);
                 text-decoration: none; cursor: pointer; }
.act-menu-list > a:hover, .act-menu-list > button:hover { background: var(--border); }
.act-menu-list .act-menu-danger { color: #c0392b; }

/* The efforts' tables (efforts_table.js): the period, beside the stops box; a row kept out
   of the period — ticked, or this activity — greyed, unranked. */
.effort-period { display: inline-flex; margin-left: .75rem; vertical-align: middle; }
.route-table tr.effort-out td { opacity: .5; }
/* The choice of curve over a replay's profile: Temps | Vitesse (replay_player.js). */
.replay-curve { display: inline-flex; margin: .5rem 0 .25rem; }
.replay-curve[hidden] { display: none; }
.leaflet-tooltip.replay-speed { text-align: center; line-height: 1.3; }
/* Above a replay's marker on the map: its speed against the reference (replay_gaps.labelMarker). */
.leaflet-tooltip.replay-speed { padding: 1px 5px; font-size: .68rem; font-weight: 600;
  background: var(--chart-tip-bg); color: var(--chart-tip-text); border: 1px solid var(--chart-tip-bdr);
  border-radius: 4px; box-shadow: none; }
.leaflet-tooltip.replay-speed::before { display: none; }
/* A replay on the map (replay_player.js, showOnMap): one white box like the map's own
   buttons — play, the speed (each click the next one), the clock — and once played a
   translucent progress bar beside it. At the TOP, right of the zoom buttons: the map is the
   window's height and starts below the header, its bottom out of sight until one scrolls. */
.replay-onmap { position: absolute; left: 56px; top: 10px; z-index: 800; display: flex;
  align-items: center; gap: .6rem; width: min(70%, 460px); pointer-events: none; }
.replay-onmap[hidden] { display: none; }
.replay-onmap > * { pointer-events: auto; }
.replay-onmap-box { flex: 0 0 auto; display: flex; align-items: center; height: 34px; padding: 0 3px;
  background: #fff; color: #333; border: 2px solid rgba(0,0,0,.2); background-clip: padding-box;
  border-radius: 19px; }
.replay-onmap-play { width: 28px; height: 28px; border-radius: 50%; border: 0; display: grid;
  place-items: center; cursor: pointer; color: #fff; background: var(--accent); }
.replay-onmap-play:hover { background: #2563eb; }
.replay-onmap-speed { display: inline-flex; align-items: center; gap: 4px; height: 28px; margin-left: 4px;
  padding: 0 9px; border: 0; border-radius: 14px; background: transparent; color: #333; cursor: pointer;
  font: 700 .75rem/1 var(--font); font-variant-numeric: tabular-nums; }
.replay-onmap-speed:hover { background: #f1f3f5; }
.replay-onmap-speed svg { color: var(--accent); }
.replay-onmap-clock { padding: 0 9px 0 8px; border-left: 1px solid #e5e7eb; color: #4b5563;
  font: 600 .75rem/1 var(--font); font-variant-numeric: tabular-nums; }
.replay-onmap-bar { visibility: hidden; flex: 1 1 auto; height: 10px; border-radius: 5px; cursor: pointer;
  background: rgba(255, 255, 255, .55); box-shadow: 0 0 0 1px rgba(0,0,0,.25); overflow: hidden; }
.replay-onmap-close { visibility: hidden; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: #333; background: #fff;
  border: 2px solid rgba(0,0,0,.2); background-clip: padding-box; }
.replay-onmap-close:hover { background: #f1f3f5; }
.replay-onmap.started .replay-onmap-bar, .replay-onmap.started .replay-onmap-close { visibility: visible; }
.replay-onmap-fill { height: 100%; width: 0; background: var(--accent); }
.route-table tr.route-gap td { text-align: center; color: var(--muted); padding: .1rem; }
.route-more { margin-top: .5rem; }
.route-views { display: inline-flex; width: fit-content; margin: .25rem 0 .75rem; vertical-align: middle; }
/* The stops box, shared by both views: beside their buttons. */
.route-views + .route-nostop { margin-left: .9rem; vertical-align: middle; }
.route-profile { height: 220px; margin: .5rem 0; }
.route-profile[hidden] { display: none; }
.route-pick-table td.pick .dot { display: inline-block; width: .7rem; height: .7rem;
                                 border-radius: 50%; vertical-align: middle; }
.route-pick-table input[disabled] { opacity: .6; }

/* The activities of one histogram bar (activity_profiles.js, openList). */
.hist-pop { position: fixed; z-index: 1000; width: min(420px, 92vw); max-height: 60vh;
            overflow: auto; background: var(--surface); color: var(--text);
            border: 1px solid var(--border); border-radius: 8px; font-size: .82rem;
            box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.hist-pop[hidden] { display: none; }
.hist-pop-head { position: sticky; top: 0; display: flex; align-items: center; gap: .4rem;
                 padding: .5rem .75rem; background: var(--surface);
                 border-bottom: 1px solid var(--border); }
.hist-pop-close { margin-left: auto; background: none; border: 0; color: var(--muted);
                  font-size: 1.1rem; cursor: pointer; line-height: 1; }
.hist-pop-list { list-style: none; margin: 0; padding: .25rem 0; }
.hist-pop-list a { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: .5rem;
                   padding: .3rem .75rem; color: var(--text); text-decoration: none; }
.hist-pop-list a:hover { background: var(--surface2); }
.hist-pop-list .d, .hist-pop-list .v { color: var(--muted); white-space: nowrap; }
.hist-pop-list .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-pop-list li.mine a { background: rgba(59, 130, 246, .12); font-weight: 600; }
.hist-tip-hint { color: var(--chart-label); font-size: 11px; }

/* ── DANGER ZONE (profil) ── */
.danger-zone { border-color: #7f1d1d; }
.danger-zone-title {
  font-weight: 700; color: #ef4444; font-size: .9rem;
  text-transform: uppercase; letter-spacing: .03em; margin-bottom: .5rem;
}
.danger-zone-text { font-size: .82rem; color: var(--muted); line-height: 1.5; margin-bottom: .8rem; }
.btn-danger {
  background: #b91c1c; color: #fff; border: none;
  padding: .5rem .9rem; border-radius: var(--radius);
  cursor: pointer; font-size: .85rem; font-weight: 600;
}
.btn-danger:hover { background: #dc2626; }
.btn-danger:disabled { opacity: .6; cursor: default; }


/* ── HEATMAP — click lookup panel ── */
.map-wrap { position: relative; flex: 1; min-height: 0; }

/* Anchored top-left, clear of Leaflet's zoom control (10px + ~30px wide); the
   layers control keeps the top-right corner to itself. */
.hit-panel {
  position: absolute; top: 12px; left: 52px; z-index: 500;
  width: 330px; max-width: calc(100% - 64px);
  max-height: calc(100% - 24px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
  font-size: .875rem;
  overflow: hidden;
}
.hit-panel[hidden] { display: none; }

.hit-head {
  padding: .75rem .875rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.hit-close {
  position: absolute; top: .5rem; right: .5rem;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.25rem; line-height: 1;
  padding: 0 .25rem;
}
.hit-close:hover { color: var(--text); }

.hit-total { font-size: 1.35rem; font-weight: 700; }
.hit-total small { font-size: .8rem; font-weight: 400; color: var(--muted); }
.hit-period { font-size: .78rem; color: var(--muted); margin-top: .1rem; }

/* Sport split — one stacked bar, proportional */
.hit-sports { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin: .6rem 0 .35rem; }
.hit-sports span { display: block; }
.hit-legend { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .72rem; color: var(--muted); }
.hit-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: .25rem; }

/* Year histogram, doubling as the year filter — the useful control when a hot
   spot returns several hundred activities. */
.hit-years { display: flex; align-items: flex-end; gap: 2px; height: 34px; margin-top: .6rem; }
.hit-years button {
  flex: 1; min-width: 0; background: var(--surface2); border: none; cursor: pointer;
  border-radius: 2px 2px 0 0; padding: 0; position: relative;
}
.hit-years button:hover { background: var(--muted); }
.hit-years button.on { background: var(--accent); }
.hit-years button::after {
  content: attr(data-y); position: absolute; bottom: -13px; left: 50%;
  transform: translateX(-50%); font-size: .58rem; color: var(--muted);
}
.hit-years.dense button::after { content: none; }

.hit-list { overflow-y: auto; flex: 1; }
.hit-item {
  display: block; padding: .5rem .875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none; cursor: pointer;
}
.hit-item:hover { background: var(--surface2); }
.hit-item-name {
  font-weight: 600; font-size: .82rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hit-item-meta { font-size: .72rem; color: var(--muted); margin-top: .1rem; }

.hit-more {
  width: 100%; padding: .55rem; background: var(--surface2);
  border: none; border-top: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: .8rem;
}
.hit-more:hover { background: var(--border); }
.hit-empty { padding: .875rem; color: var(--muted); font-size: .8rem; }

/* Small screens: bottom sheet rather than a floating card over the whole map */
@media (max-width: 640px) {
  .hit-panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: 100%; max-height: 55%;
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

/* ── ACCOUNTS PAGE ── */
.account-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1.25rem;
  transition: border-color .15s;
}

.account-card-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.account-info     { flex: 1; min-width: 0; }
.account-name     { font-weight: 600; font-size: .95rem; }
.account-username { font-size: .8rem; color: var(--muted); }

.account-badge-active {
  font-size: .75rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: .2rem .7rem;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ── */

.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  margin-left: auto;
  flex-shrink: 0;
  transition: background .15s;
}
.nav-hamburger:hover { background: var(--surface2); }

/* ── Mobile nav panel (hidden on desktop) ── */
.nav-mobile {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 56px;
  left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  z-index: 98;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}
.nav-mobile.open { display: flex; }

.nav-mobile a {
  padding: .9rem 1.5rem;
  font-size: .95rem;
  color: var(--muted);
  border-left: 3px solid transparent;
  transition: color .1s, background .1s;
}
.nav-mobile a:hover         { color: var(--text); background: var(--surface2); }
.nav-mobile-active          { color: var(--accent) !important; border-left-color: var(--accent) !important; }
.nav-mobile-lang-active     { color: var(--accent) !important; }
.nav-mobile-divider         { height: 1px; background: var(--border); }
.nav-mobile-account         { display: flex; align-items: center; gap: .6rem; padding: .9rem calc(1.5rem + 3px);
                              font-weight: 600; color: var(--text); }

/* ── Tablet & mobile nav ── */
@media (max-width: 768px) {
  nav { padding: 0 1rem; }
  .nav-links      { display: none; }
  .nav-profile    { display: none; }
  .nav-hamburger  { display: flex; }
}

/* ── Mobile layout ── */
@media (max-width: 640px) {
  .page { padding: 1rem; }

  /* Stats bar: 2 cards per row */
  .stats-bar { gap: .625rem; }
  .stat-card { min-width: calc(50% - .375rem); flex: none; }
  .stat-card .value { font-size: 1.2rem; }

  /* Toolbar: stack selects */
  .toolbar { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .toolbar-right { flex-wrap: wrap; width: 100%; }

  /* Table: horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Pagination: smaller buttons */
  .pagination a, .pagination span { width: 32px; height: 32px; font-size: .8rem; }

  /* Stats section nav */
  .stats-section-nav { gap: 0; }

  /* Stats controls: stack vertically */
  .stats-controls { flex-direction: column; align-items: stretch; gap: .625rem; }
  .stats-controls .stats-toggle { width: 100%; justify-content: stretch; }
  .stats-toggle-btn { flex: 1; text-align: center; justify-content: center; }
  .stats-toggle { width: 100%; }

  /* Year selector: smaller pills */
  .stats-year-btn { padding: .25rem .6rem; font-size: .75rem; }

  /* Activity page: smaller map */
  #map { height: 240px; }

  /* Hover-value column: narrower to leave room for the plot */
  .cv-col { flex-basis: 52px; width: 52px; }
  .cv-val { font-size: .85rem; }

  /* Zone stats: compact */
  .zone-stats { gap: .6rem; padding: .5rem .75rem; font-size: .8rem; }

  /* Profile card: stack */
  .profile-card { flex-direction: column; align-items: flex-start; max-width: 100%; }
}

/* ── Place filter (activities list) ─────────────────────────────────────────
   A typeahead, then a chip once a place is picked: the filter is a KEY, so it is
   shown as a thing to remove rather than as editable text. */
.area-search { position: relative; display: inline-block; }
.area-suggest {
  /* 1100: above Leaflet's panes (400+) and controls (1000) — on the map page the
     list opens over the map. */
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 1100; min-width: 100%;
  width: max-content; max-width: 22rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.area-item {
  display: grid; grid-template-columns: 1fr auto; column-gap: .8rem;
  padding: .4rem .7rem; cursor: pointer; font-size: .85rem;
}
.area-item b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.area-item small { grid-column: 1 / -1; color: var(--muted); font-size: .72rem; }
.area-item.on, .area-item:hover { background: var(--surface2); }
.area-chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .3rem .25rem .6rem;
  border: 1px solid var(--accent); border-radius: 999px; font-size: .85rem; white-space: nowrap;
}
.area-chip small { color: var(--muted); font-size: .72rem; }
.area-chip button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: .8rem; padding: 0 .25rem; line-height: 1;
}
.area-chip button:hover { color: var(--text); }


/* ── Données: the manual import's dropzone ──────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 1.75rem 1rem;
  text-align: center; cursor: pointer; background: var(--surface2);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); }
.dropzone.over { border-color: var(--accent); background: var(--surface); }
.dropzone-main { margin: 0; font-weight: 600; }
.dropzone-sub { margin: .25rem 0 0; color: var(--muted); font-size: .85rem; }

/* What this activity brought to a profile chart, when it is little or nothing. */
.profiles .profile-note { margin-left: .5rem; font-weight: 400; font-size: .78rem; color: var(--muted); }

/* ── The account page: ways in, and sources ─────────────────────────────── */
.card-title { font-weight: 600; margin-bottom: .35rem; }
.btn-small { padding: .25rem .6rem; font-size: .78rem; }

/* The ways in, side by side: one of them is not more of a way in than the others. */
.login-others { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.login-others .btn { display: inline-flex; align-items: center; gap: .45rem; }

/* The activity title, while it is being edited. Same size and weight as the heading it
   replaces, so the line does not jump when you click it. */
.name-input {
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: .1rem .4rem;
  min-width: 14rem;
  max-width: 100%;
}
#act-name, #route-name { cursor: text; border-bottom: 1px dashed transparent; }
#act-name:hover, #act-name:focus-visible,
#route-name:hover, #route-name:focus-visible { border-bottom-color: var(--muted); outline: none; }
#name-saved { font-size: .8rem; font-weight: 400; margin-left: .5rem; }

/* The footer of every page: the privacy policy and where the data comes from. Quiet on
   purpose — it is there to be found, not to be read. */
.site-footer {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center;
  padding: 2rem 1rem 1.5rem; margin-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: .82rem;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* The privacy policy: prose, so it needs a reading width and air between its parts. */
.legal { max-width: 44rem; }
.legal h2 { margin: 1.8rem 0 .6rem; font-size: 1.05rem; }
.legal p, .legal li { line-height: 1.6; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: .4rem; }

/* "View on Strava": their API guidelines ask for the exact phrase, legible and clearly a
   link — bold, underlined, or their orange. Ours is bold and underlined: the site has no
   Strava orange left (see CLAUDE.md, Conventions UI). */
.strava-link, .act-menu-list > a.strava-link { font-weight: 600; text-decoration: underline; }

/* "Powered by Strava", their file as they ship it — never recoloured (their brand rules).
   The theme picks the colour they already provide. */
.strava-badge img { height: 1.1rem; display: block; }
.strava-badge .on-light { display: none; }
.theme-light .strava-badge .on-dark { display: none; }
.theme-light .strava-badge .on-light { display: block; }

/* "Connect with Strava", their own button image — never redrawn (their brand rules). Its
   height follows the buttons beside it; the file is 237×48, and @2x for dense screens. */
.strava-connect { display: inline-block; line-height: 0; }
.strava-connect img { height: 2.4rem; width: auto; display: block; }

/* The Strava card of the account page: their logo, then who is connected. */
.strava-source { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* The activity's description, under its title: its own line breaks kept; empty, a muted
   invitation to write one (data-empty, translated). Edited in a text area as wide as it. */
.act-date { margin: .3rem 0 0; }
/* The description: a block of its own under the date, its lines kept, a rule at its left;
   empty, just the discreet line that says how to add one. */
.act-description { margin: .5rem 0 .75rem; padding: .1rem 0 .1rem .7rem; font-size: .9rem;
                   line-height: 1.45; color: var(--text); border-left: 2px solid var(--border);
                   max-width: 48rem; }
/* Read from the text itself, not a class to keep in step: saved empty, it says so at once. */
.act-description:has(> #act-description:empty) { border-left-color: transparent; padding-left: 0; margin-top: .2rem;
                            color: var(--muted); }
#act-description { white-space: pre-line; cursor: text; }
#act-description:empty::before { content: attr(data-empty); font-style: italic; opacity: .7; }
.name-actions { display: flex; align-items: center; gap: .5rem; margin-top: .4rem; flex-wrap: wrap; }
.name-actions .btn { padding: .3rem .9rem; font-size: .85rem; }
.name-hint { color: var(--muted); font-size: .72rem; }
@media (hover: none) { .name-hint { display: none; } }   /* a phone: no keys to tell of */
.name-textarea { display: block; width: 100%; font-weight: 400; font-size: .9rem;
                 resize: vertical; margin-top: .4rem; }

/* Parcours favoris: the table and the times at the left, the route on a map at the right —
   kept in view while the table scrolls. One column on a phone, the map first. */
.routes-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 36%); gap: 1rem; align-items: start; }
.routes-map { height: 460px; border-radius: 8px; border: 1px solid var(--border); position: sticky; top: 1rem; }
@media (max-width: 900px) {
  .routes-split { grid-template-columns: 1fr; }
  .routes-map { order: -1; position: static; height: 300px; }
}
.routes-left { min-width: 0; overflow-x: auto; }   /* a wide table scrolls, never under the map */
.stat-card .value-of { font-size: 1rem; font-weight: 400; color: var(--muted); }  /* "245 / 276" */
.routes-left .table td:first-child { white-space: normal; }  /* a long route name wraps, the figures stay in view */

/* How many suspect activities wait, beside the tab's name (Données page). */
.tab-count { display: inline-block; min-width: 1.3em; padding: 0 .35em; margin-left: .25rem;
             border-radius: 999px; background: #f59e0b; color: #111; font-size: .72rem;
             font-weight: 700; text-align: center; line-height: 1.4; }
/* Suspect activities: the name and the reason wrap, the date and the two buttons do not. */
#sus-table td { white-space: normal; }
#sus-table td:first-child, #sus-table td:last-child { white-space: nowrap; }

/* The way to the Strava archive, step by step (data/data.html). */
.sx-steps { margin: .25rem 0 .75rem; padding-left: 1.25rem; font-size: .85rem; line-height: 1.5; }
.sx-steps a { color: var(--accent); }

/* Every Leaflet map keeps its layers to itself. Its panes (z-index 400) and controls (1000)
   otherwise stack against the whole page, and the map covered the account menu, whose nav
   sits at 100. `isolation` makes the map one layer, painted in its place. */
.leaflet-container { isolation: isolate; }

/* "Créer un secteur", in the selection's bar, beside the ✕ (static/sector_create.js). */
.zone-sector { padding: .25rem .65rem; font-size: .78rem; }
.zone-sector:disabled { opacity: .45; cursor: not-allowed; }
/* Placing its two ends before it is cut: the bar under the selection's, and the handles
   on the map. `:not([hidden])`, or the display would beat `hidden`. */
.sector-adjust:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem;
  padding: .5rem .75rem; margin-bottom: .6rem; border: 1px solid var(--accent);
  border-radius: var(--radius); font-size: .82rem; }
.sector-adjust-hint { flex-basis: 100%; color: var(--muted); }
.sector-adjust-end { display: inline-flex; align-items: center; gap: .3rem; }
/* A stretch's start and finish on a map — the selection's, a sector's being placed — and
   in the bar that names them: a disc with its letter (D / A). */
.map-pin { display: inline-block; width: 22px; height: 22px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); color: #fff; text-align: center;
  font: 700 11px/18px system-ui, sans-serif; vertical-align: middle; }
.map-pin.start { background: #22c55e; }
.map-pin.end { background: #ef4444; }
.leaflet-marker-icon.sector-handle { cursor: grab; }
/* The record above a sector's passes (templates/sectors/sector.html). */
.sector-record { font-weight: 600; margin: .4rem 0 .6rem; }
/* The "Secteurs" tab: the activity's profile and a line per sector (static/activity_sectors.js). */
.sectors-chart { position: relative; }
.sectors-profile { width: 100%; margin-bottom: .5rem; }
/* The sector hovered or kept, between the profile and the bars (activity_sectors.js, info). */
.sectors-info { position: absolute; left: 0; right: 16px; font-size: .82rem; white-space: nowrap;
                overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.sectors-info a { font-weight: 600; }
.sectors-info small { color: var(--muted); }
.sectors-info-hint { color: var(--muted); font-style: italic; }
/* The sectors tab: a row is the pass on the map when hovered (static/activity_sectors.js). */
.sector-row { cursor: pointer; }
.sector-row:hover td { background: var(--hover, rgba(59,130,246,.08)); }
.sector-badge { background: #22c55e; color: #fff; border-radius: 4px; padding: 0 .4rem;
                font-size: .75rem; font-weight: 700; }

/* The language menus' flags (templates/_flags.html): SVG, Windows having no flag emoji. */
.lang-flag { display: inline-block; vertical-align: -1px; margin-right: .35rem; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
