/* =============================================================================
   Bornopale — styles communs aux pages de l'application
   =============================================================================
   Fichier unique partagé par index.html et reinitialisation.html : les deux
   pages avaient chacune leur copie du style, elles divergeaient au premier
   changement de couleur.

   Palette reprise du logo officiel (bornopale.com) :
     bleu nuit #202c56 — couleur dominante du monogramme et du mot-symbole
     vert      #0b8e36 — la moitié droite du « bo »
   ============================================================================= */

:root {
  --bleu: #202c56;
  --bleu-clair: #33427a;
  --vert: #0b8e36;
  --fond: #f4f6f8;
  --carte: #ffffff;
  --texte: #1a2733;
  --texte-doux: #5b6b7a;
  --bordure: #dde3e9;
  --rouge: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0; min-height: 100vh; display: grid; place-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--fond); color: var(--texte); padding: 1.5rem;
}

.carte {
  background: var(--carte); width: 100%; max-width: 400px;
  border: 1px solid var(--bordure); border-radius: 14px;
  padding: 2.25rem 2rem; box-shadow: 0 2px 16px rgba(32, 44, 86, .10);
}

/* --- En-tête : logo de la marque ------------------------------------------ */
.logo { text-align: center; margin-bottom: 1.75rem; }
.logo img {
  /* Hauteur fixe plutôt que largeur : le logo garde la même présence
     visuelle quelle que soit la page. */
  height: 74px; width: auto; max-width: 100%;
}
.logo small {
  display: block; margin-top: .5rem; font-size: .72rem;
  color: var(--texte-doux); letter-spacing: .06em; text-transform: uppercase;
}

/* --- Formulaires ----------------------------------------------------------- */
label {
  display: block; font-size: .82rem; font-weight: 600;
  margin: 0 0 .35rem; color: var(--texte-doux);
}

input {
  width: 100%; padding: .7rem .8rem; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--bordure); border-radius: 8px; background: #fff;
  color: var(--texte); margin-bottom: 1.1rem;
}
input:focus {
  outline: 2px solid var(--bleu-clair); outline-offset: 1px;
  border-color: transparent;
}

button {
  width: 100%; padding: .75rem; font-size: 1rem; font-weight: 600;
  font-family: inherit; color: #fff; background: var(--bleu);
  border: 0; border-radius: 8px; cursor: pointer;
}
button:hover:not(:disabled) { background: var(--bleu-clair); }
button:disabled { opacity: .6; cursor: progress; }

.secondaire {
  background: transparent; color: var(--texte-doux);
  border: 1px solid var(--bordure);
}
.secondaire:hover:not(:disabled) { background: var(--fond); color: var(--texte); }

.lien-discret {
  display: block; margin-top: 1rem; text-align: center;
  font-size: .84rem; color: var(--bleu-clair); background: none; border: 0;
  cursor: pointer; font-family: inherit; text-decoration: underline;
  text-underline-offset: 2px; width: 100%; padding: 0;
}
.lien-discret:hover { color: var(--bleu); }

