/* Outil interne — palette neutre, accent bordeaux repris de la marque. */

:root {
  --fond: #ffffff;
  --fond-2: #ffffff;
  --fond-3: #f4f4f5;
  --fond-depot: #fafafa;
  --bordure: #e6e6e8;
  --bordure-forte: #d2d2d6;
  --texte: #24242a;
  --texte-2: #8e8e96;
  --texte-3: #b3b3ba;

  --accent: #8a2431;          /* boutons, états sélectionnés */
  --accent-vif: #bf1c2d;      /* rouge de la marque */
  --accent-bord: #b0475a;
  --accent-doux: #fbf1f2;
  --accent-texte: #ffffff;
  --danger: #b42318;

  --rayon: 10px;
  --rayon-p: 8px;
}

:root[data-theme="dark"] {
  --fond: #1b1b1e;
  --fond-2: #212125;
  --fond-3: #2a2a2f;
  --fond-depot: #232328;
  --bordure: #35353b;
  --bordure-forte: #45454d;
  --texte: #ececee;
  --texte-2: #9a9aa2;
  --texte-3: #6e6e77;

  --accent: #a63343;
  --accent-bord: #a63343;
  --accent-doux: #33202400;
  --accent-doux: rgba(191, 28, 45, .14);
}

* { box-sizing: border-box; }

/* Les règles `display` de ce fichier l'emporteraient sinon sur l'attribut hidden. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--fond-3);
  color: var(--texte);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.sprite { display: none; }
.ico { width: 16px; height: 16px; flex: none; }

/* ---------------- En-tête ---------------- */

.entete {
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 56px;
  background: var(--fond);
  border-bottom: 1px solid var(--bordure);
  position: sticky; top: 0; z-index: 20;
}
.entete-titre { display: flex; align-items: baseline; gap: 10px; }
.entete-titre strong { font-size: 15px; letter-spacing: .02em; }
.entete-titre span { font-size: 13px; color: var(--texte-2); }

.onglets { display: flex; gap: 4px; margin-left: auto; }
.onglet {
  border: 0; background: transparent; color: var(--texte-2);
  padding: 6px 14px; border-radius: var(--rayon-p);
  font: inherit; font-size: 14px; cursor: pointer;
  text-decoration: none;
}
.onglet:hover { background: var(--fond-3); color: var(--texte); }
.onglet.actif { background: var(--fond-3); color: var(--texte); font-weight: 600; }

.bouton-icone {
  border: 1px solid var(--bordure); background: var(--fond); color: var(--texte-2);
  width: 32px; height: 32px; border-radius: var(--rayon-p);
  cursor: pointer; font-size: 15px; line-height: 1;
}
.bouton-icone:hover { background: var(--fond-3); }

/* ---------------- Structure ---------------- */

main { padding: 20px; }
.vue { display: none; }
.vue.active { display: block; }

/*
 * Coque à hauteur fixe : chaque colonne défile pour son propre compte.
 * Volontairement sans `position: sticky` — un élément collant dont un
 * ancêtre passe en display:none (bascule d'onglet) se repositionne mal.
 */
.colonnes {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 20px;
  height: calc(100vh - 96px);
  min-height: 520px;
  max-width: 1400px;
  margin: 0 auto;
}

.panneau {
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}

/* Le formulaire défile seul, le bouton reste visible en pied. */
.formulaire {
  display: flex; flex-direction: column;
  min-height: 0;              /* autorise l'enfant à défiler dans la grille */
  overflow: hidden;
}
.defilement { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 8px; }
.pied {
  border-top: 1px solid var(--bordure); padding: 12px 16px; background: var(--fond);
  display: flex; gap: 8px;
}
.pied .bouton-secondaire { flex: none; }

.resultat { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 20px; }

/* ---------------- Titres de section ---------------- */

.section {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 16px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--texte-3);
}
.section::after { content: ""; flex: 1; height: 1px; background: var(--bordure); }
.section:not(:first-child) { margin-top: 26px; }

