/* ==========================================================================
   Styles de tous les composants — dépend de variables.css (chargé avant).
   ========================================================================== */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
}
#layout {
  flex: 1;
  display: flex;
  min-height: 0;
}
#sidebar {
  width: 350px;
  min-width: 300px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 18px;
  font-family: var(--sans);
  font-size: 13.5px;
}
#map {
  flex: 1;
  background: #e5e9e3;
}
.mobile-tabs {
  display: none;
}

/* Mobile : le formulaire et la carte prennent chacun tout l'écran, avec un
     onglet pour basculer entre les deux, plutôt que de les serrer côte à côte
     sur un écran trop étroit pour les deux à la fois. */
@media (max-width: 860px) {
  .mobile-tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }
  .mobile-tabs button {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--sans);
    color: var(--muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
  }
  .mobile-tabs button.active {
    color: var(--moss-dark);
    border-bottom-color: var(--moss);
  }
  #layout {
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
    min-width: 0;
    border-right: none;
    display: none;
    max-height: none;
  }
  #map {
    width: 100%;
  }
  #layout.show-sidebar #sidebar {
    display: block;
  }
  #layout.show-sidebar #map {
    display: none;
  }
  #layout.show-map #map {
    display: block;
  }
  #layout.show-map #sidebar {
    display: none;
  }
}
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input[type="text"],
.field input[type="number"] {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--lc-bordure-champ);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
}
#address::placeholder {
  font-style: italic;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.section-title {
  font-size: 11px;
  color: var(--moss-dark);
  font-weight: 700;
  margin: 20px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.section-title:first-child {
  margin-top: 0;
}
button#compute {
  width: 100%;
  padding: 11px;
  background: var(--moss);
  color: white;
  border: none;
  border-radius: var(--lc-rayon-bouton);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 6px;
}
button#compute:disabled {
  background: #9aa89f;
  cursor: default;
}
button#compute:hover:not(:disabled) {
  background: var(--moss-dark);
}
button.geo-btn {
  padding: 7px 12px;
  border: 1.5px solid var(--moss);
  color: var(--moss);
  background: transparent;
  border-radius: var(--lc-rayon-bouton);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
button.geo-btn:hover {
  background: var(--moss);
  color: white;
}
#status {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
  min-height: 18px;
}
#status.error {
  color: var(--danger);
}
.progress-wrapper {
  display: none;
  margin-top: 10px;
}
.progress-wrapper.active {
  display: block;
}
.progress-outer {
  height: 16px;
  background: var(--lc-bordure); /* fond : reste gris clair */
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.progress-inner {
  height: 100%;
  background-color: var(--moss);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 8px;
  background-image: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.18) 75%,
    transparent 75%,
    transparent
  );
  background-size: 22px 22px;
  animation: progress-stripes 0.9s linear infinite;
}
@keyframes progress-stripes {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 22px 0;
  }
}
.progress-percent {
  text-align: right;
  font-size: 12px;
  color: var(--moss-dark);
  font-weight: 600;
  margin-top: 3px;
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 14px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.offre-impression {
  margin-top: 10px;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}
.address-suggestions {
  position: absolute;
  z-index: 1000;
  left: 0;
  right: 46px;
  top: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  display: none;
}
.address-suggestions.active {
  display: block;
}
.address-suggestion-item {
  padding: 7px 9px;
  font-size: 13px;
  cursor: pointer;
}
.address-suggestion-item:hover,
.address-suggestion-item.highlighted {
  background: var(--paper);
}
/* Bloc « Méthode » replié sous le bouton Calculer (06/10/2026 : le bouton était
   repoussé sous la ligne de flottaison par le texte de méthode). */
.method-details {
  margin: 14px 0 16px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
}
.method-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--moss-dark);
  padding: 9px 0;
  min-height: 24px;
}
.method-details[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.method-details p {
  margin: 8px 0;
}
.lien-bouton {
  background: none;
  border: 0;
  padding: 4px 0;
  min-height: 24px;
  color: var(--moss-dark);
  text-decoration: underline;
  font: inherit;
  cursor: pointer;
}
/* Sens du trajet : trois choix sur une ligne. */
.sens-choix {
  margin: 4px 0 14px;
}
.sens-libelle {
  /* même aspect que .section-title */
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--moss-dark);
  margin: 14px 0 8px;
  padding: 0 0 5px;
  border-bottom: 1px solid var(--line);
}
.sens-choix select {
  width: 100%;
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid var(--lc-bordure-champ);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
}
.method-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
a {
  color: var(--moss-dark);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 20, 0.45);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: var(--panel);
  border-radius: 8px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 26px 30px;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.6;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.modal-box h2 {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}
.modal-box h3 {
  font-size: 14px;
  color: var(--moss-dark);
  margin: 22px 0 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
}
.modal-box h3:first-of-type {
  margin-top: 16px;
}
.modal-box p {
  margin: 0 0 10px;
}
.modal-box ul {
  margin: 0 0 10px;
  padding-left: 20px;
}
.modal-box li {
  margin-bottom: 6px;
}
.modal-box code {
  background: var(--paper);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12.5px;
}
.modal-box table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 14px;
  font-size: 12.5px;
}
.modal-box th,
.modal-box td {
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}
.modal-box th {
  color: var(--muted);
  font-weight: 600;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
}
.modal-close:hover {
  color: var(--ink);
}
.limits-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 8px;
}
.sidebar-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.sidebar-footer a {
  color: var(--moss-dark);
  font-weight: 600;
}
.export-section {
  display: none;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.export-section.active {
  display: block;
}
.export-section select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
}

/* ---- iso/index.html : anciens attributs style="…" (CSP stricte). Une classe st-xxxxxx par déclaration. ---- */
.st-5e6099 { color: var(--muted); }
.st-48031c { position: relative; }
.st-9001ab { display:flex; gap:6px; }
.st-0e9103 { display:block;font-weight:400; }
.st-287c6e { background:var(--walk); }
.st-80c0ec { background:var(--bike); }
.st-4a152a { background:var(--ebike); }
.st-d3acf5 { width:100%; margin-top:6px; }
.st-d2f1a6 { display:none; margin-top:8px; font-size:12.5px; }
.st-60d36d { margin-top:20px; }

/* Message « fond de carte incomplet » (fond-carte.js) : cadre fin homogène. */
.fond-carte-alerte {
  max-width: 320px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink);
}
.fond-carte-alerte button {
  margin-top: 6px;
  display: block;
  font: inherit;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--moss);
  background: var(--moss);
  color: #fff;
  cursor: pointer;
}
.fond-carte-alerte button:hover {
  background: var(--moss-dark);
}

/* Message si la feuille de style de Leaflet n'est pas appliquée (main.js). */
.alerte-carte {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--danger);
  background: var(--panel);
  color: var(--danger);
  font-family: var(--sans);
  font-size: 13.5px;
}
