/* Simulateur WE ski 2027 : thème clair, outil de travail pour le budget */

:root {
  --fond: #ffffff;
  --fond-doux: oklch(0.978 0.004 255);
  --fond-creux: oklch(0.952 0.007 255);
  --encre: oklch(0.25 0.03 262);
  --encre-2: oklch(0.46 0.025 262);
  --trait: oklch(0.25 0.03 262 / 0.12);
  --trait-fort: oklch(0.25 0.03 262 / 0.26);
  --accent: oklch(0.47 0.15 258);
  --accent-fonce: oklch(0.4 0.14 258);
  --accent-fond: oklch(0.95 0.025 258);
  --vert: oklch(0.48 0.12 152);
  --vert-fond: oklch(0.963 0.035 152);
  --rouge: oklch(0.5 0.18 27);
  --rouge-fond: oklch(0.962 0.028 25);
  --ambre: oklch(0.5 0.11 65);
  --ambre-fond: oklch(0.965 0.045 85);
  --rayon: 6px;
  --police: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --h-bandeau: 0px;

  /* Couleurs des graphiques (en hexadécimal pour le canevas) */
  --graphe-encre: #1f2637;
  --graphe-encre-2: #5b6273;
  --graphe-trait: #e6e8ee;
  --graphe-vert: #1f7a4a;
  --graphe-rouge: #b3312a;
  --graphe-accent: #2c5bbd;
  --graphe-rouge-fond: rgba(179, 49, 42, 0.12);
  --serie-1: #2c5bbd;
  --serie-2: #c46a17;
  --serie-3: #1f7a4a;
  --serie-4: #8a4fa3;
  --serie-5: #b3312a;
  --serie-6: #1c8a8c;
  --serie-7: #8c7a1e;
  --serie-8: #5b6273;
  --serie-9: #7fa0dc;
  --serie-10: #d99a5b;
  --serie-11: #7cbf95;
  --serie-12: #b58fc4;

  color-scheme: light;
  interpolate-size: allow-keywords;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--h-bandeau) + 1rem); }
