/* Vishtra 0.2.0
   Couleurs du logo, Archivo étendu pour les titres et les chiffres, aucun angle arrondi. */

:root {
  --bleu: #1646E5;
  --bleu-fonce: #0F33AE;
  --vert-sommet: #79F977;
  --vert-sentier: #12873B;
  --encre: #101A3D;
  --gris: #59637F;
  --papier: #F4F6FA;
  --blanc: #FFFFFF;
  --trait: #D6DCE8;
  --rouge: #C62A2A;
  --police: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --nav-bas: 64px;
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.5;
  color: var(--encre);
  background: var(--papier);
  font-variant-numeric: tabular-nums;
}

a { color: var(--bleu); }

:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }

h1, h2, p { margin: 0; }

/* ---------- Marque ---------- */

.marque { display: inline-flex; align-items: center; gap: 10px; }
.marque img { display: block; width: 32px; height: 32px; }
.marque-mot {
  font-stretch: 125%;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1;
  text-transform: uppercase;
}
.marque-mot .vish { color: var(--bleu); }
.marque-mot .tra { color: #4FD94D; }

/* ---------- Barre du haut et navigation ---------- */

.barre {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
  padding: 0 32px;
  background: var(--blanc);
  border-bottom: 1px solid var(--trait);
}
.barre-accueil { text-decoration: none; }

.nav { display: flex; gap: 4px; height: 100%; }
.nav-lien {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  color: var(--encre);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}
.nav-lien:hover { color: var(--bleu); }
.nav-lien.actif { color: var(--bleu); border-bottom-color: var(--bleu); }
.nav-lien.a-venir { color: #9AA2B8; font-weight: 500; cursor: default; }
.nav-lien small { font-size: 11px; font-weight: 600; color: #9AA2B8; }
.nav-lien .court { display: none; }

.barre-sortie { margin-left: auto; }
.lien-discret {
  font: inherit;
  font-size: 14px;
  color: var(--gris);
  background: none;
  border: 0;
  padding: 8px 0;
  cursor: pointer;
}
.lien-discret:hover { color: var(--encre); text-decoration: underline; }

/* ---------- Contenu ---------- */

.contenu {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 32px 48px;
}

.pied {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 32px 32px;
  font-size: 13px;
  color: #9AA2B8;
}

/* ---------- Le sommet (bloc bleu du tableau de bord) ---------- */

.sommet {
  background: var(--bleu);
  color: var(--blanc);
  padding: 28px 32px 20px;
}

.sommet-annee { font-weight: 600; font-size: 16px; opacity: .8; }

.sommet-total {
  font-stretch: 125%;
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
  margin-top: 4px;
}
.sommet-total .chiffre {
  font-size: clamp(56px, 13vw, 104px);
  letter-spacing: -0.03em;
}

.sommet-ecart { margin-top: 10px; font-size: 15px; opacity: .9; }

.crete { display: block; width: 100%; height: clamp(110px, 24vw, 200px); margin-top: 24px; }
.crete-mois {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  margin: 6px 0 0;
  padding: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, .6);
}
.crete-mois .courant { color: var(--blanc); font-weight: 800; }

.legende { margin-top: 12px; font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: rgba(255, 255, 255, .9); }
.legende-record { margin-left: auto; color: var(--vert-sommet); font-weight: 700; }
.cle { display: inline-block; width: 14px; height: 10px; }
.cle-actuelle { background: var(--vert-sommet); }
.cle-prec { height: 0; border-top: 2.5px solid var(--blanc); margin-left: 12px; }

/* État vide */
.sommet-vide { padding: 40px 32px 36px; }
.titre-large {
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(30px, 6vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.sommet-intro { margin-top: 14px; max-width: 34em; font-size: 17px; opacity: .92; }

.etapes { list-style: none; counter-reset: etape; margin: 28px 0 0; padding: 0; max-width: 40em; }
.etapes li {
  counter-increment: etape;
  position: relative;
  padding: 14px 0 14px 56px;
  border-top: 1px solid rgba(255, 255, 255, .25);
}
.etapes li::before {
  content: counter(etape);
  position: absolute;
  left: 0;
  top: 8px;
  font-stretch: 125%;
  font-weight: 900;
  font-size: 34px;
  line-height: 1;
  color: var(--vert-sommet);
}
.etapes strong { display: block; font-weight: 700; }

/* ---------- Totaux ---------- */

.totaux {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-top: 0;
}
.totaux > div { padding: 16px 20px; border-left: 1px solid var(--trait); }
.totaux > div:first-child { border-left: 0; }
.totaux dt { font-size: 13px; color: var(--gris); }
.totaux dd { margin: 2px 0 0; font-stretch: 112%; font-weight: 700; font-size: 24px; line-height: 1.2; }

/* ---------- Blocs ---------- */

.bloc { margin-top: 40px; }
.titre-bloc {
  font-stretch: 112%;
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 12px;
}

/* ---------- Liste des sorties ---------- */

.sorties { list-style: none; margin: 0; padding: 0; background: var(--blanc); border: 1px solid var(--trait); }
.sortie { border-top: 1px solid var(--trait); }
.sortie:first-child { border-top: 0; }
.sortie-lien {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 20px 12px 12px;
  color: inherit;
  text-decoration: none;
}
.sortie-lien:hover { background: #F8F9FC; }
.sortie-lien:hover .sortie-nom strong { color: var(--bleu); }

.trace { display: block; width: 56px; height: 56px; color: var(--bleu); background: var(--papier); }

.sortie-nom { min-width: 0; }
.sortie-nom strong { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sortie-nom span { font-size: 14px; color: var(--gris); }

.sortie-chiffres { display: grid; grid-template-columns: repeat(4, minmax(72px, auto)); gap: 20px; margin: 0; text-align: right; }
.sortie-chiffres dt { font-size: 12px; color: var(--gris); }
.sortie-chiffres dd { margin: 0; font-weight: 700; white-space: nowrap; }

/* ---------- Connexion ---------- */

.page-connexion { background: var(--blanc); }
.connexion {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 20px;
}
.connexion-marque { margin-bottom: 28px; text-align: center; }
.connexion-marque .marque img { width: 56px; height: 56px; }
.connexion-marque .marque-mot { font-size: 36px; }
.logo-complet { display: block; width: min(340px, 80vw); height: auto; }

.formulaire { width: min(360px, 100%); display: flex; flex-direction: column; }
.formulaire label { font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
.formulaire input {
  font: inherit;
  font-size: 17px;
  height: 50px;
  padding: 0 14px;
  color: var(--encre);
  background: var(--blanc);
  border: 1.5px solid var(--trait);
}
.formulaire input:focus { border-color: var(--bleu); outline: 0; box-shadow: inset 0 0 0 1px var(--bleu); }

.bouton {
  margin-top: 24px;
  height: 52px;
  font: inherit;
  font-stretch: 112%;
  font-weight: 800;
  font-size: 17px;
  color: var(--blanc);
  background: var(--bleu);
  border: 0;
  cursor: pointer;
}
.bouton:hover { background: var(--bleu-fonce); }
.bouton:active { transform: translateY(1px); }

.erreur {
  padding: 12px 14px;
  font-size: 15px;
  color: var(--rouge);
  background: #FDF0F0;
  border-left: 4px solid var(--rouge);
}

/* ---------- Éléments communs (0.2) ---------- */

.visuellement-cache {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.entete-page { margin-bottom: 20px; }
.titre-page {
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.resume-filtre { margin-top: 6px; color: var(--gris); }

.vide { padding: 24px 20px; color: var(--gris); background: var(--blanc); border: 1px solid var(--trait); }
.suite { margin-top: 12px; font-weight: 700; }
.suite a { text-decoration: none; }
.suite a::after { content: " →"; }
.succes {
  margin-top: 14px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--vert-sentier);
  background: #EEF8F1;
  border-left: 4px solid var(--vert-sentier);
}

/* Puces de sport */
.puces { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.puce {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 15px;
  color: var(--encre);
  text-decoration: none;
  background: var(--blanc);
  border: 1px solid var(--trait);
}
.puce small { font-size: 12px; font-weight: 500; color: var(--gris); }
.puce:hover { border-color: var(--bleu); color: var(--bleu); }
.puce.active { background: var(--encre); border-color: var(--encre); color: var(--blanc); }
.puce.active small { color: rgba(255, 255, 255, .7); }

/* Filtres */
.filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 28px; }
.filtres select, .filtres input, .formulaire select, .formulaire textarea {
  font: inherit;
  font-size: 16px;
  height: 44px;
  padding: 0 12px;
  color: var(--encre);
  background: var(--blanc);
  border: 1.5px solid var(--trait);
}
.filtres input { flex: 1 1 200px; min-width: 0; }
.filtres select:focus, .filtres input:focus { border-color: var(--bleu); outline: 0; }
.bouton-petit { margin-top: 0; height: 44px; padding: 0 18px; font-size: 15px; }

/* Liste groupée par mois */
.mois { margin-bottom: 28px; }
.mois-titre {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 8px;
  font-stretch: 112%;
  font-weight: 800;
  font-size: 19px;
}
.mois-titre small { font-stretch: 100%; font-weight: 500; font-size: 14px; color: var(--gris); }

.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 8px; color: var(--gris); font-size: 15px; }
.pagination a { font-weight: 700; text-decoration: none; }
.pagination a:last-child { text-align: right; }

/* ---------- Fiche d'une activité ---------- */

.activite-entete { margin-bottom: 20px; }
.activite-quand { margin-bottom: 6px; color: var(--gris); font-weight: 500; }

.chiffres-cles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  background: var(--bleu);
  color: var(--blanc);
}
.chiffres-cles > div { padding: 16px 20px 18px; border-left: 1px solid rgba(255, 255, 255, .2); }
.chiffres-cles > div:first-child { border-left: 0; }
.chiffres-cles dt { font-size: 13px; opacity: .8; }
.chiffres-cles dd {
  margin: 2px 0 0;
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.chiffres-cles dd small { font-size: .5em; font-weight: 700; letter-spacing: 0; opacity: .85; }

.carte-cadre { position: relative; background: #E9EDF3; border: 1px solid var(--trait); border-top: 0; }
.carte { height: clamp(300px, 52vh, 520px); }
.carte-fonds { position: absolute; left: 10px; top: 10px; display: flex; z-index: 2; box-shadow: 0 1px 3px rgba(16, 26, 61, .2); }
.carte-fonds button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 11px;
  color: var(--encre);
  background: var(--blanc);
  border: 0;
  border-left: 1px solid var(--trait);
  cursor: pointer;
}
.carte-fonds button:first-child { border-left: 0; }
.carte-fonds button[aria-pressed="true"] { background: var(--encre); color: var(--blanc); }

/* MapLibre sans angles arrondis */
.maplibregl-ctrl-group, .maplibregl-ctrl-group button, .maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib-button,
.maplibregl-ctrl-scale, .maplibregl-cooperative-gesture-screen { border-radius: 0 !important; }
.maplibregl-ctrl-group:not(:empty) { box-shadow: 0 1px 3px rgba(16, 26, 61, .2) !important; }
.maplibregl-ctrl-scale { border-color: var(--gris); color: var(--encre); font-family: var(--police); }
.maplibregl-cooperative-gesture-screen { font-family: var(--police); font-size: 18px; background: rgba(16, 26, 61, .55); }

/* Profils */
.graphiques { background: var(--blanc); border: 1px solid var(--trait); padding: 12px 8px 8px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.graphiques:focus-visible { outline-offset: -3px; }
.chargement { padding: 28px 20px; color: var(--gris); }
.g-lecture { padding: 0 12px 6px 52px; font-size: 13px; color: var(--gris); min-height: 1.5em; }
.graphique { margin: 0; }
.graphique + .graphique { margin-top: 6px; }
.graphique figcaption { display: flex; justify-content: space-between; align-items: baseline; padding: 0 12px 0 52px; font-size: 14px; }
.g-titre { color: var(--gris); font-weight: 600; }
.g-valeur { font-weight: 800; font-stretch: 112%; font-size: 16px; color: var(--encre); }
.graphique svg { display: block; width: 100%; height: auto; overflow: visible; }
.g-axe { font-family: var(--police); font-size: 11px; fill: var(--gris); }
.g-grille { stroke: #EBEEF4; stroke-width: 1; }
.g-base { stroke: var(--trait); stroke-width: 1; }
.g-curseur { stroke: var(--encre); stroke-width: 1; }

/* Découpage */
.tableau-defile { overflow-x: auto; background: var(--blanc); border: 1px solid var(--trait); }
.decoupe { width: 100%; border-collapse: collapse; font-size: 15px; }
.decoupe th { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--gris); text-align: left; border-bottom: 1px solid var(--trait); }
.decoupe td { padding: 7px 14px; border-top: 1px solid #EEF1F6; white-space: nowrap; }
.decoupe tbody tr:first-child td { border-top: 0; }
.decoupe .nb { font-weight: 600; }
.decoupe tr.meilleur td { font-weight: 800; }
.decoupe tbody tr:hover { background: #F8F9FC; }
.col-barre { width: 40%; }
.barre-effort { display: block; height: 10px; background: var(--bleu); }
.meilleur .barre-effort { background: var(--vert-sentier); }

.description { padding: 16px 20px; background: var(--blanc); border: 1px solid var(--trait); white-space: normal; overflow-wrap: anywhere; }

.details { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0; background: var(--blanc); border: 1px solid var(--trait); }
.details > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 20px; border-top: 1px solid #EEF1F6; }
.details > div:nth-child(-n+2) { border-top: 0; }
.details > div:nth-child(even) { border-left: 1px solid #EEF1F6; }
.details dt { color: var(--gris); }
.details dd { margin: 0; font-weight: 700; text-align: right; }

.modifier summary { cursor: pointer; font-weight: 700; color: var(--bleu); padding: 6px 0; }
.formulaire-large { width: min(560px, 100%); margin-top: 8px; }
.formulaire select { height: 50px; font-size: 17px; }
.formulaire textarea { height: auto; padding: 12px 14px; font-size: 16px; resize: vertical; }

.voisines { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 40px; }
.voisines a { display: block; padding: 14px 18px; background: var(--blanc); border: 1px solid var(--trait); text-decoration: none; font-weight: 700; color: var(--encre); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voisines a:hover { border-color: var(--bleu); color: var(--bleu); }
.voisines small { display: block; font-size: 12px; font-weight: 500; color: var(--gris); }
.voisines .voisine-prec { text-align: right; }

/* ---------- Téléphone ---------- */

@media (max-width: 760px) {
  body.app { padding-bottom: calc(var(--nav-bas) + env(safe-area-inset-bottom)); }

  .barre { padding: 0 16px; height: 56px; }

  .nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--nav-bas) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    gap: 0;
    background: var(--blanc);
    border-top: 1px solid var(--trait);
  }
  .nav-lien {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    padding: 0 4px;
    font-size: 13px;
    text-align: center;
    border-bottom: 0;
    border-top: 3px solid transparent;
  }
  .nav-lien.actif { border-top-color: var(--bleu); }
  .nav-lien .long { display: none; }
  .nav-lien .court { display: inline; }
  .legende-record { margin-left: 0; flex-basis: 100%; margin-top: 2px; }

  .contenu { padding: 0 0 32px; }
  .pied { padding: 0 16px 24px; }

  .sommet { padding: 24px 16px 16px; }
  .sommet-vide { padding: 32px 16px 28px; }
  .crete { margin-top: 20px; }

  .totaux { grid-template-columns: 1fr 1fr; border-left: 0; border-right: 0; }
  .totaux > div { padding: 14px 16px; }
  .totaux > div:nth-child(3) { border-left: 0; }
  .totaux > div:nth-child(n+3) { border-top: 1px solid var(--trait); }
  .totaux dd { font-size: 22px; }

  .bloc { margin-top: 28px; }
  .entete-page, .activite-entete { padding: 20px 16px 0; }
  .puces { padding: 0 16px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .puces::-webkit-scrollbar { display: none; }
  .puce { flex: none; }
  .filtres { padding: 0 16px; }
  .mois-titre { padding: 0 16px; }
  .vide { border-left: 0; border-right: 0; }
  .pagination { padding: 0 16px; }
  .suite { padding: 0 16px; }

  .chiffres-cles { grid-template-columns: 1fr 1fr; }
  .chiffres-cles > div { padding: 14px 16px; }
  .chiffres-cles > div:nth-child(3) { border-left: 0; }
  .chiffres-cles > div:nth-child(n+3) { border-top: 1px solid rgba(255, 255, 255, .2); }
  .carte-cadre { border-left: 0; border-right: 0; }
  .carte { height: 340px; }
  .graphiques, .tableau-defile, .description, .details { border-left: 0; border-right: 0; }
  .details { grid-template-columns: 1fr; }
  .details > div:nth-child(2) { border-top: 1px solid #EEF1F6; }
  .details > div:nth-child(even) { border-left: 0; }
  .details > div { padding: 11px 16px; }
  .decoupe th, .decoupe td { padding-left: 12px; padding-right: 12px; }
  .col-barre { width: 30%; }
  .modifier { padding: 0 16px; }
  .voisines { padding: 0 16px; grid-template-columns: 1fr; }
  .voisines .voisine-prec { text-align: left; }
  .titre-bloc { padding: 0 16px; }
  .sorties { border-left: 0; border-right: 0; }

  .sortie-lien { grid-template-columns: 56px 1fr; gap: 10px 14px; padding: 14px 16px; }
  .sortie-chiffres { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: left; }
  .sortie-chiffres .facultatif { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