.separateur { border: 0; border-top: 1px solid var(--bordure); margin: 4px 0 16px; }

/* ---------------- Champs ---------------- */

.champ { margin-bottom: 18px; }

.etiquette {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--texte);
  margin-bottom: 8px;
}
.etiquette.espace { margin-top: 14px; }
.mention { font-size: 12px; font-weight: 400; color: var(--texte-3); }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bordure-forte);
  border-radius: var(--rayon-p);
  background: var(--fond);
  color: var(--texte);
  font: inherit; font-size: 13.5px;
  resize: vertical;
}
textarea { min-height: 44px; }
::placeholder { color: var(--texte-3); }

input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-bord);
  box-shadow: 0 0 0 3px var(--accent-doux);
}
input:disabled, textarea:disabled {
  background: var(--fond-3); color: var(--texte-3); cursor: not-allowed;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--texte-2) 50%),
                    linear-gradient(135deg, var(--texte-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.retrait { margin-left: 26px; margin-top: 8px; }
/* Un champ en retrait garde width:100% : on retire l'indentation pour éviter le débordement. */
input.retrait { width: calc(100% - 26px); }
/* Seuls les conteneurs empilent leurs enfants ; un input garde son rendu normal. */
#bloc-graphique-choix, #bloc-variantes { display: flex; flex-direction: column; gap: 8px; }
.retrait:not([hidden]) + .aide { margin-top: 10px; }

/* ---------------- Cartes de choix (radio) ---------------- */

.cartes { display: flex; flex-direction: column; gap: 8px; }

.carte-choix {
  /* Positionné : sinon l'input absolu ci-dessous se rattache au document
     entier, échappe au défilement du formulaire et rallonge la page. */
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-p);
  background: var(--fond);
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color .12s, background .12s;
}
.carte-choix input { position: absolute; opacity: 0; pointer-events: none; }
.carte-choix:hover { border-color: var(--bordure-forte); background: var(--fond-3); }

.puce {
  width: 16px; height: 16px; flex: none;
  border: 1.6px solid var(--bordure-forte);
  border-radius: 50%;
  display: grid; place-items: center;
}
.puce::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); transform: scale(0); transition: transform .12s;
}

.carte-choix:has(input:checked) {
  border-color: var(--accent-bord);
  background: var(--accent-doux);
}
.carte-choix:has(input:checked) .puce { border-color: var(--accent); }
.carte-choix:has(input:checked) .puce::after { transform: scale(1); }
.carte-choix:has(input:checked) .texte { color: var(--accent); font-weight: 500; }
.carte-choix:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-doux); }

/* Segments côte à côte */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.duo.trio { grid-template-columns: repeat(3, 1fr); }
.carte-choix.centre { justify-content: center; text-align: center; padding: 13px 12px; }
.carte-choix small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--texte-2); font-weight: 400; }
.carte-choix.petit { padding: 9px 12px; }

/* ---------------- Cases à cocher ---------------- */

.case {
  position: relative; /* même raison que .carte-choix */
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}
.case input { position: absolute; opacity: 0; pointer-events: none; }

.boite {
  width: 16px; height: 16px; flex: none;
  border: 1.6px solid var(--bordure-forte);
  border-radius: 4px;
  background: var(--fond);
  display: grid; place-items: center;
  transition: background .12s, border-color .12s;
}
.boite::after {
  content: "";
  width: 9px; height: 5px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  transition: transform .12s;
}
.case:has(input:checked) .boite { background: var(--accent); border-color: var(--accent); }
.case:has(input:checked) .boite::after { transform: rotate(-45deg) scale(1); }
.case:has(input:focus-visible) .boite { box-shadow: 0 0 0 3px var(--accent-doux); }
.case:has(input:disabled) { opacity: .45; cursor: not-allowed; }

/* ---------------- Aides ---------------- */

.aide { font-size: 12px; line-height: 1.45; color: var(--texte-2); margin: 9px 0 0; }
.aide.accent { color: var(--accent-bord); }

