/* Domanea – feuille de style.
   Charte : vert profond, bleu doux, crème, orange carotte et rouge tabasco. */

:root {
  --fond: #f9f6e8;            /* crème : plan de la page */
  --carte: #ffffff;           /* surface des cartes et des graphiques */
  --encre: #12292a;
  --discret: #5b6b6c;
  --trait: #e6e1cf;

  --primaire: #0f3d3e;        /* vert profond : menu, boutons, titres d'action */
  --primaire-fonce: #0a2c2d;
  --bleu: #52a5b2;            /* bleu doux : touches secondaires */
  --bleu-fond: #e3f1f3;
  --bleu-trait: #a9cfd5;
  --lien: #0f6c78;

  --accent: #ef972e;          /* orange : mise en avant, focus */
  --accent-fond: #fdf1dd;
  --accent-texte: #8f5000;

  --vert: #2f7a4f;
  --vert-fond: #e3f1e6;
  --rouge: #b62203;           /* rouge tabasco : erreurs, suppression */
  --rouge-fond: #fbe7e1;
  --rouge-texte: #a11e03;

  --rayon: 12px;
  --ombre: 0 1px 2px rgba(15, 61, 62, .06);
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a { color: var(--lien); }
a:hover { color: var(--primaire); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: 1.9rem; font-weight: 600; color: var(--primaire); }
h2 { font-size: 1.2rem; }
h3 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--discret); margin-top: 1.4rem;
}
p { margin: 0 0 .8rem; }

/* --- Structure ---------------------------------------------------------- */

body.connecte { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }

main { padding: 2rem clamp(1rem, 4vw, 3rem) 4rem; max-width: 1180px; width: 100%; }
body.visiteur main { margin: 0 auto; }

.menu {
  background: var(--primaire); color: #fff; padding: 1.5rem 1rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.marque {
  display: block; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 600;
  color: inherit; text-decoration: none; margin: 0 .6rem 1.5rem; letter-spacing: .01em;
}
.menu .marque { border-bottom: 3px solid var(--accent); padding-bottom: .7rem; }
.menu nav { display: flex; flex-direction: column; gap: 2px; }
.menu nav a, .menu nav button.lien {
  display: block; width: 100%; text-align: left; color: #d2e4e2; text-decoration: none;
  padding: .55rem .7rem; border-radius: 8px; font-size: 1rem;
}
.menu nav a:hover, .menu nav button.lien:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.menu nav a.actif { background: var(--fond); color: var(--primaire); font-weight: 600; }
.menu nav .sous { font-size: .93rem; padding: .4rem .7rem; }
.menu nav .ajouter { color: #f7bb6d; }
.menu-titre {
  margin: 1.4rem .7rem .3rem; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .08em; color: #8fbcc0;
}
.menu-bascule, .menu-bouton { display: none; }

@media (max-width: 820px) {
  body.connecte { display: block; }
  .menu {
    position: static; height: auto; padding: .8rem 1rem;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  }
  .menu .marque { margin: 0; border-bottom: 0; padding-bottom: 0; }
  .menu-bouton {
    display: inline-block; padding: .4rem .9rem; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .4); border-radius: 8px;
  }
  .menu nav { display: none; width: 100%; margin-top: .8rem; }
  .menu-bascule:checked ~ nav { display: flex; }
  main { padding-top: 1.2rem; }
}

/* --- Éléments ----------------------------------------------------------- */

.carte {
  background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 1.4rem 1.5rem; margin-bottom: 1.3rem; box-shadow: var(--ombre);
}
.carte.etroite { max-width: 560px; }
.carte.accueil { max-width: 480px; margin: 6vh auto 0; padding: 2rem; border-top: 4px solid var(--accent); }
.carte.accueil .marque { color: var(--primaire); margin: 0 0 1rem; }
.carte > h2:first-child { margin-bottom: 1rem; }

.entete {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: .8rem; margin-bottom: 1rem;
}
.entete h1, .entete h2 { margin: 0; }
.entete p { margin: .2rem 0 0; }
main > .entete { margin-top: 1.6rem; }
main > .entete:first-child, .retour + .entete { margin-top: 0; }

.colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 2.5rem; }
main > .colonnes { gap: 0 1.3rem; }
.colonnes h3:first-child { margin-top: .2rem; }

.intro { color: var(--discret); max-width: 70ch; }
.discret, .aide, small { color: var(--discret); font-size: .88rem; }
.aide { margin-top: .8rem; }
.vide { color: var(--discret); margin: 0; }
.retour { display: inline-block; margin-bottom: .8rem; text-decoration: none; font-size: .93rem; }

.etiquette {
  display: inline-block; background: var(--bleu-fond); color: var(--primaire);
  font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 99px;
  margin-bottom: .35rem;
}

