/* ===== Base ===== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: #eef1f5; color: #1d2b3a; font-size: 14px;
}
h1, h2, h3 { margin: 0 0 12px; }
button { font-family: inherit; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid #c5cdd8; border-radius: 5px; width: 100%; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #0b6e79; border-color: #0b6e79; }
label { display: block; margin: 10px 0 4px; font-weight: 600; color: #33475b; font-size: 13px; }

/* ===== Boutons ===== */
.btn {
  border: 0; border-radius: 6px; padding: 9px 18px; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: filter .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn-principal { background: #0b6e79; color: #fff; }
.btn-secondaire { background: #64748b; color: #fff; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-succes { background: #27ae60; color: #fff; }
.btn-large { width: 100%; padding: 12px; font-size: 15px; margin-top: 16px; }
.btn-petit { padding: 5px 10px; font-size: 12.5px; }
.btn-lien { background: none; border: 0; color: #d3eef1; cursor: pointer; font-size: 13px; text-decoration: underline; }
.btn-lien:hover { color: #fff; }

/* ===== Écrans plein page (login, choix projet) ===== */
.ecran-plein {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0b3d4a 0%, #0b6e79 55%, #128291 100%); overflow: auto;
}
.login-box, .choix-projet-box {
  background: #fff; border-radius: 12px; padding: 36px 40px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35); width: 400px; max-width: 94vw; text-align: center;
}
.choix-projet-box { width: 720px; }
.login-logo { font-size: 46px; }
.login-box h1, .choix-projet-box h1 { color: #0b6e79; font-size: 24px; }
.login-sous-titre { color: #64748b; margin-top: -6px; }
.login-box form { text-align: left; margin-top: 10px; }
.msg-erreur {
  background: #fdecea; color: #c0392b; border: 1px solid #f5b7b1;
  border-radius: 5px; padding: 8px 12px; margin-top: 12px; font-size: 13px;
}
.msg-info { background: #eaf2fd; color: #1a5276; border-radius: 5px; padding: 12px; margin: 14px 0; }

.grille-projets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 18px 0; }
.carte-projet {
  border: 2px solid #dbe2ea; border-radius: 10px; padding: 16px; cursor: pointer;
  text-align: left; background: #fff; transition: all .15s;
}
.carte-projet:hover { border-color: #0b6e79; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(11,110,121,.18); }
.carte-projet .cp-type {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; margin-bottom: 8px; letter-spacing: .5px;
}
.cp-type.MAISON { background: #fdebd0; color: #b9770e; }
.cp-type.TERRAIN { background: #d5f5e3; color: #1e8449; }
.carte-projet h3 { font-size: 16px; margin: 2px 0 6px; color: #17384a; }
.carte-projet .cp-detail { font-size: 12.5px; color: #64748b; }
.barre-actions-centre { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }

/* ===== Structure application ===== */
.entete-app {
  height: 54px; background: linear-gradient(90deg, #0b3d4a, #0b6e79);
  color: #fff; display: flex; align-items: center; padding: 0 18px; gap: 20px;
  position: sticky; top: 0; z-index: 20;
}
.entete-titre { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.entete-projet {
  flex: 1; text-align: center; font-weight: 600; font-size: 14px; color: #d3eef1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.entete-projet b { color: #ffd465; }
.entete-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
#entete-user-nom { font-weight: 600; }

.corps-app { display: flex; min-height: calc(100vh - 54px); }

/* ===== Menu latéral (style maquette WINDEV) ===== */
.menu-lateral {
  width: 232px; background: #f7f9fb; border-right: 1px solid #dde3ea;
  padding: 12px 8px; flex-shrink: 0;
}
.menu-lateral .titre-menu {
  font-size: 11px; font-weight: 700; color: #0b3d4a; letter-spacing: 1px;
  padding: 4px 10px 8px; border-bottom: 2px solid #0b6e79; margin-bottom: 8px;
}
.item-menu {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: #fff; border: 1px solid #dde3ea; border-radius: 6px;
  padding: 10px 12px; margin-bottom: 6px; cursor: pointer;
  font-size: 12.5px; font-weight: 700; color: #17384a; text-align: left;
  letter-spacing: .3px; transition: all .12s;
}
.item-menu:hover { border-color: #0b6e79; background: #eef7f8; }
.item-menu.actif { border-color: #0b6e79; background: #0b6e79; color: #fff; }
.item-menu .ico { font-size: 16px; width: 22px; text-align: center; }

/* Menu réduit (icônes seules) */
.btn-menu-toggle {
  background: rgba(255,255,255,.12); border: 0; color: #fff; font-size: 18px;
  cursor: pointer; padding: 4px 10px; border-radius: 6px; margin-right: 4px;
}
.btn-menu-toggle:hover { background: rgba(255,255,255,.25); }
.menu-lateral { transition: width .15s ease; }
.menu-lateral.reduit { width: 64px; padding: 12px 7px; }
.menu-lateral.reduit .titre-menu { font-size: 0; padding: 0 0 8px; }
.menu-lateral.reduit .item-menu { justify-content: center; padding: 10px 4px; }
.menu-lateral.reduit .item-menu .lib { display: none; }
.menu-lateral.reduit .item-menu .ico { width: auto; }

/* Résumé en tête des fenêtres popup */
.bloc-resume-popup {
  display: flex; gap: 26px; align-items: center; flex-wrap: wrap;
  background: #f5f8fa; border: 1px solid #dde5eb; border-radius: 6px;
  padding: 10px 14px; margin-bottom: 12px; font-size: 13.5px;
}

/* Pied de l'écran de connexion + bouton À propos du menu */
.pied-login {
  margin-top: 18px; padding-top: 12px; border-top: 1px solid #e3eaf0;
  font-size: 11px; color: #8795a7; text-align: center; line-height: 1.6;
}
.pied-login a { color: #0b6e79; text-decoration: none; }
.pied-login a:hover { text-decoration: underline; }
.menu-apropos {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; border-top: 1px solid #dde3ea; border-radius: 0;
  padding: 12px; margin-top: 10px; cursor: pointer;
  font-size: 11.5px; color: #8795a7; text-align: left;
}
.menu-apropos:hover { color: #0b6e79; }
.menu-lateral.reduit .menu-apropos { justify-content: center; padding: 12px 4px; }
.menu-lateral.reduit .menu-apropos .lib { display: none; }

/* ===== Contenu ===== */
.contenu { flex: 1; padding: 20px 24px; overflow-x: auto; }
.titre-page {
  color: #0b3d4a; font-size: 20px; font-weight: 800; letter-spacing: .5px;
  border-bottom: 3px solid #0b6e79; padding-bottom: 8px; margin-bottom: 18px;
  text-transform: uppercase;
}
.barre-outils { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.barre-outils input[type="text"] { width: 260px; }
.barre-outils .espace { flex: 1; }

/* ===== Alertes du tableau de bord ===== */
.zone-alertes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.alerte {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-radius: 8px; border-left: 5px solid; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.08); font-size: 13.5px;
}
.alerte .a-ico { font-size: 19px; }
.alerte .a-texte { flex: 1; }
.alerte.attention { border-color: #e67e22; background: #fef9f3; }
.alerte.danger { border-color: #c0392b; background: #fdf3f2; }
.alerte.info { border-color: #2980b9; background: #f2f8fd; }
.alerte.ok { border-color: #27ae60; background: #f3fbf6; }

/* ===== Activité récente / Actions rapides ===== */
.zone-basse { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; margin-top: 22px; align-items: start; }
.titre-carte {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800; font-size: 14px; color: #0b3d4a;
  padding: 13px 16px; border-bottom: 1px solid #e7edf2;
}
.liste-activite { max-height: 420px; overflow-y: auto; }
.ligne-activite {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid #f0f4f7;
}
.ligne-activite:last-child { border-bottom: 0; }
.ligne-activite .la-ico {
  width: 34px; height: 34px; border-radius: 50%; background: #eef4f8;
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.ligne-activite .la-texte { flex: 1; min-width: 0; }
.ligne-activite .la-titre { font-weight: 600; font-size: 13px; color: #1d2b3a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne-activite .la-sous { font-size: 12px; color: #8795a7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne-activite .la-droite { text-align: right; flex-shrink: 0; }
.ligne-activite .la-date { font-size: 11px; color: #a0acba; margin-top: 3px; }
.liste-actions { padding: 8px; }
.action-rapide {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: #fff; border: 1px solid #e3eaf0; border-radius: 8px;
  padding: 11px 14px; margin-bottom: 7px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: #17384a; text-align: left; transition: all .12s;
}
.action-rapide:hover { border-color: #0b6e79; background: #eef7f8; transform: translateX(2px); }
.action-rapide .ar-ico {
  width: 32px; height: 32px; border-radius: 8px; background: #eef4f8;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
@media (max-width: 900px) { .zone-basse { grid-template-columns: 1fr; } }

/* ===== Tuiles du tableau de bord ===== */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tuile {
  border-radius: 8px; color: #fff; padding: 16px; text-align: center;
  box-shadow: 0 4px 10px rgba(0,0,0,.12);
}
.tuile .t-ico { font-size: 26px; }
.tuile .t-valeur { font-size: 30px; font-weight: 800; margin: 4px 0; }
.tuile .t-libelle { font-size: 12px; font-weight: 600; opacity: .95; }
.tuile.vert { background: linear-gradient(160deg, #1e8449, #27ae60); }
.tuile.jaune { background: linear-gradient(160deg, #b9770e, #f1c40f); }
.tuile.orange { background: linear-gradient(160deg, #ba4a00, #e67e22); }
.tuile.bleu { background: linear-gradient(160deg, #1a5276, #2980b9); }
.tuile.rose { background: linear-gradient(160deg, #922b5e, #c0397b); }
.tuile.rouge { background: linear-gradient(160deg, #922b21, #c0392b); }

.bandeau-section {
  background: linear-gradient(90deg, #0b3d4a, #128291); color: #fff;
  padding: 10px 16px; border-radius: 6px; font-weight: 800; font-size: 15px;
  letter-spacing: .5px; margin: 8px 0 16px; text-transform: uppercase;
}

.tuiles-finance { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tuile-finance {
  border-radius: 8px; color: #fff; padding: 18px; text-align: center;
}
.tuile-finance .tf-montant { font-size: 24px; font-weight: 800; }
.tuile-finance .tf-libelle { font-size: 12px; font-weight: 600; margin-top: 4px; opacity: .95; }
.tuile-finance.teal { background: linear-gradient(160deg, #0e6655, #16a085); }
.tuile-finance.olive { background: linear-gradient(160deg, #7d6608, #9a7d0a); }
.tuile-finance.violet { background: linear-gradient(160deg, #4a235a, #6c3483); }
.tuile-finance.vert { background: linear-gradient(160deg, #1e8449, #2ecc71); }

.zone-finances { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
.carte-graphique { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 3px 8px rgba(0,0,0,.08); }
.carte-graphique h3 { text-align: center; font-size: 14px; color: #33475b; }
.legende-graph { font-size: 12.5px; margin-top: 10px; }
.legende-graph div { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.legende-graph .pastille { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* ===== Tableaux ===== */
.conteneur-table { background: #fff; border-radius: 8px; box-shadow: 0 3px 8px rgba(0,0,0,.08); overflow-x: auto; }
table.donnees { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.donnees th {
  background: #0b6e79; color: #fff; text-align: left; padding: 10px 12px;
  font-size: 12px; letter-spacing: .4px; white-space: nowrap;
}
table.donnees td { padding: 9px 12px; border-bottom: 1px solid #edf1f5; }
table.donnees tr:hover td { background: #f2f8f9; }
table.donnees td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.donnees .actions { white-space: nowrap; text-align: right; }
table.donnees .actions button { margin-left: 5px; }
.table-vide { padding: 26px; text-align: center; color: #8795a7; }

/* ===== Tableau interactif (pagination, tri, export) ===== */
.dt-pied {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 12px 0; font-size: 13px; color: #33475b;
}
th.dt-th { cursor: pointer; user-select: none; }
.dt-filtre-nombre { display: inline-flex; align-items: center; gap: 6px; }
.dt-filtre-nombre label { font-size: 13px; color: #33475b; }
th.dt-th:hover { background: #0b5860; }
.dt-compteur { white-space: nowrap; }

/* ===== Badges de statut ===== */
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; letter-spacing: .3px; white-space: nowrap;
}
.badge.DISPONIBLE, .badge.VALIDEE, .badge.VALIDE, .badge.PAYEE, .badge.ACTIF { background: #d5f5e3; color: #1e8449; }
.badge.RESERVE, .badge.EN_ATTENTE, .badge.PARTIEL { background: #fdebd0; color: #b9770e; }
.badge.VENDU, .badge.SOLDEE { background: #d6eaf8; color: #1a5276; }
.badge.ANNULEE, .badge.REJETE, .badge.A_PAYER, .badge.RETARD, .badge.CLOTURE { background: #fdecea; color: #c0392b; }
.badge.ADMIN { background: #ebdef0; color: #6c3483; }
.badge.GESTIONNAIRE { background: #d6eaf8; color: #1a5276; }
.badge.CAISSIER { background: #fdebd0; color: #b9770e; }
.badge.LECTEUR { background: #eaecee; color: #566573; }

/* ===== Modale ===== */
.modal-fond {
  position: fixed; inset: 0; background: rgba(10,25,35,.55); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto;
}
.modal-boite {
  background: #fff; border-radius: 10px; width: 640px; max-width: 96vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.modal-boite.large { width: 900px; }
.modal-entete {
  display: flex; justify-content: space-between; align-items: center;
  background: #0b6e79; color: #fff; border-radius: 10px 10px 0 0; padding: 12px 18px;
}
.modal-entete h2 { margin: 0; font-size: 16px; }
.modal-fermer { background: none; border: 0; color: #fff; font-size: 18px; cursor: pointer; }
.modal-corps { padding: 18px 22px 22px; }
.ligne-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.ligne-champs-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.pied-modal { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.section-form {
  font-size: 12px; font-weight: 800; color: #0b6e79; letter-spacing: 1px;
  border-bottom: 1px solid #d5e3e5; padding-bottom: 4px; margin: 18px 0 4px; text-transform: uppercase;
}

/* Section repliable (enrouler / dérouler) */
.section-repliable { margin: 18px 0 8px; }
.section-repliable summary {
  cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 800; color: #0b6e79; letter-spacing: 1px;
  border-bottom: 1px solid #d5e3e5; padding-bottom: 4px; text-transform: uppercase;
}
.section-repliable summary::-webkit-details-marker { display: none; }
.section-repliable summary::before { content: '▸'; font-size: 13px; transition: transform .15s; }
.section-repliable[open] summary::before { transform: rotate(90deg); }
.section-repliable summary:hover { color: #0b3d4a; }
.section-repliable summary .indice { font-weight: 600; color: #8795a7; text-transform: none; letter-spacing: 0; }
.section-repliable .sr-corps { margin-top: 8px; }
.total-calcule {
  background: #eef7f8; border: 1px solid #0b6e79; border-radius: 6px;
  padding: 10px 14px; margin-top: 12px; font-weight: 700; color: #0b3d4a; text-align: right;
}

/* ===== Fiche détail ===== */
.fiche { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.fiche .champ { padding: 6px 0; border-bottom: 1px dotted #dde3ea; font-size: 13.5px; }
.fiche .champ b { color: #567; font-weight: 600; display: inline-block; min-width: 150px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  padding: 13px 22px; border-radius: 8px; color: #fff; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.3); animation: apparait .2s ease;
}
.toast.succes { background: #1e8449; }
.toast.erreur { background: #c0392b; }
@keyframes apparait { from { opacity: 0; transform: translateY(10px); } }

/* ===== Divers ===== */
.progression { background: #edf1f5; border-radius: 10px; height: 16px; overflow: hidden; min-width: 90px; }
.progression > div { background: linear-gradient(90deg, #16a085, #27ae60); height: 100%; border-radius: 10px; }
.texte-droite { text-align: right; }
.texte-muet { color: #8795a7; font-size: 12.5px; }
@media (max-width: 900px) {
  .zone-finances, .ligne-champs, .fiche { grid-template-columns: 1fr; }
  .menu-lateral { width: 180px; }
}