body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 400 15px/1.5 var(--police);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 0.98rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
.masque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.aide { color: var(--encre-2); font-size: 0.88rem; max-width: 72ch; }
.discret { color: var(--encre-2); font-weight: 400; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Boutons et champs ---------- */

button, .bouton, summary.bouton {
  font: 500 0.875rem/1.2 var(--police);
  color: var(--encre);
  background: var(--fond);
  border: 1px solid var(--trait-fort);
  border-radius: var(--rayon);
  padding: 0.5rem 0.85rem;
  min-height: 2.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background-color 120ms, border-color 120ms, scale 150ms ease-out;
}
button:hover, .bouton:hover { background: var(--fond-doux); border-color: var(--encre-2); }
button:active, .bouton:active { scale: 0.97; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.principal:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
button.lien {
  border: 0; background: none; padding: 0.15rem 0; min-height: 0;
  color: var(--accent); text-decoration: underline; text-decoration-color: oklch(0.47 0.15 258 / 0.35); text-underline-offset: 3px;
}
button.lien:hover { text-decoration-color: currentColor; background: none; }
button.lien.danger { color: var(--rouge); text-decoration-color: oklch(0.5 0.18 27 / 0.35); }
button.lien.danger.confirmer { font-weight: 600; text-decoration-color: currentColor; }

input, select {
  font: 400 0.9rem var(--police);
  font-variant-numeric: tabular-nums;
  color: var(--encre);
  background: var(--fond);
  border: 1px solid var(--trait-fort);
  border-radius: var(--rayon);
  padding: 0.4rem 0.55rem;
  min-height: 2.15rem;
  max-width: 100%;
  transition: border-color 120ms, box-shadow 120ms;
}
input:hover, select:hover { border-color: var(--encre-2); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fond); }
input[type='number'] { width: 7.5rem; text-align: right; }
input.court { width: 6.5rem; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; min-height: 0; margin: 0; box-shadow: none; }
input[type='range'] { accent-color: var(--accent); padding: 0; border: 0; min-height: 0; flex: 1; min-width: 6rem; box-shadow: none; background: none; }
input::placeholder { color: var(--encre-2); opacity: 0.8; }
label { font-size: 0.875rem; }

@media (pointer: coarse) {
  button, .bouton, summary.bouton, input, select { min-height: 2.75rem; }
  button.lien { min-height: 2.75rem; padding: 0 0.2rem; }
}

/* ---------- Menus déroulants ---------- */

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after {
  content: ''; width: 0.4rem; height: 0.4rem; margin-left: 0.15rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  rotate: 45deg; translate: 0 -0.12rem; transition: rotate 150ms;
}
.menu[open] > summary::after { rotate: -135deg; translate: 0 0.1rem; }
.menu-liste {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 17rem; background: var(--fond);
  border: 1px solid var(--trait); border-radius: 10px; padding: 6px;
  box-shadow: 0 12px 32px oklch(0.25 0.03 262 / 0.14), 0 2px 6px oklch(0.25 0.03 262 / 0.06);
  display: flex; flex-direction: column;
  transform-origin: top right;
  transition: scale 200ms cubic-bezier(0.32, 0.72, 0, 1), opacity 200ms;
}
@starting-style { .menu[open] .menu-liste { scale: 0.97; opacity: 0; } }
.menu-liste button, .menu-liste .element-menu {
  border: 0; background: none; justify-content: flex-start; text-align: left; width: 100%;
  padding: 0.55rem 0.7rem; border-radius: 6px; font-weight: 450; cursor: pointer; font-size: 0.875rem; min-height: 2.25rem;
  display: flex; align-items: center;
}
.menu-liste button:hover, .menu-liste .element-menu:hover { background: var(--fond-doux); }
.menu-liste hr { border: 0; border-top: 1px solid var(--trait); margin: 4px 2px; }
.menu-liste .danger { color: var(--rouge); }

/* ---------- En-tête ---------- */

.entete {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.8rem 1.5rem;
  padding: 1rem max(1.5rem, env(safe-area-inset-right)) 1rem max(1.5rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--trait);
}
.entete-titre p { color: var(--encre-2); font-size: 0.875rem; margin-top: 0.15rem; }
.entete-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.version-courante { font-size: 0.82rem; color: var(--encre-2); margin-right: 0.3rem; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-courante strong { color: var(--encre); font-weight: 600; }

/* ---------- Bandeau des indicateurs (toujours visible) ---------- */

.bandeau {
  position: sticky; top: 0; z-index: 20;
  background: oklch(1 0 0 / 0.96);
  border-bottom: 1px solid var(--trait);
  padding: 0.6rem max(1.5rem, env(safe-area-inset-right)) 0.55rem max(1.5rem, env(safe-area-inset-left));
}
@supports (backdrop-filter: blur(8px)) { .bandeau { backdrop-filter: blur(8px); } }
.kpis { display: grid; grid-template-columns: minmax(0, 1.15fr) repeat(5, minmax(0, 1fr)) minmax(0, 1.35fr) minmax(0, 0.8fr); gap: 0; }
.kpi { display: flex; flex-direction: column; padding: 0.3rem 0.9rem; border-left: 1px solid var(--trait); min-width: 0; }
.kpi-titre { font-size: 0.76rem; color: var(--encre-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-valeur { font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; line-height: 1.3; }
.kpi-detail { font-size: 0.74rem; color: var(--encre-2); line-height: 1.3; overflow: hidden; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kpi.negatif .kpi-valeur { color: var(--rouge); }
.kpi.positif .kpi-valeur { color: var(--vert); }
.kpi.solde { border: 0; border-radius: 8px; background: var(--fond-doux); padding-left: 0.9rem; }
.kpi.solde.negatif { background: var(--rouge-fond); }
.kpi.solde.positif { background: var(--vert-fond); }
.kpi.solde .kpi-valeur { font-size: 1.35rem; }
.kpi.solde + .kpi { border-left: 0; }

.ligne-alertes {
  margin-top: 0.45rem; font-size: 0.82rem; color: var(--rouge);
  display: flex; align-items: center; gap: 0.6rem; min-width: 0;
}
.ligne-alertes .texte-alertes { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.compteur-alertes {
  flex: none; border: 0; min-height: 0; padding: 0.1rem 0.5rem; border-radius: 4px;
  background: var(--rouge-fond); color: var(--rouge); font-weight: 600; font-size: 0.8rem;
}
.compteur-alertes:hover { background: oklch(0.93 0.05 25); }
.compteur-alertes.ok { background: var(--vert-fond); color: var(--vert); }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 0.35rem; }
  .kpi:nth-child(5) { border-left: 0; }
}
@media (max-width: 720px) {
  .kpis {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    mask-image: linear-gradient(to right, black 88%, transparent);
  }
  .kpis::-webkit-scrollbar { display: none; }
  .kpi { flex: 0 0 44%; scroll-snap-align: start; }
  .kpi:nth-child(5) { border-left: 1px solid var(--trait); }
  .kpi.solde { flex-basis: 48%; }
  .kpi-valeur { font-size: 1.08rem; }
  .kpi.solde .kpi-valeur { font-size: 1.15rem; }
}

/* ---------- Mise en page : réglages à gauche, résultats à droite ---------- */

.page { display: grid; grid-template-columns: 26rem minmax(0, 1fr); align-items: start; }
.reglages {
  position: sticky; top: var(--h-bandeau);
  max-height: calc(100dvh - var(--h-bandeau)); overflow-y: auto; overscroll-behavior: contain;
  background: var(--fond-doux); border-right: 1px solid var(--trait);
  padding: 1.25rem 1.25rem 3rem max(1.5rem, env(safe-area-inset-left));
  scrollbar-width: thin;
}
.resultats { padding: 0.4rem max(1.5rem, env(safe-area-inset-right)) 4rem 2rem; min-width: 0; container-type: inline-size; }
@media (max-width: 1100px) {
  .page { grid-template-columns: 1fr; }
  .reglages { position: static; max-height: none; overflow: visible; border-right: 0; border-bottom: 1px solid var(--trait); padding-right: max(1.5rem, env(safe-area-inset-right)); }
  .resultats { padding-left: max(1.5rem, env(safe-area-inset-left)); }
}
@media (max-width: 720px) {
  .entete, .bandeau, .reglages, .resultats { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
}

/* Scénario (pilotage) */
.pilotage { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--trait); }
.segments { border: 0; padding: 0; margin: 0; min-width: 0; }
.segments legend, .titre-champ { font-size: 0.8rem; font-weight: 600; color: var(--encre-2); margin-bottom: 0.35rem; padding: 0; display: block; }
.segments-options {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  border: 1px solid var(--trait-fort); border-radius: var(--rayon); background: var(--fond); overflow: hidden;
}
.segment { position: relative; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 0.45rem 0.4rem; cursor: pointer; border-left: 1px solid var(--trait); min-height: 2.5rem; transition: background-color 120ms; }
.segment:first-child { border-left: 0; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment-titre { font-size: 0.85rem; font-weight: 550; line-height: 1.2; }
.segment-sous { font-size: 0.72rem; color: var(--encre-2); line-height: 1.25; margin-top: 0.1rem; }
.segment:hover { background: var(--fond-doux); }
.segment:has(input:checked) { background: var(--accent); color: #fff; }
.segment:has(input:checked) .segment-sous { color: oklch(0.95 0.02 258); }
.segment:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -4px; }
.segment:has(input:disabled) { cursor: not-allowed; color: var(--encre-2); background: repeating-linear-gradient(135deg, transparent 0 6px, var(--fond-creux) 6px 7px); }
.note { font-size: 0.8rem; color: var(--encre-2); margin-top: -0.5rem; }
.effectif-ligne { display: flex; align-items: center; gap: 0.75rem; }
.effectif-ligne input[type='number'] { width: 5.5rem; }
.raccourcis { display: flex; gap: 0.35rem; margin-top: 0.5rem; }
.raccourcis button { min-height: 1.9rem; padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.raccourcis button[aria-pressed='true'] { border-color: var(--accent); color: var(--accent); background: var(--accent-fond); }

/* Paramètres */
.parametres-tete { display: flex; justify-content: space-between; align-items: baseline; padding-top: 1.3rem; }
.legende-statuts { display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; align-items: center; margin: 0.5rem 0 0.75rem; font-size: 0.8rem; color: var(--encre-2); }
.section-param { border-top: 1px solid var(--trait); }
.section-param:last-child { border-bottom: 1px solid var(--trait); }
.section-param > summary {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 0; cursor: pointer;
  list-style: none; font-weight: 600; font-size: 0.92rem;
}
.section-param > summary::-webkit-details-marker { display: none; }
.section-param > summary::before {
  content: ''; flex: none; width: 0.42rem; height: 0.42rem;
  border-right: 1.5px solid var(--encre-2); border-bottom: 1.5px solid var(--encre-2);
  rotate: -45deg; transition: rotate 180ms; margin: 0 0.1rem;
}
.section-param[open] > summary::before { rotate: 45deg; }
.section-param > summary:hover { color: var(--accent); }
.section-param::details-content { block-size: 0; overflow: clip; transition: block-size 240ms ease, content-visibility 240ms allow-discrete; }
.section-param[open]::details-content { block-size: auto; }
.marque-offre { font-size: 0.72rem; font-weight: 600; color: var(--accent); background: var(--accent-fond); padding: 0.05rem 0.45rem; border-radius: 4px; }
.marque-offre:empty { display: none; }
.champs { display: flex; flex-direction: column; padding-bottom: 0.6rem; }
.champ { padding: 0.55rem 0; border-top: 1px dashed var(--trait); }
.champ:first-child { border-top: 0; }
.champ-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; }
.champ-ligne .libelle { font-size: 0.86rem; line-height: 1.3; }
.champ-ligne .libelle .unite-longue { display: block; font-size: 0.76rem; color: var(--encre-2); }
.saisie { display: inline-flex; align-items: center; gap: 0.35rem; }
.saisie .unite { font-size: 0.78rem; color: var(--encre-2); width: 2.6rem; }
.champ-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.3rem; flex-wrap: wrap; }
.selon-niveau { font-size: 0.74rem; color: var(--encre-2); }
.source {
  margin-top: 0.4rem; font-size: 0.8rem; color: var(--encre-2); line-height: 1.45;
  background: var(--fond); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 0.45rem 0.6rem;
}
.champ-case .libelle-case { display: flex; align-items: flex-start; gap: 0.55rem; font-size: 0.86rem; cursor: pointer; line-height: 1.35; }
.champ-case input { margin-top: 0.1rem; }
.champ.vide input { border-color: var(--rouge); background: var(--rouge-fond); }
.champ-bloc .titre-champ { color: var(--encre); font-size: 0.86rem; font-weight: 500; margin: 0; }
.champ-bloc-tete { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.45rem; }
.section-actions { padding: 0.2rem 0 0.9rem; }
.infos-offre { font-size: 0.82rem; color: var(--encre-2); padding: 0 0 0.6rem; }

.badge {
  font: 600 0.72rem/1.4 var(--police); padding: 0.05rem 0.45rem; min-height: 0; border-radius: 4px;
  border: 0; display: inline-block; white-space: nowrap;
}
button.badge { cursor: pointer; }
button.badge:hover { text-decoration: underline; text-underline-offset: 2px; }
button.badge:active { scale: 1; }
.badge-source { color: var(--vert); background: var(--vert-fond); }
.badge-hypothese { color: var(--ambre); background: var(--ambre-fond); }
.badge-non-chiffre { color: var(--rouge); background: var(--rouge-fond); }
.badge-decision { color: var(--encre-2); background: var(--fond-creux); }
button.badge-source:hover, button.badge-hypothese:hover, button.badge-non-chiffre:hover, button.badge-decision:hover { background-color: inherit; }

/* Échéanciers, lignes libres, repas */
.lignes-edition { display: flex; flex-direction: column; gap: 0.5rem; }
.ligne-edition {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.4rem 0.5rem; align-items: center;
  padding: 0.5rem; background: var(--fond); border: 1px solid var(--trait); border-radius: var(--rayon);
}
.ligne-edition .large { grid-column: 1 / -1; width: 100%; }
.ligne-edition .montant { font-size: 0.82rem; color: var(--encre-2); }
.ligne-edition input[type='date'] { width: 9.5rem; }
.repas { display: flex; flex-direction: column; gap: 0.5rem; }
.repas-ligne { display: grid; grid-template-columns: minmax(0, 1fr) 11rem; gap: 0.6rem; align-items: center; }
.repas-ligne label { font-size: 0.86rem; line-height: 1.3; }
.repas-ligne .cout { display: block; font-size: 0.76rem; color: var(--encre-2); }
.repas-ligne select { width: 100%; }

/* ---------- Onglets des résultats ---------- */

.onglets {
  position: sticky; top: var(--h-bandeau); z-index: 10; background: var(--fond);
  display: flex; gap: 0.25rem; border-bottom: 1px solid var(--trait); overflow-x: auto; scrollbar-width: none;
  margin: 0 -0.25rem; padding: 0 0.25rem;
}
.onglets::-webkit-scrollbar { display: none; }
.onglets [role='tab'] {
  border: 0; border-radius: 0; background: none; min-height: 2.9rem; padding: 0.6rem 0.75rem;
  color: var(--encre-2); font-weight: 600; font-size: 0.9rem; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.onglets [role='tab']:hover { color: var(--encre); background: none; }
.onglets [role='tab'][aria-selected='true'] { color: var(--encre); border-bottom-color: var(--accent); }
.onglets [role='tab']:active { scale: 1; }
.pastille { font-size: 0.72rem; font-weight: 600; padding: 0.02rem 0.4rem; border-radius: 4px; background: var(--rouge-fond); color: var(--rouge); }
.pastille:empty { display: none; }
@media (max-width: 1100px) {
  .onglets { position: static; mask-image: linear-gradient(to right, black 90%, transparent); }
}

[role='tabpanel'] { padding-top: 1.5rem; }
.panneau-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 0.75rem 1.5rem; margin-bottom: 1rem; }
.panneau-tete .aide { margin-top: 0.25rem; }
.sous-partie { margin-top: 2.25rem; }
.sous-partie > h3 { margin-bottom: 0.35rem; }
.sous-partie.premiere { margin-top: 1rem; }

.constat {
  font-size: 0.98rem; line-height: 1.5; padding: 0.8rem 1rem; border-radius: 8px;
  background: var(--fond-doux); max-width: 80ch;
}
.constat.negatif { background: var(--rouge-fond); }
.constat.positif { background: var(--vert-fond); }
.constat strong { font-weight: 650; }

/* Graphiques */
.graphiques { display: grid; grid-template-columns: 1fr; gap: 2rem 2.25rem; margin-top: 1.5rem; }
.graphique { margin: 0; min-width: 0; }
.graphique figcaption { margin-bottom: 0.6rem; }
.graphique figcaption .aide { margin-top: 0.15rem; }
.zone-graphique { position: relative; height: 290px; }
.graphique.large .zone-graphique { height: 330px; }
@container (min-width: 780px) {
  .graphiques { grid-template-columns: 1fr 1fr; }
  .graphique.large { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .zone-graphique, .graphique.large .zone-graphique { height: 250px; }
}

/* Tableaux */
.table-defilante { overflow-x: auto; max-width: 100%; }
.tableau { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
.tableau caption { text-align: left; font-weight: 600; font-size: 0.95rem; padding: 0 0 0.5rem; caption-side: top; }
.tableau th, .tableau td { text-align: left; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.tableau thead th { font-size: 0.78rem; font-weight: 600; color: var(--encre-2); background: var(--fond-doux); white-space: nowrap; border-bottom-color: var(--trait-fort); }
.tableau tbody th { font-weight: 500; }
.tableau tbody tr:hover { background: var(--fond-doux); }
.tableau tfoot th, .tableau tfoot td { font-weight: 650; border-top: 1px solid var(--trait-fort); border-bottom: 0; }
.tableau .nombre { text-align: right; white-space: nowrap; }
.tableau .fort { font-weight: 650; }
.tableau .detail { color: var(--encre-2); font-size: 0.8rem; min-width: 13rem; }
.tableau tr.nul th, .tableau tr.nul td.nombre { color: var(--encre-2); }
.tableau tr.courante th { color: var(--accent); }
.tableau.compact th, .tableau.compact td { padding: 0.4rem 0.55rem; }
.tableau td input[type='number'] { min-height: 1.9rem; padding: 0.25rem 0.45rem; }
.texte-negatif { color: var(--rouge); }
.texte-positif { color: var(--vert); }
.actions-ligne { white-space: nowrap; }
.actions-ligne > * + * { margin-left: 0.75rem; }
.actions-ligne .menu { display: inline-block; vertical-align: middle; }
.actions-ligne .menu > summary { font-size: 0.84rem; color: var(--encre-2); cursor: pointer; display: inline-flex; align-items: center; gap: 0.3rem; }
.actions-ligne .menu-liste { min-width: 12rem; }
button.tri { border: 0; background: none; padding: 0; min-height: 0; font: inherit; color: inherit; }
button.tri:hover { color: var(--accent); background: none; }
button.tri:active { scale: 1; }

.budget-colonnes { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: start; }
.budget-annexes { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-top: 2.25rem; }
.budget-colonnes > *, .budget-annexes > * { min-width: 0; }
@container (min-width: 1150px) {
  .budget-colonnes { grid-template-columns: 1.15fr 1fr; }
}
@container (min-width: 820px) {
  .budget-annexes { grid-template-columns: 1fr 1fr; }
}
.chiffre-texte { font-size: 0.92rem; margin: 0.2rem 0 1.2rem; }

/* Chargement des versions */
.squelette {
  display: block; height: 0.75rem; border-radius: 4px; width: var(--l, 70%);
  background: linear-gradient(90deg, var(--fond-creux) 0%, var(--fond-doux) 50%, var(--fond-creux) 100%);
  background-size: 200% 100%; animation: miroitement 1.2s linear infinite;
}
@keyframes miroitement { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.vide-etat { padding: 1.25rem; border: 1px dashed var(--trait-fort); border-radius: 8px; color: var(--encre-2); font-size: 0.9rem; }
.vide-etat strong { color: var(--encre); }

/* Alertes */
.liste-alertes { list-style: none; padding: 0; margin: 0.6rem 0 0; display: flex; flex-direction: column; gap: 0.45rem; max-width: 90ch; }
.alerte {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  border-left: 3px solid var(--rouge); background: var(--rouge-fond); border-radius: 0 var(--rayon) var(--rayon) 0;
  padding: 0.6rem 0.85rem; font-size: 0.9rem;
}
.alerte.ok { border-left-color: var(--vert); background: var(--vert-fond); }
.alerte.resolue { border-left-color: var(--trait-fort); background: var(--fond-doux); color: var(--encre-2); }
.alerte.resolue span { text-decoration: line-through; text-decoration-color: var(--trait-fort); }
.case-resolu { display: flex; align-items: center; gap: 0.4rem; white-space: nowrap; font-size: 0.82rem; color: var(--encre-2); cursor: pointer; }

.liste-agences { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.7rem 1.5rem; margin: 1rem 0 0; max-width: 90ch; }
.liste-agences dt { font-weight: 600; }
.liste-agences dd { margin: 0; color: var(--encre-2); }
@media (max-width: 720px) { .liste-agences { grid-template-columns: 1fr; gap: 0.2rem; } .liste-agences dd { margin-bottom: 0.7rem; } }

/* ---------- Fenêtres ---------- */

dialog {
  border: 0; border-radius: 12px; padding: 1.5rem; color: var(--encre); background: var(--fond);
  width: min(34rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem);
  box-shadow: 0 24px 64px oklch(0.25 0.03 262 / 0.22);
  transition: scale 250ms cubic-bezier(0.32, 0.72, 0, 1), opacity 250ms, display 250ms allow-discrete, overlay 250ms allow-discrete;
}
dialog:not([open]) { opacity: 0; scale: 0.97; }
@starting-style { dialog[open] { opacity: 0; scale: 0.97; } }
dialog::backdrop { background: oklch(0.25 0.03 262 / 0.4); transition: opacity 250ms, display 250ms allow-discrete, overlay 250ms allow-discrete; }
@starting-style { dialog[open]::backdrop { opacity: 0; } }
.dialogue-entete { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.4rem; }
.formulaire { display: flex; flex-direction: column; gap: 0.85rem; }
.formulaire label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; }
.formulaire label input { width: 100%; }
.formulaire .boutons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.2rem; }
.message { color: var(--rouge); font-size: 0.85rem; min-height: 1.2em; }
.secoue { animation: secousse 360ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes secousse {
  0%, 100% { translate: 0; } 16% { translate: -10px; } 33% { translate: 10px; } 50% { translate: -6px; } 66% { translate: 6px; } 83% { translate: -3px; }
}
#dialogue-compte .tableau { margin: 0.8rem 0 1.4rem; }

/* Notification */
.notification {
  position: fixed; left: 50%; bottom: max(1.2rem, env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 1rem;
  background: var(--encre); color: #fff; padding: 0.65rem 0.9rem 0.65rem 1rem; border-radius: 8px;
  font-size: 0.88rem; max-width: calc(100vw - 2rem);
  box-shadow: 0 10px 30px oklch(0.25 0.03 262 / 0.25);
  translate: -50% 1rem; opacity: 0; visibility: hidden; pointer-events: none;
  transition: translate 220ms cubic-bezier(0.32, 0.72, 0, 1), opacity 220ms, visibility 220ms;
}
.notification.visible { translate: -50% 0; opacity: 1; visibility: visible; pointer-events: auto; }
.notification.erreur { background: var(--rouge); }
.notification button { background: none; border: 0; color: #fff; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; padding: 0.2rem 0.3rem; min-height: 0; }
.notification button:hover { background: oklch(1 0 0 / 0.12); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop { transition: none !important; animation: none !important; }
}

/* ---------- Page de connexion ---------- */

.page-connexion { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; background: var(--fond-doux); }
.carte-connexion { width: min(25rem, 100%); background: var(--fond); border: 1px solid var(--trait); border-radius: 12px; padding: 1.75rem; }
.carte-connexion h1 { font-size: 1.4rem; }
.carte-connexion .aide { margin-top: 0.4rem; }
.carte-connexion form { margin-top: 1.3rem; }
.carte-connexion button { justify-content: center; }

/* ---------- Impression : indicateurs, graphiques et budget ---------- */

@media print {
  @page { size: A4; margin: 11mm; }
  body { font-size: 9.5pt; }
  .entete-actions, .reglages, .onglets, .notification, dialog, .aide, .ligne-alertes .compteur-alertes { display: none !important; }
  .page { display: block; }
  .resultats { padding: 0; }
  .entete { padding: 0 0 0.4rem; }
  .bandeau { position: static; padding: 0.4rem 0; backdrop-filter: none; }
  .kpis { grid-template-columns: repeat(4, 1fr); row-gap: 0.3rem; }
  .kpi:nth-child(5) { border-left: 0; }
  .ligne-alertes .texte-alertes { white-space: normal; }
  [role='tabpanel'] { display: none !important; }
  #panneau-synthese, #panneau-budget { display: block !important; padding-top: 0.6rem; }
  #panneau-synthese { break-after: page; }
  .graphiques { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .graphique { break-inside: avoid; }
  .graphique.large { grid-column: 1 / -1; }
  .zone-graphique, .graphique.large .zone-graphique { height: 205px; }
  .budget-colonnes { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .budget-annexes { display: none; }
  .tableau { font-size: 7.5pt; }
  .tableau .detail { display: none; }
  .tableau th, .tableau td { padding: 0.12rem 0.3rem; }
  .tableau input { border: 0; padding: 0; width: auto; min-height: 0; font-size: 7.5pt; background: none; }
}