/* ---------------- Zone de dépôt ---------------- */

.depot {
  margin-top: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 26px 18px;
  border: 1.5px dashed var(--bordure-forte);
  border-radius: var(--rayon-p);
  background: var(--fond-depot);
  color: var(--texte-2);
  font-size: 12.5px; text-align: center;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.depot:hover, .depot.survol { border-color: var(--accent-bord); background: var(--accent-doux); color: var(--accent); }
.depot .ico { width: 20px; height: 20px; }

/* Photos fournies : grille de vignettes retirables une à une. */
.photos-liste {
  margin-top: 12px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px;
}
.photo-vignette { position: relative; }
.photo-vignette img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--rayon-p); border: 1px solid var(--bordure); display: block;
}
.photo-vignette button {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.photo-vignette button:hover { background: var(--accent); }

.lien-retirer {
  border: 0; background: none; padding: 0;
  color: var(--accent-bord); font: inherit; font-size: 12.5px;
  text-decoration: underline; cursor: pointer;
}

/* Légende Instagram proposée sous le visuel. */
.legende {
  margin-top: 16px; padding: 14px;
  background: var(--fond-3); border-radius: var(--rayon-p);
}
.legende-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.legende-tete .etiquette { margin-bottom: 0; }
.legende p {
  margin: 8px 0 0; font-size: 13.5px; line-height: 1.55;
  white-space: pre-wrap; color: var(--texte);
}

/* ---------------- Encart verrouillé ---------------- */

.verrou {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--fond-3);
  border-radius: var(--rayon-p);
  color: var(--texte-2);
  font-size: 12.5px; line-height: 1.45;
  margin-bottom: 18px;
}
.verrou .ico { color: var(--texte-2); margin-top: 1px; }

/* ---------------- Options avancées ---------------- */

.avance {
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-p);
  margin-bottom: 18px;
}
.avance summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; user-select: none;
  list-style: none;
}
.avance summary::-webkit-details-marker { display: none; }
.avance summary::after {
  content: ""; width: 7px; height: 7px;
  border-right: 1.7px solid var(--texte-2); border-bottom: 1.7px solid var(--texte-2);
  transform: rotate(45deg); margin-top: -3px;
  transition: transform .15s;
}
.avance[open] summary::after { transform: rotate(-135deg); margin-top: 2px; }
.avance-corps { padding: 0 14px 14px; }
.avance-corps .case:first-child { margin-top: 0; }

/* ---------------- Boutons ---------------- */

.bouton-principal, .bouton-secondaire, .bouton-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--rayon-p);
  padding: 12px 16px;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none;
}
.bouton-principal { background: var(--accent); color: var(--accent-texte); width: 100%; }
.bouton-principal:hover { filter: brightness(1.12); }
.bouton-principal:disabled { opacity: .6; cursor: not-allowed; filter: none; }
.bouton-principal .ico { width: 15px; height: 15px; }

.bouton-secondaire { background: var(--fond); color: var(--texte); border-color: var(--bordure-forte); font-weight: 500; }
.bouton-secondaire:hover { background: var(--fond-3); }

.bouton-danger { background: transparent; color: var(--danger); border-color: var(--bordure-forte); font-weight: 500; }
.bouton-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.erreur {
  margin: 14px 0 4px; padding: 10px 12px;
  border-radius: var(--rayon-p);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger); font-size: 13px; white-space: pre-wrap;
}

/* ---------------- Résultat ---------------- */

.etat-vide {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--texte-2); text-align: center; padding: 60px 20px;
}
.etat-vide p { margin: 0; }

.rond {
  width: 26px; height: 26px;
  border: 2.5px solid var(--bordure);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tourne .8s linear infinite;
  margin-bottom: 10px;
}
@keyframes tourne { to { transform: rotate(360deg); } }

.chrono { font-variant-numeric: tabular-nums; color: var(--texte-3); font-size: 12.5px; }
#arreter { margin-top: 14px; }