/* --- Messages -------------------------------------------------------------- */
.msg {
  margin-top: 1rem; font-size: .88rem; padding: .7rem .8rem;
  border-radius: 8px; display: none;
}
.msg.erreur { display: block; background: #fdeceb; color: var(--rouge); }
.msg.ok     { display: block; background: #eaf4ec; color: #0b6b2c; }
.msg.alerte { display: block; background: #fff4e5; color: #8a4b00; }

.pied {
  margin-top: 1.5rem; font-size: .74rem; color: var(--texte-doux);
  text-align: center; line-height: 1.5;
}

/* --- Profil affiché après connexion ---------------------------------------- */
.profil { display: none; }
.profil dl {
  margin: 0 0 1.5rem; display: grid; grid-template-columns: auto 1fr;
  gap: .5rem 1rem; font-size: .9rem;
}
.profil dt { color: var(--texte-doux); font-weight: 600; }
.profil dd { margin: 0; }

/* --- Conditions de mot de passe (page de réinitialisation) ------------------ */
.exigences {
  margin: -.5rem 0 1.1rem; padding: 0; list-style: none;
  font-size: .8rem; color: var(--texte-doux);
}
.exigences li { padding-left: 1.2rem; position: relative; line-height: 1.7; }
.exigences li::before { content: '○'; position: absolute; left: 0; }
.exigences li.ok { color: var(--vert); }
.exigences li.ok::before { content: '●'; }

/* =============================================================================
   Back-office — coquille applicative
   ============================================================================= */

/* La page de connexion est centrée ; l'application occupe tout l'écran. */
body.page-connexion { display: grid; place-items: center; }
body:not(.page-connexion) { display: block; padding: 0; }

.carte-connexion { margin: auto; }

.application {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

/* --- Barre latérale --------------------------------------------------------- */
.barre-laterale {
  background: var(--bleu); color: #fff;
  display: flex; flex-direction: column;
  padding: 1.25rem 0.9rem;
}

.marque {
  display: flex; align-items: center; gap: .55rem;
  color: #fff; text-decoration: none;
  font-size: 1.05rem; font-weight: 650; letter-spacing: -.01em;
  padding: 0 .5rem 1.4rem;
}
/* Le monogramme est bleu nuit : sur fond bleu nuit il disparaîtrait, on le
   pose donc sur une pastille claire. */
.marque img {
  height: 30px; width: auto; background: #fff;
  border-radius: 7px; padding: 3px 5px;
}

.navigation { display: flex; flex-direction: column; gap: .15rem; flex: 1; }

.nav-lien {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .7rem; border-radius: 8px;
  color: rgba(255,255,255,.78); text-decoration: none;
  font-size: .92rem; font-weight: 500;
}
.nav-lien:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav-lien.actif { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-icone { font-size: 1.05rem; line-height: 1; }

.pied-laterale {
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: .9rem; margin-top: .9rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.identite { display: flex; flex-direction: column; padding: 0 .7rem; font-size: .88rem; }
.identite .discret { color: rgba(255,255,255,.6); }
.pied-laterale .lien { color: rgba(255,255,255,.8); text-align: left; padding: 0 .7rem; }
.pied-laterale .lien:hover { color: #fff; }

.bascule-menu { display: none; }

/* --- Contenu ---------------------------------------------------------------- */
.contenu { padding: 1.9rem 2.2rem 3rem; overflow-x: hidden; }
.vue { max-width: 1080px; }

.entete-vue {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem;
}
.entete-vue h1 { margin: 0 0 .2rem; font-size: 1.5rem; letter-spacing: -.02em; }
.entete-vue p { margin: 0; font-size: .88rem; }

h2 { font-size: 1.02rem; margin: 0 0 .9rem; }
.sous-titre { font-size: .88rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--texte-doux); margin: 1.4rem 0 .7rem; }

.discret { color: var(--texte-doux); }
.petit-texte { font-size: .8rem; }
.compteur { font-size: .84rem; color: var(--texte-doux); margin: 0 0 .6rem; }

/* --- Boutons ---------------------------------------------------------------- */
button.principal, button.danger, button.secondaire { width: auto; }
button { width: auto; }
.formulaire > button[type="submit"] { width: 100%; }
button.auto { width: auto; }
button.petit { padding: .38rem .7rem; font-size: .84rem; }
button.principal { background: var(--bleu); color: #fff; }
button.danger { background: var(--rouge); color: #fff; }
button.danger:hover:not(:disabled) { background: #8e1e18; }

button.lien {
  background: none; border: 0; padding: 0; width: auto;
  color: var(--bleu-clair); font-size: .86rem; font-weight: 500;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
button.lien:hover:not(:disabled) { color: var(--bleu); background: none; }
button.lien.danger-texte { color: var(--rouge); }
button.retour { margin-bottom: .9rem; }

.actions-ligne { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.actions-cellule { display: flex; gap: .8rem; flex-wrap: wrap; white-space: nowrap; }

/* --- Recherche et tableaux ---------------------------------------------------- */
.recherche {
  max-width: 480px; margin-bottom: 1.1rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b7a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat .7rem center;
  background-size: 17px; padding-left: 2.3rem;
}

/* Sur un petit écran le tableau défile horizontalement dans son cadre,
   plutôt que de faire déborder toute la page. */
.tableau-enveloppe {
  overflow-x: auto; border: 1px solid var(--bordure);
  border-radius: 10px; background: var(--carte);
}
.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tableau th {
  text-align: left; padding: .7rem .9rem; font-size: .76rem;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--texte-doux); border-bottom: 1px solid var(--bordure);
  background: #fafbfc; white-space: nowrap;
}
.tableau td { padding: .72rem .9rem; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau tr.cliquable { cursor: pointer; }
.tableau tr.cliquable:hover { background: #f7f9fb; }
.tableau tr.inactive { opacity: .55; }

/* --- Étiquettes et badges ------------------------------------------------------ */
.etiquette {
  display: inline-block; padding: .16rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; background: #eef1f6; color: #3d4a63;
  white-space: nowrap;
}
.etiquette.t-particulier { background: #e8effa; color: #24457e; }
.etiquette.t-professionnel { background: #e6f4ea; color: #0b6b2c; }
.etiquette.t-copropriete { background: #fdf0e3; color: #8a4b00; }
.etiquette.t-collectivite { background: #f0e9fa; color: #4b2b7e; }
.etiquette.t-admin { background: #e8effa; color: #24457e; }
.etiquette.t-technicien { background: #eef1f6; color: #3d4a63; }

.badge {
  display: inline-block; padding: .1rem .45rem; border-radius: 5px;
  font-size: .72rem; font-weight: 600; background: #eef1f6; color: #4a5766;
  margin-left: .35rem;
}
.badge-vert { background: #e6f4ea; color: #0b6b2c; }
.badge-rouge { background: #fdeceb; color: var(--rouge); }
.badge-gris { background: #eceff2; color: #6b7785; }
.badges { display: flex; gap: .3rem; }

/* --- Panneaux ------------------------------------------------------------------- */
.panneau {
  background: var(--carte); border: 1px solid var(--bordure);
  border-radius: 12px; padding: 1.2rem 1.3rem; margin-bottom: 1.1rem;
}
.panneau-tete { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.panneau-tete h2 { margin: 0; }

.infos { display: grid; gap: .55rem; margin: 0; }
.info { display: grid; grid-template-columns: 150px 1fr; gap: 1rem; font-size: .9rem; }
.info dt { color: var(--texte-doux); font-weight: 600; }
.info dd { margin: 0; }
.notes { margin: 1rem 0 0; font-size: .9rem; white-space: pre-wrap;
  background: #fafbfc; padding: .7rem .85rem; border-radius: 8px; }

.liste-adresses { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.carte-adresse { border: 1px solid var(--bordure); border-radius: 10px; padding: .85rem .95rem; font-size: .89rem; }
.carte-adresse-tete { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.adresse-texte { margin: 0 0 .5rem; line-height: 1.5; }
.notes-acces { margin: .5rem 0; font-size: .84rem; color: var(--texte-doux);
  background: #fffaf0; padding: .45rem .6rem; border-radius: 6px; }

/* --- Formulaires ----------------------------------------------------------------- */
.formulaire { display: block; }
.champ { margin-bottom: .1rem; }
.champ input, .champ select, .champ textarea { margin-bottom: .35rem; }
.champ .aide { display: block; font-size: .77rem; color: var(--texte-doux); margin-bottom: .8rem; }
.champ:not(:has(.aide)) input,
.champ:not(:has(.aide)) select,
.champ:not(:has(.aide)) textarea { margin-bottom: 1rem; }
select, textarea {
  width: 100%; padding: .7rem .8rem; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--bordure); border-radius: 8px; background: #fff; color: var(--texte);
}
textarea { resize: vertical; min-height: 70px; }
.requis { color: var(--rouge); }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.case { display: flex; align-items: center; gap: .5rem; font-size: .9rem; margin: .3rem 0 .6rem; font-weight: 500; }
.case input { width: auto; margin: 0; }

/* --- Fenêtres modales -------------------------------------------------------------- */
.fond-modale {
  position: fixed; inset: 0; background: rgba(26, 39, 51, .48);
  display: grid; place-items: center; padding: 1.2rem; z-index: 60;
  overflow-y: auto;
}
.modale {
  background: var(--carte); border-radius: 13px; width: 100%;
  box-shadow: 0 18px 48px rgba(26, 39, 51, .25); margin: auto;
  max-height: calc(100vh - 2.4rem); display: flex; flex-direction: column;
}
.modale-tete {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--bordure);
}
.modale-tete h2 { margin: 0; font-size: 1.05rem; }
.fermer { background: none; border: 0; font-size: 1.5rem; line-height: 1;
  color: var(--texte-doux); cursor: pointer; padding: 0 .2rem; width: auto; }
.fermer:hover { color: var(--texte); background: none; }
.modale-corps { padding: 1.2rem 1.3rem; overflow-y: auto; }
.modale-pied {
  display: flex; justify-content: flex-end; gap: .7rem;
  padding: .9rem 1.3rem; border-top: 1px solid var(--bordure);
}
.texte-modale { margin: 0; font-size: .93rem; line-height: 1.55; }

/* --- Notifications ---------------------------------------------------------------- */
.toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex;
  flex-direction: column; gap: .55rem; z-index: 80; max-width: min(400px, calc(100vw - 2.4rem)); }
.toast {
  padding: .75rem 1rem; border-radius: 9px; font-size: .89rem; line-height: 1.45;
  background: var(--bleu); color: #fff; box-shadow: 0 6px 20px rgba(26,39,51,.22);
  animation: entree .22s ease-out;
}
.toast-erreur { background: var(--rouge); }
.toast-alerte { background: #8a4b00; }
.toast.sortie { opacity: 0; transform: translateY(6px); transition: all .3s; }
@keyframes entree { from { opacity: 0; transform: translateY(10px); } }

/* --- États ------------------------------------------------------------------------ */
.chargement { display: flex; align-items: center; gap: .7rem; padding: 2.5rem 0;
  color: var(--texte-doux); font-size: .9rem; }
.spinner {
  width: 17px; height: 17px; border: 2px solid var(--bordure);
  border-top-color: var(--bleu); border-radius: 50%; animation: tourne .7s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

.etat-vide {
  text-align: center; padding: 3rem 1rem; color: var(--texte-doux);
  border: 1px dashed var(--bordure); border-radius: 12px; background: var(--carte);
}
.etat-vide p { margin: 0 0 1rem; }

/* --- Écrans étroits ---------------------------------------------------------------- */
@media (max-width: 900px) {
  .application { grid-template-columns: 1fr; }
  .barre-laterale {
    position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 50;
    transform: translateX(-100%); transition: transform .22s ease-out;
  }
  .barre-laterale.ouverte { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .bascule-menu {
    display: block; position: fixed; top: .7rem; left: .7rem; z-index: 55;
    width: 40px; height: 40px; padding: 0; font-size: 1.15rem;
    background: var(--bleu); color: #fff; border-radius: 9px;
  }
  .contenu { padding: 4rem 1.1rem 2.5rem; }
  .grille-2 { grid-template-columns: 1fr; }
  .info { grid-template-columns: 1fr; gap: .1rem; }
  .info dt { font-size: .8rem; }
}

/* Icônes SVG : elles héritent de la couleur du texte environnant. */
.nav-icone { display: inline-flex; align-items: center; opacity: .85; }
.nav-lien.actif .nav-icone { opacity: 1; }
.bascule-menu { display: none; align-items: center; justify-content: center; }
.icone-inline { display: inline-flex; vertical-align: -.2em; margin-right: .35rem; opacity: .7; }
@media (max-width: 900px) { .bascule-menu { display: inline-flex; } }

/* Un numéro de téléphone ne doit jamais se couper en deux lignes. */
.tableau td.tel, .tableau td:has(> .tel) { white-space: nowrap; }

/* --- Filtres et barres d'outils --------------------------------------------- */
.barre-filtres { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.1rem; align-items: center; }
.barre-filtres .recherche { margin-bottom: 0; flex: 1 1 260px; }
.filtre {
  padding: .6rem .7rem; font-size: .92rem; font-family: inherit;
  border: 1px solid var(--bordure); border-radius: 8px; background: #fff;
  color: var(--texte); width: auto;
}
.pleine-largeur { width: 100%; margin-bottom: .9rem; }

/* --- Statuts de chantier ------------------------------------------------------ */
.etiquette.s-prospect      { background: #eef1f6; color: #3d4a63; }
.etiquette.s-devis_envoye  { background: #fdf0e3; color: #8a4b00; }
.etiquette.s-devis_accepte { background: #e6f4ea; color: #0b6b2c; }
.etiquette.s-planifie      { background: #e8effa; color: #24457e; }
.etiquette.s-en_cours      { background: #fff3cd; color: #7a5b00; }
.etiquette.s-installe      { background: #e6f4ea; color: #0b6b2c; }
.etiquette.s-en_sav        { background: #fdeceb; color: #b3261e; }
.etiquette.s-archive       { background: #eceff2; color: #6b7785; }
.etiquette.s-abandonne     { background: #eceff2; color: #6b7785; }

/* --- Pointage ------------------------------------------------------------------ */
.pointage-actif { border-color: var(--vert); background: linear-gradient(#f6fbf7, #fff); }
.pointage-tete { display: flex; align-items: flex-start; gap: .75rem; }
.pointage-tete h2 { margin: 0 0 .15rem; }
.pointage-tete p { margin: 0; font-size: .88rem; }

/* Pastille qui bat : signale d'un coup d'œil qu'un pointage tourne. */
.pastille-active {
  width: 11px; height: 11px; border-radius: 50%; background: var(--vert);
  flex: none; margin-top: .35rem; animation: battement 2s ease-in-out infinite;
}
@keyframes battement { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.duree-live {
  font-size: 2.1rem; font-weight: 650; color: var(--bleu);
  margin: .9rem 0 1rem; letter-spacing: -.02em;
}
button.grand { width: 100%; padding: .95rem; font-size: 1.02rem; }

.tableau tr.valide { background: #fafcfa; }

/* --- Relevés mensuels ------------------------------------------------------------ */
.cartes-releves { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.carte-releve { margin-bottom: 0; display: flex; flex-direction: column; }
.carte-releve .actions-ligne { margin-top: auto; padding-top: .9rem; }
.alerte-ligne {
  background: #fff4e5; color: #8a4b00; font-size: .84rem;
  padding: .5rem .7rem; border-radius: 7px; margin: .5rem 0 0; line-height: 1.45;
}
