/* =====================================================================
   SIBIS — nouvelle génération (27/10/2026). Même construction que CAMYnergie (Bootstrap + une couche de design),
   couleurs du logo SIBIS : sarcelle #0D6B60 (dominante), bleu #1A7BBE, orange #C4532B.
   ===================================================================== */
:root {
  --sibis: #0D6B60;
  --sibis-fonce: #08473F;
  --sibis-clair: #e6f2f0;
  --sibis-bleu: #1A7BBE;
  --sibis-orange: #C4532B;
  --devis: #3AAE54;
  --facture: #0D7064;
  --fond: #f1f5f4;
  --carte: #ffffff;
  --encre: #15302c;
  --encre-2: #58706b;
  --bord: #dde8e5;
  --ombre: 0 1px 2px rgba(8, 71, 63, .05), 0 10px 28px -14px rgba(8, 71, 63, .18);
  --rayon: 14px;
  --menu-l: 248px;
  --bs-primary: #0D6B60;
  --bs-link-color: #0D6B60;
  --bs-link-hover-color: #08473F;
}

html { font-size: 15px; }
body {
  background: var(--fond);
  color: var(--encre);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  min-height: 100vh;
}
h1, h2, h3, h4, h5, h6 { color: var(--sibis-fonce); font-weight: 650; }
a { color: var(--sibis); }

