/* ==========================================================================
   Feuille de style de l'ERP Immobilier & BTP
   Une seule feuille pour tout le site : couleurs, mise en page, tableaux, formulaires.
   ========================================================================== */

/* --- 1. Couleurs et réglages communs, rangés dans des "variables" réutilisables --- */
:root {
  --nuit: #16213a;          /* bleu nuit : barre latérale */
  --nuit-clair: #22304f;    /* bleu nuit plus clair : survol dans la barre latérale */
  --laterite: #c2692b;      /* ocre latérite : couleur d'accent (boutons, liens actifs) */
  --laterite-fonce: #a35520;/* accent foncé : survol des boutons */
  --fond: #f5f3ee;          /* fond de page, blanc cassé chaud */
  --carte: #ffffff;         /* fond des cartes et tableaux */
  --bord: #e4dfd5;          /* couleur des bordures */
  --texte: #1e2430;         /* texte principal */
  --discret: #6b7280;       /* texte secondaire */
  --vert: #2f8f5b;          /* statut disponible, succès */
  --ambre: #c99212;         /* statut optionné */
  --bleu: #2f6fb3;          /* statut réservé */
  --brique: #b34a2f;        /* statut vendu, erreurs */
  --ardoise: #5b6575;       /* statut livré */
  --rayon: 10px;            /* arrondi des angles */
  --ombre: 0 1px 2px rgba(22, 33, 58, .06), 0 4px 16px rgba(22, 33, 58, .05); /* ombre légère des cartes */
}

/* --- 2. Base : police, marges, couleurs par défaut --- */
* { box-sizing: border-box; }                       /* la largeur inclut les marges intérieures */
html, body { margin: 0; }                           /* pas de marge autour de la page */
body {
  font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* police lisible, présente partout */
  font-size: 15px;
  color: var(--texte);
  background: var(--fond);
  line-height: 1.5;                                 /* interligne confortable */
}
a { color: var(--laterite); text-decoration: none; }  /* liens couleur accent, non soulignés */
a:hover { text-decoration: underline; }               /* soulignés au survol */
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 650; }
.discret { color: var(--discret); }
.petit { font-size: .85rem; }