/* Le bouton principal indique la génération en cours. */
.bouton-principal.occupe .ico { animation: tourne 1.1s linear infinite; }

.apercu { display: flex; justify-content: center; }
.apercu img {
  max-width: 100%; max-height: calc(100vh - 260px);
  border-radius: var(--rayon-p); border: 1px solid var(--bordure);
}

.vignettes { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.vignettes img { width: 58px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; display: block; }
.vignettes img.actif { border-color: var(--accent); }

.actions-resultat { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.actions-resultat .bouton-principal { flex: 1 1 150px; width: auto; }

/* Zone de correction, sous le visuel produit. */
.retouche {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--bordure);
}
.retouche .actions-resultat { margin-top: 10px; }
.retouche .bouton-secondaire { flex: 1 1 auto; }

/* ---------------- Galerie ---------------- */

.galerie {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px; max-width: 1400px; margin: 0 auto;
}
.carte {
  background: var(--fond); border: 1px solid var(--bordure);
  border-radius: var(--rayon); overflow: hidden; cursor: pointer;
  transition: transform .12s ease, border-color .12s;
}
.carte:hover { transform: translateY(-2px); border-color: var(--bordure-forte); }
.carte img { width: 100%; display: block; aspect-ratio: 4/5; object-fit: cover; background: var(--fond-3); }
.carte-pied { padding: 10px 12px; }
.carte-pied strong { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte-pied span { font-size: 12px; color: var(--texte-2); }

/* ---------------- Charte ---------------- */

.charte {
  max-width: 980px; margin: 0 auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.charte-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.charte-tete .etiquette { margin-bottom: 4px; }
.charte-tete .aide { margin: 0; max-width: 62ch; }

#charte {
  min-height: calc(100vh - 320px);
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6;
  resize: vertical;
}

.charte-pied { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.charte-actions { display: flex; gap: 8px; margin-left: auto; }
.charte-actions .bouton-principal { width: auto; }

/* ---------------- Connexion ---------------- */

.page-connexion { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.connexion { width: 100%; max-width: 380px; }
.connexion-carte { padding: 28px 26px; }

.connexion-tete { text-align: center; margin-bottom: 22px; }
.connexion-tete strong { display: block; font-size: 18px; letter-spacing: .02em; }
.connexion-tete span { font-size: 13px; color: var(--texte-2); }

.connexion-carte .etiquette { margin-bottom: 8px; }
.connexion-carte input { margin-bottom: 14px; }
.connexion-carte .bouton-principal { width: 100%; }
.connexion-carte .aide { text-align: center; margin-top: 18px; }

/* ---------------- Aide ---------------- */

.aide-page {
  max-width: 780px; margin: 0 auto; padding: 28px 32px;
  line-height: 1.6;
}
.aide-page h2 { font-size: 20px; margin: 0 0 12px; }
.aide-page h3 {
  font-size: 14px; margin: 30px 0 10px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--texte-3);
}
.aide-page p { margin: 0 0 12px; font-size: 14px; }
.aide-page ol, .aide-page ul { margin: 0 0 12px; padding-left: 20px; font-size: 14px; }
.aide-page li { margin-bottom: 8px; }

.aide-liste { font-size: 14px; }
.aide-liste dt {
  font-size: 13.5px; font-weight: 600; color: var(--texte);
  margin-top: 14px; text-transform: none; letter-spacing: 0;
}
/* `white-space: pre-wrap` vient des <dd> de la modale : il conserverait
   l'indentation du HTML et déchirerait les paragraphes. */
.aide-liste dd { margin: 3px 0 0; color: var(--texte-2); white-space: normal; }

/* ---------------- Budget ---------------- */

.budget-chiffre { font-size: 26px; font-weight: 600; margin: 0 0 8px; }
.budget-chiffre span { font-size: 15px; font-weight: 400; color: var(--texte-2); }

.budget-jauge {
  height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--fond-3); margin-bottom: 8px;
}
.budget-jauge div { height: 100%; background: var(--accent); border-radius: 4px; }

/* Photo agrandie : fond sombre, image au centre. */
#modale-photo {
  background: transparent; border: 0; padding: 0;
  max-width: 96vw; max-height: 96vh; overflow: visible;
}
#modale-photo::backdrop { background: rgba(0, 0, 0, .82); }
#photo-agrandie {
  max-width: 96vw; max-height: 92vh; display: block;
  border-radius: var(--rayon-p); object-fit: contain;
}
#fermer-photo { color: #fff; font-size: 34px; top: -6px; right: 2px; z-index: 1; }