.bouton {
  display: inline-block; background: var(--primaire); color: #fff; border: 1px solid var(--primaire);
  padding: .6rem 1.15rem; border-radius: 9px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.bouton:hover { background: var(--primaire-fonce); color: #fff; }
.bouton.secondaire { background: #fff; color: var(--primaire); border-color: var(--bleu-trait); }
.bouton.secondaire:hover { background: var(--bleu-fond); color: var(--primaire); }
.bouton.danger { background: var(--rouge); border-color: var(--rouge); }
.bouton.danger:hover { background: #8f1b02; }
.bouton.petit { padding: .3rem .75rem; font-size: .88rem; margin-right: .5rem; }
.bouton[disabled] { opacity: .55; cursor: default; }
button.lien {
  background: none; border: 0; padding: 0; font: inherit; color: var(--lien);
  text-decoration: underline; cursor: pointer;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin-top: 1.3rem; }
.actions .pousse { margin-left: auto; }
.bascule { margin: 1.3rem 0 0; color: var(--discret); }
form.bascule { margin-top: 1.3rem; }
.zone-danger { text-align: right; font-size: .9rem; }
.zone-danger a { color: var(--rouge-texte); }

/* --- Messages, pastilles ------------------------------------------------ */

.alerte {
  border-radius: 9px; padding: .75rem 1rem; margin-bottom: .8rem;
  border-left: 5px solid var(--bleu); background: var(--bleu-fond);
}
.alerte.success { border-color: var(--vert); background: var(--vert-fond); }
.alerte.attention, .alerte.warning { border-color: var(--accent); background: var(--accent-fond); }
.alerte.danger, .alerte.error { border-color: var(--rouge); background: var(--rouge-fond); }
.alerte ul { margin: 0; padding-left: 1.1rem; }
.alerte-texte { color: var(--rouge-texte) !important; }

.pastille {
  display: inline-block; font-size: .8rem; font-weight: 600; padding: .15rem .6rem;
  border-radius: 99px; white-space: nowrap; background: var(--bleu-fond); color: var(--primaire);
}
.pastille.valide, .pastille.en_cours, .pastille.paye { background: var(--vert-fond); color: var(--vert); }
.pastille.bientot, .pastille.attention, .pastille.preavis, .pastille.partiel {
  background: var(--accent-fond); color: var(--accent-texte);
}
.pastille.expire, .pastille.danger, .pastille.retard { background: var(--rouge-fond); color: var(--rouge-texte); }
.pastille.attendu { background: var(--bleu-fond); color: var(--primaire); }
.pastille.termine { background: #eceae1; color: var(--discret); }

/* Classes énergie : couleurs officielles du DPE, indépendantes de la charte. */
.dpe {
  display: inline-block; min-width: 1.7rem; text-align: center; font-weight: 700;
  color: #fff; border-radius: 5px; padding: .05rem .4rem;
}
.dpe-A { background: #2e9a4b; } .dpe-B { background: #55b247; }
.dpe-C { background: #a5c93a; color: #23310a; } .dpe-D { background: #f1dc1d; color: #3a3400; }
.dpe-E { background: #f2b21a; color: #3d2a00; } .dpe-F { background: #e8792a; }
.dpe-G { background: #d7262b; }

/* --- Tableau de bord ---------------------------------------------------- */

.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin: 1.2rem 0 1.3rem; }
.chiffre {
  background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 1rem 1.2rem; color: var(--discret); font-size: .93rem; box-shadow: var(--ombre);
}
.chiffre > span { display: block; font-size: 1.6rem; font-weight: 700; color: var(--primaire); }

.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.tuiles.espace { margin-top: 1.6rem; max-width: 860px; }
.choix { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.tuile {
  display: flex; flex-direction: column; align-items: flex-start; gap: .15rem;
  background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 1.1rem 1.2rem; text-decoration: none; color: var(--encre); box-shadow: var(--ombre);
}
.tuile:hover { border-color: var(--bleu); color: var(--encre); }
.tuile strong { font-size: 1.1rem; color: var(--primaire); }

.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; gap: .8rem; align-items: flex-start; padding: .6rem 0; border-top: 1px solid var(--trait); }
.liste li:first-child { border-top: 0; padding-top: 0; }
.liste .pastille, .liste .dpe { flex: none; margin-top: .15rem; }

.etapes { padding-left: 1.3rem; margin: .5rem 0 1.3rem; }
.etapes li { margin-bottom: .5rem; }

.invitation-recue {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  border-left: 5px solid var(--accent);
}

/* --- Offre et abonnement ------------------------------------------------ */

.bandeau-offre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; }
.bandeau-offre .bouton { margin: 0; flex: none; }
.jauge { margin: .2rem 0 .8rem; max-width: 420px; }
.jauge svg { display: block; width: 100%; height: 10px; }
.formules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 320px)); gap: 1rem; margin-bottom: 1rem; }
.carte.formule { margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.carte.formule.recommandee { border-top: 4px solid var(--accent); }
.formule h3 { margin: 0; }
.formule .prix { margin: 0; color: var(--discret); }
.formule .prix span { font-size: 1.8rem; font-weight: 700; color: var(--primaire); }
.formule ul { margin: .2rem 0 .8rem; padding-left: 1.2rem; flex: 1; }
.formule li { margin-bottom: .25rem; }

/* --- Réseau ------------------------------------------------------------- */

.compteur {
  display: inline-block; min-width: 1.4rem; text-align: center; margin-left: .3rem;
  background: var(--accent); color: var(--encre); font-size: .78rem; font-weight: 700;
  border-radius: 99px; padding: 0 .4rem;
}
.avatar {
  flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primaire); color: #fff; font-weight: 700;
}
.avatar.externe { background: var(--bleu-fond); color: var(--primaire); border: 1px solid var(--bleu-trait); }
.liste li:has(.avatar) { align-items: center; }
.liste-texte { flex: 1; min-width: 0; }
.liste .fin { flex: none; font-size: .9rem; white-space: nowrap; }
.actions.sans-marge { margin-top: 0; }
.carte.invitations-reseau { border-left: 5px solid var(--accent); }
.depuis-reseau {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; max-width: 860px;
  background: var(--bleu-fond); border-radius: var(--rayon); padding: .8rem 1.1rem; margin-bottom: 1rem;
}
.depuis-reseau label { font-weight: 600; }
.depuis-reseau select { flex: 1 1 260px; width: auto; }

/* --- Graphiques --------------------------------------------------------- */

.graphiques { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin: 1rem 0 1.3rem; }
.carte.graphique { margin: 0; padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
/* Titre et sous-titre réservent deux lignes : les camemberts restent alignés d'une carte à l'autre. */
.graphique h2 { font-size: 1.02rem; margin: 0; color: var(--primaire); min-height: 2.5em; }
.graphique > p { margin: 0; min-height: 2.7em; }
.graphique-image {
  display: block; width: 100%; max-width: 200px; margin: .5rem auto .3rem; padding: 0;
  background: none; border: 0; border-radius: 50%; cursor: zoom-in;
}
.graphique-image svg, .agrandi-image svg { display: block; width: 100%; height: auto; }
.graphique-image path, .graphique-image circle,
.agrandi-image path, .agrandi-image circle { transition: opacity .12s; }
.graphique-image path:hover, .graphique-image circle:hover,
.agrandi-image path:hover, .agrandi-image circle:hover { opacity: .82; }

.legende { list-style: none; margin: .2rem 0 .5rem; padding: 0; font-size: .88rem; flex: 1; }
.legende li { display: flex; align-items: center; gap: .5rem; padding: .14rem 0; }
.pastille-couleur { width: 12px; height: 12px; flex: none; }
.legende-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legende-valeur { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.graphique > button.lien { align-self: flex-start; font-size: .88rem; }

dialog.agrandi {
  border: 0; border-radius: 14px; padding: 1.2rem; width: min(960px, 94vw);
  color: var(--encre); box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}
dialog.agrandi::backdrop { background: rgba(10, 30, 31, .6); }
.agrandi .actions { margin-top: .8rem; }

/* --- Fiches et tableaux ------------------------------------------------- */

.fiche { margin: 0; }
.fiche > div {
  display: grid; grid-template-columns: minmax(130px, 40%) 1fr; gap: .8rem;
  padding: .42rem 0; border-top: 1px solid var(--trait);
}
.fiche > div:first-child { border-top: 0; }
.fiche dt { color: var(--discret); }
.fiche dd { margin: 0; overflow-wrap: anywhere; }
.fiche dd.nombre { text-align: right; white-space: nowrap; }
.fiche.compacte > div { padding: .25rem 0; border: 0; }

.defilement { overflow-x: auto; }
.carte.defilement { padding: .4rem 1.2rem; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--discret); font-weight: 600; padding: .5rem .7rem .5rem 0; white-space: nowrap;
}
td { padding: .65rem .7rem .65rem 0; border-top: 1px solid var(--trait); vertical-align: top; }
td.nombre, th.nombre { text-align: right; white-space: nowrap; }
td.fin { text-align: right; white-space: nowrap; font-size: .9rem; padding-right: 0; }
tfoot td { font-weight: 700; }
tr.hors-champ td { opacity: .55; }
tr.courant td { background: var(--accent-fond); font-weight: 600; }

.onglets { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.1rem 0; }
.onglets a {
  background: var(--carte); border: 1px solid var(--trait); border-radius: 99px;
  padding: .3rem .95rem; text-decoration: none; font-size: .93rem; color: var(--primaire);
}
.onglets a:hover { border-color: var(--bleu); }
.onglets a[aria-current] { background: var(--primaire); border-color: var(--primaire); color: #fff; }
.onglets.secondaires { margin-top: 0; }
.onglets.secondaires a { font-size: .86rem; padding: .2rem .8rem; }
section[id] { scroll-margin-top: 1rem; }

details.reperes { margin-top: 1.4rem; background: var(--fond); border-radius: 9px; padding: .8rem 1rem; }
details.reperes summary, details.section summary { cursor: pointer; font-weight: 600; }
details.reperes ul, .reperes ul, details.section ul { margin: .7rem 0 0; padding-left: 1.2rem; }
details.reperes li, .reperes li, details.section li { margin-bottom: .35rem; }
.carte.reperes { background: #fffdf5; border-left: 5px solid var(--accent); }

.invitation { border-top: 1px solid var(--trait); padding: .8rem 0; }
.lien-invitation { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .5rem; }
.lien-invitation input { flex: 1 1 260px; }

/* --- Formulaires -------------------------------------------------------- */

.formulaire { max-width: 860px; }
.page-formulaire { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.3rem; align-items: start; }
.page-formulaire > aside { order: -1; margin: 0; font-size: .93rem; }
@media (min-width: 1350px) {
  .page-formulaire:has(> aside:not([hidden])) { grid-template-columns: minmax(0, 1fr) 340px; }
  .page-formulaire > aside { order: 0; position: sticky; top: 1rem; }
}
.page-formulaire > aside .fiche > div { grid-template-columns: 1fr; gap: 0; padding: .3rem 0; }
.carte.accueil .formulaire .grille { grid-template-columns: 1fr; }

details.section {
  background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: .9rem 1.3rem; margin-bottom: .8rem; box-shadow: var(--ombre);
}
details.section > summary { font-size: 1.08rem; color: var(--primaire); }
details.section[open] > summary { margin-bottom: .9rem; }
.carte details.section { background: var(--fond); box-shadow: none; }

.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 1.3rem; }
.champ { display: flex; flex-direction: column; gap: .25rem; }
.champ.large { grid-column: 1 / -1; }
.champ label { font-weight: 600; font-size: .95rem; }
.champ.case { justify-content: center; }
.champ.case label { display: flex; gap: .6rem; align-items: center; font-weight: 500; cursor: pointer; }
.champ.case input { width: 1.2rem; height: 1.2rem; flex: none; }
.requis { color: var(--rouge); }
input[type=checkbox], input[type=radio] { accent-color: var(--primaire); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1px solid #b4c2c2; border-radius: 8px; padding: .55rem .7rem; min-height: 2.6rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--bleu); }
textarea { resize: vertical; }
.en-erreur input, .en-erreur select, .en-erreur textarea { border-color: var(--rouge); }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--rouge-texte); font-size: .9rem; font-weight: 600; }
.champ small ul { margin: .2rem 0 0; padding-left: 1.1rem; }

/* Listes de choix (boutons radio, cases à cocher) */
.champ.large > div { display: flex; flex-direction: column; gap: .5rem; }
.champ.large > div label { font-weight: 500; display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.champ.large > div input[type=radio], .champ.large > div input[type=checkbox] {
  margin-top: .3rem; flex: none; width: 1.1rem; height: 1.1rem;
}

.filtres { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.2rem; }
.filtres input { flex: 2 1 240px; }
.filtres select { flex: 1 1 200px; }
form.en-ligne { display: inline; }
form.en-ligne select { min-height: 2.2rem; padding: .3rem .5rem; width: auto; }

.code-local { font-size: 1.25rem; letter-spacing: .15em; white-space: nowrap; }
#id_code { font-size: 1.5rem; letter-spacing: .3em; text-align: center; max-width: 14rem; }

/* --- Documents imprimables (quittances) --------------------------------- */

.document {
  background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon);
  max-width: 760px; padding: 2.5rem clamp(1.2rem, 5vw, 3rem); margin-top: 1rem;
}
.document header { text-align: center; margin-bottom: 2rem; }
.document header p { color: var(--discret); margin: 0; }
.document-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 1rem; }
.document h3 { margin-top: 0; }
.document table { margin: 1.5rem 0; }
.document-signature { margin-top: 2.5rem; text-align: right; }

@media print {
  html { font-size: 12pt; }
  body, body.connecte { display: block; background: #fff; }
  .menu, .sans-impression, .alerte { display: none !important; }
  main { padding: 0; max-width: none; }
  .document { border: 0; padding: 0; margin: 0; max-width: none; }
  a, h1 { color: inherit; text-decoration: none; }
}
