/* IMD Électricité — une seule feuille, pas de framework. */

:root {
  /* Charte IMD : bleu roi, rouge, blanc. */
  --encre: #0a2f5c;
  --texte: #1f2933;
  --doux: #5f6b7a;
  --ligne: #dbe2ea;
  --fond: #ffffff;
  --fond-2: #f2f5f9;
  --bleu: #0b4ea2;
  --bleu-fonce: #083d80;
  --rouge: #d7343a;
  --rouge-fonce: #b3262c;
  --alerte: #c0262d;
  --alerte-fond: #fdeeee;
  --ok: #1f7a4d;
  --ok-fond: #e9f6ef;
  --rayon: 10px;
}

* { box-sizing: border-box; }
/* Un élément masqué l'est vraiment, même s'il a un style d'affichage (boutons…). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  margin: 0 auto;
  padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
}
main.etroit { max-width: 560px; }
main.large { max-width: 1100px; }
main.page-chantier { max-width: 560px; }

h1 { font-size: 1.35rem; line-height: 1.2; margin: 8px 0 16px; color: var(--encre); }
h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
a { color: var(--bleu); }
small { color: var(--doux); font-weight: normal; }

.vide { color: var(--doux); }
.aide { color: var(--doux); font-size: .9rem; }
.adresse { color: var(--doux); display: block; }
.sous-titre { color: var(--doux); margin-top: -10px; }
.masque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ─── Boutons ─── */

.bouton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border: 2px solid var(--encre);
  border-radius: var(--rayon);
  background: var(--fond);
  color: var(--encre);
  font: inherit;
  font-size: .95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  text-decoration: none;
  cursor: pointer;
}
.bouton.principal { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.bouton.principal:hover { background: var(--bleu-fonce); }
.bouton.petit { display: inline-flex; width: auto; min-height: 36px; padding: 6px 12px; font-size: .8rem; }
.bouton.danger { border-color: var(--alerte); color: var(--alerte); }
.bouton[disabled] { opacity: .6; cursor: wait; }

.lien {
  background: none;
  border: 0;
  padding: 0;
  color: var(--bleu);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.actions { display: grid; gap: 12px; margin: 20px 0; }
.pied { margin-top: 40px; text-align: center; }

/* ─── Formulaires ─── */

label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], input:not([type]), textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #b8c1cc;
  border-radius: 8px;
  background: #fff;
  color: var(--texte);
  font: inherit;
  font-size: 16px; /* 16 px minimum : sinon l'iPhone zoome sur le champ */
  font-weight: normal;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(11, 78, 162, .25); border-color: var(--bleu); }
.formulaire { margin-bottom: 28px; }
.formulaire .bouton { margin-top: 14px; }
.conges h2 { margin-top: 8px; }
.ligne-conge { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ligne); }
.deux-colonnes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.deux-colonnes input { min-width: 0; }
.suggestions {
  list-style: none; margin: 4px 0 0; padding: 4px 0;
  border: 1px solid var(--ligne); border-radius: 8px; background: #fff;
  box-shadow: 0 6px 20px rgba(10, 47, 92, .12);
  font-weight: normal;
}
.suggestions li { padding: 10px 12px; cursor: pointer; }
.suggestions li:hover, .suggestions li.actif { background: var(--fond-2); color: var(--bleu); }
.position summary { cursor: pointer; color: var(--doux); margin: 16px 0 4px; }

.message { padding: 12px 14px; border-radius: 8px; margin: 0 0 12px; background: var(--fond-2); }
/* Confirmations et erreurs après une action : bandeau flottant au-dessus de
   tout (en-têtes collants compris), en bas de l'écran comme les autres avis. */
