/* Compléments au CDN Tailwind : ce qui ne s'exprime pas en classes utilitaires. */

[x-cloak] { display: none !important; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Focus clavier visible et cohérent (les champs gardent leur anneau Tailwind). */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid #231F20;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Bouton en cours d'envoi (voir components/head.html) */
button[aria-busy="true"] { cursor: wait; opacity: .75; }
button[aria-busy="true"]::after {
  content: "";
  display: inline-block;
  width: .9em;
  height: .9em;
  margin-left: .5em;
  vertical-align: -.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: tourne .6s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* Indicateur de requête HTMX */
.htmx-indicator { opacity: 0; transition: opacity .15s ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Planning : demi-journées où une personne est attendue sur deux chantiers */
.zone-conflit {
  background: repeating-linear-gradient(135deg, rgb(208 59 59 / .16) 0 5px, transparent 5px 10px);
  box-shadow: inset 1px 0 0 rgb(208 59 59 / .5), inset -1px 0 0 rgb(208 59 59 / .5);
}

/* Planning : barres qu'on glisse (déplacer) et qu'on étire (poignée droite) */
[data-gantt-barre]:not([data-verrou]) { cursor: grab; touch-action: none; -webkit-user-drag: none; user-select: none; }
[data-gantt-poignee] {
  position: absolute; top: 0; right: 0; bottom: 0; width: 9px; cursor: ew-resize; border-radius: 0 5px 5px 0;
  background: linear-gradient(to right, transparent 3px, rgb(35 31 32 / .35) 3px, rgb(35 31 32 / .35) 4px, transparent 4px, transparent 6px, rgb(35 31 32 / .35) 6px, rgb(35 31 32 / .35) 7px, transparent 7px);
  opacity: 0; transition: opacity .15s;
}
[data-gantt-barre]:hover [data-gantt-poignee], .gantt-en-cours [data-gantt-poignee] { opacity: 1; }
.gantt-en-cours { cursor: grabbing !important; z-index: 30 !important; box-shadow: 0 8px 20px -6px rgb(0 0 0 / .35), 0 0 0 2px #231F20 !important; }
body.gantt-glisse, body.gantt-glisse * { cursor: grabbing !important; user-select: none; }
.gantt-bulle {
  position: fixed; z-index: 90; pointer-events: none; white-space: nowrap; border-radius: 6px; background: #231F20;
  padding: 4px 8px; font-size: 12px; font-weight: 500; color: #fff; box-shadow: 0 4px 12px rgb(0 0 0 / .25);
}

/* Barres de défilement discrètes (planning, listes longues) */
.scroll-fin::-webkit-scrollbar { height: 8px; width: 8px; }
.scroll-fin::-webkit-scrollbar-thumb { background: rgb(0 0 0 / .15); border-radius: 999px; }

/* --- Formulaires et boutons (mêmes valeurs que les classes Tailwind de l'outil) --- */
.champ {
  display: block; width: 100%; border: 1px solid #D6D3D1; border-radius: .375rem; background: #fff;
  padding: .5rem .75rem; font-size: .875rem; line-height: 1.25rem; color: #1C1917;
}
.champ:focus { outline: none; border-color: #231F20; box-shadow: 0 0 0 1px #231F20; }
textarea.champ { resize: vertical; }
.etiquette { display: block; margin-bottom: .25rem; font-size: .75rem; font-weight: 500; color: #57534E; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; white-space: nowrap;
  border-radius: .375rem; padding: .5rem .875rem; font-size: .875rem; font-weight: 500; line-height: 1.25rem;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primaire { background: #231F20; color: #fff; }
.btn-primaire:hover { background: #000; }
.btn-secondaire { border: 1px solid #D6D3D1; background: #fff; color: #231F20; }
.btn-secondaire:hover { border-color: #231F20; }
.btn-discret { color: #57534E; }
.btn-discret:hover { background: #F5F5F4; color: #231F20; }
.btn-danger { border: 1px solid rgb(208 59 59 / .4); background: #fff; color: #B42318; }
.btn-danger:hover { background: #FEF3F2; }
.btn-succes { background: #006300; color: #fff; }
.btn-succes:hover { background: #004d00; }
.btn-petit { padding: .3125rem .625rem; font-size: .75rem; gap: .375rem; }

/* --- Fenêtres (formulaires qui s'ouvrent au clic) --- */
.modale-fond {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 6vh 1rem 2rem; background: rgb(28 25 23 / .5);
}
.modale { width: 100%; max-width: 34rem; border-radius: .75rem; background: #fff; box-shadow: 0 25px 50px -12px rgb(0 0 0 / .35); }
.modale-large { max-width: 52rem; }
/* Relance : deux fois plus large, le message d'origine à côté de la nouvelle relance. */
.modale-relance { max-width: 68rem; }
.modale-xl { max-width: 76rem; }
.modale-entete { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #F5F5F4; padding: 1rem 1.25rem; }
.modale-corps { display: grid; gap: 1rem; padding: 1.25rem; }
.modale-pied {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem;
  border-top: 1px solid #F5F5F4; background: #FAFAF9; padding: .75rem 1.25rem; border-radius: 0 0 .75rem .75rem;
}

/* Barres de progression (facturation, avancement) */
.jauge { height: .375rem; overflow: hidden; border-radius: 999px; background: #E7E5E4; }
.jauge > span { display: block; height: 100%; border-radius: 999px; background: #231F20; }

/* Carte des clients */
.carte-clients { height: 26rem; border-radius: 0 0 .5rem .5rem; overflow: hidden; z-index: 0; }
/* Le fond de carte est désaturé côté Google Maps (option styles) : seuls les clients gardent leur couleur. */
.carte-clients .gm-style { font-family: Bahnschrift, Barlow, system-ui, sans-serif; }

/* Fiche d'un point de la carte : reprend la mise en page des listes de l'application. */
/* L'infobulle de Google est vidée de son gabarit : en-tête réservé au titre, marges et hauteur imposée. */
.gm-style .gm-style-iw-c { padding: 0; border-radius: .5rem; box-shadow: 0 8px 24px rgb(35 31 32 / .16); }
.gm-style .gm-style-iw-ch { padding: 0; }
/* La barre de titre ne sert qu'à porter la croix : hors du flux, la fiche commence en haut. */
.gm-style .gm-style-iw-chr { position: absolute; top: 0; right: 0; z-index: 1; }
.gm-style .gm-style-iw-d { overflow: auto !important; max-height: none !important; }
.gm-style .gm-style-iw-c button.gm-ui-hover-effect { margin: 0 !important; opacity: .45; }
.gm-style .gm-style-iw-c button.gm-ui-hover-effect:hover { opacity: 1; }
/* Google donne le focus au premier lien à l'ouverture : le liseré ne doit apparaître qu'au clavier. */
.fiche-carte a:focus { outline: none; }
.fiche-carte a:focus-visible { outline: 2px solid #B19C7F; outline-offset: 2px; border-radius: .125rem; }
.fiche-carte { width: 18.5rem; padding: .875rem 1rem 1rem; font-size: .8125rem; line-height: 1.45; color: #231F20; }
.fc-tete { display: flex; align-items: center; gap: .5rem; margin-bottom: .375rem; }
.fc-marque { border-radius: .125rem; background: #EDE6DC; padding: .125rem .375rem;
  font-size: .625rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.fc-marque--or { background: #0F0F0F; color: #C9A04E; }
.fc-etat { display: inline-flex; align-items: center; gap: .375rem; margin-left: auto; padding-right: 1.75rem;
  white-space: nowrap; font-size: .6875rem; font-weight: 500; color: #57534E; }
.fc-etat i { height: .5rem; width: .5rem; border-radius: 999px; }
.fc-nom { display: block; font-size: .9375rem; font-weight: 600; color: #231F20; }
.fc-nom:hover { text-decoration: underline; }
.fc-sous { margin-top: .0625rem; font-size: .75rem; color: #78716C; }

/* Bloc central : le chantier en cours, le bilan du client ou la piste commerciale. */
.fc-bloc { display: block; margin-top: .625rem; border-radius: .375rem; border: 1px solid #E7E5E4;
  background: #FAFAF9; padding: .5rem .625rem; transition: background-color .15s, border-color .15s; }
a.fc-bloc:hover { border-color: #D6D3D1; background: #F5F5F4; }
.fc-bloc-titre { font-weight: 600; color: #231F20; }
.fc-bloc-ref { margin-top: .0625rem; font-size: .6875rem; color: #78716C; }
.fc-jauge { margin: .5rem 0 .375rem; height: .25rem; overflow: hidden; border-radius: 999px; background: #E7E5E4; }
.fc-jauge > span { display: block; height: 100%; border-radius: 999px; background: #231F20; }
.fc-mesures { display: flex; align-items: baseline; gap: .5rem; white-space: nowrap;
  font-size: .6875rem; color: #78716C; }
.fc-pose { margin-top: .125rem; font-size: .6875rem; color: #78716C; }
.fc-mesures--large { font-size: .75rem; }
.fc-mesures strong { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; color: #231F20; }
.fc-retard { font-weight: 600; color: #B42318; }
.fc-perdu { text-decoration: line-through; text-decoration-color: #D6D3D1; }
.fc-note { margin-top: .375rem; font-size: .6875rem; color: #A8A29E; }

.fc-pied { display: flex; align-items: center; gap: .75rem; margin-top: .625rem;
  border-top: 1px solid #F5F5F4; padding-top: .5rem; font-size: .6875rem; }
.fc-pied a { color: #78716C; }
.fc-pied a:hover { color: #231F20; text-decoration: underline; }
.fc-pied .fc-fiche { margin-left: auto; white-space: nowrap; font-weight: 600; color: #231F20; }

/* --- Espace personnel et écran d'atelier --- */
/* Écran fixe de l'atelier : caractères agrandis ; sur un téléphone, la taille normale. */
html.atelier { font-size: 100%; }
@media (min-width: 1024px) { html.atelier { font-size: 112.5%; } }

/* Feuille qui monte du bas sur téléphone, fenêtre centrée sur écran. */
.feuille {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  border-radius: 1.25rem 1.25rem 0 0; background: #fff; padding: .75rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgb(0 0 0 / .25);
}
@media (min-width: 640px) {
  .feuille {
    left: 50%; right: auto; bottom: auto; top: 8vh; width: 100%; max-width: 32rem; transform: translateX(-50%);
    max-height: 84vh; border-radius: 1rem; padding: 1.5rem;
  }
  .feuille-large { max-width: 44rem; }
}

/* Messages : bulles */
.bulle-autre { border-radius: 1.125rem 1.125rem 1.125rem .25rem; background: #fff; border: 1px solid #E7E5E4; }
.bulle-moi { border-radius: 1.125rem 1.125rem .25rem 1.125rem; background: #231F20; color: #fff; }
.bulle-bureau { border-color: #B19C7F; background: #FBF8F3; }

/* Jauge d'heures de la journée */
.jauge-heures { height: .5rem; overflow: hidden; border-radius: 999px; background: #E7E5E4; }
.jauge-heures > span { display: block; height: 100%; border-radius: 999px; background: #231F20; transition: width .3s; }
.jauge-heures > span.complet { background: #006300; }

/* Demi-journées d'une semaine en un coup d'œil */
.demi { height: .5rem; flex: 1; border-radius: 2px; background: #E7E5E4; }
.demi.occupe { background: #D4952B; }
.demi.occupe-chantier { background: #B94E48; }

/* Liste horizontale qui défile au doigt (cartes) */
.defile-x { display: flex; gap: .75rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .25rem; -webkit-overflow-scrolling: touch; }
.defile-x > * { scroll-snap-align: start; flex: 0 0 min(85%, 22rem); }
