* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* prime sur #app{display:flex} / #portail{display:flex} */
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #222; }

/* Vue principale */
#app { display: flex; flex-direction: column; height: 100%; }
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  padding: .7rem 1.5rem; background: #3d6b4a; color: #fff; flex-wrap: wrap; }
header h1 { margin: 0; font-size: 1.15rem; }
.sous-titre { margin: .15rem 0; font-size: .9rem; opacity: .95; }
.badge { background: #f0ad4e; color: #222; font-size: .7rem; padding: .1rem .4rem; border-radius: 4px; margin-left: .4rem; }
.zones { margin: .1rem 0 0; font-size: .85rem; opacity: .9; }
.filtre-zone { display: flex; align-items: center; gap: .55rem; }
.filtre-label { font-size: .9rem; opacity: .95; white-space: nowrap; }
.filtre-sep { opacity: .55; margin: 0 .15rem; }
.filtre { display: inline-flex; gap: 2px; background: rgba(255,255,255,.18); padding: 3px; border-radius: 9px;
  border: 1px solid rgba(255,255,255,.35); }
.filtre button { border: 0; padding: .55rem 1.1rem; border-radius: 7px; cursor: pointer;
  background: transparent; color: #fff; font-weight: 600; font-size: .92rem; transition: background .15s; }
.filtre button:hover { background: rgba(255,255,255,.15); }
.filtre button.actif { background: #fff; color: #234; box-shadow: 0 1px 3px rgba(0,0,0,.25); }

main { flex: 1; display: flex; min-height: 0; }
#carte { flex: 1; min-width: 0; min-height: 300px; }   /* min-width:0 = laisse le panneau tenir dans l'écran */
#panneau { width: 340px; padding: 1.3rem 2.3rem 1.3rem 1.6rem; background: #f7f7f5; border-left: 1px solid #ddd; overflow: auto; }

/* Panneau d'info : description de la couche active + météo récente */
#info { margin-bottom: 1rem; padding-bottom: .9rem; border-bottom: 1px solid #e3e3de; }
#info h2 { font-size: 1rem; margin: 0 0 .4rem; }
.info-txt { font-size: .85rem; color: #444; line-height: 1.4; margin: 0 0 .7rem; }
.info-meta { width: 100%; border-collapse: collapse; font-size: .8rem; }
.info-meta td { padding: .18rem 0; vertical-align: top; }
.info-meta td:first-child { color: #777; padding-right: .8rem; white-space: nowrap; }
.info-meta td:last-child { text-align: right; }
.info-sous { font-size: .85rem; margin: .9rem 0 .3rem; }
.info-meteo { width: 100%; border-collapse: collapse; font-size: .78rem; }
.info-meteo th { color: #777; font-weight: 600; text-align: right; font-size: .72rem; border-bottom: 1px solid #e3e3de; padding: .1rem 0; }
.info-meteo th:first-child { text-align: left; }
.info-meteo td { text-align: right; padding: .12rem 0; }
.info-meteo td:first-child { text-align: left; color: #555; }
.pluie-oui { color: #2b6cb0; font-weight: 600; }

/* Décomposition de la synthèse (panneau) */
.info-compo { margin: 0 0 .8rem; }
.info-compo-titre { font-size: .78rem; color: #777; margin-bottom: .3rem; }
.compo { display: flex; align-items: baseline; gap: .45rem; font-size: .82rem; padding: .13rem 0; }
.compo-nom { font-weight: 600; }
.compo-src { color: #999; font-size: .72rem; margin-left: auto; }
/* Badge de recommandation (fiche synthèse) */
.reco { text-align: center; color: #fff; font-weight: 700; padding: .5rem; border-radius: 6px; margin: .4rem 0 .2rem; text-shadow: 0 1px 2px rgba(0,0,0,.4); }

#fiche h2 { font-size: 1rem; margin: 0 0 .6rem; }
#fiche .hint { color: #888; font-size: .9rem; }
.fiche-hint-moyenne { color: #777; font-size: .78rem; font-style: italic; margin: 0 0 .6rem; }
#fiche table { width: 100%; border-collapse: collapse; font-size: .9rem; }
#fiche td { padding: .25rem 0; border-bottom: 1px solid #eee; }
#fiche td:first-child { color: #666; padding-right: .8rem; white-space: nowrap; }
#fiche td:last-child { text-align: right; font-weight: 600; word-break: break-word; }

/* Légende (S5.6) */
.legende { background: #fff; padding: .5rem .6rem; border-radius: 6px; box-shadow: 0 1px 5px rgba(0,0,0,.3); font-size: .8rem; line-height: 1.4; }
.legende .barre { height: 10px; width: 140px; border-radius: 3px;
  background: linear-gradient(to right, rgb(0,255,0), rgb(255,255,0), rgb(255,0,0)); margin: 3px 0; }
.legende .bornes { display: flex; justify-content: space-between; }

#liste-mobile { display: none; }

/* Responsive (S5.5) */
@media (max-width: 768px) {
  main { flex-direction: column; }
  #panneau { width: auto; border-left: 0; border-top: 1px solid #ddd; max-height: 48vh; }
  #fiche.vide { display: none; }
  #liste-mobile { display: block; padding: .5rem 1rem; background: #fff; overflow: auto; max-height: 35vh; }
  #liste-mobile h3 { margin: .6rem 0 .3rem; font-size: .95rem; }
  #liste-mobile .parcelle { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; font-size: .85rem; }
  #liste-mobile .pastille { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
}

/* Repli nuages : petit nuage à taille fixe (constant au zoom) sur les parcelles nuageuses,
   avec la date de l'image précédente. La donnée antérieure reste visible derrière. */
.nuage-icone { background: none; border: 0; }
/* Nuage empilé (glyphe au-dessus, date en dessous) pour limiter la largeur.
   La taille (font-size) est fixée en ligne par app.js : ~1/5 de la parcelle à l'écran. */
.nuage-pastille {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  line-height: 1; color: #33506b;
  background: rgba(255,255,255,.82); border: 1px solid rgba(90,120,150,.55);
  border-radius: 8px; padding: 2px 5px; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transform: translate(-50%, -50%);
}
.nuage-pastille span { font-weight: 600; }
.fiche-nuage { color: #33506b; font-size: .78rem; background: #eef3f8;
  border-left: 3px solid #7ba0c4; padding: .35rem .5rem; border-radius: 4px; margin: 0 0 .6rem; }
