/* Environnement « Particulier » (phase 6, 04/10/2026) — disposition d'Obat : bandeau, menu gauche, contenu.
   Les couleurs restent celles de CAMYnergie (jetons de site.css). */
:root {
  --p-fond: #f3f5f9;
  --p-menu-largeur: 232px;
  --p-bandeau-hauteur: 60px;
  --p-accent: var(--camy-bleu);
  --p-accent-clair: #e8f0fb;
  --p-rouge: #d64545;
  --p-vert: #1f845a;
  --p-orange: #c77a16;
}
body.p-corps { background: var(--p-fond); margin: 0; min-height: 100vh; }

/* ---------- bandeau ---------- */
.p-bandeau { position: sticky; top: 0; z-index: 1020; height: var(--p-bandeau-hauteur); background: #fff; border-bottom: 1px solid var(--bord);
  display: grid; grid-template-columns: var(--p-menu-largeur) 1fr auto; align-items: center; gap: 16px; padding: 0 16px 0 0; }
.p-identite { padding: 0 16px; border-right: 1px solid var(--bord); height: 100%; display: flex; flex-direction: column; justify-content: center; }
.p-identite-nom { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--encre); }
.p-identite-societe { font-size: .72rem; letter-spacing: .08em; color: var(--encre-2); }
.p-bandeau-actions { display: flex; align-items: center; gap: 14px; }
.p-btn-creer { background: var(--p-accent); color: #fff; border-radius: 10px; font-weight: 600; padding: 6px 14px; }
.p-btn-creer:hover { background: var(--camy-bleu-clair); color: #fff; }
.p-recherche { flex: 1; max-width: 460px; }
.p-recherche input { background: #f3f5f9; border: 1px solid transparent; border-radius: 10px; }
.p-recherche input:focus { background: #fff; border-color: var(--p-accent); box-shadow: none; }
.p-bandeau-droite { display: flex; align-items: center; gap: 12px; }
.p-btn-bascule { border: 1px solid var(--bord); border-radius: 10px; color: var(--p-accent); background: #fff; font-weight: 600; }
.p-btn-bascule:hover { background: var(--p-accent-clair); }
.p-icone { font-size: 1.15rem; text-decoration: none; }
.p-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--camy-bleu-fonce); color: #fff; font-weight: 700; border: 0; font-size: .8rem; }
.p-avatar::after { display: none; }

/* ---------- menu gauche ---------- */
.p-cadre { display: grid; grid-template-columns: var(--p-menu-largeur) 1fr; min-height: calc(100vh - var(--p-bandeau-hauteur)); }
.p-menu { background: #fff; border-right: 1px solid var(--bord); padding: 14px 0; position: sticky; top: var(--p-bandeau-hauteur); height: calc(100vh - var(--p-bandeau-hauteur)); overflow-y: auto; display: flex; flex-direction: column; }
.p-menu-item { display: block; padding: 9px 20px; color: var(--encre); text-decoration: none; font-size: .93rem; border-left: 3px solid transparent; }
.p-menu-item:hover { background: #f6f8fb; text-decoration: none; color: var(--p-accent); }
.p-menu-item.actif { color: var(--p-accent); font-weight: 600; border-left-color: var(--p-accent); background: var(--p-accent-clair); }
.p-sous-menu { padding: 2px 0 6px 0; }
.p-sous-menu a { display: block; padding: 5px 20px 5px 38px; font-size: .85rem; color: var(--encre-2); text-decoration: none; }
.p-sous-menu a:hover, .p-sous-menu a.actif { color: var(--p-accent); }
.p-sous-menu a.actif { font-weight: 600; }
/* groupe du menu (31/10/2026) : titre repliable, entrées encadrées d'un filet */
.p-menu-groupe { margin: 4px 0 6px; border-top: 1px solid var(--bord); border-bottom: 1px solid var(--bord); background: #fbfcfe; }
.p-menu-groupe-titre { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 8px 20px 4px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--encre-2); user-select: none; }
.p-menu-groupe-titre::-webkit-details-marker { display: none; }
.p-menu-groupe-titre:hover { color: var(--p-accent); }
.p-menu-groupe-titre svg.ico { width: .85rem; height: .85rem; transition: transform .15s; }
.p-menu-groupe[open] > .p-menu-groupe-titre svg.ico { transform: rotate(90deg); }
.p-menu-groupe[open] { padding-bottom: 4px; }
.p-menu-pied { margin-top: auto; padding: 14px 20px 4px; font-size: .75rem; color: var(--encre-2); }

/* ---------- contenu ---------- */
.p-contenu { padding: 20px 24px 40px; min-width: 0; }
.p-titre { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.p-titre h1 { font-size: 1.25rem; font-weight: 700; margin: 0; color: var(--encre); }
.p-titre .p-filtre { flex: 1; max-width: 520px; }
.p-titre .p-filtre input, .p-titre .p-filtre select { border-radius: 10px; }
.p-btn-principal { background: var(--p-accent); color: #fff; border-radius: 10px; font-weight: 600; }
.p-btn-principal:hover { background: var(--camy-bleu-clair); color: #fff; }

.p-cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.p-carte { background: #fff; border: 1px solid var(--bord); border-radius: 14px; padding: 14px 16px; }
.p-carte .p-carte-libelle { font-size: .8rem; color: var(--encre-2); display: flex; justify-content: space-between; }
.p-carte .p-carte-nombre { font-size: 1.3rem; font-weight: 700; color: var(--encre); margin-top: 4px; font-variant-numeric: tabular-nums; }
.p-carte .p-carte-nombre small { font-size: .72rem; color: var(--encre-2); font-weight: 500; }
.p-carte.p-carte-rouge .p-carte-nombre { color: var(--p-rouge); }
.p-carte.p-carte-vert .p-carte-nombre { color: var(--p-vert); }

.p-tableau { background: #fff; border: 1px solid var(--bord); border-radius: 14px; overflow: hidden; }
.p-tableau table { margin: 0; font-size: .88rem; }
.p-tableau thead th { font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; color: var(--encre-2); font-weight: 600; border-bottom: 1px solid var(--bord); background: #fafbfd; white-space: nowrap; }
.p-tableau tbody td { vertical-align: middle; border-bottom: 1px solid #eef1f5; }
.p-tableau tbody tr:hover { background: #f8fafd; }
.p-tableau td.num, .p-tableau th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-tableau .p-second { display: block; font-size: .78rem; color: var(--encre-2); }
.p-pied { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: .85rem; color: var(--encre-2); border-top: 1px solid var(--bord); background: #fafbfd; }
.p-pied .pagination { margin: 0; }

/* pastilles de statut, comme Obat : pilule douce, texte coloré */
.p-statut { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: #eef1f5; color: var(--encre-2); }
.p-statut.brouillon { background: #eef1f5; color: #5a6b7e; }
.p-statut.emis, .p-statut.envoyee, .p-statut.finalisee, .p-statut.ouvert, .p-statut.saisi { background: var(--p-accent-clair); color: var(--p-accent); }
.p-statut.signe, .p-statut.payee, .p-statut.paye, .p-statut.termine, .p-statut.versee { background: #e9f7f0; color: var(--p-vert); }
.p-statut.perdu, .p-statut.annule, .p-statut.annulee, .p-statut.en_retard, .p-statut.refusee { background: #fdecec; color: var(--p-rouge); }
.p-statut.abandonne, .p-statut.deposee, .p-statut.estimee { background: #fff4e5; color: var(--p-orange); }
.p-origine { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: .7rem; font-weight: 600; letter-spacing: .04em; background: #f1f5fa; color: var(--encre-2); }
.p-origine.OBAT { background: #e9f1ff; color: #2f5fd0; }
.p-origine.SELLSY { background: #fff0e3; color: #c06a16; }
.p-origine.ZOHO { background: #f3e8ff; color: #7a3fb3; }
.p-origine.CAMY { background: #e9f7f0; color: var(--p-vert); }
.p-origine.VELTRON { background: #e6f4f8; color: #0e7490; }
.p-origine.BATAPPLI { background: #fdf2e9; color: #9a4a12; }   /* reprise du BatAppli des débuts de CAMYnergie (09/10/2026) */
.p-origine.BATICHIFFRAGE { background: #eef6e8; color: #3f6b1f; }   /* bibliothèque de prix BatiChiffrage (09/10/2026) */
.p-avancement { height: 6px; border-radius: 3px; background: #e9eef5; width: 90px; overflow: hidden; }
.p-avancement > div { height: 100%; background: var(--p-accent); }

/* fiches */
.p-fiche { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.p-fiche .p-bloc { background: #fff; border: 1px solid var(--bord); border-radius: 14px; padding: 16px 18px; }
.p-fiche .p-bloc h2 { font-size: .95rem; font-weight: 700; margin-bottom: 10px; color: var(--encre); }
.p-ligne-cle { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: .88rem; border-bottom: 1px dashed #eef1f5; }
.p-ligne-cle span:first-child { color: var(--encre-2); }
.p-total { display: flex; justify-content: space-between; padding: 6px 0; font-size: .95rem; }
.p-total.net { background: var(--p-accent); color: #fff; padding: 8px 12px; border-radius: 10px; font-weight: 700; margin-top: 6px; }
.p-section-ligne td { background: #f6f8fb; font-weight: 600; }
.p-texte-ligne td { color: var(--encre-2); font-size: .82rem; }
.p-description { font-size: .8rem; color: var(--encre-2); white-space: pre-line; }
@media (max-width: 900px) {
  .p-bandeau { grid-template-columns: 1fr auto; }
  .p-identite { display: none; }
  .p-cadre { grid-template-columns: 1fr; }
  .p-menu { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .p-sous-menu { display: none; }
  .p-fiche { grid-template-columns: 1fr; }
}

/* ---- phase 9 (04/10/2026) : chaîne prospection → facturation → réception ---- */
.p-formulaire .form-label { font-size: .8rem; color: #6b7280; margin-bottom: .15rem; }
.p-formulaire .p-bloc h2 { margin-bottom: .6rem; }
.p-choix { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .6rem; border: 1px solid var(--bord, #e5e7eb); border-radius: 8px; background: #fff; cursor: pointer; font-size: .9rem; }
.p-cases { display: flex; flex-wrap: wrap; gap: .4rem; }
.p-resultats { position: relative; z-index: 20; max-height: 260px; overflow: auto; }
.p-resultats .list-group-item { padding: .35rem .7rem; }
.p-barre-outils { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 1rem; border-bottom: 1px solid var(--bord, #e5e7eb); flex-wrap: wrap; }
.p-biblio { padding: .6rem 1rem; background: #f8fafc; border-bottom: 1px solid var(--bord, #e5e7eb); }
.p-biblio .list-group { max-height: 280px; overflow: auto; }
.p-editeur td { vertical-align: top; padding: .35rem .4rem; }
.p-editeur input.num { text-align: right; }
.p-editeur .c-description { resize: vertical; min-height: 30px; font-size: .8rem; }
.p-editeur tr.p-section-ligne td { background: #f1f5f9; }
.p-editeur tr.p-section-ligne .c-libelle { font-weight: 600; }
.p-editeur tr.p-texte-ligne .c-libelle { font-style: italic; }
.p-editeur tfoot td { border-top: 1px solid var(--bord, #e5e7eb); font-size: .95rem; }
.p-editeur tr.p-total-ttc td { background: #fff7e6; }
.p-poignee { cursor: default; font-size: .8rem; }
.p-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.p-actions form { margin: 0; }
.p-panneau { background: #fff; border: 1px solid var(--bord, #e5e7eb); border-radius: 14px; padding: 12px 18px; }
.p-panneau h2 { font-size: .95rem; margin-bottom: .5rem; }
details.p-repli > summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: #374151; list-style: none; }
details.p-repli > summary::before { content: "▸ "; }
details.p-repli[open] > summary::before { content: "▾ "; }
details.p-repli { border: 1px dashed var(--bord, #e5e7eb); border-radius: 10px; padding: .5rem .8rem; background: #fcfcfd; }
.p-statut.en_cours, .p-statut.planifiee, .p-statut.a_planifier { background: #e0f2fe; color: #075985; }
.p-statut.receptionne, .p-statut.terminee, .p-statut.clos { background: #dcfce7; color: #166534; }

/* ---------- messagerie des chantiers (05/10/2026, architecture Obat) ---------- */
.p-icone-badge { position: relative; }
.p-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--p-rouge); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; vertical-align: top; margin-left: -6px; }
.p-badge-menu { margin-left: 6px; }
.p-chat { display: grid; grid-template-columns: 340px 1fr; gap: 0; background: #fff; border: 1px solid var(--bord); border-radius: 12px; min-height: calc(100vh - 150px); overflow: hidden; }
.p-chat-liste { border-right: 1px solid var(--bord); display: flex; flex-direction: column; min-height: 0; }
.p-chat-liste .p-chat-onglets { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--bord); }
.p-chat-onglets a { padding: 4px 10px; border-radius: 10px; font-size: .85rem; text-decoration: none; color: var(--encre); }
.p-chat-onglets a.actif { background: var(--p-accent-clair); color: var(--p-accent); font-weight: 600; }
.p-chat-defil { overflow-y: auto; flex: 1; }
.p-chat-item { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f0f2f6; text-decoration: none; color: var(--encre); align-items: start; }
.p-chat-item:hover { background: #f6f8fb; text-decoration: none; }
.p-chat-item.actif { background: var(--p-accent-clair); }
.p-chat-item .p-chat-nom { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-chat-item .p-chat-extrait { font-size: .8rem; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-chat-item .p-chat-date { font-size: .72rem; color: #9aa3b2; white-space: nowrap; }
.p-chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--p-accent-clair); color: var(--p-accent); font-weight: 700; font-size: .78rem; display: flex; align-items: center; justify-content: center; }
.p-chat-fil { display: flex; flex-direction: column; min-height: 0; }
.p-chat-entete { padding: 12px 16px; border-bottom: 1px solid var(--bord); display: flex; align-items: center; gap: 12px; }
.p-chat-entete h2 { font-size: 1rem; margin: 0; }
.p-chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #fafbfd; }
.p-chat-jour { align-self: center; font-size: .72rem; color: #6b7280; background: #eef1f6; border-radius: 10px; padding: 2px 10px; margin: 6px 0; }
.p-chat-msg { display: grid; grid-template-columns: 32px 1fr; gap: 8px; max-width: 70%; }
.p-chat-msg.moi { align-self: flex-end; grid-template-columns: 1fr; }
.p-chat-msg .p-chat-auteur { font-size: .75rem; color: #6b7280; }
.p-chat-bulle { background: #fff; border: 1px solid var(--bord); border-radius: 12px; padding: 8px 12px; white-space: pre-wrap; font-size: .92rem; }
.p-chat-msg.moi .p-chat-bulle { background: var(--p-accent-clair); border-color: transparent; }
.p-chat-msg.systeme { align-self: center; max-width: 100%; grid-template-columns: 1fr; }
.p-chat-msg.systeme .p-chat-bulle { background: transparent; border: 0; color: #6b7280; font-size: .78rem; font-style: italic; text-align: center; }
.p-chat-piece { display: inline-block; margin: 4px 6px 0 0; padding: 3px 8px; border-radius: 8px; background: #eef1f6; font-size: .8rem; }
.p-chat-saisie { border-top: 1px solid var(--bord); padding: 10px 16px; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.p-chat-saisie textarea { border-radius: 10px; resize: vertical; min-height: 44px; }
.p-chat-membres { font-size: .8rem; color: #6b7280; }
/* onglets de fiche (chantier) */
.p-onglets { display: flex; gap: 2px; border-bottom: 1px solid var(--bord); margin-bottom: 14px; flex-wrap: wrap; }
.p-onglets a { padding: 8px 14px; text-decoration: none; color: var(--encre); font-size: .9rem; border-bottom: 2px solid transparent; }
.p-onglets a.actif { color: var(--p-accent); font-weight: 600; border-bottom-color: var(--p-accent); }
.p-onglet-contenu { display: none; }
.p-onglet-contenu.actif { display: block; }
/* niveau 2 du menu (08/10/2026) : propositions, pré-propositions et modèles sous la fiche sélectionnée */
.p-sous-menu a.niveau2 { padding-left: 54px; font-size: .8rem; }
.p-sous-menu a.niveau2::before { content: "↳ "; color: #9aa7b6; }

/* Bouton « CAMYnergía » (Super admin, 27/10/2026) : aux couleurs de l'application espagnole, vert sapin et jaune safran
   (charte CAMYnergía : #1d4b3a, #123226, #e2b13c / #e8c25a), pour qu'on le distingue des rubriques de CAMYnergie. */
.p-menu-item.p-menu-camynergia { margin: 8px 12px 4px; padding: 9px 14px; border-radius: 8px; border-left: 0;
  background: linear-gradient(120deg, #123226 0%, #1d4b3a 70%, #24583f 100%); color: #fff; box-shadow: inset 0 -2px 0 #e2b13c; }
.p-menu-item.p-menu-camynergia b { color: #e8c25a; font-weight: 700; }
.p-menu-item.p-menu-camynergia svg.ico { color: #e8c25a; opacity: 1; }
.p-menu-item.p-menu-camynergia:hover { background: linear-gradient(120deg, #0d261c 0%, #1d4b3a 100%); color: #fff; }

/* BOUTONS DES AUTRES APPLICATIONS DU GROUPE (règle de Yann, 07/11/2026) : à leurs couleurs, bien distincts des liens et des
   onglets — jamais un texte suivi de « ↗ ». Couleurs : Services/MarquesApplications.cs (--fond, --fond2, --accent). */
.p-menu-item.p-menu-appli { margin: 6px 12px 4px; padding: 9px 14px; border-radius: 8px; border-left: 0;
  background: linear-gradient(120deg, var(--fond2) 0%, var(--fond) 100%); color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
.p-menu-item.p-menu-appli b { color: var(--accent); font-weight: 700; }
.p-menu-item.p-menu-appli svg.ico { color: var(--accent); opacity: 1; }
.p-menu-item.p-menu-appli:hover { filter: brightness(1.12); color: #fff; }
.btn-appli { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: 9px; font-size: .86rem; font-weight: 600;
  background: linear-gradient(120deg, var(--fond2, #102A43) 0%, var(--fond, #004B79) 100%); color: #fff !important; text-decoration: none !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.15), inset 0 -2px 0 var(--accent, #C9A15A); white-space: nowrap; line-height: 1.2; transition: filter .15s; }
.btn-appli:hover { filter: brightness(1.12); }
.btn-appli b { color: var(--accent, #C9A15A); font-weight: 800; }
.btn-appli svg.ico, .btn-appli svg { width: 15px; height: 15px; color: var(--accent, #C9A15A); background: rgba(255,255,255,.14); border-radius: 6px; padding: 3px; box-sizing: content-box; }
.btn-appli.petit { font-size: .74rem; padding: 2px 8px 2px 4px; border-radius: 7px; gap: 5px; vertical-align: 1px; }
.btn-appli.petit svg.ico, .btn-appli.petit svg { width: 11px; height: 11px; padding: 2px; }
