@font-face { font-family: 'Barlow'; src: url(fonts/Barlow-SemiBold.ttf); font-weight: 600; }
@font-face { font-family: 'Barlow'; src: url(fonts/Barlow-Bold.ttf); font-weight: 700; }
@font-face { font-family: 'Inter'; src: url(fonts/Inter-Regular.ttf); font-weight: 400; }
@font-face { font-family: 'Inter'; src: url(fonts/Inter-SemiBold.ttf); font-weight: 600; }
@font-face { font-family: 'Barlow Semi Condensed'; src: url(fonts/BarlowSemiCondensed-SemiBold.ttf); font-weight: 600; }
@font-face { font-family: 'IBM Plex Mono'; src: url(fonts/IBMPlexMono-Regular.ttf); font-weight: 400; }

:root {
  --marine: #000030; --marine-800: #0E1452; --marine-700: #1F2A6B; --marine-500: #3A4BA8; --marine-300: #9AA3D6; --marine-100: #E3E6F4; --marine-50: #F2F3FA;
  --jaune: #F9C004; --jaune-700: #8A6700; --jaune-100: #FEF2C7; --jaune-50: #FFF9E6;
  --ardoise-900: #161A26; --ardoise-600: #545B6B; --ardoise-500: #6B7280; --ardoise-300: #C4C9D2; --ardoise-200: #DEE2E8; --ardoise-100: #EEF0F4; --ardoise-50: #F6F7F9;
  --ok: #1A6E45; --ok-fond: #E8F5EE; --alerte: #9A5A00; --alerte-fond: #FDF0D9; --nc: #B42318; --nc-fond: #FDE7E5; --info: #1F5FA0; --info-fond: #E4EEF8;
  --s1: #3A4BA8; --s2: #DB9C00; --s3: #159E8C; --s4: #D35F3B;
  --fond: #F6F7F9; --surface: #FFFFFF; --texte: #161A26; --texte-2: #545B6B; --trait: #DEE2E8;
  --titres: 'Barlow', Arial, sans-serif; --corps: 'Inter', Arial, sans-serif; --dense: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif; --mono: 'IBM Plex Mono', Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--corps); font-size: 14px; line-height: 1.4; color: var(--texte); background: var(--fond); }
h1, h2, h3 { font-family: var(--titres); color: var(--marine); font-weight: 600; margin: 0 0 8px; }
h1 { font-size: 24px; } h1::before { content: ""; display: block; width: 36px; height: 4px; background: var(--jaune); margin-bottom: 8px; }
h2 { font-size: 18px; } h3 { font-size: 15px; color: var(--marine-700); }
button, input, select, textarea { font: inherit; }