/* Icônes Lucide (sprite local) */
.ico { width: 1.2em; height: 1.2em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

/* ---------- Menu latéral ---------- */
.s-menu {
  position: fixed; inset: 0 auto 0 0; width: var(--menu-l); z-index: 1040;
  background: var(--carte); border-right: 1px solid var(--bord);
  display: flex; flex-direction: column; overflow-y: auto; padding: 14px 10px 20px;
}
.s-marque { display: block; padding: 6px 18px 14px; }
.s-marque img { width: 112px; height: auto; display: block; }
.s-menu nav { display: flex; flex-direction: column; gap: 2px; }
.s-item {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
  border-radius: 10px; color: var(--encre); text-decoration: none; font-weight: 520;
}
.s-item .ico { width: 21px; height: 21px; color: var(--sibis); }
.s-item:hover { background: var(--sibis-clair); color: var(--sibis-fonce); }
.s-item.actif { background: var(--sibis); color: #fff; }
.s-item.actif .ico { color: #fff; }
.s-item.futur { color: var(--encre-2); }
.s-item.futur .ico { color: #93a8a3; }
.s-lib { flex: 1; line-height: 1.2; }
.s-phase {
  font-size: .72rem; font-weight: 700; color: var(--encre-2); background: #eef3f2;
  border: 1px solid var(--bord); border-radius: 999px; padding: 1px 7px;
}
.s-item.actif .s-phase { background: rgba(255,255,255,.18); color: #fff; border-color: transparent; }
.s-titre { margin: 16px 12px 6px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--encre-2); }

/* ---------- Bandeau ---------- */
.avec-menu .s-page { margin-left: var(--menu-l); }
.s-bandeau {
  position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 12px;
  min-height: 62px; padding: 8px 24px; background: rgba(241, 245, 244, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bord);
}
.s-burger { display: none; border: 0; background: transparent; color: var(--sibis-fonce); padding: 8px; border-radius: 10px; }
.s-burger .ico { width: 26px; height: 26px; }
.s-titre-page { flex: 1; font-size: 1.15rem; font-weight: 650; color: var(--sibis-fonce); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-utilisateur { display: flex; align-items: center; gap: 8px; }
.s-pastille { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--encre); padding: 4px 10px; border-radius: 10px; }
.s-pastille:hover { background: var(--carte); }
.s-pastille .ico { width: 28px; height: 28px; color: var(--sibis); }
.s-qui { display: flex; flex-direction: column; line-height: 1.15; }
.s-qui b { font-weight: 600; font-size: .92rem; }
.s-qui small { color: var(--encre-2); font-size: .78rem; }
.s-sortir { display: flex; align-items: center; gap: 6px; border: 1px solid var(--bord); background: var(--carte); color: var(--encre); border-radius: 10px; padding: 7px 12px; min-height: 40px; }
.s-sortir:hover { border-color: var(--sibis-orange); color: var(--sibis-orange); }

.s-contenu { padding: 24px; max-width: 1280px; }
.s-contenu-seul { margin: 0 auto; max-width: 460px; padding: 32px 16px; }
.s-logo-seul { text-align: center; margin: 12px 0 8px; }
.s-logo-seul img { width: 150px; height: auto; }

/* ---------- Composants ---------- */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 20px; }
.btn-sibis { background: var(--sibis); border-color: var(--sibis); color: #fff; }
.btn-sibis:hover, .btn-sibis:focus, .btn-sibis:active { background: var(--sibis-fonce); border-color: var(--sibis-fonce); color: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--sibis); box-shadow: 0 0 0 .2rem rgba(13, 107, 96, .18); }

/* Accueil : tuiles des rubriques */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tuile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 150px;
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre);
  text-decoration: none; color: var(--encre); transition: transform .12s, box-shadow .12s;
}
.tuile:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(8,71,63,.06), 0 16px 36px -14px rgba(8,71,63,.26); color: var(--encre); }
/* Photo de la banque d'images : fondu vers la carte en bas, coin haut-gauche appuyé aux couleurs SIBIS. */
.tuile-photo { position: relative; height: 112px; flex: none; background: center / cover no-repeat; transition: transform .4s; }
.tuile-photo::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.75) 78%, #fff 100%),
    linear-gradient(135deg, rgba(8,71,63,.92) 0%, rgba(13,107,96,.55) 22%, rgba(13,107,96,0) 52%);
}
.tuile:hover .tuile-photo { transform: scale(1.04); }
.tuile:not(.prete) .tuile-photo { filter: grayscale(.55) brightness(1.04); }
.tuile-corps { position: relative; display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 0 18px 18px; margin-top: -26px; }
.tuile-tete { display: flex; align-items: center; gap: 12px; }
.tuile-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--sibis-clair); color: var(--sibis); box-shadow: 0 4px 12px -4px rgba(8,71,63,.35); border: 2px solid #fff; }
.tuile.prete .tuile-ico { background: var(--sibis); color: #fff; }
.tuile-corps.sans-photo { margin-top: 0; padding-top: 18px; }
.tuiles.familles { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tuiles.familles .tuile { min-height: 0; }
.tuiles.familles .tuile-photo { height: 96px; }
/* Catalogue : bandeau de la famille ouverte, photo en fondu à droite */
.famille-tete {
  position: relative; overflow: hidden; display: flex; align-items: center; min-height: 104px; padding: 16px 22px;
  border-radius: var(--rayon); color: #fff; box-shadow: var(--ombre);
  background: linear-gradient(90deg, var(--sibis-fonce) 0%, var(--sibis-fonce) 38%, rgba(8,71,63,.55) 70%, rgba(8,71,63,.1) 100%), var(--photo, none) right center / 60% auto no-repeat, var(--sibis-fonce);
}
.famille-tete h1 { color: #fff; }
.famille-tete a, .famille-tete span { color: #bfe6df; }
.tuile-ico .ico { width: 24px; height: 24px; }
.tuile b { font-size: 1.02rem; color: var(--sibis-fonce); }
.tuile p { margin: 0; color: var(--encre-2); font-size: .9rem; line-height: 1.4; }
.tuile .etat { margin-top: auto; font-size: .78rem; font-weight: 650; color: var(--encre-2); }
.tuile.prete .etat { color: var(--sibis); }
.liens-apps { display: flex; flex-wrap: wrap; gap: 10px; }
.lien-app { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--bord); background: var(--carte); text-decoration: none; color: var(--encre); font-weight: 550; min-height: 44px; }
.lien-app:hover { border-color: var(--sibis); color: var(--sibis-fonce); }
.lien-app .ico { color: var(--sibis); }

.phases { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.phases li { display: flex; gap: 12px; align-items: flex-start; }
.phases .num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #eef3f2; color: var(--encre-2); font-weight: 700; font-size: .85rem; }
.phases li.faite .num { background: var(--sibis); color: #fff; }

/* Bandeau : applications reliées, entre le titre de la page et l'utilisateur */
.s-apps { display: flex; align-items: center; gap: 6px; }
.s-apps a {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 12px; border-radius: 10px;
  background: var(--sibis-fonce); color: #fff; text-decoration: none; font-weight: 560; font-size: .9rem;
}
.s-apps a .ico { width: 18px; height: 18px; color: #9fd8cf; }
.s-apps a:hover { background: var(--sibis); color: #fff; }
.s-apps a:hover .ico { color: #fff; }
@media (max-width: 991.98px) { .s-apps span { display: none; } .s-apps a { padding: 6px 10px; } }

/* Accueil : avancement, bande sombre allongée avec barre de progression */
.avancement {
  border-radius: var(--rayon); padding: 20px 22px; color: #e6f2f0;
  background: linear-gradient(120deg, #062f2a 0%, var(--sibis-fonce) 55%, #0b5a51 100%);
  box-shadow: 0 12px 30px -16px rgba(6, 47, 42, .6);
}
.av-tete { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.av-tete h2 { margin: 0; font-size: 1rem; color: #fff; }
.av-chiffre { font-size: .88rem; color: #9fd8cf; font-weight: 600; }
.av-barre { height: 10px; margin: 14px 0 18px; border-radius: 999px; background: rgba(255,255,255,.14); overflow: hidden; }
.av-barre span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3fbfa9, #9fe3d6); }
.av-etapes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.av-etapes li { display: flex; flex-direction: column; gap: 8px; font-size: .84rem; line-height: 1.3; color: rgba(230,242,240,.7); }
.av-etapes .num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: .85rem; background: rgba(255,255,255,.12); color: #cfe6e1; }
.av-etapes .num .ico { width: 16px; height: 16px; }
.av-etapes li.faite { color: #fff; }
.av-etapes li.faite .num { background: #3fbfa9; color: #062f2a; }
.av-etapes li.en_cours { color: #fff; }
.av-etapes li.en_cours .num { background: var(--sibis-orange); color: #fff; box-shadow: 0 0 0 4px rgba(196,83,43,.3); }
.av-txt em { display: inline-block; margin-left: 4px; font-style: normal; font-size: .7rem; font-weight: 700; padding: 0 7px; border-radius: 999px; background: var(--sibis-orange); color: #fff; }
.av-txt small { display: block; margin-top: 3px; color: #9fd8cf; font-size: .74rem; }
@media (max-width: 991.98px) { .av-etapes { grid-template-columns: 1fr; } .av-etapes li { flex-direction: row; align-items: flex-start; } }

.table-sibis { --bs-table-bg: transparent; }
.table-sibis th { color: var(--encre-2); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; border-bottom-color: var(--bord); }
.badge-role { background: var(--sibis-clair); color: var(--sibis-fonce); font-weight: 600; }

/* ---------- Smartphone ---------- */
@media (max-width: 991.98px) {
  .avec-menu .s-page { margin-left: 0; }
  .s-menu { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.18); }
  body.menu-ouvert .s-menu { transform: none; }
  .s-voile { position: fixed; inset: 0; background: rgba(8, 30, 27, .35); z-index: 1035; }
  .s-voile[hidden] { display: none !important; }
  .s-burger { display: inline-flex; }
  .s-bandeau { padding: 8px 16px; }
  .s-contenu { padding: 16px; }
  .s-qui, .s-sortir span { display: none; }
}
@media print { .s-menu, .s-bandeau { display: none !important; } .avec-menu .s-page { margin-left: 0; } }

/* ---------- Phase 2 : galerie et visionneuse des photos BatAppli ---------- */
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.vignette { border: 1px solid var(--bord); border-radius: 10px; padding: 0; overflow: hidden; background: #eef3f2; aspect-ratio: 4 / 3; cursor: zoom-in; }
.vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vignette:hover { border-color: var(--sibis); }
/* Survol : la vignette grandit x2,5 au-dessus du reste (origine calculée par visionneuse.js pour rester dans la fenêtre). */
@media (hover: hover) {
  .vignette { position: relative; transition: transform .15s ease, box-shadow .15s ease; }
  .vignette:hover { transform: scale(2.5); z-index: 50; box-shadow: 0 8px 28px rgba(0,0,0,.35); border-radius: 6px; }
}
.visionneuse { position: fixed; inset: 0; z-index: 2000; background: rgba(6, 22, 20, .94); display: flex; align-items: center; justify-content: center; }
/* Règle conventions-ui-apps : un display:flex écrase l'attribut hidden — sans cette ligne la visionneuse resterait affichée et bloquerait les clics. */
.visionneuse[hidden] { display: none !important; }
.v-scene { position: absolute; inset: 64px 72px 44px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.v-scene img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; transition: transform .12s ease; user-select: none; }
.v-scene.zoome img { cursor: grab; transition: none; }
.v-scene img[hidden], .v-scene iframe[hidden] { display: none !important; }
.v-scene iframe { width: min(100%, 1100px); height: 100%; border: 0; border-radius: 6px; background: #fff; }
/* PDF : le lecteur du navigateur a son propre zoom et sa rotation ; on masque ceux de la photo. */
.visionneuse.mode-pdf .v-barre button[data-action="moins"], .visionneuse.mode-pdf .v-barre button[data-action="plus"], .visionneuse.mode-pdf .v-barre button[data-action="tourner"] { display: none; }
.piece-visio { border: 0; background: none; padding: 0; color: var(--sibis); text-decoration: underline; cursor: pointer; text-align: left; }
.piece-visio:hover { color: var(--sibis-fonce, var(--sibis)); }
.visionneuse button { border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.visionneuse button:hover { background: rgba(255,255,255,.28); }
.visionneuse button .ico { width: 22px; height: 22px; }
.v-barre { position: absolute; top: 10px; left: 14px; right: 14px; display: flex; align-items: center; gap: 6px; z-index: 2; }
.v-nom { flex: 1; min-width: 0; color: #fff; opacity: .85; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-prec, .v-suiv { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.v-prec { left: 14px; } .v-suiv { right: 14px; }
.visionneuse.seule .v-prec, .visionneuse.seule .v-suiv { display: none; }
.v-compteur { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); color: #fff; font-size: .9rem; opacity: .8; }
.v-info { position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%); background: #fff; color: #111; padding: 8px 14px; border-radius: 8px; font-size: .9rem; max-width: 90vw; }
.v-info[hidden] { display: none !important; }
@media (max-width: 575.98px) {
  .v-scene { inset: 60px 0 70px; }
  .v-prec, .v-suiv { top: auto; bottom: 10px; transform: none; }
  .v-barre button[data-action="moins"], .v-barre button[data-action="plus"], .v-barre button[data-action="onglet"] { display: none; }
}
/* Vignette d'un PDF : aperçu de la première page (haut de page), badge PDF et nom du fichier. */
.vignette-pdf { background: #fff; }
.vignette-pdf img { object-fit: cover; object-position: top; }
.vignette-pdf::before { content: "PDF"; position: absolute; top: 4px; left: 4px; z-index: 1; background: #c0392b; color: #fff; font-size: .62rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.vignette-pdf .vignette-nom { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.92); color: #222; font-size: .68rem; padding: 2px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.vignette-pdf { position: relative; }

/* Décision déduite du statut Inch (personne n'a encore tranché) : badge en pointillés. */
.badge.decision-auto { background: transparent !important; border: 1.5px dashed currentColor; color: var(--sibis) !important; }

/* File des tickets : numéro dans une case, bloc des devis à part (en fin de liste, teinté). */
.case-ticket { display: inline-block; min-width: 58px; text-align: center; padding: 4px 8px; border: 1.5px solid var(--sibis); border-radius: 8px;
  color: var(--sibis); font-weight: 700; text-decoration: none; background: #fff; }
.case-ticket:hover { background: var(--sibis); color: #fff; }
.case-ticket.case-ticket-sm { min-width: 52px; padding: 1px 6px; font-size: .82rem; border-radius: 6px; }
.separateur-devis td { background: #fff4dc !important; color: #8a5a00; font-weight: 700; border-top: 2px solid #f0b429; padding-top: 10px !important; padding-bottom: 10px !important; }
.ligne-devis td { background: #fffaf0 !important; }
.ligne-devis td:first-child { border-left: 4px solid #f0b429; }
.ligne-devis .case-ticket { border-color: #c98a00; color: #8a5a00; }
.ligne-devis .case-ticket:hover { background: #c98a00; color: #fff; }
.separateur-renvoyes td { background: #eef1f4 !important; color: #445; font-weight: 700; border-top: 2px solid #9aa5b1; padding-top: 10px !important; padding-bottom: 10px !important; }
.ligne-renvoyee td { background: #f6f7f9 !important; color: #555; }
.ligne-renvoyee td:first-child { border-left: 4px solid #9aa5b1; }
.ligne-renvoyee .case-ticket { border-color: #7b8794; color: #445; }

/* Fiche ticket : fil du ticket, un événement sur deux teinté, date mise en avant. */
.fil-ticket { max-height: 520px; overflow: auto; }
.fil-ticket li { padding: 8px 10px; border-radius: 8px; margin-bottom: 4px; }
.fil-ticket li:nth-child(even) { background: rgba(15, 110, 95, .06); }
.fil-entete { margin-bottom: 2px; }
.fil-date { font-weight: 700; color: var(--sibis); white-space: nowrap; }
.fil-date .ico { width: 14px; height: 14px; vertical-align: -2px; }

/* Fiche ticket : frise du circuit (une étape après l'autre, barre de progression). */
.frise { list-style: none; padding: 0; margin: 0; }
.frise-etape { position: relative; padding-left: 40px; padding-bottom: 4px; }
.frise-etape::before { content: ""; position: absolute; left: 14px; top: 32px; bottom: 0; width: 2px; background: var(--bord); }
.frise-etape:last-child::before { display: none; }
.frise-etape.faite::before { background: #198754; }
.frise-etape summary { list-style: none; cursor: pointer; padding: 4px 0 6px; min-height: 34px; }
.frise-etape summary::-webkit-details-marker { display: none; }
.frise-etape summary:hover .frise-titre b { text-decoration: underline; }
.frise-case { position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--bord); background: #fff;
  display: grid; place-items: center; padding: 0; font-size: .8rem; font-weight: 700; color: #6c757d; cursor: pointer; }
.frise-case .ico { width: 16px; height: 16px; }
.frise-etape.faite .frise-case { background: #198754; border-color: #198754; color: #fff; }
.frise-etape.courante .frise-case { border-color: var(--sibis); color: var(--sibis); box-shadow: 0 0 0 4px rgba(15, 110, 95, .15); }
.frise-etape:not(.faite) .frise-case:hover { border-color: #198754; color: #198754; }
.frise-etape.a-venir .frise-titre b { color: #6c757d; font-weight: 600; }
.frise-maintenant { color: var(--sibis); font-weight: 600; }
.frise-corps { padding: 2px 0 14px; }
.frise-deja { border-top: 1px dashed var(--bord); margin-top: 10px; padding-top: 8px; }
.frise-deja.surligne { background: rgba(25, 135, 84, .08); border-radius: 8px; padding: 8px; }

/* Fiche ticket : petites icônes de fichier devant les pièces qui ne sont pas des photos. */
.liste-pieces .ico { width: 16px; height: 16px; vertical-align: -3px; }
.pastille-nb { display: inline-block; min-width: 1.6em; padding: 0 .45em; border-radius: 999px; background: var(--sibis-orange); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; }

/* ---------- Phase 3 : éditeur des lignes ---------- */
.editeur-lignes td { vertical-align: top; }
.editeur-lignes textarea { min-width: 260px; }
.editeur-lignes .ligne-section td { background: var(--sibis-clair); }
.editeur-lignes .ligne-texte td { background: #fafbfb; }
.editeur-lignes .ligne-deduction td { color: var(--encre-2); }
.editeur-lignes .outils button { font-size: .85rem; text-decoration: none; }
.editeur-lignes .poignee { cursor: grab; color: var(--encre-2, #6c757d); font-size: 1.05rem; padding: 0 4px; user-select: none; vertical-align: middle; }
.editeur-lignes .poignee:hover { color: var(--sibis, #0D7064); }
.editeur-lignes tr.en-glisse td { opacity: .45; }
.editeur-lignes tr.depot-avant td { box-shadow: inset 0 3px 0 #0D7064; }
.editeur-lignes tr.depot-apres td { box-shadow: inset 0 -3px 0 #0D7064; }
.totaux { min-width: 260px; }
.totaux > div { display: flex; justify-content: space-between; gap: 24px; padding: 2px 0; }
.totaux .ttc { border-top: 1px solid var(--bord); margin-top: 4px; padding-top: 6px; font-size: 1.1rem; }
.totaux .ttc b { color: var(--sibis-fonce); }

/* Filtre par colonne (site.js, tableaux .table-filtrable) */
.ligne-filtres th { padding-top: 2px !important; padding-bottom: 6px !important; font-weight: normal; border-bottom-width: 1px; }
.ligne-filtres .form-control, .ligne-filtres .form-select { min-width: 70px; font-size: .8rem; padding-top: 2px; padding-bottom: 2px; }
.ligne-filtres .form-control:not(:placeholder-shown), .ligne-filtres .form-select:has(option:checked:not([value=""])) { border-color: var(--sibis); background-color: #eef7f5; }

/* Facture préparée (étape 2 de la frise) */
.proposition { border: 1.5px solid var(--sibis); border-radius: 10px; padding: 10px 12px; background: #f6fbfa; }
.proposition-lignes td, .proposition-lignes th { font-size: .82rem; }
.proposition-lignes .pl-section td { font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding-top: 8px; }
.proposition-lignes .pl-texte td { font-weight: 700; }
.proposition-lignes .pl-a-chiffrer td { background: #fff4dc; }

/* Choix du bail SPI (éditeur de facture) : présents en vert, partis en rouge, comme SIBIS Facturation */
.baux { border: 1px solid var(--bord); border-radius: 8px; padding: 8px; background: #fff; }
.baux-liste { max-height: 320px; overflow: auto; display: grid; gap: 4px; }
.bail { text-align: left; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; font-size: .85rem; cursor: pointer; }
.bail.present { background: rgba(46, 204, 113, .16); } .bail.present .etat { color: #1e9e57; font-weight: 600; }
.bail.parti { background: rgba(231, 76, 60, .13); } .bail.parti .etat { color: #c0392b; font-weight: 600; }
.bail:hover { border-color: var(--sibis); }

/* Fenêtre de question dans le circuit (après un dépôt, après un courrier) */
.question-circuit { border: 2px solid var(--sibis); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; background: #eef7f5; box-shadow: 0 4px 14px rgba(15,110,95,.15); }

/* Photos des lignes de devis / factures (bouton 📷, 28/10/2026) */
.photos-ligne { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.photos-ligne .ph { position: relative; display: inline-block; }
.photos-ligne img { height: 56px; width: auto; border: 1px solid var(--bord, #d8dee0); border-radius: 6px; display: block; transition: transform .15s ease, box-shadow .15s ease; transform-origin: left top; }
@media (hover: hover) { .photos-ligne img:hover { transform: scale(2.5); position: relative; z-index: 50; box-shadow: 0 8px 28px rgba(0,0,0,.35); } }
.photos-ligne .ph b { position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; line-height: 16px; text-align: center; border-radius: 50%; background: #c0392b; color: #fff; font-size: 12px; cursor: pointer; z-index: 51; }
.menu-photos { position: absolute; z-index: 1060; background: #fff; border: 1px solid var(--bord, #d8dee0); border-radius: 8px; padding: 4px; min-width: 190px; }
.galerie-photos { position: fixed; inset: 0; z-index: 1070; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.galerie-photos .boite { background: #fff; border-radius: 12px; padding: 16px; width: min(860px, 100%); max-height: 90vh; overflow: auto; }
.galerie-photos .grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.galerie-photos .vig { border: 3px solid transparent; border-radius: 8px; padding: 0; overflow: hidden; aspect-ratio: 4 / 3; background: #eef3f2; }
.galerie-photos .vig img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galerie-photos .vig.choisie { border-color: var(--sibis, #0D7064); box-shadow: 0 0 0 2px #fff inset; }

/* Circuit : une ligne par document en plus de la facture principale (avoir, devis, autre facture) — 28/10/2026 */
.frise-doc-ligne { display: flex; align-items: flex-start; gap: 0; padding: 4px 0 8px; min-height: 34px; }
.frise-doc .frise-case { cursor: default; }
.frise-doc .frise-titre { display: block; }
.puce-etat { display: inline-block; border: 1px solid var(--bord, #d8dee0); border-radius: 999px; padding: 0 8px; margin: 0 4px 3px 0; color: #6c757d; background: #fff; white-space: nowrap; }
.puce-etat.ok { border-color: #198754; color: #198754; background: #eef8f1; }
.frise-ajout .frise-case { font-weight: 700; color: var(--sibis, #0D7064); }
/* Ligne de dépôt visée depuis le circuit (« Déposer » d'un avoir, d'un devis…) : mise en évidence */
.depot-doc { scroll-margin-top: 120px; }
.depot-doc:target { border-color: var(--sibis, #0D7064) !important; box-shadow: 0 0 0 3px rgba(15,110,95,.2); background: #f2faf7; }