.photo-vignette img { cursor: zoom-in; }

/* ---------------- Prompt ---------------- */

.prompt-texte {
  margin: 12px 0 0;
  padding: 14px;
  background: var(--fond-3);
  border-radius: var(--rayon-p);
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  max-height: 58vh; overflow-y: auto;
}

/* ---------------- Modale ---------------- */

dialog {
  border: 1px solid var(--bordure); border-radius: 12px; padding: 0;
  background: var(--fond); color: var(--texte);
  max-width: 1000px; width: 94vw; max-height: 90vh; overflow: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.fermer {
  position: absolute; top: 10px; right: 12px;
  border: 0; background: transparent; color: var(--texte-2);
  font-size: 26px; line-height: 1; cursor: pointer;
}
.modale-corps { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 22px; }
.modale-corps.solo { grid-template-columns: 1fr; }
.modale-image img { width: 100%; border-radius: var(--rayon-p); border: 1px solid var(--bordure); }
.modale-infos h2 { font-size: 15px; margin: 0 0 12px; }

dl { margin: 0; font-size: 13px; }
dt { font-weight: 600; color: var(--texte-2); margin-top: 10px; font-size: 12px; }
dd { margin: 2px 0 0; white-space: pre-wrap; }

/* ---------------- Adaptatif ---------------- */

/* ---------------- Téléphone ---------------- */

@media (max-width: 640px) {
  /* Les quatre onglets ne tiennent pas sur la ligne du titre : on les descend. */
  .entete {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 12px 0;
    gap: 8px 12px;
  }
  .entete-titre { flex: 1; min-width: 0; }
  .entete-titre strong { white-space: nowrap; }
  .bouton-icone { width: 40px; height: 40px; }

  .onglets {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 2px;
  }
  .onglet { flex: 1; padding: 11px 4px; font-size: 13px; }

  main { padding: 12px; }
  .defilement { padding: 16px 14px 8px; }
  .resultat { padding: 16px 14px; }

  /* iOS zoome sur un champ dont le texte fait moins de 16px. */
  input[type="text"], input[type="password"], textarea, select { font-size: 16px; }

  /* Cibles tactiles : 20px de haut, c'était trop petit pour le doigt. */
  .case { padding: 7px 0; }
  .carte-choix { padding: 15px 14px; }
  .bouton-principal, .bouton-secondaire, .bouton-danger { padding: 14px 16px; }

  /* Deux boutons côte à côte deviennent illisibles sous 400px. */
  .pied { flex-direction: column; }
  .pied .bouton-secondaire { flex: 1 1 auto; width: 100%; }
  .actions-resultat { flex-direction: column; }
  .actions-resultat .bouton-principal,
  .actions-resultat .bouton-secondaire,
  .actions-resultat .bouton-danger { flex: 1 1 auto; width: 100%; }

  /* Choix côte à côte : sur téléphone, l'un sous l'autre. */
  .duo { grid-template-columns: 1fr; }
  .duo.trio { grid-template-columns: repeat(3, 1fr); }

  .galerie { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .photos-liste { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }

  .aide-page { padding: 20px 16px; }
  .charte { padding: 16px 14px; }
  #charte { min-height: 50vh; }
  .charte-actions { width: 100%; }
  .charte-actions button { flex: 1; }

  dialog { width: 100vw; max-width: 100vw; max-height: 100vh; border-radius: 0; border: 0; }
  .modale-corps { padding: 16px; gap: 16px; }
  .prompt-texte { max-height: 45vh; font-size: 11.5px; }
}

@media (max-width: 980px) {
  .colonnes { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .formulaire { overflow: visible; }
  .defilement { overflow: visible; }
  .pied { position: sticky; bottom: 0; }
  .resultat { overflow: visible; min-height: 420px; }
  .modale-corps { grid-template-columns: 1fr; }
  .entete { gap: 12px; padding: 0 12px; }
  .entete-titre span { display: none; }
}

/* ==================================================================
   Ajouts de la version PHP
   ================================================================== */

/* Logo à la place du texte, dans l'en-tête et sur la connexion. */
.entete-logo { display: flex; align-items: center; flex: none; }
.entete-logo img { height: 34px; width: auto; display: block; }

.logo-connexion {
  display: block; width: 100%; max-width: 260px;
  margin: 0 auto 24px; height: auto;
}

.deconnexion { margin-left: auto; display: flex; }

/* Messages après une action. */
.bandeau-message {
  max-width: 1400px; margin: 0 auto 16px; padding: 12px 16px;
  border-radius: var(--rayon-p);
  background: var(--fond); border: 1px solid var(--bordure);
  font-size: 13.5px;
}
.bandeau-message.erreur {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
}

/* Zone de suppression totale : visuellement distincte du reste. */
.zone-danger {
  max-width: 1400px; margin: 24px auto 0; padding: 20px;
  border-color: color-mix(in srgb, var(--danger) 30%, var(--bordure));
}
.zone-danger .bouton-danger { margin-top: 12px; }
.en-ligne { display: inline-flex; }

/* Détail d'un visuel dans la galerie. */
.detail { max-width: 1200px; margin: 0 auto; padding: 20px; }
.detail-corps { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }
.detail-image img { width: 100%; border-radius: var(--rayon-p); border: 1px solid var(--bordure); }
.detail-infos h2 { font-size: 15px; margin: 0 0 12px; }

/* Agrandissement d'une image. */
#agrandissement {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .85); padding: 20px;
}
#agrandissement[hidden] { display: none; }
#agrandissement img { max-width: 96vw; max-height: 92vh; border-radius: var(--rayon-p); }
#agrandissement button {
  position: absolute; top: 12px; right: 18px;
  background: none; border: 0; color: #fff; font-size: 34px; cursor: pointer;
}
.photo-vignette img, .apercu img { cursor: zoom-in; }

/* Demande de confirmation — remplace la boîte du navigateur. */
.demande {
  width: min(400px, calc(100vw - 32px));
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  background: var(--fond);
  color: var(--texte);
  padding: 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}
.demande::backdrop { background: rgba(0, 0, 0, .45); }
.demande form { padding: 22px 24px 18px; }
.demande h2 { font-size: 16px; margin: 0 0 8px; }
.demande p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--texte-2); }
.demande p:empty { display: none; }

.demande-actions { display: flex; gap: 8px; margin-top: 20px; }
.demande-actions button { flex: 1; width: auto; }

@media (max-width: 640px) {
  .demande-actions { flex-direction: column-reverse; }
}

/* Tableau des dépenses par mois. */
.tableau { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.tableau th, .tableau td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--bordure); }
.tableau th { font-size: 12px; color: var(--texte-2); font-weight: 600; }

/* La charte occupe la largeur utile. */
.charte { max-width: 980px; margin: 0 auto; padding: 20px; }
.charte textarea {
  width: 100%; min-height: calc(100vh - 380px);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6; margin-top: 12px;
}
.charte-pied { display: flex; gap: 8px; margin: 12px 0; }

@media (max-width: 640px) {
  .entete-logo img { height: 28px; }
  .detail-corps { grid-template-columns: 1fr; }
  .charte textarea { min-height: 50vh; }
}