.barre { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--marine); color: #fff; border-bottom: 3px solid var(--jaune); }
.logo { height: 30px; }
.projet { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.surtitre { font-family: var(--titres); font-weight: 600; font-size: 11px; letter-spacing: .14em; color: var(--jaune); text-transform: uppercase; }
.nom-projet { font-family: var(--titres); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identite { margin-left: auto; display: flex; gap: 6px; }
.identite select, .identite input { background: var(--marine-800); color: #fff; border: 1px solid var(--marine-500); border-radius: 4px; padding: 4px 6px; max-width: 160px; }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }

.cadre { display: flex; min-height: calc(100vh - 51px); }
.menu { width: 210px; flex: none; background: var(--surface); border-right: 1px solid var(--trait); padding: 12px 0; }
.menu a { display: block; padding: 8px 18px; color: var(--texte); text-decoration: none; border-left: 3px solid transparent; }
.menu a:hover { background: var(--marine-50); }
.menu a.actif { border-left-color: var(--jaune); background: var(--marine-50); color: var(--marine); font-weight: 600; }
.menu .sep { margin: 10px 18px 4px; font-family: var(--titres); font-size: 11px; letter-spacing: .12em; color: var(--ardoise-500); text-transform: uppercase; }
.vue { flex: 1; min-width: 0; padding: 20px 24px 48px; }
.attente { color: var(--texte-2); }
.chapeau { color: var(--texte-2); max-width: 900px; margin: -2px 0 16px; }

.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tuile { background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; padding: 12px 14px; }
.tuile .v { font-family: var(--titres); font-size: 26px; font-weight: 600; color: var(--marine); line-height: 1.1; }
.tuile .l { color: var(--texte-2); font-size: 12.5px; }
.tuile .s { font-size: 12px; color: var(--ardoise-500); margin-top: 2px; }
.tuile.alerte { border-left: 4px solid var(--alerte); } .tuile.critique { border-left: 4px solid var(--nc); } .tuile.ok { border-left: 4px solid var(--ok); }

.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; padding: 14px 16px; min-width: 0; }
.carte h3 { margin-bottom: 10px; }
.legende { font-size: 12px; color: var(--texte-2); margin-top: 6px; }

.alertes { list-style: none; padding: 0; margin: 0; }
.alertes li { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--ardoise-100); font-size: 13px; }
.alertes li:last-child { border: 0; }
.pastille { flex: none; font-family: var(--dense); font-weight: 600; font-size: 11px; letter-spacing: .04em; padding: 1px 6px; border-radius: 3px; text-transform: uppercase; height: fit-content; }
.pastille.critique { background: var(--nc-fond); color: var(--nc); } .pastille.alerte { background: var(--alerte-fond); color: var(--alerte); } .pastille.info { background: var(--info-fond); color: var(--info); }

.outils { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.outils input[type=search] { flex: 1; min-width: 180px; max-width: 360px; padding: 7px 10px; border: 1px solid var(--ardoise-300); border-radius: 6px; background: #fff; }
.outils select { padding: 6px 8px; border: 1px solid var(--ardoise-300); border-radius: 6px; background: #fff; }
.btn { border: 1px solid var(--marine); background: var(--marine); color: #fff; padding: 7px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; text-decoration: none; display: inline-block; font-size: 13px; }
.btn.sec { background: #fff; color: var(--marine); }
.btn.jaune { background: var(--jaune); border-color: var(--jaune); color: var(--marine); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.compte { color: var(--texte-2); font-size: 12.5px; }

.onglets { display: flex; gap: 2px; border-bottom: 2px solid var(--trait); margin-bottom: 14px; overflow-x: auto; }
.onglets button { background: none; border: 0; padding: 8px 14px; cursor: pointer; color: var(--texte-2); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.onglets button.actif { color: var(--marine); border-bottom-color: var(--jaune); font-weight: 600; }

.tableau-boite { overflow-x: auto; background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--marine); color: #fff; text-align: left; font-weight: 600; padding: 7px 9px; border-bottom: 2px solid var(--jaune); cursor: pointer; white-space: nowrap; font-family: var(--dense); font-size: 13.5px; letter-spacing: .02em; }
td { padding: 6px 9px; border-bottom: 1px solid var(--ardoise-200); vertical-align: top; }
td.n, th.n { text-align: right; }
tbody tr:hover { background: var(--marine-50); cursor: pointer; }
tr.total td { font-weight: 600; border-top: 1.5px solid var(--marine); background: var(--marine-50); }
td .long { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 520px; }
.code { font-family: var(--mono); font-size: 12px; white-space: nowrap; }

.tag { display: inline-block; font-family: var(--dense); font-weight: 600; font-size: 11px; letter-spacing: .04em; padding: 1px 6px; border-radius: 3px; border: 1px solid; white-space: nowrap; }
.tag.MESURÉ { color: #fff; background: #000030; border-color: #000030; }
.tag.FACTURÉ { color: #0B5F55; background: #DDF3EF; border-color: #159E8C; }
.tag.DOCUMENTÉ { color: #1F2A6B; background: #E3E6F4; border-color: #3A4BA8; }
.tag.CALCULÉ { color: #4F2F7A; background: #EFE7F8; border-color: #9061C2; }
.tag.EXTRAPOLÉ { color: #7A3A12; background: #FBE6DD; border-color: #D35F3B; }
.tag.HYPOTHÈSE { color: #3B4252; background: #fff; border-color: #6B7280; border-style: dashed; }
.tag.RECOMMANDATION { color: #000030; background: #F9C004; border-color: #F9C004; }
.statut { font-family: var(--dense); font-weight: 600; font-size: 11.5px; letter-spacing: .05em; padding: 1px 7px; border-radius: 3px; text-transform: uppercase; background: var(--ardoise-100); color: var(--ardoise-600); white-space: nowrap; }
.statut.vert { background: var(--ok-fond); color: var(--ok); } .statut.orange { background: var(--alerte-fond); color: var(--alerte); } .statut.rouge { background: var(--nc-fond); color: var(--nc); } .statut.bleu { background: var(--info-fond); color: var(--info); } .statut.plein { background: var(--ok); color: #fff; }
.crit { color: var(--nc); font-weight: 600; }
.alerte-txt { color: var(--alerte); font-weight: 600; }

.modale { position: fixed; inset: 0; background: rgba(0,0,48,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modale[hidden] { display: none; }
.modale-boite { background: #fff; border-radius: 10px; width: 100%; max-width: 760px; box-shadow: 0 10px 40px rgba(0,0,48,.25); }
.modale-tete { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--trait); }
.modale-tete h2 { margin: 0; flex: 1; }
.fermer { background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--texte-2); }
#modaleCorps { padding: 16px 18px 18px; }
.formulaire { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.formulaire label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--texte-2); }
.formulaire label.large { grid-column: 1 / -1; }
.formulaire input, .formulaire select, .formulaire textarea { padding: 6px 8px; border: 1px solid var(--ardoise-300); border-radius: 5px; color: var(--texte); background: #fff; }
.formulaire textarea { min-height: 64px; resize: vertical; }
.pied { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.trace { font-size: 12px; color: var(--ardoise-500); margin-top: 10px; }

.circuit { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.circuit span { padding: 5px 10px; border-radius: 4px; border: 1px solid var(--ardoise-300); font-family: var(--dense); font-weight: 600; font-size: 13px; }
.circuit span.fait { background: var(--ok); border-color: var(--ok); color: #fff; }
.circuit span.attendu { background: var(--jaune-100); border-color: var(--jaune); color: var(--marine); }
.encadre { border-left: 4px solid var(--marine); background: var(--marine-50); padding: 10px 14px; margin: 10px 0; border-radius: 0 6px 6px 0; font-size: 13px; }
.encadre.cle { border-color: var(--jaune); background: var(--jaune-50); }

.postes { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.poste { background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; padding: 12px 14px; cursor: pointer; }
.poste:hover { border-color: var(--marine-500); }
.poste .ab { font-family: var(--dense); font-weight: 600; color: var(--jaune-700); letter-spacing: .06em; }
.poste .nb { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--texte-2); margin-top: 6px; }
.poste .nb b { color: var(--marine); }

svg text { font-family: var(--corps); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--marine); color: #fff; padding: 10px 16px; border-radius: 6px; z-index: 60; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--nc); }

@media (max-width: 860px) {
  .menu-btn { display: block; }
  .menu { position: fixed; top: 51px; bottom: 0; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.15); overflow-y: auto; }
  .menu.ouvert { transform: none; }
  .identite { display: none; }
  .vue { padding: 16px; }
  .grille { grid-template-columns: 1fr; }
  .formulaire { grid-template-columns: 1fr; }
  .logo { height: 24px; }
}
@media print { .barre, .menu, .outils { display: none; } .vue { padding: 0; } }

/* Lot L0 : connexion, comptes */
.identite { align-items: center; }
.identite .moi { font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.identite .lien { background: none; border: 1px solid var(--marine-500); color: var(--jaune); border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 12.5px; }
.connexion { max-width: 420px; margin: 40px auto; }
.form-pile { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.form-pile label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--texte-2); }
.form-pile input, .form-ligne input, .form-ligne select { padding: 7px 10px; border: 1px solid var(--ardoise-300); border-radius: 6px; background: #fff; color: var(--texte); }
.form-ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-ligne input { min-width: 150px; flex: 1; }
.tableau-boite td select { padding: 3px 6px; border: 1px solid var(--ardoise-300); border-radius: 4px; }
body.hors-session .menu { display: none; }
@media (max-width: 720px) { .identite .moi { max-width: 120px; } .identite .lien { padding: 3px 5px; } }
body.hors-session .menu-btn { display: none; }

/* ---------------------------------------------------------------- fichiers des documents et visionneuse (lot L3) */
.fichiers-doc .tableau-boite { margin-bottom: 8px; }
.fichiers-doc tr.ancien td { color: var(--texte-2); }
.fichiers-doc td.actions { white-space: nowrap; text-align: right; }
.fichiers-doc td.actions .btn { padding: 4px 10px; margin-left: 4px; text-decoration: none; display: inline-block; }
.depot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.depot label.btn { cursor: pointer; }
body.sans-defilement { overflow: hidden; }
.visionneuse { position: fixed; inset: 0; z-index: 60; background: var(--ardoise-100); display: flex; flex-direction: column; }
.visionneuse[hidden] { display: none; }
.vis-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 14px; background: var(--marine); color: #fff; border-bottom: 3px solid var(--jaune); }
.vis-titre { flex: 1 1 280px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vis-titre .legende { color: var(--marine-300); }
.vis-outils { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vis-outils .btn { padding: 4px 10px; text-decoration: none; }
.vis-outils .btn.sec { background: var(--marine-800); color: #fff; border-color: var(--marine-500); }
.vis-outils .btn.actif, .vis-outils .btn[aria-pressed="true"] { background: var(--jaune); color: var(--marine); border-color: var(--jaune); }
.vis-outils select { background: var(--marine-800); color: #fff; border: 1px solid var(--marine-500); border-radius: 4px; padding: 4px 6px; max-width: 220px; }
.vis-outils .fermer { color: #fff; font-size: 24px; background: none; border: 0; cursor: pointer; padding: 0 4px; }
.vis-page { font-family: var(--mono); font-size: 13px; min-width: 56px; text-align: center; }
.vis-corps { flex: 1; display: flex; min-height: 0; }
.vis-scene { flex: 1; overflow: auto; padding: 12px; display: flex; justify-content: center; align-items: flex-start; }
.vis-feuille { position: relative; display: inline-block; background: #fff; box-shadow: 0 2px 12px rgba(0,0,48,.18); line-height: 0; }
.vis-feuille canvas, .vis-feuille img, .vis-feuille video { display: block; max-width: none; }
.vis-feuille img, .vis-feuille video { max-width: 100%; max-height: calc(100vh - 120px); }
.vis-cote { display: flex; gap: 12px; align-items: flex-start; }
.vis-absente { padding: 40px; line-height: 1.4; color: var(--texte-2); min-width: 240px; }
.vis-calque { position: absolute; inset: 0; pointer-events: none; }
.vis-calque.actif { pointer-events: auto; cursor: crosshair; touch-action: none; }
.vis-calque .vis-zone { pointer-events: auto; }
.vis-zone { position: absolute; border: 2px solid var(--nc); background: rgba(180,35,24,.08); cursor: pointer; line-height: 1; }
.vis-zone span { position: absolute; top: -10px; left: -10px; background: var(--nc); color: #fff; font: 600 11px/18px var(--corps); min-width: 18px; height: 18px; border-radius: 9px; text-align: center; padding: 0 4px; }
.vis-zone.point { width: 0; height: 0; border: 0; background: none; }
.vis-zone.traitee { border-color: var(--info); background: rgba(31,95,160,.08); } .vis-zone.traitee span { background: var(--info); }
.vis-zone.close { border-color: var(--ok); background: rgba(26,110,69,.06); border-style: dashed; } .vis-zone.close span { background: var(--ok); }
.vis-zone.actif { outline: 3px solid var(--jaune); }
.vis-zone.trace { border-style: dashed; pointer-events: none; }
.vis-notes { width: 340px; flex: none; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--trait); padding: 12px 14px; line-height: 1.4; }
.vis-notes h3 { margin-top: 10px; }
.note { border: 1px solid var(--trait); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; }
.note.close { opacity: .7; }
.note.actif { border-color: var(--jaune); box-shadow: 0 0 0 2px var(--jaune-100); }
.note-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.note-reponse { margin-top: 6px; padding: 6px 8px; background: var(--info-fond); border-radius: 4px; }
.note-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.note-actions .btn { padding: 3px 9px; font-size: 13px; }
.note-form { border: 1px solid var(--jaune); background: var(--jaune-50); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
.note-form textarea { width: 100%; margin-top: 6px; border: 1px solid var(--ardoise-300); border-radius: 4px; padding: 6px; }
button.lien { background: none; border: 0; padding: 0; color: var(--marine-500); cursor: pointer; font-weight: 600; text-decoration: underline; }
.pastille { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.pastille.rouge { background: rgb(200,40,32); } .pastille.bleue { background: rgb(31,95,200); }
@media (max-width: 800px) {
  .vis-corps { flex-direction: column; }
  .vis-notes { width: auto; max-height: 40vh; border-left: 0; border-top: 1px solid var(--trait); }
  .vis-feuille img, .vis-feuille video { max-height: 55vh; }
}

/* 0.4.2 : plans DWG / DXF et maquettes IFC dans la visionneuse */
.vis-scene { justify-content: safe center; }
.vis-plan img { max-width: none; max-height: none; }
.vis-calques { margin-bottom: 10px; }
.vis-calques-liste { max-height: 38vh; overflow-y: auto; border: 1px solid var(--trait); border-radius: 4px; padding: 4px 8px; margin-top: 6px; }
.vis-calques-liste label { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 0; cursor: pointer; word-break: break-all; }
.vis-calques-liste label.vide { color: var(--texte-2); }
.vis-calques-liste .pastille { border: 1px solid var(--ardoise-300); }
.vis-3d { flex: 1; align-self: stretch; min-height: 320px; height: calc(100vh - 110px); position: relative; }
.vis-3d canvas { display: block; touch-action: none; }
@media (max-width: 760px) { .vis-3d { height: 50vh; } }

/* mode Drive (0.4.4) */
.bandeau-drive { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 6px 16px; font-size: 13px; border-bottom: 1px solid var(--trait); }
.bandeau-drive.lecteur { background: var(--alerte-fond); color: var(--alerte); }
.bandeau-drive.ecrivain { background: var(--ok-fond); color: var(--ok); }
.bandeau-drive .drive-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bandeau-drive .drive-erreur { color: var(--nc); font-weight: 600; }
.bandeau-drive .btn { padding: 4px 10px; font-size: 12px; }