.messages {
  position: fixed; z-index: 25; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--hauteur-composeur, 0px) + 16px + env(safe-area-inset-bottom));
  width: min(520px, calc(100vw - 32px)); display: grid; gap: 8px;
}
.messages .message { margin: 0; box-shadow: 0 8px 24px rgba(10, 47, 92, .25); cursor: pointer; font-weight: 600; }
.messages .message.success { background: var(--encre); color: #fff; }
.messages .message.info { background: var(--bleu); color: #fff; }
.messages .message.error { background: var(--alerte); color: #fff; }
.messages .message.warning { background: #7a5200; color: #fff; }
.message.success { background: var(--ok-fond); color: var(--ok); font-weight: 600; }
.message.error { background: var(--alerte-fond); color: var(--alerte); }
.message.info { background: #eaf1fb; color: var(--bleu-fonce); }
.message.warning { background: #fff6e0; color: #7a5200; }

/* ─── Connexion ─── */

.connexion { max-width: 380px; margin: 8vh auto 0; }
.logo { font-size: 2rem; font-style: italic; font-weight: 900; color: var(--bleu); text-align: center; margin-bottom: 32px; }
.logo span { display: block; font-size: .95rem; text-transform: uppercase; color: var(--bleu); font-weight: 800; }
.logo-image { display: block; margin: 0 auto 12px; border-radius: 22px; }
.connexion .bouton { margin-top: 24px; }

/* ─── Employé ─── */

.bonjour { font-size: 1.45rem; margin-top: 16px; }
.carte {
  border: 2px solid var(--encre);
  border-left: 8px solid var(--rouge);
  border-radius: var(--rayon);
  padding: 16px;
}
.carte-info { padding: 16px; border-radius: var(--rayon); background: var(--ok-fond); color: var(--ok); font-weight: 600; }
.nom-chantier { font-size: 1.1rem; font-weight: 800; text-transform: uppercase; color: var(--encre); margin: 0; }
.carte .adresse { margin: 4px 0 0; }
.carte .avec { margin: 6px 0 16px; }
.avec { color: var(--bleu); font-weight: 600; }
.semaine .avec { display: block; font-size: .9rem; }
.vous-aujourdhui .avec { font-weight: normal; color: var(--doux); }

.semaine { list-style: none; padding: 0; margin: 0 0 24px; }
.semaine li { padding: 12px 0; border-bottom: 1px solid var(--ligne); }
.semaine .jour { display: block; font-size: .85rem; font-weight: 700; color: var(--doux); text-transform: uppercase; }
.semaine a { font-size: 1.05rem; font-weight: 600; text-decoration: none; }
.semaine .conge { font-size: 1.05rem; font-weight: 600; color: var(--ok); }
.semaine li.aujourdhui { border-left: 4px solid var(--rouge); padding-left: 10px; }

.liste-chantiers { list-style: none; padding: 0; margin: 0; }
.liste-chantiers a {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--ligne);
  color: inherit;
  text-decoration: none;
}
.liste-chantiers .nom-chantier { font-size: 1rem; }
.liste .distance { margin-left: 6px; font-weight: 700; color: var(--bleu); }
.liste-chantiers .distance { font-weight: 700; color: var(--bleu); white-space: nowrap; }
.liste-chantiers .adresse { grid-column: 1 / -1; }

/* ─── Fiche chantier ─── */

/* En-tête de la fiche chantier : toujours visible en haut de l'écran. */
.haut-page {
  position: sticky; top: 0; z-index: 6;
  margin: -20px -16px 8px;
  padding-top: env(safe-area-inset-top);
  background: #fff;
}
.barre-page {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px;
}
.haut-page + * { margin-top: 12px; }
.barre-page h1 {
  flex: 1; min-width: 0; margin: 0 8px 0 0; font-size: 1.1rem;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barre-retour, .infos-chantier summary {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; color: var(--encre);
}
.barre-retour svg { width: 24px; height: 24px; fill: currentColor; }
.infos-chantier summary { list-style: none; cursor: pointer; }
.infos-chantier summary::-webkit-details-marker { display: none; }
.infos-chantier summary span {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--bleu); color: var(--bleu); font-weight: 800;
}
.infos-chantier[open] summary span { background: var(--bleu); color: #fff; }
/* Infos ouvertes : le reste de la page est voilé et inaccessible (barre
   d'envoi comprise) ; toucher le voile referme, comme toucher « ? ». */
.infos-chantier[open] summary::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: rgba(10, 20, 35, .5);
}
.barre-page, .onglets { background: #fff; }
.infos-panneau {
  position: absolute; left: 0; right: 0; top: 100%;
  padding: 14px 16px 16px;
  background: #fff; border-bottom: 1px solid var(--ligne);
  box-shadow: 0 10px 20px rgba(10, 47, 92, .10);
}
.gps { display: flex; align-items: center; gap: 10px; color: var(--texte); text-decoration: none; }
.gps span { text-decoration: underline; text-decoration-color: var(--ligne); text-underline-offset: 3px; }
.gps svg { flex: none; width: 26px; height: 26px; fill: var(--rouge); }

.choix-gps {
  width: min(420px, calc(100vw - 32px));
  margin: auto auto 16px;
  padding: 16px;
  border: 0;
  border-radius: 14px;
}
.choix-gps::backdrop { background: rgba(0, 0, 0, .45); }
.choix-gps p { margin: 0 0 12px; text-align: center; color: var(--doux); font-weight: 600; }
.choix-gps .bouton { margin-bottom: 10px; }
.choix-gps .lien { display: block; width: 100%; padding: 10px; text-align: center; }
.notes { background: var(--fond-2); padding: 10px 12px; border-radius: 8px; margin: 12px 0 0; }
.outils-admin { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin: 10px 0 0; font-size: .9rem; }

.separateur { border-bottom: 1px solid var(--ligne); padding-bottom: 6px; }
.fil { list-style: none; padding: 0; margin: 0; }
.envoi { padding: 10px 0 14px; }
.envoi + .envoi { border-top: 1px dashed var(--ligne); }
.auteur { margin: 0 0 4px; color: var(--doux); font-size: .92rem; }
.auteur strong { color: var(--texte); }
.texte { margin: 0 0 8px; white-space: pre-line; }
.etiquette { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--fond-2); color: var(--doux); }
.etiquette.attente { background: var(--alerte-fond); color: var(--alerte); }
.etiquette.ok { background: var(--ok-fond); color: var(--ok); }

/* ─── Fiche chantier : fils de discussion ─── */

/* La discussion remplit l'écran et se lit par le bas, comme une messagerie :
   les derniers messages sont juste au-dessus de la barre d'envoi. Sur
   téléphone, la barre est fixée en bas ; on lui réserve exactement sa
   hauteur (mesurée en JavaScript, 64 px par défaut). */
body { --haut-page: 20px; }
body.admin { --haut-page: calc(20px + var(--hauteur-nav)); }
main.page-chantier { padding-bottom: 0; }
.page-chat {
  display: flex; flex-direction: column;
  min-height: calc(100dvh - var(--haut-page));
  padding-bottom: calc(var(--hauteur-composeur, 64px) + 8px);
}
.page-chat .chat { margin-top: auto; }
.onglets { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-bottom: 2px solid var(--ligne); }
.onglets a {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 8px; margin-bottom: -2px;
  color: var(--doux); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-size: .9rem;
  text-decoration: none; border-bottom: 3px solid transparent;
}
.onglets a[aria-current] { color: var(--bleu); border-bottom-color: var(--rouge); }
.pastille { min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--rouge); color: #fff; font-size: .75rem; }

.chat { display: flex; flex-direction: column; gap: 8px; }
.plus-ancien { align-self: center; font-size: .9rem; margin: 6px 0; }
.jour-chat { text-align: center; margin: 14px 0 4px; }
.jour-chat span { display: inline-block; padding: 3px 12px; border-radius: 99px; background: var(--fond-2); color: var(--doux); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.chat-vide { text-align: center; margin: 40px 0; }
.bulle {
  align-self: flex-start;
  max-width: 85%;
  padding: 8px 12px 10px;
  border-radius: 4px 14px 14px 14px;
  background: var(--fond-2);
}
.bulle.moi { align-self: flex-end; border-radius: 14px 4px 14px 14px; background: #e3edfa; }
.bulle .auteur { font-size: .8rem; margin-bottom: 2px; }
.bulle .texte { margin: 0; }
.bulle .medias { margin: 6px 0 2px; }
.bulle .etiquette { margin: 6px 0 0; }
.bloc .etiquette { margin-left: 6px; }
.entete-bulle { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.menu-message { flex: none; margin: -6px -8px -6px 0; }
.bulle, .envoi { position: relative; }
.menu-message summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 28px; border-radius: 6px; color: var(--doux); font-size: 1.2rem; line-height: 1;
}
.menu-message summary::-webkit-details-marker { display: none; }
.menu-message[open] summary, .menu-message summary:hover { background: rgba(10, 47, 92, .08); }
.menu-message-liste {
  /* Calé sur le bord de la bulle, du côté où il y a de la place. */
  position: absolute; left: 0; top: 34px; z-index: 4; min-width: 210px; padding: 6px 0;
  background: #fff; border: 1px solid var(--ligne); border-radius: 10px; box-shadow: 0 8px 24px rgba(10, 47, 92, .16);
}
.menu-message-liste button {
  display: block; width: 100%; padding: 11px 14px; border: 0; background: none; text-align: left;
  font: inherit; font-size: .95rem; color: var(--texte); cursor: pointer;
}
.menu-message-liste button:hover { background: var(--fond-2); }
.bulle.moi .menu-message-liste { left: auto; right: 0; }
/* Hors du chat (accueil du patron), le message prend toute la largeur : menu sous le « ⋯ », à droite. */
.envoi .menu-message-liste { left: auto; right: 0; }
.menu-message.vers-haut .menu-message-liste { top: auto; bottom: calc(100% - 4px); }
.menu-message-liste button.danger { color: var(--alerte); }
.bulle.supprime, .envoi.supprime { opacity: .6; }
.bulle.supprime { background: #fff; outline: 1px dashed #b8c1cc; }
.bulle.en-cours, .envoi.en-cours { opacity: .4; }
.avis {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 20;
  bottom: calc(var(--hauteur-composeur, 64px) + 16px);
  margin: 0; padding: 10px 16px; border-radius: 18px;
  background: var(--encre); color: #fff; font-size: .9rem; font-weight: 600;
  box-shadow: 0 6px 20px rgba(10, 47, 92, .25);
  width: max-content; max-width: calc(100vw - 32px); text-align: center;
}
.avis.erreur { background: var(--alerte); }
.mention-supprime { margin: 0 0 4px; font-size: .8rem; font-style: italic; color: var(--alerte); }
.commander summary { list-style: none; cursor: pointer; }
.actions-demande { flex-wrap: wrap; }
.commander[open] { flex-basis: 100%; }
.commander summary::-webkit-details-marker { display: none; }
.commander[open] summary.bouton { background: var(--fond-2); }
.note-commande { display: grid; gap: 8px; margin-top: 8px; min-width: min(320px, 70vw); }
.note-commande textarea, .dialogue-livraison textarea { margin: 0; font-size: 16px; min-height: 64px; }
.note-livraison { margin: 6px 0 0; padding: 6px 10px; border-radius: 8px; background: var(--ok-fond); color: var(--ok); font-size: .9rem; }
.actions-demande { display: flex; align-items: center; gap: 14px; margin-top: 8px; font-size: .88rem; }

.medias { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.photo img { display: block; width: 104px; height: 104px; object-fit: cover; border-radius: 8px; background: #dfe5ec; }
.video { display: block; width: 240px; max-width: 100%; aspect-ratio: 9 / 16; max-height: 320px; border-radius: 8px; background: #000; object-fit: contain; }
.media-attente { display: flex; align-items: center; justify-content: center; width: 160px; height: 104px; padding: 8px; border-radius: 8px; background: #dfe5ec; color: var(--doux); font-size: .85rem; text-align: center; }

dialog#visionneuse { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
dialog#visionneuse::backdrop { background: rgba(0, 0, 0, .9); }
dialog#visionneuse img { display: block; max-width: 100vw; max-height: 100vh; object-fit: contain; cursor: zoom-out; }

.composeur {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  margin: 0 auto; max-width: 560px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--ligne);
  box-shadow: 0 -4px 16px rgba(10, 47, 92, .06);
}
.composeur.ferme { text-align: center; color: var(--doux); }
.composeur .message { margin: 0 0 8px; }
.composeur-ligne { display: flex; align-items: flex-end; gap: 8px; }
.composeur textarea {
  flex: 1; margin: 0; min-height: 44px; max-height: 140px; resize: none;
  border-radius: 22px; padding: 10px 16px; line-height: 1.35;
}
.bouton-rond {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%;
  cursor: pointer; color: #fff;
}
.bouton-rond svg { width: 24px; height: 24px; fill: currentColor; }
.bouton-rond.camera { background: var(--rouge); }
.bouton-rond.camera input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.bouton-rond.envoyer { background: var(--bleu); }
.bouton-rond[disabled] { opacity: .5; cursor: wait; }
.apercus { display: flex; flex-wrap: wrap; gap: 8px; }
.apercus:not(:empty) { margin-bottom: 10px; }
.apercu { position: relative; }
.apercu img, .apercu video { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: 6px; background: #000; }
.apercu button {
  position: absolute; top: -8px; right: -8px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff; background: var(--encre); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.progression { height: 6px; margin-bottom: 8px; border-radius: 3px; background: var(--fond-2); overflow: hidden; }
.progression span { display: block; height: 100%; width: 0; background: var(--bleu); transition: width .2s; }

/* ─── Administrateur ─── */

/* Menu du patron : toujours visible en haut de l'écran. */
:root { --hauteur-nav: 56px; }
.nav-admin {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  height: var(--hauteur-nav); padding: 0 16px;
  background: var(--bleu); color: #fff;
}
.nav-admin .marque { color: #fff; font-weight: 800; text-decoration: none; border-left: 4px solid var(--rouge); padding-left: 8px; }
.nav-admin nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-admin nav a { color: #dce7f5; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.nav-admin nav a[aria-current] { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: inset 0 -3px 0 var(--rouge); }
.nav-admin .deconnexion { margin-left: auto; }
.nav-admin .lien { color: #dce7f5; font-size: .9rem; }
.menu-case { position: absolute; opacity: 0; pointer-events: none; }
.hamburger { display: none; }

@media (max-width: 759px) {
  .hamburger {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin: 0 -8px 0 auto; border-radius: 8px; cursor: pointer; color: #fff;
  }
  .hamburger svg { width: 26px; height: 26px; fill: currentColor; }
  .hamburger .point { position: absolute; top: 9px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--rouge); border: 2px solid var(--bleu); }
  .menu-case:checked + .hamburger { background: rgba(255, 255, 255, .16); }
  .nav-admin nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px; background: var(--bleu);
    box-shadow: 0 12px 24px rgba(10, 47, 92, .25);
  }
  .menu-case:checked ~ nav { display: flex; }
  .nav-admin nav a { padding: 14px 12px; font-size: 1.05rem; }
  .nav-admin nav a[aria-current] { box-shadow: inset 4px 0 0 var(--rouge); }
  .nav-admin .deconnexion { margin: 8px 0 0; padding: 12px 12px 4px; border-top: 1px solid rgba(255, 255, 255, .2); }
  .nav-admin .deconnexion .lien { font-size: 1rem; }
}

/* En-têtes collants des pages : juste sous le menu du patron. */
body.admin .haut-page { top: var(--hauteur-nav); }

.titre-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.en-conge { color: var(--doux); margin: -8px 0 16px; }
.vous-aujourdhui { background: var(--fond-2); padding: 10px 14px; border-radius: 8px; border-left: 4px solid var(--rouge); }

.bloc { border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 12px; }
.bloc .prevus { color: var(--doux); font-weight: normal; }
.bloc h3 a { color: var(--encre); text-transform: uppercase; }
.bloc.alerte { border: 2px solid var(--alerte); background: var(--alerte-fond); }
.bloc.alerte p { color: var(--alerte); font-weight: 700; margin: 0; }
.sans-retour h2 { color: var(--alerte); }
.a-prevoir { margin-top: 36px; }
.nav-admin .pastille { margin-left: 4px; }
.bloc.demande form { margin-top: 10px; }

.liste { list-style: none; padding: 0; margin: 0 0 20px; }
.liste li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--ligne); }
.liste li > a { font-weight: 700; font-size: 1rem; text-decoration: none; }
.liste li.inactif a { color: var(--doux); }
.liste .adresse { font-size: .92rem; }
.liste .boutons { display: flex; gap: 8px; }

.titre-semaine { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.titre-semaine-centre { flex: 1; min-width: 0; text-align: center; }
.titre-semaine h2 { margin: 0; font-size: 1.2rem; text-transform: none; letter-spacing: 0; color: var(--encre); }
.titre-semaine-centre a { font-size: .85rem; }
.titre-semaine h2 { white-space: nowrap; }
.date-courte { display: none; }
@media (max-width: 479px) {
  .date-longue { display: none; }
  .date-courte { display: inline; }
}
.fleche-semaine {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 2px solid var(--encre); border-radius: 50%; color: var(--encre);
}
.fleche-semaine:hover { background: var(--fond-2); }
.fleche-semaine svg { width: 26px; height: 26px; fill: currentColor; }
.defilement { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.planning { border-collapse: collapse; width: 100%; min-width: 900px; table-layout: fixed; }
.planning th, .planning td { border: 1px solid var(--ligne); padding: 0; text-align: left; vertical-align: middle; }
.planning thead th { padding: 8px 10px; font-size: .85rem; text-transform: uppercase; color: var(--doux); }
.planning thead th small { display: block; }
.planning tbody th { padding: 8px 10px; }
.planning col.personne { width: 130px; }
.planning .samedi { background: var(--fond-2); }
.planning col.samedi { width: 11%; }
.planning .aujourdhui { box-shadow: inset 0 3px 0 var(--rouge); }
.planning .ferie { background: repeating-linear-gradient(-45deg, #fff, #fff 6px, var(--fond-2) 6px, var(--fond-2) 12px); }
.planning .nom-ferie { color: var(--rouge); font-weight: 700; text-transform: none; }
.case-passee { display: block; padding: 14px 8px; color: var(--doux); font-size: .92rem; background: var(--fond-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-conge { display: block; padding: 14px 8px; background: var(--ok-fond); color: var(--ok); font-weight: 700; font-size: .9rem; }
.planning select {
  margin: 0; border: 0; border-radius: 0; background: transparent;
  padding: 14px 6px; width: 100%; font-size: .92rem; text-overflow: ellipsis; cursor: pointer; color: var(--doux);
}
.planning select.rempli { color: var(--encre); font-weight: 600; }
.planning select.enregistre { background: var(--ok-fond); }
.planning select.erreur { background: var(--alerte-fond); }
.semaine-entiere summary { cursor: pointer; font-weight: 700; }
.semaine-entiere form { position: absolute; z-index: 2; background: #fff; border: 1px solid var(--ligne); border-radius: 8px; padding: 10px 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); min-width: 260px; }
.semaine-entiere label { font-size: .9rem; margin-top: 0; }
.semaine-entiere .bouton { margin-top: 8px; }

@media (min-width: 700px) {
  .admin .actions { grid-template-columns: 1fr 1fr; }
  .admin .bouton:not(.petit) { max-width: 420px; }
  .admin .actions .bouton { max-width: none; }
}

/* ─── Fiche chantier sur ordinateur : infos toujours visibles à droite ─── */

.infos-laterales { display: none; }

@media (min-width: 960px) {
  main.page-chantier { max-width: 1040px; }
  .mise-en-page-chantier { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
  /* La discussion occupe toute la hauteur de l'écran : même avec peu de
     messages, la barre d'envoi est en bas. --haut-page = ce qui précède la
     colonne (menu du patron, marge). */
  .colonne-chat { min-width: 0; display: flex; flex-direction: column; min-height: calc(100dvh - var(--haut-page)); }
  .colonne-chat .page-chat { flex: 1; min-height: 0; padding-bottom: 12px; }
  .haut-page { margin: -20px 0 8px; }
  .infos-chantier { display: none; }
  /* La barre d'envoi reste en bas de la colonne de discussion. */
  .composeur { position: sticky; max-width: none; margin: 0; border: 1px solid var(--ligne); border-bottom: 0; border-radius: 12px 12px 0 0; }
  .infos-laterales {
    display: block; position: sticky; top: 20px;
  }
  body.admin .infos-laterales { top: calc(var(--hauteur-nav) + 20px); }
  .infos-laterales {
    padding: 16px; border: 1px solid var(--ligne); border-radius: var(--rayon); background: #fff;
  }
}

/* ─── Ajouter à l'écran d'accueil ─── */

.installer { margin: 28px 0 0; }
.installer > .bouton { justify-content: flex-start; gap: 12px; padding-left: 12px; }
.icone-appli { flex: none; width: 32px; height: 32px; border-radius: 8px; }
.icone-appli.grande { display: block; width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 14px; }
.admin .installer { max-width: 420px; }
.aide-installation { width: min(420px, calc(100vw - 32px)); border: 0; border-radius: 14px; padding: 20px; }
.aide-installation::backdrop { background: rgba(0, 0, 0, .45); }
.aide-installation .aide-titre { margin: 0 0 8px; font-weight: 700; color: var(--encre); }
.aide-installation ol { margin: 0 0 12px; padding-left: 22px; }
.aide-installation li { margin-bottom: 10px; }
.icone-partage { width: 20px; height: 20px; fill: var(--bleu); vertical-align: -4px; }

/* ─── Tirer pour rafraîchir (application installée) ─── */

.tirer {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); z-index: 30;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; color: var(--doux); font-size: 22px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(10, 47, 92, .2);
  opacity: 0; transform: translate(-50%, 0); pointer-events: none;
}
.tirer.pret { color: var(--bleu); }
.tirer.charge { opacity: 1 !important; color: var(--bleu); animation: tourne .8s linear infinite; }
@keyframes tourne { from { transform: translate(-50%, 72px) rotate(0); } to { transform: translate(-50%, 72px) rotate(360deg); } }

/* ─── Onglets Plans et Photos ─── */

@media (max-width: 480px) {
  .onglets a { font-size: .78rem; letter-spacing: 0; padding: 12px 2px; }
}
.documents { display: grid; gap: 10px; }
.ajout-plan { display: grid; gap: 10px; margin-bottom: 12px; padding: 12px; border: 1px dashed #b8c1cc; border-radius: var(--rayon); }
.ajout-plan input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ajout-plan [data-libelle-fichier] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; }
.suite-plan { display: grid; gap: 8px; }
.suite-plan label { margin: 0; }
.suite-plan input[name=nom] { margin: 0; }
.ajout-photos .progression { margin: 8px 0 0; }
.erreurs-envoi:empty { display: none; }
.document { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid var(--ligne); border-radius: var(--rayon); }
.document-lien { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--texte); text-decoration: none; }
.document-lien img, .document-icone { flex: none; width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--fond-2); }
.document-icone { display: flex; align-items: center; justify-content: center; background: var(--rouge); color: #fff; font-weight: 800; font-size: .85rem; }
.document-texte { display: flex; flex-direction: column; min-width: 0; }
.document-texte strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-texte small { color: var(--doux); }
.danger-lien { color: var(--alerte); font-size: .9rem; }
.photos-etat { margin: 8px 0 24px; }
.ajout-photos { margin-bottom: 10px; }
.ajout-photos input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.galerie .vide { grid-column: 1 / -1; margin: 0; }
.photo-etat { position: relative; margin: 0; }
.photo-etat .photo img { width: 100%; height: auto; aspect-ratio: 1; }
.photo-etat figcaption { font-size: .75rem; color: var(--doux); margin-top: 2px; }
.retirer-photo {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(10, 47, 92, .75); color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}

/* ─── Notifications ─── */

.notifications-appareil { margin: 28px 0 0; }
.admin .notifications-appareil { max-width: 420px; }
.notifications-appareil + .installer { margin-top: 12px; }
.case-a-cocher { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-weight: normal; }
.case-a-cocher input { width: 22px; height: 22px; margin: 0; accent-color: var(--bleu); }

/* ─── Livraison, réception ─── */

.champs-livraison { display: grid; gap: 10px; }
.champs-livraison label { margin: 0; font-size: .9rem; }
.champs-livraison input[type=date], .champs-livraison input[name=livraison_fournisseur] { margin-top: 4px; font-size: 16px; }
.segments { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; }
.segments legend { width: 100%; margin-bottom: 4px; font-size: .85rem; font-weight: 700; color: var(--doux); }
.segments label { font-weight: 600; }
.segments input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segments span { display: inline-block; padding: 8px 12px; border: 1.5px solid #b8c1cc; border-radius: 99px; cursor: pointer; background: #fff; }
.segments input:checked + span { border-color: var(--bleu); background: var(--bleu); color: #fff; }
.segments input:focus-visible + span { outline: 3px solid rgba(11, 78, 162, .3); }
/* À récupérer : pas auprès du patron (c'est lui qui apporte). */
.champs-livraison:has(input[name=livraison_mode][value=A_RECUPERER]:checked) .source-patron { display: none; }
/* Le nom du fournisseur ne sert que si « Fournisseur » est choisi. */
.champs-livraison:has(input[name=livraison_source]:checked:not([value=FOURNISSEUR])) .champ-fournisseur { display: none; }
.reception { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.bouton.ok { border-color: var(--ok); color: var(--ok); }
.reception-faite { margin: 6px 0 0; font-size: .85rem; color: var(--ok); font-weight: 600; }
.du-jour h2 small { text-transform: none; letter-spacing: 0; }
.livraisons { list-style: none; margin: 12px 0 14px; padding: 0; display: grid; gap: 10px; }
.livraisons li { padding: 10px 12px; border-radius: 8px; background: var(--fond-2); }
.livraisons p { margin: 0; }
.livraisons .aide { margin-top: 2px; }
.jour-livraisons { margin: 14px 0 8px; font-size: .95rem; }
.jour-livraisons small { font-weight: normal; }

/* ─── Commandes : traitement par lots ─── */

.lot { padding-bottom: 90px; }
.section-lot h2 { margin-top: 24px; }
.tout-cocher { display: inline-flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--encre); }
.tout-cocher input, .ligne-lot input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--bleu); }
.ligne-lot { display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 10px 4px; border-top: 1px dashed var(--ligne); font-weight: normal; cursor: pointer; }
.ligne-lot:first-of-type { border-top: 0; }
.ligne-lot:has(input:checked) { background: #eef4fc; border-radius: 8px; }
.contenu-lot { display: grid; gap: 4px; min-width: 0; }
.contenu-lot .auteur, .contenu-lot .texte, .contenu-lot .note-livraison { margin: 0; }
.ligne-lot + .medias { margin: -4px 0 8px 38px; }
.barre-lot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--ligne); box-shadow: 0 -4px 16px rgba(10, 47, 92, .1);
}
.compte-lot { font-weight: 700; color: var(--encre); margin-right: 4px; }
.dialogue-livraison { width: min(480px, calc(100vw - 24px)); border: 0; border-radius: 14px; padding: 18px; }
.dialogue-livraison::backdrop { background: rgba(0, 0, 0, .45); }
.dialogue-livraison h2 { margin-top: 0; }
.boutons-dialogue { display: grid; gap: 8px; margin-top: 14px; }

.statut-position { margin: 0 0 8px; font-size: .85rem; color: var(--doux); }
.statut-position .lien { font-size: .85rem; }
.statut-position small { display: block; margin-top: 2px; }

/* ─── Ouverture d'un plan ─── */

.chargement-document { display: grid; justify-items: center; gap: 6px; max-width: 420px; margin: 18vh auto 0; padding: 0 24px; text-align: center; }
.nom-document { margin: 8px 0 0; font-size: 1.15rem; font-weight: 800; color: var(--encre); word-break: break-word; }
.chargement-document .progression { width: 100%; margin: 14px 0 4px; }
.etat-chargement { margin: 0; color: var(--doux); font-weight: 600; }
a.pastille { text-decoration: none; vertical-align: 2px; }
.source-fil { display: inline-block; margin-right: 4px; padding: 1px 8px; border-radius: 99px; background: #e3edfa; color: var(--bleu); font-size: .75rem; font-weight: 700; text-decoration: none; }
.alerte-livraison { display: inline-block; margin: 2px 0 4px; padding: 3px 10px; border-radius: 8px; background: var(--alerte-fond); color: var(--alerte); font-size: .85rem; font-weight: 700; }