/* --- 3. Mise en page générale : barre latérale + contenu --- */
.app {
  display: flex; min-height: 100vh;                 /* deux colonnes côte à côte, sur toute la hauteur */
  background: linear-gradient(to right, var(--nuit) 248px, transparent 248px); /* colonne bleue jusqu'en bas de page */
}
.lateral {
  width: 248px; flex-shrink: 0;                     /* largeur fixe de la barre latérale */
  background: var(--nuit); color: #cfd6e4;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;          /* reste visible quand on fait défiler */
}
.marque {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.25rem 1.25rem 1rem; color: #fff; font-weight: 700; font-size: 1.05rem;
}
.marque .logo {                                     /* petit carré avec l'initiale, en guise de logo */
  width: 34px; height: 34px; border-radius: 8px; background: var(--laterite);
  display: grid; place-items: center; font-size: 1rem; color: #fff;
}
.marque small { display: block; font-weight: 400; font-size: .72rem; color: #8f9bb3; }
.menu { padding: .5rem .75rem; overflow-y: auto; flex: 1; }
.menu .rubrique {                                   /* titre de groupe dans le menu */
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: #7f8aa3; margin: 1rem .5rem .35rem;
}
.menu a {
  display: block; padding: .5rem .75rem; border-radius: 8px;
  color: #d5dbe7; font-weight: 500;
}
.menu a:hover { background: var(--nuit-clair); text-decoration: none; color: #fff; }
.menu a.actif { background: var(--laterite); color: #fff; }  /* page en cours */
.lateral .pied { padding: 1rem 1.25rem; font-size: .75rem; color: #7f8aa3; }

.contenu { flex: 1; min-width: 0; }                 /* min-width:0 évite que les grands tableaux débordent */
.entete {
  display: flex; justify-content: space-between; align-items: center;
  padding: .9rem 2rem; background: var(--carte); border-bottom: 1px solid var(--bord);
}
.utilisateur { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.page { padding: 1.75rem 2rem 3rem; max-width: 1280px; }

/* Boutons "Menu" et "Fermer" visibles seulement sur téléphone */
.bouton-menu, .fermer-menu { display: none; }

/* --- 4. Titre de page avec boutons d'action à droite --- */
.titre-page {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.titre-page p { margin: .2rem 0 0; color: var(--discret); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* --- 5. Boutons --- */
.bouton {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--laterite);
  background: var(--laterite); color: #fff; font-weight: 600; font-size: .9rem;
  cursor: pointer; font-family: inherit;
}
.bouton:hover { background: var(--laterite-fonce); text-decoration: none; }
.bouton.secondaire { background: var(--carte); color: var(--texte); border-color: var(--bord); }
.bouton.secondaire:hover { background: #f0ede6; }
.bouton.danger { background: var(--brique); border-color: var(--brique); }
.bouton.petit { padding: .3rem .6rem; font-size: .8rem; white-space: nowrap; }  /* bouton dans un tableau */
.lien-bouton { background: none; border: 0; color: #cfd6e4; cursor: pointer; font: inherit; padding: 0; }

/* --- 6. Cartes et grilles --- */
.carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem;
}
.carte > h2 { display: flex; justify-content: space-between; align-items: center; }
.grille { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.grille > .carte, .grille > div > .carte:last-child { margin-bottom: 0; } /* l'écart vient déjà de la grille */
.grille-4 { grid-template-columns: repeat(4, 1fr); }  /* 4 colonnes égales */
.grille-3 { grid-template-columns: repeat(3, 1fr); }  /* 3 colonnes égales */
.grille-2 { grid-template-columns: 2fr 1fr; }          /* 2 colonnes : la première deux fois plus large */
.grille-2-egal { grid-template-columns: 1fr 1fr; }

/* Indicateurs chiffrés du tableau de bord */
.kpi .libelle { font-size: .8rem; color: var(--discret); text-transform: uppercase; letter-spacing: .05em; }
.kpi .valeur { font-size: 1.45rem; font-weight: 700; margin-top: .25rem; white-space: nowrap; }
.kpi .note { font-size: .8rem; color: var(--discret); }
.kpi.accent { border-top: 3px solid var(--laterite); }

/* --- 7. Tableaux --- */
.tableau-conteneur { overflow-x: auto; }             /* défilement horizontal sur petit écran */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--discret); font-weight: 600; padding: .6rem .75rem; border-bottom: 1px solid var(--bord);
}
td { padding: .7rem .75rem; border-bottom: 1px solid #efebe3; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf8f4; }
td.nombre, th.nombre { text-align: right; white-space: nowrap; }  /* montants alignés à droite */
.vide { text-align: center; color: var(--discret); padding: 2rem; }

/* --- 8. Étiquettes de statut --- */
.statut {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.statut-disponible { background: #e3f3ea; color: var(--vert); }
.statut-optionne   { background: #fbf1d6; color: #8a6406; }
.statut-reserve    { background: #e2edf8; color: var(--bleu); }
.statut-vendu      { background: #f8e3dc; color: var(--brique); }
.statut-livre      { background: #e7e9ed; color: var(--ardoise); }
.etiquette { display: inline-block; padding: .1rem .45rem; border-radius: 5px; background: #efebe3; font-size: .75rem; font-weight: 600; white-space: nowrap; }

/* Barre empilée : répartition des lots par statut */
.barre { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #efebe3; }
.barre span { display: block; height: 100%; }
.fond-disponible { background: var(--vert); }
.fond-optionne { background: var(--ambre); }
.fond-reserve { background: var(--bleu); }
.fond-vendu { background: var(--brique); }
.fond-livre { background: var(--ardoise); }
.legende { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .75rem; font-size: .85rem; }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; }

/* Petite barre de progression (taux de commercialisation) */
.progression { display: flex; align-items: center; gap: .6rem; min-width: 140px; }
.progression .piste { flex: 1; height: 6px; background: #efebe3; border-radius: 999px; overflow: hidden; }
.progression .piste span { display: block; height: 100%; background: var(--laterite); }

/* --- 9. Fiches : listes "libellé : valeur" --- */
.fiche { display: grid; grid-template-columns: 180px 1fr; gap: .55rem 1rem; margin: 0; }
.fiche dt { color: var(--discret); font-size: .88rem; }
.fiche dd { margin: 0; font-weight: 500; }

/* --- 10. Formulaires --- */
.formulaire { max-width: 820px; }
.grille-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.groupe-champ.large { grid-column: 1 / -1; }          /* champ sur toute la largeur (zones de texte) */
.groupe-champ label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.champ {
  width: 100%; padding: .6rem .75rem; border: 1px solid #d6d0c4; border-radius: 8px;
  background: #fff; font: inherit; color: var(--texte);
}
.champ:focus { outline: 2px solid rgba(194, 105, 43, .25); border-color: var(--laterite); }
.case { width: 18px; height: 18px; accent-color: var(--laterite); vertical-align: middle; }
.aide { font-size: .8rem; color: var(--discret); margin-top: .25rem; }
.erreur { font-size: .82rem; color: var(--brique); margin-top: .25rem; }
.boutons-formulaire { display: flex; gap: .6rem; margin-top: 1.5rem; }

/* Barre de recherche et filtres au-dessus des listes */
.filtres { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filtres .champ { width: auto; min-width: 220px; }

/* --- 11. Messages de confirmation / d'erreur --- */
.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.messages li { padding: .75rem 1rem; border-radius: 8px; margin-bottom: .5rem; font-weight: 500; }
.messages .success { background: #e3f3ea; color: #1f6b43; }
.messages .error { background: #f8e3dc; color: #8f3420; }
.messages .info, .messages .warning { background: #fbf1d6; color: #7a5806; }

/* --- 12. Pagination --- */
.pagination { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; margin-top: 1rem; font-size: .9rem; }

/* --- 13. Page de connexion --- */
.connexion { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.connexion .visuel {
  background: linear-gradient(160deg, var(--nuit) 0%, #24365c 100%);
  color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
}
.connexion .visuel h1 { font-size: 2.2rem; max-width: 16ch; }
.connexion .visuel p { color: #b9c3d6; max-width: 42ch; }
.connexion .formulaire-connexion { display: grid; place-items: center; padding: 2rem; }
.connexion .boite { width: 100%; max-width: 380px; }
.connexion .champ { margin-bottom: 1rem; }

/* --- 14. Adaptation aux tablettes et téléphones --- */
@media (max-width: 1000px) {
  .grille-4, .grille-3 { grid-template-columns: 1fr 1fr; }  /* 2 indicateurs par ligne */
  .grille-2, .grille-2-egal { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { display: block; background: none; }
  .lateral { position: fixed; left: -260px; z-index: 10; transition: left .2s; } /* barre cachée à gauche */
  #menu-ouvert:checked ~ .app .lateral { left: 0; }    /* elle apparaît quand on touche « Menu » */
  .bouton-menu { display: inline-block; cursor: pointer; font-weight: 600; }
  .fermer-menu { display: block; cursor: pointer; padding: .75rem 1.25rem; color: #fff; font-weight: 600; }
  .entete .date, .entete .role { display: none; }      /* on gagne de la place dans l'en-tête */
  .entete, .page { padding-left: 1rem; padding-right: 1rem; }
  .grille-4, .grille-3, .grille-champs { grid-template-columns: 1fr; }
  .fiche { grid-template-columns: 1fr; }
  .connexion { grid-template-columns: 1fr; }
  .connexion .visuel { display: none; }
}


/* ==========================================================================
   15. Chantiers (v3) : diagramme de Gantt simplifié du planning
   ========================================================================== */
.gantt-ligne { display: grid; grid-template-columns: minmax(180px, 28%) 1fr 48px; gap: .8rem; align-items: center;
               padding: .45rem 0; border-bottom: 1px solid #f0ece4; }
.gantt-nom { font-size: .9rem; line-height: 1.25; }
.gantt-nom .discret { display: block; }
.gantt-piste { position: relative; height: 18px; background: #f5f1e9; border-radius: 4px; }
.gantt-barre { position: absolute; top: 0; height: 100%; border-radius: 4px; background: #c9bfae; overflow: hidden; }
.gantt-barre i { display: block; height: 100%; background: rgba(0, 0, 0, .28); }   /* partie déjà réalisée */
.gantt-en_cours { background: #5b8fb9; }
.gantt-termine { background: #6a9f6a; }
.gantt-en_retard { background: #b5472f; }
.gantt-a_venir { background: #cdc3b1; }
.gantt-pct { text-align: right; font-size: .85rem; color: var(--discret); }
@media (max-width: 700px) { .gantt-ligne { grid-template-columns: 1fr 48px; } .gantt-piste { grid-column: 1 / -1; order: 3; } }


/* ==========================================================================
   16. Confort tactile sur téléphone (v17)
   ========================================================================== */
@media (max-width: 760px) {
  .champ, input, select, textarea { font-size: 16px; }          /* évite le zoom automatique d'iPhone dans les champs */
  .bouton { padding: .7rem 1rem; min-height: 44px; }            /* cible tactile d'au moins 44 px */
  .menu a { padding: .8rem .9rem; }                             /* liens du menu plus faciles à toucher */
  .titre-page { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .titre-page .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
  table { font-size: .9rem; }
}
