:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #19332f;
  background: #f4f7f3;
  line-height: 1.55;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { width: 100%; padding: 1rem; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.12; letter-spacing: -0.035em; margin-bottom: 0.75rem; }
h1 span { color: #145a48; }
h1 .titre-principal { color: #19332f; }
.langues { display: flex; justify-content: flex-end; gap: 0.4rem; margin-bottom: 1.5rem; }
.langues button { width: auto; margin: 0; padding: 0.5rem 0.85rem; background: transparent; color: #19332f; border: 1px solid #80968b; min-height: 44px; }
.langues button[aria-pressed="true"] { background: #145a48; color: white; border-color: #145a48; }
.langues button:hover { background: #e3f0e9; color: #19332f; }
.navigation-principale { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; padding: 0.5rem; margin-bottom: 1rem; background: #fff; border: 1px solid #d4dfd8; border-radius: 0.85rem; }
.navigation-principale a, .navigation-principale .lien-indisponible { display: inline-flex; align-items: center; min-height: 44px; padding: 0.5rem 0.7rem; border-radius: 0.5rem; font-size: 0.85rem; text-decoration: none; overflow-wrap: anywhere; }
.navigation-principale a:hover { background: #edf4ee; }
.navigation-principale a[aria-current="page"] { background: #e3f0e9; color: #124b3d; font-weight: 750; }
.barre-haute { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.5rem; margin-bottom: 1.5rem; background: white; border: 1px solid #d4dfd8; border-radius: 0.85rem; }
.barre-haute .navigation-principale { flex: 1 1 560px; min-width: 0; margin: 0; padding: 0; border: 0; }
.barre-haute .langues { flex: 0 0 auto; margin: 0; margin-inline-start: auto; }
.barre-haute .navigation-principale a, .barre-haute .navigation-principale .lien-indisponible { padding-inline: 0.5rem; }
h2 { font-size: 1.25rem; line-height: 1.3; }
.entete { margin-bottom: 1.25rem; }
.surtitre { font-size: 0.75rem; font-weight: 750; letter-spacing: 0.12em; color: #35645b; margin-bottom: 0.75rem; }
.introduction { color: #4b625b; font-size: 1.05rem; }
.entete .introduction { margin-bottom: 0; }
.avertissement { padding: 0.9rem 1.1rem; border: 1px solid #d6af57; border-inline-start: 4px solid #a47719; border-radius: 0.7rem; background: #fff6df; color: #63460d; margin-bottom: 1.25rem; }
.avertissement p { margin: 0.4rem 0 0; font-size: 0.875rem; }
.panneau { background: white; border: 1px solid #d4dfd8; border-radius: 1rem; padding: 1.4rem; min-width: 0; }
.saisie { box-shadow: 0 8px 30px #19332f08; }
.saisie { margin-bottom: 2rem; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.champs { display: grid; gap: 1rem; }
label, legend { display: block; font-size: 0.9rem; font-weight: 650; margin-bottom: 0.5rem; }
legend { padding: 0; }
.unite { color: #4b625b; font-size: 0.8rem; margin-inline-start: 0.4rem; }
input[type="number"] { width: 100%; padding: 0.8rem 1rem; border: 1px solid #80968b; border-radius: 0.5rem; font: inherit; color: #19332f; background: #fff; min-height: 52px; }
.selecteur-personnes { display: grid; grid-template-columns: repeat(4, minmax(44px, 1fr)); gap: 0.45rem; }
.selecteur-personnes label { position: relative; margin: 0; cursor: pointer; }
.selecteur-personnes input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.selecteur-personnes span { display: grid; place-items: center; min-height: 48px; border: 1px solid #80968b; border-radius: 0.5rem; background: #fff; font-size: 1rem; }
.selecteur-personnes label:hover span { background: #edf4ee; }
.selecteur-personnes input:checked + span { background: #145a48; border-color: #145a48; color: white; box-shadow: inset 0 0 0 2px #fff; }
.selecteur-personnes input:focus-visible + span { outline: 3px solid #286bb0; outline-offset: 3px; }
.selecteur-personnes input:disabled + span { opacity: 0.65; cursor: wait; }
input[aria-invalid="true"] { border: 2px solid #b32121; }
button { display: flex; justify-content: space-between; gap: 1.5rem; align-items: center; padding: 0.85rem 1.2rem; margin-top: 1rem; min-height: 48px; width: 100%; border: 0; border-radius: 0.5rem; background: #145a48; color: white; font: inherit; font-weight: 650; cursor: pointer; }
button:hover { background: #0c4033; }
button:disabled, fieldset:disabled button { cursor: wait; opacity: 0.65; }
:focus-visible { outline: 3px solid #286bb0; outline-offset: 4px; }
.aide { font-size: 0.82rem; color: #4b625b; margin: 0.5rem 0 0; }
.erreur-champ { font-size: 0.85rem; color: #a51d1d; margin: 0.4rem 0 0; }
.erreur-champ:empty { display: none; }
.erreur-generale { background: #fff0ef; border: 1px solid #b32121; border-radius: 0.5rem; padding: 0.9rem; color: #8f1717; margin: 1rem 0 0; }
.comparaison { display: grid; gap: 1rem; margin-top: 1rem; }
.carte-annee h3 { font-size: 1.4rem; margin: 0; }
.statut { color: #4b625b; font-size: 0.85rem; margin: 0.3rem 0 1.5rem; }
.projet { border-top: 4px solid #a47719; }
dl { margin: 0; }
.ligne { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin: 0.9rem 0; }
dt { font-size: 0.9rem; }
dd { margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 0.9rem; font-weight: 600; }
#resultats { scroll-margin-top: 1.5rem; animation: apparaitre 300ms ease-out; }
.gain { background: #124b3d; color: white; border-radius: 1rem; padding: 1.5rem; margin: 1rem 0; box-shadow: 0 12px 30px #124b3d18; }
.gain[data-sens="baisse"] { background: #704020; }
.gain[data-sens="neutre"] { background: #354d47; }
.gain-contexte { font-size: 1rem; margin-bottom: 0.6rem; }
.gain-montant { margin-bottom: 0.5rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; }
.gain-montant strong { font-size: clamp(2rem, 7vw, 3.7rem); line-height: 1.15; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gain-montant span { font-size: 1rem; }
.gain-annuel { font-size: 1.1rem; margin-bottom: 1.25rem; }
.gain-condition { border-top: 1px solid #ffffff50; padding-top: 1rem; margin-bottom: 0; font-size: 0.8rem; color: #fff; max-width: 650px; }
.synthese { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 1.25rem 0 2rem; border: 1px solid #c6d6cc; border-radius: 1rem; background: white; overflow: hidden; }
.net-synthese { padding: 1rem 0.75rem; min-width: 0; }
.net-synthese + .net-synthese { border-inline-start: 1px solid #c6d6cc; }
.net-synthese h3 { margin: 0; font-size: 1rem; }
.net-synthese .statut { font-size: 0.75rem; min-height: 3.5em; margin-bottom: 1rem; }
.net-projet { background: #edf4ee; }
.net-valeur { font-size: clamp(1.05rem, 4.5vw, 2rem); font-weight: 750; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; margin: 0; overflow-wrap: anywhere; }
.net-unite { font-size: 0.75rem; color: #4b625b; margin: 0.2rem 0 0; }
.titre-detail { font-size: 1rem; margin-bottom: 0; }
.precision { margin-top: 1rem; }
.limites { margin-top: 2rem; }
.limites h2 { font-size: 0.95rem; margin-bottom: 0.4rem; }
.limites p, footer { font-size: 0.85rem; color: #4b625b; }
footer { border-top: 1px solid #d4dfd8; padding-top: 1.25rem; margin-top: 1.5rem; }
.liens-pied { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-bottom: 1rem; }
a { color: #145a48; text-underline-offset: 0.2em; }
.liens-pied a { display: inline-flex; align-items: center; min-height: 44px; }
.lien-indisponible { display: inline-flex; align-items: center; min-height: 44px; color: #68716d; cursor: not-allowed; }
.contenu-editorial { width: 100%; }
.contenu-editorial section { margin-block: 2rem; }
.contenu-editorial p { line-height: 1.8; }
:lang(ar) { letter-spacing: normal; }
html:lang(ar) { line-height: 1.8; }
[dir="rtl"] .fleche { transform: scaleX(-1); }
[dir="rtl"] .ligne { flex-wrap: wrap; }
.net-valeur { text-align: start; unicode-bidi: isolate; }
#brut { direction: ltr; text-align: start; }

@media (min-width: 640px) {
  main { padding: 1.5rem clamp(1.5rem, 2.5vw, 3rem); }
  .champs { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
  .comparaison { grid-template-columns: 1fr 1fr; }
  .panneau, .gain { padding: 1.6rem; }
  button { width: auto; }
  .net-synthese { padding: 1.5rem; }
  .net-synthese h3 { font-size: 1.15rem; }
  .net-synthese .statut { min-height: 1.5em; }
}

@media (min-width: 900px) {
  .selecteur-personnes { grid-template-columns: repeat(7, minmax(44px, 1fr)); }
}

@keyframes apparaitre {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  #resultats { animation: none; }
}
